Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2 1/2] mac802154: free the skb when MLME TX is rejected
@ 2026-11-29 13:03 leegun25
  2026-11-29 13:03 ` [PATCH net v2 2/2] mac802154: fix locking for association response TX leegun25
  2026-11-30 14:03 ` [PATCH net v2 1/2] mac802154: free the skb when MLME TX is rejected netdev-bot+sashiko
  0 siblings, 2 replies; 4+ messages in thread
From: leegun25 @ 2026-11-29 13:03 UTC (permalink / raw)
  To: miquel.raynal, alex.aring, stefan; +Cc: linux-wpan, netdev

>From 0fb563b521939707808b720d3e5801b3370c97f2 Mon Sep 17 00:00:00 2001
From: Lee Keon-Hyeong <leegun25@proton.me>
Date: Fri, 27 Nov 2026 11:42:37 +0900
Subject: [PATCH net v2 1/2] mac802154: free the skb when MLME TX is rejected

ieee802154_mlme_tx_locked() returns -ENETDOWN on two paths before
passing the skb to ieee802154_tx(). Its callers expect it to consume
the skb, so both paths leak it. Free the skb before returning.

I found this during an LLM-assisted review of the MLME TX error
paths. An earlier review of beacon TX also noted the leak.

The association tests exercised only successful transmissions. I did
not test either error path or run the in-tree selftests.

Link: https://lore.kernel.org/linux-wpan/179370015236.488856.9062135405491525675@kernel.org/
Fixes: ddd9ee7cda12 ("net: mac802154: Introduce a synchronous API for MLME commands")
Fixes: 4f790184139b ("net: mac802154: Add a warning in the slow path")
Signed-off-by: Lee Keon-Hyeong <leegun25@proton.me>
---
 net/mac802154/tx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 4d13f18f6..af5003b93 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -147,14 +147,18 @@ int ieee802154_mlme_tx_locked(struct ieee802154_local *local,
 	ASSERT_RTNL();
 
 	/* Ensure the device was not stopped, otherwise error out */
-	if (!local->open_count)
+	if (!local->open_count) {
+		kfree_skb(skb);
 		return -ENETDOWN;
+	}
 
 	/* Warn if the ieee802154 core thinks MLME frames can be sent while the
 	 * net interface expects this cannot happen.
 	 */
-	if (WARN_ON_ONCE(!netif_running(sdata->dev)))
+	if (WARN_ON_ONCE(!netif_running(sdata->dev))) {
+		kfree_skb(skb);
 		return -ENETDOWN;
+	}
 
 	ieee802154_tx(local, skb);
 	return ieee802154_sync_queue(local);
-- 
2.56.0



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

end of thread, other threads:[~2026-11-30 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 13:03 [PATCH net v2 1/2] mac802154: free the skb when MLME TX is rejected leegun25
2026-11-29 13:03 ` [PATCH net v2 2/2] mac802154: fix locking for association response TX leegun25
2026-11-30 14:04   ` netdev-bot+sashiko
2026-11-30 14:03 ` [PATCH net v2 1/2] mac802154: free the skb when MLME TX is rejected netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox