public inbox for linux-x25@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame()
@ 2022-11-14 11:05 Wei Yongjun
  2022-11-14 11:53 ` Martin Schiller
  2022-11-16  4:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2022-11-14 11:05 UTC (permalink / raw)
  To: Martin Schiller, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Hendry, Matthew Daley
  Cc: Wei Yongjun, linux-x25, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

x25_lapb_receive_frame() using skb_copy() to get a private copy of
skb, the new skb should be freed in the undersized/fragmented skb
error handling path. Otherwise there is a memory leak.

Fixes: cb101ed2c3c7 ("x25: Handle undersized/fragmented skbs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/x25/x25_dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 5259ef8f5242..748d8630ab58 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -117,7 +117,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
 
 	if (!pskb_may_pull(skb, 1)) {
 		x25_neigh_put(nb);
-		return 0;
+		goto drop;
 	}
 
 	switch (skb->data[0]) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame()
  2022-11-14 11:05 [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame() Wei Yongjun
@ 2022-11-14 11:53 ` Martin Schiller
  2022-11-16  4:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Schiller @ 2022-11-14 11:53 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Andrew Hendry, Matthew Daley, Wei Yongjun, linux-x25, netdev

On 2022-11-14 12:05, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> x25_lapb_receive_frame() using skb_copy() to get a private copy of
> skb, the new skb should be freed in the undersized/fragmented skb
> error handling path. Otherwise there is a memory leak.
> 
> Fixes: cb101ed2c3c7 ("x25: Handle undersized/fragmented skbs")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  net/x25/x25_dev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
> index 5259ef8f5242..748d8630ab58 100644
> --- a/net/x25/x25_dev.c
> +++ b/net/x25/x25_dev.c
> @@ -117,7 +117,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb,
> struct net_device *dev,
> 
>  	if (!pskb_may_pull(skb, 1)) {
>  		x25_neigh_put(nb);
> -		return 0;
> +		goto drop;
>  	}
> 
>  	switch (skb->data[0]) {

Looks good to me.

Thanks.

Acked-by: Martin Schiller <ms@dev.tdt.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame()
  2022-11-14 11:05 [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame() Wei Yongjun
  2022-11-14 11:53 ` Martin Schiller
@ 2022-11-16  4:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-16  4:30 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: ms, davem, edumazet, kuba, pabeni, andrew.hendry, mattjd,
	weiyongjun1, linux-x25, netdev

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 14 Nov 2022 11:05:19 +0000 you wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> x25_lapb_receive_frame() using skb_copy() to get a private copy of
> skb, the new skb should be freed in the undersized/fragmented skb
> error handling path. Otherwise there is a memory leak.
> 
> Fixes: cb101ed2c3c7 ("x25: Handle undersized/fragmented skbs")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> [...]

Here is the summary with links:
  - [net] net/x25: Fix skb leak in x25_lapb_receive_frame()
    https://git.kernel.org/netdev/net/c/2929cceb2fcf

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:[~2022-11-16  4:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-14 11:05 [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame() Wei Yongjun
2022-11-14 11:53 ` Martin Schiller
2022-11-16  4: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