aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/signalfd.c4
-rw-r--r--include/linux/signalfd.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/signalfd.c b/fs/signalfd.c
index c8609fa51a13..5441a4bca772 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -211,7 +211,7 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
211 sigset_t sigmask; 211 sigset_t sigmask;
212 struct signalfd_ctx *ctx; 212 struct signalfd_ctx *ctx;
213 213
214 if (flags & ~SFD_CLOEXEC) 214 if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
215 return -EINVAL; 215 return -EINVAL;
216 216
217 if (sizemask != sizeof(sigset_t) || 217 if (sizemask != sizeof(sigset_t) ||
@@ -232,7 +232,7 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
232 * anon_inode_getfd() will install the fd. 232 * anon_inode_getfd() will install the fd.
233 */ 233 */
234 ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx, 234 ufd = anon_inode_getfd("[signalfd]", &signalfd_fops, ctx,
235 flags & O_CLOEXEC); 235 flags & (O_CLOEXEC | O_NONBLOCK));
236 if (ufd < 0) 236 if (ufd < 0)
237 kfree(ctx); 237 kfree(ctx);
238 } else { 238 } else {
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 8b3f7b7420a1..bef0c46d4713 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -8,11 +8,12 @@
8#ifndef _LINUX_SIGNALFD_H 8#ifndef _LINUX_SIGNALFD_H
9#define _LINUX_SIGNALFD_H 9#define _LINUX_SIGNALFD_H
10 10
11/* For O_CLOEXEC */ 11/* For O_CLOEXEC and O_NONBLOCK */
12#include <linux/fcntl.h> 12#include <linux/fcntl.h>
13 13
14/* Flags for signalfd4. */ 14/* Flags for signalfd4. */
15#define SFD_CLOEXEC O_CLOEXEC 15#define SFD_CLOEXEC O_CLOEXEC
16#define SFD_NONBLOCK O_NONBLOCK
16 17
17struct signalfd_siginfo { 18struct signalfd_siginfo {
18 __u32 ssi_signo; 19 __u32 ssi_signo;