diff mbox series

[wpan] mac802154: Fix possible double free upon parsing error

Message ID 20221216235742.646134-1-miquel.raynal@bootlin.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [wpan] mac802154: Fix possible double free upon parsing error | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Miquel Raynal Dec. 16, 2022, 11:57 p.m. UTC
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(-)

Comments

Stefan Schmidt Dec. 19, 2022, 10:47 a.m. UTC | #1
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
diff mbox series

Patch

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;
 	}