summaryrefslogtreecommitdiff
path: root/net/can/af_can.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/can/af_can.c')
-rw-r--r--net/can/af_can.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 1684ba5b51eb..cade7250c6d4 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -59,6 +59,7 @@
#include <linux/can/core.h>
#include <linux/can/skb.h>
#include <linux/ratelimit.h>
+#include <linux/nospec.h>
#include <net/net_namespace.h>
#include <net/sock.h>
@@ -136,6 +137,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
if (protocol < 0 || protocol >= CAN_NPROTO)
return -EINVAL;
+ protocol = array_index_nospec(protocol, CAN_NPROTO);
cp = can_get_proto(protocol);