]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
bpf, offload: Unlock on error in bpf_offload_dev_create()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 4 Nov 2019 09:15:36 +0000 (12:15 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 6 Nov 2019 23:20:27 +0000 (00:20 +0100)
We need to drop the bpf_devs_lock on error before returning.

Fixes: 9fd7c5559165 ("bpf: offload: aggregate offloads per-device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Link: https://lore.kernel.org/bpf/20191104091536.GB31509@mwanda
kernel/bpf/offload.c

index ba635209ae9a8bca1c6d59b0e77814c07f7cc67c..5b9da0954a27f4266eaf9a1e14ea1eeb85b270ca 100644 (file)
@@ -678,8 +678,10 @@ bpf_offload_dev_create(const struct bpf_prog_offload_ops *ops, void *priv)
        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);