* [PATCH net] hsr: Prevent use after free in prp_create_tagged_frame()
@ 2023-10-27 12:19 Dan Carpenter
2023-10-31 12:15 ` Paolo Abeni
2023-11-02 5:51 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-10-27 12:19 UTC (permalink / raw)
To: Murali Karicheri
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Sebastian Andrzej Siewior, YueHaibing, Ziyang Xuan, netdev,
kernel-janitors
The prp_fill_rct() function can fail. In that situation, it frees the
skb and returns NULL. Meanwhile on the success path, it returns the
original skb. So it's straight forward to fix bug by using the returned
value.
Fixes: 451d8123f897 ("net: prp: add packet handling support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
net/hsr/hsr_forward.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
index b71dab630a87..80cdc6f6b34c 100644
--- a/net/hsr/hsr_forward.c
+++ b/net/hsr/hsr_forward.c
@@ -342,9 +342,7 @@ struct sk_buff *prp_create_tagged_frame(struct hsr_frame_info *frame,
skb = skb_copy_expand(frame->skb_std, 0,
skb_tailroom(frame->skb_std) + HSR_HLEN,
GFP_ATOMIC);
- prp_fill_rct(skb, frame, port);
-
- return skb;
+ return prp_fill_rct(skb, frame, port);
}
static void hsr_deliver_master(struct sk_buff *skb, struct net_device *dev,
--
2.42.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] hsr: Prevent use after free in prp_create_tagged_frame()
2023-10-27 12:19 [PATCH net] hsr: Prevent use after free in prp_create_tagged_frame() Dan Carpenter
@ 2023-10-31 12:15 ` Paolo Abeni
2023-11-02 5:51 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2023-10-31 12:15 UTC (permalink / raw)
To: Dan Carpenter, Murali Karicheri
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski,
Sebastian Andrzej Siewior, YueHaibing, Ziyang Xuan, netdev,
kernel-janitors
On Fri, 2023-10-27 at 15:19 +0300, Dan Carpenter wrote:
> The prp_fill_rct() function can fail. In that situation, it frees the
> skb and returns NULL. Meanwhile on the success path, it returns the
> original skb. So it's straight forward to fix bug by using the returned
> value.
>
> Fixes: 451d8123f897 ("net: prp: add packet handling support")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> net/hsr/hsr_forward.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c
> index b71dab630a87..80cdc6f6b34c 100644
> --- a/net/hsr/hsr_forward.c
> +++ b/net/hsr/hsr_forward.c
> @@ -342,9 +342,7 @@ struct sk_buff *prp_create_tagged_frame(struct hsr_frame_info *frame,
> skb = skb_copy_expand(frame->skb_std, 0,
> skb_tailroom(frame->skb_std) + HSR_HLEN,
> GFP_ATOMIC);
> - prp_fill_rct(skb, frame, port);
> -
> - return skb;
> + return prp_fill_rct(skb, frame, port);
> }
>
> static void hsr_deliver_master(struct sk_buff *skb, struct net_device *dev,
Acked-by: Paolo Abeni <pabeni@redhat.com>
(note both trees are currently locked now due to the pending PR; this
tag is intended to speed-up the merge after the PR itself)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] hsr: Prevent use after free in prp_create_tagged_frame()
2023-10-27 12:19 [PATCH net] hsr: Prevent use after free in prp_create_tagged_frame() Dan Carpenter
2023-10-31 12:15 ` Paolo Abeni
@ 2023-11-02 5:51 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-02 5:51 UTC (permalink / raw)
To: Dan Carpenter
Cc: m-karicheri2, davem, edumazet, kuba, pabeni, bigeasy, yuehaibing,
william.xuanziyang, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 27 Oct 2023 15:19:01 +0300 you wrote:
> The prp_fill_rct() function can fail. In that situation, it frees the
> skb and returns NULL. Meanwhile on the success path, it returns the
> original skb. So it's straight forward to fix bug by using the returned
> value.
>
> Fixes: 451d8123f897 ("net: prp: add packet handling support")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>
> [...]
Here is the summary with links:
- [net] hsr: Prevent use after free in prp_create_tagged_frame()
https://git.kernel.org/netdev/net/c/876f8ab52363
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:[~2023-11-02 5:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27 12:19 [PATCH net] hsr: Prevent use after free in prp_create_tagged_frame() Dan Carpenter
2023-10-31 12:15 ` Paolo Abeni
2023-11-02 5:51 ` 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