OSDN Git Service

net: Revert recent Spectre-v1 patches.
authorDavid S. Miller <davem@davemloft.net>
Mon, 24 Dec 2018 00:01:35 +0000 (16:01 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Dec 2018 00:01:35 +0000 (16:01 -0800)
This reverts:

50d5258634ae ("net: core: Fix Spectre v1 vulnerability")
d686026b1e6e ("phonet: af_phonet: Fix Spectre v1 vulnerability")
a95386f0390a ("nfc: af_nfc: Fix Spectre v1 vulnerability")
a3ac5817ffe8 ("can: af_can: Fix Spectre v1 vulnerability")

After some discussion with Alexei Starovoitov these all seem to
be completely unnecessary.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/can/af_can.c
net/core/filter.c
net/nfc/af_nfc.c
net/phonet/af_phonet.c

index cade725..1684ba5 100644 (file)
@@ -59,7 +59,6 @@
 #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>
 
@@ -137,7 +136,6 @@ 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);
 
index 0c74c2f..8d2c629 100644 (file)
@@ -73,7 +73,6 @@
 #include <linux/seg6_local.h>
 #include <net/seg6.h>
 #include <net/seg6_local.h>
-#include <linux/nospec.h>
 
 /**
  *     sk_filter_trim_cap - run a packet through a socket filter
@@ -1039,7 +1038,6 @@ static int bpf_check_classic(const struct sock_filter *filter,
        bool anc_found;
        int pc;
 
-       flen = array_index_nospec(flen, BPF_MAXINSNS + 1);
        /* Check the filter code now */
        for (pc = 0; pc < flen; pc++) {
                const struct sock_filter *ftest = &filter[pc];
index 256f3c5..d3e594e 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <linux/nfc.h>
 #include <linux/module.h>
-#include <linux/nospec.h>
 
 #include "nfc.h"
 
@@ -38,7 +37,6 @@ 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)) {
index d4b2abd..3b0ef69 100644 (file)
@@ -34,8 +34,6 @@
 #include <net/phonet/phonet.h>
 #include <net/phonet/pn_dev.h>
 
-#include <linux/nospec.h>
-
 /* Transport protocol registration */
 static const struct phonet_protocol *proto_tab[PHONET_NPROTO] __read_mostly;
 
@@ -45,7 +43,6 @@ static const struct phonet_protocol *phonet_proto_get(unsigned int protocol)
 
        if (protocol >= PHONET_NPROTO)
                return NULL;
-       protocol = array_index_nospec(protocol, PHONET_NPROTO);
 
        rcu_read_lock();
        pp = rcu_dereference(proto_tab[protocol]);