* [PATCH net 0/2] pull-request: can 2026-01-23
@ 2026-01-23 17:30 Marc Kleine-Budde
2026-01-23 17:30 ` [PATCH net 1/2] can: at91_can: Fix memory leak in at91_can_probe() Marc Kleine-Budde
2026-01-23 17:30 ` [PATCH net 2/2] can: gs_usb: gs_usb_receive_bulk_callback(): fix error message Marc Kleine-Budde
0 siblings, 2 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-01-23 17:30 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel
Hello netdev-team,
this is a pull request of 2 patches for net/main.
The first patch is by Zilin Guan and fixes a memory leak in the error
path of the at91_can driver's probe function.
The last patch is by me and fixes yet another error in the gs_usb's
gs_usb_receive_bulk_callback() function.
regards,
Marc
---
The following changes since commit 5778d65d4b85d4929d30998863e08e20af4b6113:
Merge branch 'vsock-virtio-fix-tx-credit-handling' (2026-01-22 15:41:36 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-6.19-20260123
for you to fetch changes up to 494fc029f662c331e06b7c2031deff3c64200eed:
can: gs_usb: gs_usb_receive_bulk_callback(): fix error message (2026-01-23 18:16:37 +0100)
----------------------------------------------------------------
linux-can-fixes-for-6.19-20260123
----------------------------------------------------------------
Marc Kleine-Budde (1):
can: gs_usb: gs_usb_receive_bulk_callback(): fix error message
Zilin Guan (1):
can: at91_can: Fix memory leak in at91_can_probe()
drivers/net/can/at91_can.c | 2 +-
drivers/net/can/usb/gs_usb.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] can: at91_can: Fix memory leak in at91_can_probe()
2026-01-23 17:30 [PATCH net 0/2] pull-request: can 2026-01-23 Marc Kleine-Budde
@ 2026-01-23 17:30 ` Marc Kleine-Budde
2026-01-25 21:20 ` patchwork-bot+netdevbpf
2026-01-23 17:30 ` [PATCH net 2/2] can: gs_usb: gs_usb_receive_bulk_callback(): fix error message Marc Kleine-Budde
1 sibling, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-01-23 17:30 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel, Zilin Guan, Marc Kleine-Budde
From: Zilin Guan <zilin@seu.edu.cn>
In at91_can_probe(), the dev structure is allocated via alloc_candev().
However, if the subsequent call to devm_phy_optional_get() fails, the
code jumps directly to exit_iounmap, missing the call to free_candev().
This results in a memory leak of the allocated net_device structure.
Fix this by jumping to the exit_free label instead, which ensures that
free_candev() is called to properly release the memory.
Compile tested only. Issue found using a prototype static analysis tool
and code review.
Fixes: 3ecc09856afb ("can: at91_can: add CAN transceiver support")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Link: https://patch.msgid.link/20260122114128.643752-1-zilin@seu.edu.cn
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/at91_can.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index c2a3a4eef5b2..58da323f14d7 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1099,7 +1099,7 @@ static int at91_can_probe(struct platform_device *pdev)
if (IS_ERR(transceiver)) {
err = PTR_ERR(transceiver);
dev_err_probe(&pdev->dev, err, "failed to get phy\n");
- goto exit_iounmap;
+ goto exit_free;
}
dev->netdev_ops = &at91_netdev_ops;
base-commit: 5778d65d4b85d4929d30998863e08e20af4b6113
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] can: gs_usb: gs_usb_receive_bulk_callback(): fix error message
2026-01-23 17:30 [PATCH net 0/2] pull-request: can 2026-01-23 Marc Kleine-Budde
2026-01-23 17:30 ` [PATCH net 1/2] can: at91_can: Fix memory leak in at91_can_probe() Marc Kleine-Budde
@ 2026-01-23 17:30 ` Marc Kleine-Budde
1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-01-23 17:30 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde
Sinc commit 79a6d1bfe114 ("can: gs_usb: gs_usb_receive_bulk_callback():
unanchor URL on usb_submit_urb() error") a failing resubmit URB will print
an info message.
In the case of a short read where netdev has not yet been assigned,
initialize as NULL to avoid dereferencing an undefined value. Also report
the error value of the failed resubmit.
Fixes: 79a6d1bfe114 ("can: gs_usb: gs_usb_receive_bulk_callback(): unanchor URL on usb_submit_urb() error")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Closes: https://lore.kernel.org/all/20260119181904.1209979-1-kuba@kernel.org/
Link: https://patch.msgid.link/20260120-gs_usb-fix-error-message-v1-1-6be04de572bc@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/usb/gs_usb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index 192338b481f2..d8b2dd74b3a1 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -610,7 +610,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
{
struct gs_usb *parent = urb->context;
struct gs_can *dev;
- struct net_device *netdev;
+ struct net_device *netdev = NULL;
int rc;
struct net_device_stats *stats;
struct gs_host_frame *hf = urb->transfer_buffer;
@@ -768,7 +768,7 @@ static void gs_usb_receive_bulk_callback(struct urb *urb)
}
} else if (rc != -ESHUTDOWN && net_ratelimit()) {
netdev_info(netdev, "failed to re-submit IN URB: %pe\n",
- ERR_PTR(urb->status));
+ ERR_PTR(rc));
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 1/2] can: at91_can: Fix memory leak in at91_can_probe()
2026-01-23 17:30 ` [PATCH net 1/2] can: at91_can: Fix memory leak in at91_can_probe() Marc Kleine-Budde
@ 2026-01-25 21:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-25 21:20 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: netdev, davem, kuba, linux-can, kernel, zilin
Hello:
This series was applied to netdev/net.git (main)
by Marc Kleine-Budde <mkl@pengutronix.de>:
On Fri, 23 Jan 2026 18:30:06 +0100 you wrote:
> From: Zilin Guan <zilin@seu.edu.cn>
>
> In at91_can_probe(), the dev structure is allocated via alloc_candev().
> However, if the subsequent call to devm_phy_optional_get() fails, the
> code jumps directly to exit_iounmap, missing the call to free_candev().
> This results in a memory leak of the allocated net_device structure.
>
> [...]
Here is the summary with links:
- [net,1/2] can: at91_can: Fix memory leak in at91_can_probe()
https://git.kernel.org/netdev/net/c/0baa4d3170d7
- [net,2/2] can: gs_usb: gs_usb_receive_bulk_callback(): fix error message
https://git.kernel.org/netdev/net/c/494fc029f662
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-25 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 17:30 [PATCH net 0/2] pull-request: can 2026-01-23 Marc Kleine-Budde
2026-01-23 17:30 ` [PATCH net 1/2] can: at91_can: Fix memory leak in at91_can_probe() Marc Kleine-Budde
2026-01-25 21:20 ` patchwork-bot+netdevbpf
2026-01-23 17:30 ` [PATCH net 2/2] can: gs_usb: gs_usb_receive_bulk_callback(): fix error message Marc Kleine-Budde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox