aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/mqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/mqueue.c')
-rw-r--r--ipc/mqueue.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 28bd64ddeda3..b53cf3469d01 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -66,6 +66,7 @@ struct mqueue_inode_info {
66 66
67 struct sigevent notify; 67 struct sigevent notify;
68 struct pid* notify_owner; 68 struct pid* notify_owner;
69 struct user_namespace *notify_user_ns;
69 struct user_struct *user; /* user who created, for accounting */ 70 struct user_struct *user; /* user who created, for accounting */
70 struct sock *notify_sock; 71 struct sock *notify_sock;
71 struct sk_buff *notify_cookie; 72 struct sk_buff *notify_cookie;
@@ -139,6 +140,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb,
139 INIT_LIST_HEAD(&info->e_wait_q[0].list); 140 INIT_LIST_HEAD(&info->e_wait_q[0].list);
140 INIT_LIST_HEAD(&info->e_wait_q[1].list); 141 INIT_LIST_HEAD(&info->e_wait_q[1].list);
141 info->notify_owner = NULL; 142 info->notify_owner = NULL;
143 info->notify_user_ns = NULL;
142 info->qsize = 0; 144 info->qsize = 0;
143 info->user = NULL; /* set when all is ok */ 145 info->user = NULL; /* set when all is ok */
144 memset(&info->attr, 0, sizeof(info->attr)); 146 memset(&info->attr, 0, sizeof(info->attr));
@@ -536,7 +538,7 @@ static void __do_notify(struct mqueue_inode_info *info)
536 rcu_read_lock(); 538 rcu_read_lock();
537 sig_i.si_pid = task_tgid_nr_ns(current, 539 sig_i.si_pid = task_tgid_nr_ns(current,
538 ns_of_pid(info->notify_owner)); 540 ns_of_pid(info->notify_owner));
539 sig_i.si_uid = user_ns_map_uid(info->user->user_ns, 541 sig_i.si_uid = user_ns_map_uid(info->notify_user_ns,
540 current_cred(), current_uid()); 542 current_cred(), current_uid());
541 rcu_read_unlock(); 543 rcu_read_unlock();
542 544
@@ -550,7 +552,9 @@ static void __do_notify(struct mqueue_inode_info *info)
550 } 552 }
551 /* after notification unregisters process */ 553 /* after notification unregisters process */
552 put_pid(info->notify_owner); 554 put_pid(info->notify_owner);
555 put_user_ns(info->notify_user_ns);
553 info->notify_owner = NULL; 556 info->notify_owner = NULL;
557 info->notify_user_ns = NULL;
554 } 558 }
555 wake_up(&info->wait_q); 559 wake_up(&info->wait_q);
556} 560}
@@ -575,7 +579,9 @@ static void remove_notification(struct mqueue_inode_info *info)
575 netlink_sendskb(info->notify_sock, info->notify_cookie); 579 netlink_sendskb(info->notify_sock, info->notify_cookie);
576 } 580 }
577 put_pid(info->notify_owner); 581 put_pid(info->notify_owner);
582 put_user_ns(info->notify_user_ns);
578 info->notify_owner = NULL; 583 info->notify_owner = NULL;
584 info->notify_user_ns = NULL;
579} 585}
580 586
581static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr) 587static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
@@ -1140,6 +1146,7 @@ retry:
1140 } 1146 }
1141 1147
1142 info->notify_owner = get_pid(task_tgid(current)); 1148 info->notify_owner = get_pid(task_tgid(current));
1149 info->notify_user_ns = get_user_ns(current_user_ns());
1143 inode->i_atime = inode->i_ctime = CURRENT_TIME; 1150 inode->i_atime = inode->i_ctime = CURRENT_TIME;
1144 } 1151 }
1145 spin_unlock(&info->lock); 1152 spin_unlock(&info->lock);