From: Wang Hai <wanghai38@huawei.com>
To: <justin.chen@broadcom.com>, <florian.fainelli@broadcom.com>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <horms@kernel.org>,
<zhangxiaoxu5@huawei.com>
Cc: <bcm-kernel-feedback-list@broadcom.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <wanghai38@huawei.com>
Subject: [PATCH v2 net] net: bcmasp: fix potential memory leak in bcmasp_xmit()
Date: Tue, 15 Oct 2024 22:34:24 +0800 [thread overview]
Message-ID: <20241015143424.71543-1-wanghai38@huawei.com> (raw)
The bcmasp_xmit() returns NETDEV_TX_OK without freeing skb
in case of mapping fails, add dev_consume_skb_any() to fix it.
Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
---
v1->v2: replace dev_kfree_skb() with dev_consume_skb_any()
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index 82768b0e9026..8cc8efa8d1fb 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -322,6 +322,7 @@ static netdev_tx_t bcmasp_xmit(struct sk_buff *skb, struct net_device *dev)
}
/* Rewind so we do not have a hole */
spb_index = intf->tx_spb_index;
+ dev_consume_skb_any(skb);
return NETDEV_TX_OK;
}
--
2.17.1
next reply other threads:[~2024-10-15 14:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 14:34 Wang Hai [this message]
2024-10-17 13:54 ` [PATCH v2 net] net: bcmasp: fix potential memory leak in bcmasp_xmit() Simon Horman
2024-10-18 18:18 ` Florian Fainelli
2024-10-19 9:35 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241015143424.71543-1-wanghai38@huawei.com \
--to=wanghai38@huawei.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=justin.chen@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox