All security modules shouldn't change sched_param parameter of security_task_setscheduler(). This is not only meaningless, but also make harmful result if caller pass static variable. This patch add const to it. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> --- include/linux/security.h | 9 +++++---- security/commoncap.c | 2 +- security/security.c | 4 ++-- security/selinux/hooks.c | 3 ++- security/smack/smack_lsm.c | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/linux/security.h b/include/linux/security.h index 5bcb395..07e94e5 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -74,7 +74,8 @@ extern int cap_file_mmap(struct file *file, unsigned long reqprot, extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5); -extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); +extern int cap_task_setscheduler(struct task_struct *p, int policy, + const struct sched_param *lp); extern int cap_task_setioprio(struct task_struct *p, int ioprio); extern int cap_task_setnice(struct task_struct *p, int nice); extern int cap_syslog(int type, bool from_file); @@ -1501,7 +1502,7 @@ struct security_operations { int (*task_getioprio) (struct task_struct *p); int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); int (*task_setscheduler) (struct task_struct *p, int policy, - struct sched_param *lp); + const struct sched_param *lp); int (*task_getscheduler) (struct task_struct *p); int (*task_movememory) (struct task_struct *p); int (*task_kill) (struct task_struct *p, @@ -1750,8 +1751,8 @@ int security_task_setnice(struct task_struct *p, int nice); int security_task_setioprio(struct task_struct *p, int ioprio); int security_task_getioprio(struct task_struct *p); int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); -int security_task_setscheduler(struct task_struct *p, - int policy, struct sched_param *lp); +int security_task_setscheduler(struct task_struct *p, int policy, + const struct sched_param *lp); int security_task_getscheduler(struct task_struct *p); int security_task_movememory(struct task_struct *p); int security_task_kill(struct task_struct *p, struct siginfo *info, diff --git a/security/commoncap.c b/security/commoncap.c index 4e01599..b74d460 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -726,7 +726,7 @@ static int cap_safe_nice(struct task_struct *p) * specified task, returning 0 if permission is granted, -ve if denied. */ int cap_task_setscheduler(struct task_struct *p, int policy, - struct sched_param *lp) + const struct sched_param *lp) { return cap_safe_nice(p); } diff --git a/security/security.c b/security/security.c index 7461b1b..6151322 100644 --- a/security/security.c +++ b/security/security.c @@ -785,8 +785,8 @@ int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim) return security_ops->task_setrlimit(resource, new_rlim); } -int security_task_setscheduler(struct task_struct *p, - int policy, struct sched_param *lp) +int security_task_setscheduler(struct task_struct *p, int policy, + const struct sched_param *lp) { return security_ops->task_setscheduler(p, policy, lp); } diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 5c9f25b..dd136bd 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3385,7 +3385,8 @@ static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim return 0; } -static int selinux_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp) +static int selinux_task_setscheduler(struct task_struct *p, int policy, + const struct sched_param *lp) { int rc; diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 07abc9c..c3336f1 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1280,7 +1280,7 @@ static int smack_task_getioprio(struct task_struct *p) * Return 0 if read access is permitted */ static int smack_task_setscheduler(struct task_struct *p, int policy, - struct sched_param *lp) + const struct sched_param *lp) { int rc; -- 1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>