Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH wpan] mac802154: Fix possible double free upon parsing error
@ 2022-12-16 23:57 Miquel Raynal
  2022-12-19 10:47 ` Stefan Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Miquel Raynal @ 2022-12-16 23:57 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David Girault, Romuald Despres, Frederic Blain, Nicolas Schodet,
	Guilhem Imberton, Thomas Petazzoni, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev, Miquel Raynal,
	Dan Carpenter

Commit 4d1c7d87030b ("mac802154: Move an skb free within the rx path")
tried to simplify error handling within the receive path by moving the
kfree_skb() call at the very end of the top-level function but missed
one kfree_skb() called upon frame parsing error. Prevent this possible
double free from happening.

Fixes: 4d1c7d87030b ("mac802154: Move an skb free within the rx path")
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/mac802154/rx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index c2aae2a6d6a6..97bb4401dd3e 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -213,7 +213,6 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local,
 	ret = ieee802154_parse_frame_start(skb, &hdr);
 	if (ret) {
 		pr_debug("got invalid frame\n");
-		kfree_skb(skb);
 		return;
 	}
 
-- 
2.34.1


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

* Re: [PATCH wpan] mac802154: Fix possible double free upon parsing error
  2022-12-16 23:57 [PATCH wpan] mac802154: Fix possible double free upon parsing error Miquel Raynal
@ 2022-12-19 10:47 ` Stefan Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Schmidt @ 2022-12-19 10:47 UTC (permalink / raw)
  To: Miquel Raynal, Alexander Aring, linux-wpan
  Cc: David Girault, Romuald Despres, Frederic Blain, Nicolas Schodet,
	Guilhem Imberton, Thomas Petazzoni, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev, Dan Carpenter

Hello.

On 17.12.22 00:57, Miquel Raynal wrote:
> Commit 4d1c7d87030b ("mac802154: Move an skb free within the rx path")
> tried to simplify error handling within the receive path by moving the
> kfree_skb() call at the very end of the top-level function but missed
> one kfree_skb() called upon frame parsing error. Prevent this possible
> double free from happening.
> 
> Fixes: 4d1c7d87030b ("mac802154: Move an skb free within the rx path")
> Reported-by: Dan Carpenter <error27@gmail.com>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>   net/mac802154/rx.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
> index c2aae2a6d6a6..97bb4401dd3e 100644
> --- a/net/mac802154/rx.c
> +++ b/net/mac802154/rx.c
> @@ -213,7 +213,6 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local,
>   	ret = ieee802154_parse_frame_start(skb, &hdr);
>   	if (ret) {
>   		pr_debug("got invalid frame\n");
> -		kfree_skb(skb);
>   		return;
>   	}
>   

This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt

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

end of thread, other threads:[~2022-12-19 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 23:57 [PATCH wpan] mac802154: Fix possible double free upon parsing error Miquel Raynal
2022-12-19 10:47 ` Stefan Schmidt

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).