aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fcntl.c')
-rw-r--r--fs/fcntl.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 549daf8005fb..cdc141946724 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -212,13 +212,14 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
212int __f_setown(struct file *filp, struct pid *pid, enum pid_type type, 212int __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
213 int force) 213 int force)
214{ 214{
215 const struct cred *cred = current_cred();
215 int err; 216 int err;
216 217
217 err = security_file_set_fowner(filp); 218 err = security_file_set_fowner(filp);
218 if (err) 219 if (err)
219 return err; 220 return err;
220 221
221 f_modown(filp, pid, type, current->uid, current->euid, force); 222 f_modown(filp, pid, type, cred->uid, cred->euid, force);
222 return 0; 223 return 0;
223} 224}
224EXPORT_SYMBOL(__f_setown); 225EXPORT_SYMBOL(__f_setown);
@@ -407,10 +408,17 @@ static const long band_table[NSIGPOLL] = {
407static inline int sigio_perm(struct task_struct *p, 408static inline int sigio_perm(struct task_struct *p,
408 struct fown_struct *fown, int sig) 409 struct fown_struct *fown, int sig)
409{ 410{
410 return (((fown->euid == 0) || 411 const struct cred *cred;
411 (fown->euid == p->suid) || (fown->euid == p->uid) || 412 int ret;
412 (fown->uid == p->suid) || (fown->uid == p->uid)) && 413
413 !security_file_send_sigiotask(p, fown, sig)); 414 rcu_read_lock();
415 cred = __task_cred(p);
416 ret = ((fown->euid == 0 ||
417 fown->euid == cred->suid || fown->euid == cred->uid ||
418 fown->uid == cred->suid || fown->uid == cred->uid) &&
419 !security_file_send_sigiotask(p, fown, sig));
420 rcu_read_unlock();
421 return ret;
414} 422}
415 423
416static void send_sigio_to_task(struct task_struct *p, 424static void send_sigio_to_task(struct task_struct *p,