Skip to contentSkip to conversation

net: wwan: iosm: drop redundant skb->data check in MUX DL decode

PATCH Applied Fang Xieyan 3 participants 3 messages Nov 3 – Nov 10

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: wwan: iosm: drop redundant skb->data check in MUX DL decode

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.

---
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(-)
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c +0 -3
index 0bbd41263cc2..2b8a22980c87 100644
@@ -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);
 
Signature · 1 line
2.50.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Fang Xieyan

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.

Quoted 5 lines

Remove the redundant skb->data check.

On top of that, the early-return branch does not release the related resources.

Quoted 27 lines

---
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(-)
drivers/net/wwan/iosm/iosm_ipc_mux_codec.c +0 -4
index 0bbd41263cc2..2b8a22980c87 100644
@@ -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

#2 lore raw
In reply to Fang Xieyan
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 11 lines · On Tue, 3 Nov 2026 22:59:25 +0800 you wrote:

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.

[...]

Here is the summary with links:
- [v2] net: wwan: iosm: drop redundant skb->data check in MUX DL decode

    https://git.kernel.org/netdev/net-next/c/66974df65a0b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html