[CIFS] Fix oops in cifs_readpages caused by not checking buf_type in an
[sfrench/cifs-2.6.git] / fs / ioprio.c
index 97e1f088ba00b3b63f7f9ea594b756781fcf6596..ca77008146c02494018bf84c28b370f0e0a6b39a 100644 (file)
@@ -22,6 +22,8 @@
 #include <linux/kernel.h>
 #include <linux/ioprio.h>
 #include <linux/blkdev.h>
+#include <linux/capability.h>
+#include <linux/syscalls.h>
 
 static int set_task_ioprio(struct task_struct *task, int ioprio)
 {
@@ -62,6 +64,8 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
 
                        break;
                case IOPRIO_CLASS_IDLE:
+                       if (!capable(CAP_SYS_ADMIN))
+                               return -EPERM;
                        break;
                default:
                        return -EINVAL;