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 475247e347ae..b91949168a87 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> |
@@ -2529,6 +2530,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2529 | 2530 | ||
2530 | if (call < 1 || call > SYS_SENDMMSG) | 2531 | if (call < 1 || call > SYS_SENDMMSG) |
2531 | return -EINVAL; | 2532 | return -EINVAL; |
2533 | call = array_index_nospec(call, SYS_SENDMMSG + 1); | ||
2532 | 2534 | ||
2533 | len = nargs[call]; | 2535 | len = nargs[call]; |
2534 | if (len > sizeof(a)) | 2536 | if (len > sizeof(a)) |
@@ -2695,7 +2697,8 @@ EXPORT_SYMBOL(sock_unregister); | |||
2695 | 2697 | ||
2696 | bool sock_is_registered(int family) | 2698 | bool sock_is_registered(int family) |
2697 | { | 2699 | { |
2698 | return family < NPROTO && rcu_access_pointer(net_families[family]); | 2700 | return family < NPROTO && |
2701 | rcu_access_pointer(net_families[array_index_nospec(family, NPROTO)]); | ||
2699 | } | 2702 | } |
2700 | 2703 | ||
2701 | static int __init sock_init(void) | 2704 | static int __init sock_init(void) |