projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
V4L/DVB (4310): Saa7134: rename dmasound_{init, exit}
[powerpc.git]
/
fs
/
ioprio.c
diff --git
a/fs/ioprio.c
b/fs/ioprio.c
index
d1c1f2b
..
93aa571
100644
(file)
--- a/
fs/ioprio.c
+++ b/
fs/ioprio.c
@@
-22,15
+22,23
@@
#include <linux/kernel.h>
#include <linux/ioprio.h>
#include <linux/blkdev.h>
#include <linux/kernel.h>
#include <linux/ioprio.h>
#include <linux/blkdev.h>
+#include <linux/capability.h>
+#include <linux/syscalls.h>
+#include <linux/security.h>
static int set_task_ioprio(struct task_struct *task, int ioprio)
{
static int set_task_ioprio(struct task_struct *task, int ioprio)
{
+ int err;
struct io_context *ioc;
if (task->uid != current->euid &&
task->uid != current->uid && !capable(CAP_SYS_NICE))
return -EPERM;
struct io_context *ioc;
if (task->uid != current->euid &&
task->uid != current->uid && !capable(CAP_SYS_NICE))
return -EPERM;
+ err = security_task_setioprio(task, ioprio);
+ if (err)
+ return err;
+
task_lock(task);
task->ioprio = ioprio;
task_lock(task);
task->ioprio = ioprio;
@@
-117,11
+125,24
@@
asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
return ret;
}
return ret;
}
+static int get_task_ioprio(struct task_struct *p)
+{
+ int ret;
+
+ ret = security_task_getioprio(p);
+ if (ret)
+ goto out;
+ ret = p->ioprio;
+out:
+ return ret;
+}
+
asmlinkage long sys_ioprio_get(int which, int who)
{
struct task_struct *g, *p;
struct user_struct *user;
int ret = -ESRCH;
asmlinkage long sys_ioprio_get(int which, int who)
{
struct task_struct *g, *p;
struct user_struct *user;
int ret = -ESRCH;
+ int tmpio;
read_lock_irq(&tasklist_lock);
switch (which) {
read_lock_irq(&tasklist_lock);
switch (which) {
@@
-131,16
+152,19
@@
asmlinkage long sys_ioprio_get(int which, int who)
else
p = find_task_by_pid(who);
if (p)
else
p = find_task_by_pid(who);
if (p)
- ret =
p->ioprio
;
+ ret =
get_task_ioprio(p)
;
break;
case IOPRIO_WHO_PGRP:
if (!who)
who = process_group(current);
do_each_task_pid(who, PIDTYPE_PGID, p) {
break;
case IOPRIO_WHO_PGRP:
if (!who)
who = process_group(current);
do_each_task_pid(who, PIDTYPE_PGID, p) {
+ tmpio = get_task_ioprio(p);
+ if (tmpio < 0)
+ continue;
if (ret == -ESRCH)
if (ret == -ESRCH)
- ret =
p->iopr
io;
+ ret =
tmp
io;
else
else
- ret = ioprio_best(ret,
p->iopr
io);
+ ret = ioprio_best(ret,
tmp
io);
} while_each_task_pid(who, PIDTYPE_PGID, p);
break;
case IOPRIO_WHO_USER:
} while_each_task_pid(who, PIDTYPE_PGID, p);
break;
case IOPRIO_WHO_USER:
@@
-155,10
+179,13
@@
asmlinkage long sys_ioprio_get(int which, int who)
do_each_thread(g, p) {
if (p->uid != user->uid)
continue;
do_each_thread(g, p) {
if (p->uid != user->uid)
continue;
+ tmpio = get_task_ioprio(p);
+ if (tmpio < 0)
+ continue;
if (ret == -ESRCH)
if (ret == -ESRCH)
- ret =
p->iopr
io;
+ ret =
tmp
io;
else
else
- ret = ioprio_best(ret,
p->iopr
io);
+ ret = ioprio_best(ret,
tmp
io);
} while_each_thread(g, p);
if (who)
} while_each_thread(g, p);
if (who)