Skip to contentSkip to conversation

mctp: i2c: fix skb memory leak in receive path

PATCH Applied Haiyue Wang 2 participants 2 messages Mar 5 – Mar 10

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

PATCH 1/1 mctp: i2c: fix skb memory leak in receive path

When 'midev->allow_rx' is false, the newly allocated skb isn't consumed by netif_rx(), it needs to free the skb directly.

Fixes f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
---
 drivers/net/mctp/mctp-i2c.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mctp/mctp-i2c.c +1 -0
index de6bc1736734..15fe4d1163c1 100644
@@ -343,6 +343,7 @@ static int mctp_i2c_recv(struct mctp_i2c_dev *midev)
 	} else {
 		status = NET_RX_DROP;
 		spin_unlock_irqrestore(&midev->lock, flags);
+		kfree_skb(skb);
 	}
 
 	if (status == NET_RX_SUCCESS) {
Signature · 1 line
2.53.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

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

Quoted 8 lines · On Thu, 5 Mar 2026 22:32:34 +0800 you wrote:

When 'midev->allow_rx' is false, the newly allocated skb isn't consumed by netif_rx(), it needs to free the skb directly.

Fixes f5b8abf9fc3d ("mctp i2c: MCTP I2C binding driver")
---
 drivers/net/mctp/mctp-i2c.c | 1 +
 1 file changed, 1 insertion(+)

Here is the summary with links:
- [net,v1] mctp: i2c: fix skb memory leak in receive path

    https://git.kernel.org/netdev/net/c/e3f5e0f22cfc

You are awesome, thank you!

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