Commit d0fbb51d authored by Dan Carpenter's avatar Dan Carpenter Committed by Daniel Borkmann

bpf, offload: Unlock on error in bpf_offload_dev_create()

We need to drop the bpf_devs_lock on error before returning.

Fixes: 9fd7c555 ("bpf: offload: aggregate offloads per-device")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Link: https://lore.kernel.org/bpf/20191104091536.GB31509@mwanda
parent 2836654a
...@@ -678,8 +678,10 @@ bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops, void *priv) ...@@ -678,8 +678,10 @@ bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops, void *priv)
down_write(&bpf_devs_lock); down_write(&bpf_devs_lock);
if (!offdevs_inited) { if (!offdevs_inited) {
err = rhashtable_init(&offdevs, &offdevs_params); err = rhashtable_init(&offdevs, &offdevs_params);
if (err) if (err) {
up_write(&bpf_devs_lock);
return ERR_PTR(err); return ERR_PTR(err);
}
offdevs_inited = true; offdevs_inited = true;
} }
up_write(&bpf_devs_lock); up_write(&bpf_devs_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment