Commit 4622676d authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

bpf, offload: Unlock on error in bpf_offload_dev_create()

[ Upstream commit d0fbb51d ]

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@mwandaSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f6dfebc9
......@@ -645,8 +645,10 @@ struct bpf_offload_dev *bpf_offload_dev_create(void)
down_write(&bpf_devs_lock);
if (!offdevs_inited) {
err = rhashtable_init(&offdevs, &offdevs_params);
if (err)
if (err) {
up_write(&bpf_devs_lock);
return ERR_PTR(err);
}
offdevs_inited = true;
}
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