diff options
-rw-r--r-- | fs/eventfd.c | 4 | ||||
-rw-r--r-- | fs/eventpoll.c | 3 | ||||
-rw-r--r-- | fs/inotify_user.c | 4 | ||||
-rw-r--r-- | fs/signalfd.c | 4 | ||||
-rw-r--r-- | fs/timerfd.c | 4 | ||||
-rw-r--r-- | net/socket.c | 6 |
6 files changed, 25 insertions, 0 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c index 3ed4466177a7..08bf558d0408 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -203,6 +203,10 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags) | |||
203 | int fd; | 203 | int fd; |
204 | struct eventfd_ctx *ctx; | 204 | struct eventfd_ctx *ctx; |
205 | 205 | ||
206 | /* Check the EFD_* constants for consistency. */ | ||
207 | BUILD_BUG_ON(EFD_CLOEXEC != O_CLOEXEC); | ||
208 | BUILD_BUG_ON(EFD_NONBLOCK != O_NONBLOCK); | ||
209 | |||
206 | if (flags & ~(EFD_CLOEXEC | EFD_NONBLOCK)) | 210 | if (flags & ~(EFD_CLOEXEC | EFD_NONBLOCK)) |
207 | return -EINVAL; | 211 | return -EINVAL; |
208 | 212 | ||
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 3fd4014f3c5a..2fdad4204044 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1051,6 +1051,9 @@ asmlinkage long sys_epoll_create2(int size, int flags) | |||
1051 | int error, fd = -1; | 1051 | int error, fd = -1; |
1052 | struct eventpoll *ep; | 1052 | struct eventpoll *ep; |
1053 | 1053 | ||
1054 | /* Check the EPOLL_* constant for consistency. */ | ||
1055 | BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC); | ||
1056 | |||
1054 | if (flags & ~EPOLL_CLOEXEC) | 1057 | if (flags & ~EPOLL_CLOEXEC) |
1055 | return -EINVAL; | 1058 | return -EINVAL; |
1056 | 1059 | ||
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index dc7e1f619748..fe79c25d95dc 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c | |||
@@ -574,6 +574,10 @@ asmlinkage long sys_inotify_init1(int flags) | |||
574 | struct file *filp; | 574 | struct file *filp; |
575 | int fd, ret; | 575 | int fd, ret; |
576 | 576 | ||
577 | /* Check the IN_* constants for consistency. */ | ||
578 | BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC); | ||
579 | BUILD_BUG_ON(IN_NONBLOCK != O_NONBLOCK); | ||
580 | |||
577 | if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) | 581 | if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) |
578 | return -EINVAL; | 582 | return -EINVAL; |
579 | 583 | ||
diff --git a/fs/signalfd.c b/fs/signalfd.c index 5441a4bca772..9c39bc7f8431 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -211,6 +211,10 @@ 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 | /* Check the SFD_* constants for consistency. */ | ||
215 | BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC); | ||
216 | BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK); | ||
217 | |||
214 | if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK)) | 218 | if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK)) |
215 | return -EINVAL; | 219 | return -EINVAL; |
216 | 220 | ||
diff --git a/fs/timerfd.c b/fs/timerfd.c index 75d44efe346c..c502c60e4f54 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c | |||
@@ -184,6 +184,10 @@ asmlinkage long sys_timerfd_create(int clockid, int flags) | |||
184 | int ufd; | 184 | int ufd; |
185 | struct timerfd_ctx *ctx; | 185 | struct timerfd_ctx *ctx; |
186 | 186 | ||
187 | /* Check the TFD_* constants for consistency. */ | ||
188 | BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC); | ||
189 | BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK); | ||
190 | |||
187 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) | 191 | if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) |
188 | return -EINVAL; | 192 | return -EINVAL; |
189 | if (clockid != CLOCK_MONOTONIC && | 193 | if (clockid != CLOCK_MONOTONIC && |
diff --git a/net/socket.c b/net/socket.c index 31105f9048a8..1310a82cbba7 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1222,6 +1222,12 @@ asmlinkage long sys_socket(int family, int type, int protocol) | |||
1222 | struct socket *sock; | 1222 | struct socket *sock; |
1223 | int flags; | 1223 | int flags; |
1224 | 1224 | ||
1225 | /* Check the SOCK_* constants for consistency. */ | ||
1226 | BUILD_BUG_ON(SOCK_CLOEXEC != O_CLOEXEC); | ||
1227 | BUILD_BUG_ON((SOCK_MAX | SOCK_TYPE_MASK) != SOCK_TYPE_MASK); | ||
1228 | BUILD_BUG_ON(SOCK_CLOEXEC & SOCK_TYPE_MASK); | ||
1229 | BUILD_BUG_ON(SOCK_NONBLOCK & SOCK_TYPE_MASK); | ||
1230 | |||
1225 | flags = type & ~SOCK_TYPE_MASK; | 1231 | flags = type & ~SOCK_TYPE_MASK; |
1226 | if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) | 1232 | if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) |
1227 | return -EINVAL; | 1233 | return -EINVAL; |