diff options
author | David S. Miller <davem@davemloft.net> | 2018-05-11 20:53:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-11 20:53:22 -0400 |
commit | b2d6cee117f708d493c020f9f355297321507be7 (patch) | |
tree | 2c6975b47034de78fc899b4191260bb2704efc0f /kernel/bpf/syscall.c | |
parent | b753a9faaf9aef1338c28ebd9ace6d749428788b (diff) | |
parent | 4bc871984f7cb5b2dec3ae64b570cb02f9ce2227 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
The bpf syscall and selftests conflicts were trivial
overlapping changes.
The r8169 change involved moving the added mdelay from 'net' into a
different function.
A TLS close bug fix overlapped with the splitting of the TLS state
into separate TX and RX parts. I just expanded the tests in the bug
fix from "ctx->conf == X" into "ctx->tx_conf == X && ctx->rx_conf
== X".
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 9b87198deea2..c286e75ec087 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/timekeeping.h> | 28 | #include <linux/timekeeping.h> |
29 | #include <linux/ctype.h> | 29 | #include <linux/ctype.h> |
30 | #include <linux/btf.h> | 30 | #include <linux/btf.h> |
31 | #include <linux/nospec.h> | ||
31 | 32 | ||
32 | #define IS_FD_ARRAY(map) ((map)->map_type == BPF_MAP_TYPE_PROG_ARRAY || \ | 33 | #define IS_FD_ARRAY(map) ((map)->map_type == BPF_MAP_TYPE_PROG_ARRAY || \ |
33 | (map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \ | 34 | (map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \ |
@@ -104,12 +105,14 @@ const struct bpf_map_ops bpf_map_offload_ops = { | |||
104 | static struct bpf_map *find_and_alloc_map(union bpf_attr *attr) | 105 | static struct bpf_map *find_and_alloc_map(union bpf_attr *attr) |
105 | { | 106 | { |
106 | const struct bpf_map_ops *ops; | 107 | const struct bpf_map_ops *ops; |
108 | u32 type = attr->map_type; | ||
107 | struct bpf_map *map; | 109 | struct bpf_map *map; |
108 | int err; | 110 | int err; |
109 | 111 | ||
110 | if (attr->map_type >= ARRAY_SIZE(bpf_map_types)) | 112 | if (type >= ARRAY_SIZE(bpf_map_types)) |
111 | return ERR_PTR(-EINVAL); | 113 | return ERR_PTR(-EINVAL); |
112 | ops = bpf_map_types[attr->map_type]; | 114 | type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types)); |
115 | ops = bpf_map_types[type]; | ||
113 | if (!ops) | 116 | if (!ops) |
114 | return ERR_PTR(-EINVAL); | 117 | return ERR_PTR(-EINVAL); |
115 | 118 | ||
@@ -124,7 +127,7 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr) | |||
124 | if (IS_ERR(map)) | 127 | if (IS_ERR(map)) |
125 | return map; | 128 | return map; |
126 | map->ops = ops; | 129 | map->ops = ops; |
127 | map->map_type = attr->map_type; | 130 | map->map_type = type; |
128 | return map; | 131 | return map; |
129 | } | 132 | } |
130 | 133 | ||
@@ -897,11 +900,17 @@ static const struct bpf_prog_ops * const bpf_prog_types[] = { | |||
897 | 900 | ||
898 | static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog) | 901 | static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog) |
899 | { | 902 | { |
900 | if (type >= ARRAY_SIZE(bpf_prog_types) || !bpf_prog_types[type]) | 903 | const struct bpf_prog_ops *ops; |
904 | |||
905 | if (type >= ARRAY_SIZE(bpf_prog_types)) | ||
906 | return -EINVAL; | ||
907 | type = array_index_nospec(type, ARRAY_SIZE(bpf_prog_types)); | ||
908 | ops = bpf_prog_types[type]; | ||
909 | if (!ops) | ||
901 | return -EINVAL; | 910 | return -EINVAL; |
902 | 911 | ||
903 | if (!bpf_prog_is_dev_bound(prog->aux)) | 912 | if (!bpf_prog_is_dev_bound(prog->aux)) |
904 | prog->aux->ops = bpf_prog_types[type]; | 913 | prog->aux->ops = ops; |
905 | else | 914 | else |
906 | prog->aux->ops = &bpf_offload_prog_ops; | 915 | prog->aux->ops = &bpf_offload_prog_ops; |
907 | prog->type = type; | 916 | prog->type = type; |