diff mbox series

[v2,net] net: bcmasp: fix potential memory leak in bcmasp_xmit()

Message ID 20241015143424.71543-1-wanghai38@huawei.com (mailing list archive)
State Under Review
Delegated to: Netdev Maintainers
Headers show
Series [v2,net] net: bcmasp: fix potential memory leak in bcmasp_xmit() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5 this patch: 5
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: andrew+netdev@lunn.ch
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-10-15--15-00 (tests: 776)

Commit Message

Wang Hai Oct. 15, 2024, 2:34 p.m. UTC
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(+)

Comments

Simon Horman Oct. 17, 2024, 1:54 p.m. UTC | #1
On Tue, Oct 15, 2024 at 10:34:24PM +0800, Wang Hai wrote:
> 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>

There seems to be some confusion over in the thread for v1 of this patchset.
Perhaps relating to several similar patches being in-flight at the same
time.

1. Changes were requested by Florian
2. Jakub confirmed this concern
3. Florian Acked v1 patch
4. The bot sent a notificaiton that v1 had been applied

But v1 is not in net-next.
And I assume that 3 was intended for v2.

From my point of view v2 addresses the concerns raised by Florian wrt v1.
And, moreover, I agree this fix is correct.

Reviewed-by: Simon Horman <horms@kernel.org>

v2 is marked as Changes Requested in patchwork.
But I suspect that is due to confusion around v1 as summarised above.
So I am (hopefully) moving it back to Under Review.
diff mbox series

Patch

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;
 		}