aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/devmap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-23 11:41:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-23 11:41:27 -0400
commit71aa60f67f032dffe58999bd8ae4b2f38a9ea05e (patch)
tree4d755f640b3135b14bf482215609b22379b62554 /kernel/bpf/devmap.c
parent79444df4e7f03843be78e4b9188d095931648842 (diff)
parent4e683f499a15cd777d3cb51aaebe48d72334c852 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix NAPI poll list corruption in enic driver, from Christian Lamparter. 2) Fix route use after free, from Eric Dumazet. 3) Fix regression in reuseaddr handling, from Josef Bacik. 4) Assert the size of control messages in compat handling since we copy it in from userspace twice. From Meng Xu. 5) SMC layer bug fixes (missing RCU locking, bad refcounting, etc.) from Ursula Braun. 6) Fix races in AF_PACKET fanout handling, from Willem de Bruijn. 7) Don't use ARRAY_SIZE on spinlock array which might have zero entries, from Geert Uytterhoeven. 8) Fix miscomputation of checksum in ipv6 udp code, from Subash Abhinov Kasiviswanathan. 9) Push the ipv6 header properly in ipv6 GRE tunnel driver, from Xin Long. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (75 commits) inet: fix improper empty comparison net: use inet6_rcv_saddr to compare sockets net: set tb->fast_sk_family net: orphan frags on stand-alone ptype in dev_queue_xmit_nit MAINTAINERS: update git tree locations for ieee802154 subsystem net: prevent dst uses after free net: phy: Fix truncation of large IRQ numbers in phy_attached_print() net/smc: no close wait in case of process shut down net/smc: introduce a delay net/smc: terminate link group if out-of-sync is received net/smc: longer delay for client link group removal net/smc: adapt send request completion notification net/smc: adjust net_device refcount net/smc: take RCU read lock for routing cache lookup net/smc: add receive timeout check net/smc: add missing dev_put net: stmmac: Cocci spatch "of_table" lan78xx: Use default values loaded from EEPROM/OTP after reset lan78xx: Allow EEPROM write for less than MAX_EEPROM_SIZE lan78xx: Fix for eeprom read/write when device auto suspend ...
Diffstat (limited to 'kernel/bpf/devmap.c')
-rw-r--r--kernel/bpf/devmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
index 959c9a07f318..e093d9a2c4dd 100644
--- a/kernel/bpf/devmap.c
+++ b/kernel/bpf/devmap.c
@@ -75,8 +75,8 @@ static u64 dev_map_bitmap_size(const union bpf_attr *attr)
75static struct bpf_map *dev_map_alloc(union bpf_attr *attr) 75static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
76{ 76{
77 struct bpf_dtab *dtab; 77 struct bpf_dtab *dtab;
78 int err = -EINVAL;
78 u64 cost; 79 u64 cost;
79 int err;
80 80
81 /* check sanity of attributes */ 81 /* check sanity of attributes */
82 if (attr->max_entries == 0 || attr->key_size != 4 || 82 if (attr->max_entries == 0 || attr->key_size != 4 ||
@@ -108,6 +108,8 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
108 if (err) 108 if (err)
109 goto free_dtab; 109 goto free_dtab;
110 110
111 err = -ENOMEM;
112
111 /* A per cpu bitfield with a bit per possible net device */ 113 /* A per cpu bitfield with a bit per possible net device */
112 dtab->flush_needed = __alloc_percpu(dev_map_bitmap_size(attr), 114 dtab->flush_needed = __alloc_percpu(dev_map_bitmap_size(attr),
113 __alignof__(unsigned long)); 115 __alignof__(unsigned long));
@@ -128,7 +130,7 @@ static struct bpf_map *dev_map_alloc(union bpf_attr *attr)
128free_dtab: 130free_dtab:
129 free_percpu(dtab->flush_needed); 131 free_percpu(dtab->flush_needed);
130 kfree(dtab); 132 kfree(dtab);
131 return ERR_PTR(-ENOMEM); 133 return ERR_PTR(err);
132} 134}
133 135
134static void dev_map_free(struct bpf_map *map) 136static void dev_map_free(struct bpf_map *map)