diff options
-rw-r--r-- | ipc/mqueue.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index d75d0ba83360..c45ae86cec31 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -73,7 +73,7 @@ struct mqueue_inode_info { | |||
73 | struct mq_attr attr; | 73 | struct mq_attr attr; |
74 | 74 | ||
75 | struct sigevent notify; | 75 | struct sigevent notify; |
76 | pid_t notify_owner; | 76 | struct pid* notify_owner; |
77 | struct user_struct *user; /* user who created, for accounting */ | 77 | struct user_struct *user; /* user who created, for accounting */ |
78 | struct sock *notify_sock; | 78 | struct sock *notify_sock; |
79 | struct sk_buff *notify_cookie; | 79 | struct sk_buff *notify_cookie; |
@@ -134,7 +134,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode, | |||
134 | INIT_LIST_HEAD(&info->e_wait_q[0].list); | 134 | INIT_LIST_HEAD(&info->e_wait_q[0].list); |
135 | INIT_LIST_HEAD(&info->e_wait_q[1].list); | 135 | INIT_LIST_HEAD(&info->e_wait_q[1].list); |
136 | info->messages = NULL; | 136 | info->messages = NULL; |
137 | info->notify_owner = 0; | 137 | info->notify_owner = NULL; |
138 | info->qsize = 0; | 138 | info->qsize = 0; |
139 | info->user = NULL; /* set when all is ok */ | 139 | info->user = NULL; /* set when all is ok */ |
140 | memset(&info->attr, 0, sizeof(info->attr)); | 140 | memset(&info->attr, 0, sizeof(info->attr)); |
@@ -338,7 +338,7 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data, | |||
338 | (info->notify_owner && | 338 | (info->notify_owner && |
339 | info->notify.sigev_notify == SIGEV_SIGNAL) ? | 339 | info->notify.sigev_notify == SIGEV_SIGNAL) ? |
340 | info->notify.sigev_signo : 0, | 340 | info->notify.sigev_signo : 0, |
341 | info->notify_owner); | 341 | pid_nr(info->notify_owner)); |
342 | spin_unlock(&info->lock); | 342 | spin_unlock(&info->lock); |
343 | buffer[sizeof(buffer)-1] = '\0'; | 343 | buffer[sizeof(buffer)-1] = '\0'; |
344 | slen = strlen(buffer)+1; | 344 | slen = strlen(buffer)+1; |
@@ -363,7 +363,7 @@ static int mqueue_flush_file(struct file *filp, fl_owner_t id) | |||
363 | struct mqueue_inode_info *info = MQUEUE_I(filp->f_dentry->d_inode); | 363 | struct mqueue_inode_info *info = MQUEUE_I(filp->f_dentry->d_inode); |
364 | 364 | ||
365 | spin_lock(&info->lock); | 365 | spin_lock(&info->lock); |
366 | if (current->tgid == info->notify_owner) | 366 | if (task_tgid(current) == info->notify_owner) |
367 | remove_notification(info); | 367 | remove_notification(info); |
368 | 368 | ||
369 | spin_unlock(&info->lock); | 369 | spin_unlock(&info->lock); |
@@ -518,8 +518,8 @@ static void __do_notify(struct mqueue_inode_info *info) | |||
518 | sig_i.si_pid = current->tgid; | 518 | sig_i.si_pid = current->tgid; |
519 | sig_i.si_uid = current->uid; | 519 | sig_i.si_uid = current->uid; |
520 | 520 | ||
521 | kill_proc_info(info->notify.sigev_signo, | 521 | kill_pid_info(info->notify.sigev_signo, |
522 | &sig_i, info->notify_owner); | 522 | &sig_i, info->notify_owner); |
523 | break; | 523 | break; |
524 | case SIGEV_THREAD: | 524 | case SIGEV_THREAD: |
525 | set_cookie(info->notify_cookie, NOTIFY_WOKENUP); | 525 | set_cookie(info->notify_cookie, NOTIFY_WOKENUP); |
@@ -528,7 +528,8 @@ static void __do_notify(struct mqueue_inode_info *info) | |||
528 | break; | 528 | break; |
529 | } | 529 | } |
530 | /* after notification unregisters process */ | 530 | /* after notification unregisters process */ |
531 | info->notify_owner = 0; | 531 | put_pid(info->notify_owner); |
532 | info->notify_owner = NULL; | ||
532 | } | 533 | } |
533 | wake_up(&info->wait_q); | 534 | wake_up(&info->wait_q); |
534 | } | 535 | } |
@@ -566,12 +567,13 @@ static long prepare_timeout(const struct timespec __user *u_arg) | |||
566 | 567 | ||
567 | static void remove_notification(struct mqueue_inode_info *info) | 568 | static void remove_notification(struct mqueue_inode_info *info) |
568 | { | 569 | { |
569 | if (info->notify_owner != 0 && | 570 | if (info->notify_owner != NULL && |
570 | info->notify.sigev_notify == SIGEV_THREAD) { | 571 | info->notify.sigev_notify == SIGEV_THREAD) { |
571 | set_cookie(info->notify_cookie, NOTIFY_REMOVED); | 572 | set_cookie(info->notify_cookie, NOTIFY_REMOVED); |
572 | netlink_sendskb(info->notify_sock, info->notify_cookie, 0); | 573 | netlink_sendskb(info->notify_sock, info->notify_cookie, 0); |
573 | } | 574 | } |
574 | info->notify_owner = 0; | 575 | put_pid(info->notify_owner); |
576 | info->notify_owner = NULL; | ||
575 | } | 577 | } |
576 | 578 | ||
577 | static int mq_attr_ok(struct mq_attr *attr) | 579 | static int mq_attr_ok(struct mq_attr *attr) |
@@ -1062,11 +1064,11 @@ retry: | |||
1062 | ret = 0; | 1064 | ret = 0; |
1063 | spin_lock(&info->lock); | 1065 | spin_lock(&info->lock); |
1064 | if (u_notification == NULL) { | 1066 | if (u_notification == NULL) { |
1065 | if (info->notify_owner == current->tgid) { | 1067 | if (info->notify_owner == task_tgid(current)) { |
1066 | remove_notification(info); | 1068 | remove_notification(info); |
1067 | inode->i_atime = inode->i_ctime = CURRENT_TIME; | 1069 | inode->i_atime = inode->i_ctime = CURRENT_TIME; |
1068 | } | 1070 | } |
1069 | } else if (info->notify_owner != 0) { | 1071 | } else if (info->notify_owner != NULL) { |
1070 | ret = -EBUSY; | 1072 | ret = -EBUSY; |
1071 | } else { | 1073 | } else { |
1072 | switch (notification.sigev_notify) { | 1074 | switch (notification.sigev_notify) { |
@@ -1086,7 +1088,8 @@ retry: | |||
1086 | info->notify.sigev_notify = SIGEV_SIGNAL; | 1088 | info->notify.sigev_notify = SIGEV_SIGNAL; |
1087 | break; | 1089 | break; |
1088 | } | 1090 | } |
1089 | info->notify_owner = current->tgid; | 1091 | |
1092 | info->notify_owner = get_pid(task_tgid(current)); | ||
1090 | inode->i_atime = inode->i_ctime = CURRENT_TIME; | 1093 | inode->i_atime = inode->i_ctime = CURRENT_TIME; |
1091 | } | 1094 | } |
1092 | spin_unlock(&info->lock); | 1095 | spin_unlock(&info->lock); |