diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c index 85633622c94d..8c24d5dc4bc8 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/magic.h> | 89 | #include <linux/magic.h> |
90 | #include <linux/slab.h> | 90 | #include <linux/slab.h> |
91 | #include <linux/xattr.h> | 91 | #include <linux/xattr.h> |
92 | #include <linux/nospec.h> | ||
92 | 93 | ||
93 | #include <linux/uaccess.h> | 94 | #include <linux/uaccess.h> |
94 | #include <asm/unistd.h> | 95 | #include <asm/unistd.h> |
@@ -2522,6 +2523,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2522 | 2523 | ||
2523 | if (call < 1 || call > SYS_SENDMMSG) | 2524 | if (call < 1 || call > SYS_SENDMMSG) |
2524 | return -EINVAL; | 2525 | return -EINVAL; |
2526 | call = array_index_nospec(call, SYS_SENDMMSG + 1); | ||
2525 | 2527 | ||
2526 | len = nargs[call]; | 2528 | len = nargs[call]; |
2527 | if (len > sizeof(a)) | 2529 | if (len > sizeof(a)) |
@@ -2688,7 +2690,8 @@ EXPORT_SYMBOL(sock_unregister); | |||
2688 | 2690 | ||
2689 | bool sock_is_registered(int family) | 2691 | bool sock_is_registered(int family) |
2690 | { | 2692 | { |
2691 | return family < NPROTO && rcu_access_pointer(net_families[family]); | 2693 | return family < NPROTO && |
2694 | rcu_access_pointer(net_families[array_index_nospec(family, NPROTO)]); | ||
2692 | } | 2695 | } |
2693 | 2696 | ||
2694 | static int __init sock_init(void) | 2697 | static int __init sock_init(void) |