mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] net: wwan: iosm: drop redundant skb->data check in MUX DL decode
@ 2026-11-03 14:59 Fang Xieyan
  2026-11-03 15:13 ` Loic Poulain
  2026-11-10 14:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Fang Xieyan @ 2026-11-03 14:59 UTC (permalink / raw)
  To: Loic Poulain, Sergey Ryazanov, Andrew Lunn
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, Johannes Berg, Guanglei Zhu

The skb passed to ipc_mux_dl_decode() through the current RX path
always has a valid data pointer.

The only caller, ipc_imem_dl_skb_process(), checks for a NULL skb
before calling ipc_mux_dl_decode(). The skb is allocated through
ipc_pcie_alloc_skb() -> ipc_pcie_alloc_local_skb() ->
__netdev_alloc_skb(), which provides a valid data buffer on
successful allocation. Allocation or DMA mapping failures return
a NULL skb instead.

Remove the redundant skb->data check.

Suggested-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
---
Changes in v2:
- Drop the "fix potential skb leak" approach. The skb->data NULL
  condition is unreachable through the current RX path, so remove
  the redundant check instead of adding an ipc_pcie_kfree_skb() call.
- Drop the Fixes: tag because this patch does not fix a reachable bug.

 drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
index 0bbd41263cc2..2b8a22980c87 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -693,9 +693,6 @@ void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
 {
 	u32 signature;
 
-	if (!skb->data)
-		return;
-
 	/* Decode the MUX header type. */
 	signature = le32_to_cpup((__le32 *)skb->data);
 
-- 
2.50.1


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH] net: wwan: iosm: fix potential skb leak in MUX DL decode
@ 2026-11-02  8:19 Fang Xieyan
  2026-11-03 11:11 ` [PATCH v2] net: wwan: iosm: drop redundant skb->data check " Fang Xieyan
  0 siblings, 1 reply; 5+ messages in thread
From: Fang Xieyan @ 2026-11-02  8:19 UTC (permalink / raw)
  To: Loic Poulain, Sergey Ryazanov
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netdev, linux-kernel, Johannes Berg, M Chetan Kumar,
	Guanglei Zhu

ipc_mux_dl_decode() owns the received skb and frees it after
decoding. However, the early return when skb->data is NULL
bypasses the skb cleanup.

Free the skb through ipc_pcie_kfree_skb() before returning
to ensure that both the DMA mapping and skb are released.

Fixes: 3670970dd8c6 ("net: iosm: shared memory IPC interface")
Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Signed-off-by: Fang Xieyan <fangxy@xiaopeng.com>
---
 drivers/net/wwan/iosm/iosm_ipc_mux_codec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
index 0bbd41263cc2..61700688eac9 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_mux_codec.c
@@ -693,8 +693,10 @@ void ipc_mux_dl_decode(struct iosm_mux *ipc_mux, struct sk_buff *skb)
 {
 	u32 signature;
 
-	if (!skb->data)
+	if (!skb->data) {
+		ipc_pcie_kfree_skb(ipc_mux->pcie, skb);
 		return;
+	}
 
 	/* Decode the MUX header type. */
 	signature = le32_to_cpup((__le32 *)skb->data);
-- 
2.50.1


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 14:59 [PATCH v2] net: wwan: iosm: drop redundant skb->data check in MUX DL decode Fang Xieyan
2026-11-03 15:13 ` Loic Poulain
2026-11-10 14:30 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2026-11-02  8:19 [PATCH] net: wwan: iosm: fix potential skb leak " Fang Xieyan
2026-11-03 11:11 ` [PATCH v2] net: wwan: iosm: drop redundant skb->data check " Fang Xieyan
2026-11-03 13:50   ` Andrew Lunn

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

all inboxes | Powered by JetHome®