* [PATCH] ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx
@ 2021-03-29 11:50 Lv Yunlong
2021-03-29 23:53 ` Jakub Kicinski
2021-03-30 0:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Lv Yunlong @ 2021-03-29 11:50 UTC (permalink / raw)
To: kuba, simon.horman, davem, ast, daniel, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh
Cc: netdev, bpf, oss-drivers, linux-kernel, Lv Yunlong
In nfp_bpf_ctrl_msg_rx, if
nfp_ccm_get_type(skb) == NFP_CCM_TYPE_BPF_BPF_EVENT is true, the skb
will be freed. But the skb is still used by nfp_ccm_rx(&bpf->ccm, skb).
My patch adds a return when the skb was freed.
Fixes: bcf0cafab44fd ("nfp: split out common control message handling code")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
---
drivers/net/ethernet/netronome/nfp/bpf/cmsg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
index 0e2db6ea79e9..2ec62c8d86e1 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/cmsg.c
@@ -454,6 +454,7 @@ void nfp_bpf_ctrl_msg_rx(struct nfp_app *app, struct sk_buff *skb)
dev_consume_skb_any(skb);
else
dev_kfree_skb_any(skb);
+ return;
}
nfp_ccm_rx(&bpf->ccm, skb);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx
2021-03-29 11:50 [PATCH] ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx Lv Yunlong
@ 2021-03-29 23:53 ` Jakub Kicinski
2021-03-30 0:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2021-03-29 23:53 UTC (permalink / raw)
To: Lv Yunlong
Cc: simon.horman, davem, ast, daniel, andrii, kafai, songliubraving,
yhs, john.fastabend, kpsingh, netdev, bpf, oss-drivers,
linux-kernel
On Mon, 29 Mar 2021 04:50:02 -0700 Lv Yunlong wrote:
> In nfp_bpf_ctrl_msg_rx, if
> nfp_ccm_get_type(skb) == NFP_CCM_TYPE_BPF_BPF_EVENT is true, the skb
> will be freed. But the skb is still used by nfp_ccm_rx(&bpf->ccm, skb).
>
> My patch adds a return when the skb was freed.
>
> Fixes: bcf0cafab44fd ("nfp: split out common control message handling code")
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx
2021-03-29 11:50 [PATCH] ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx Lv Yunlong
2021-03-29 23:53 ` Jakub Kicinski
@ 2021-03-30 0:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-30 0:30 UTC (permalink / raw)
To: Lv Yunlong
Cc: kuba, simon.horman, davem, ast, daniel, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, netdev, bpf,
oss-drivers, linux-kernel
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Mon, 29 Mar 2021 04:50:02 -0700 you wrote:
> In nfp_bpf_ctrl_msg_rx, if
> nfp_ccm_get_type(skb) == NFP_CCM_TYPE_BPF_BPF_EVENT is true, the skb
> will be freed. But the skb is still used by nfp_ccm_rx(&bpf->ccm, skb).
>
> My patch adds a return when the skb was freed.
>
> Fixes: bcf0cafab44fd ("nfp: split out common control message handling code")
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
>
> [...]
Here is the summary with links:
- ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx
https://git.kernel.org/netdev/net/c/6e5a03bcba44
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-30 0:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-29 11:50 [PATCH] ethernet/netronome/nfp: Fix a use after free in nfp_bpf_ctrl_msg_rx Lv Yunlong
2021-03-29 23:53 ` Jakub Kicinski
2021-03-30 0:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox