diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c index 49917a1cac7d..41e8847508aa 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -2098,12 +2098,17 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2098 | unsigned long a[6]; | 2098 | unsigned long a[6]; |
2099 | unsigned long a0, a1; | 2099 | unsigned long a0, a1; |
2100 | int err; | 2100 | int err; |
2101 | unsigned int len; | ||
2101 | 2102 | ||
2102 | if (call < 1 || call > SYS_ACCEPT4) | 2103 | if (call < 1 || call > SYS_ACCEPT4) |
2103 | return -EINVAL; | 2104 | return -EINVAL; |
2104 | 2105 | ||
2106 | len = nargs[call]; | ||
2107 | if (len > sizeof(a)) | ||
2108 | return -EINVAL; | ||
2109 | |||
2105 | /* copy_from_user should be SMP safe. */ | 2110 | /* copy_from_user should be SMP safe. */ |
2106 | if (copy_from_user(a, args, nargs[call])) | 2111 | if (copy_from_user(a, args, len)) |
2107 | return -EFAULT; | 2112 | return -EFAULT; |
2108 | 2113 | ||
2109 | audit_socketcall(nargs[call] / sizeof(unsigned long), a); | 2114 | audit_socketcall(nargs[call] / sizeof(unsigned long), a); |