* [PATCH bpf] bpf: offload: unlock on error in bpf_offload_dev_create()
@ 2019-11-04 9:15 Dan Carpenter
2019-11-04 16:29 ` Jakub Kicinski
2019-11-06 23:23 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-11-04 9:15 UTC (permalink / raw)
To: Alexei Starovoitov, Jakub Kicinski
Cc: Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
Andrii Nakryiko, netdev, bpf, kernel-janitors
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>
---
Static analysis. Not tested.
kernel/bpf/offload.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index ba635209ae9a..5b9da0954a27 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -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);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] bpf: offload: unlock on error in bpf_offload_dev_create()
2019-11-04 9:15 [PATCH bpf] bpf: offload: unlock on error in bpf_offload_dev_create() Dan Carpenter
@ 2019-11-04 16:29 ` Jakub Kicinski
2019-11-06 23:23 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2019-11-04 16:29 UTC (permalink / raw)
To: Dan Carpenter
Cc: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
Yonghong Song, Andrii Nakryiko, netdev, bpf, kernel-janitors
On Mon, 4 Nov 2019 12:15:36 +0300, Dan Carpenter wrote:
> 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>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf] bpf: offload: unlock on error in bpf_offload_dev_create()
2019-11-04 9:15 [PATCH bpf] bpf: offload: unlock on error in bpf_offload_dev_create() Dan Carpenter
2019-11-04 16:29 ` Jakub Kicinski
@ 2019-11-06 23:23 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-11-06 23:23 UTC (permalink / raw)
To: Dan Carpenter, Alexei Starovoitov, Jakub Kicinski
Cc: Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
netdev, bpf, kernel-janitors
On 11/4/19 10:15 AM, Dan Carpenter wrote:
> 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>
Applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-06 23:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 9:15 [PATCH bpf] bpf: offload: unlock on error in bpf_offload_dev_create() Dan Carpenter
2019-11-04 16:29 ` Jakub Kicinski
2019-11-06 23:23 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).