From: Sébastien Dugué Make sure we only accept valid sigev_notify values in aio_setup_sigevent(), namely SIGEV_NONE, SIGEV_THREAD_ID or SIGEV_SIGNAL. Signed-off-by: Sébastien Dugué Cc: Laurent Vivier Cc: Bharata B Rao Cc: Christoph Hellwig Cc: Suparna Bhattacharya Cc: Zach Brown Cc: Oleg Nesterov Cc: Badari Pulavarty Cc: Benjamin LaHaise Cc: Jean Pierre Dion Signed-off-by: Andrew Morton --- fs/aio.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) diff -puN fs/aio.c~aio-completion-signal-notification-fix fs/aio.c --- a/fs/aio.c~aio-completion-signal-notification-fix +++ a/fs/aio.c @@ -938,7 +938,7 @@ static int aio_send_signal(struct aio_no info->si_uid = 0; info->si_value = notify->value; - if (notify->notify & SIGEV_THREAD_ID) + if (notify->notify == SIGEV_THREAD_ID) ret = send_sigqueue(notify->signo, sigq, notify->target); else ret = send_group_sigqueue(notify->signo, sigq, notify->target); @@ -958,6 +958,10 @@ static long aio_setup_sigevent(struct ai if (event.sigev_notify == SIGEV_NONE) return 0; + if (event.sigev_notify != SIGEV_SIGNAL && + event.sigev_notify != SIGEV_THREAD_ID) + return -EINVAL; + notify->notify = event.sigev_notify; notify->signo = event.sigev_signo; notify->value = event.sigev_value; _