aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/af_nfc.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/af_nfc.c')
-rw-r--r--net/nfc/af_nfc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c
index d3e594eb36d0..256f3c57059e 100644
--- a/net/nfc/af_nfc.c
+++ b/net/nfc/af_nfc.c
@@ -21,6 +21,7 @@
#include <linux/nfc.h>
#include <linux/module.h>
+#include <linux/nospec.h>
#include "nfc.h"
@@ -37,6 +38,7 @@ static int nfc_sock_create(struct net *net, struct socket *sock, int proto,
if (proto < 0 || proto >= NFC_SOCKPROTO_MAX)
return -EINVAL;
+ proto = array_index_nospec(proto, NFC_SOCKPROTO_MAX);
read_lock(&proto_tab_lock);
if (proto_tab[proto] && try_module_get(proto_tab[proto]->owner)) {

Privacy Policy