[PATCH] mqueue: reject mq_notify with signo 0

Yi Xie posted 1 patch 5 days, 3 hours ago
ipc/mqueue.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] mqueue: reject mq_notify with signo 0
Posted by Yi Xie 5 days, 3 hours ago
valid_signal(0) is true; __do_notify() skips signo 0 anyway.

Signed-off-by: Yi Xie <xieyi@kylinos.cn>
---
 ipc/mqueue.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 4798b375972b..fa0b02c68cf1 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -790,7 +790,6 @@ static void __do_notify(struct mqueue_inode_info *info)
 			struct kernel_siginfo sig_i;
 			struct task_struct *task;
 
-			/* do_mq_notify() accepts sigev_signo == 0, why?? */
 			if (!info->notify.sigev_signo)
 				break;
 
@@ -1281,9 +1280,9 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
 			     notification->sigev_notify != SIGEV_THREAD))
 			return -EINVAL;
 		if (notification->sigev_notify == SIGEV_SIGNAL &&
-			!valid_signal(notification->sigev_signo)) {
+		    (!notification->sigev_signo ||
+		     !valid_signal(notification->sigev_signo)))
 			return -EINVAL;
-		}
 		if (notification->sigev_notify == SIGEV_THREAD) {
 			long timeo;
 
-- 
2.25.1