Szymon Wilczek

research / torvalds/linux / can / b1979778e985

etas_es58x: allow partial RX URB allocation to succeed

torvalds/linux

can +1 −1 syzbot

versions

showing v2, the version that was merged · the message and the diff below change with the tab

From: Szymon Wilczek <[email protected]>
Date: 23 Dec 2025
Subject: [PATCH v2] can: etas_es58x: allow partial RX URB allocation to succeed
Merged: 9 Jan 2026, by Marc Kleine-Budde

When es58x_alloc_rx_urbs() fails to allocate the requested number of URBs but succeeds in allocating some, it returns an error code. This causes es58x_open() to return early, skipping the cleanup label 'free_urbs', which leads to the anchored URBs being leaked.

As pointed out by maintainer Vincent Mailhol, the driver is designed to handle partial URB allocation gracefully. Therefore, partial allocation should not be treated as a fatal error.

Modify es58x_alloc_rx_urbs() to return 0 if at least one URB has been allocated, restoring the intended behavior and preventing the leak in es58x_open().

signed, reported, fixes

  • Fixes 8537257874e9 the commit it fixes
  • Reported-by syzbot reported it
  • Signed-off-by Szymon Wilczek author
  • Reviewed-by Vincent Mailhol reviewed it
  • Signed-off-by Marc Kleine-Budde maintainer · merged it

diff

drivers/net/can/usb/etas_es58x/es58x_core.c +1 −1
@@ -1736,7 +1736,7 @@ static int es58x_alloc_rx_urbs(struct es58x_device *es58x_dev) 	dev_dbg(dev, "%s: Allocated %d rx URBs each of size %u\n", 		__func__, i, rx_buf_len); -	return ret;+	return 0; }  /**

discussion · on the list

v1 · 2 messages

Szymon Wilczek author 22 Dec 2025

[PATCH] can: etas_es58x: fix memory leak in es58x_open()

Vincent Mailhol reviewer 22 Dec 2025

Hi Szymon, Thanks for the patch. The intended logic is that if es58x_alloc_rx_urbs() only partially succeeds (i.e. submits at least one URB), then you are still able to continue. To keep the intended logic, the final: return ret; of es58x_alloc_rx_urbs() should be changed to: return 0; If you want to treat a partial allocation of the URBs as a non-recoverable error, then fine, but this fix is not elegant. In that case, please do the clean-up in es58x_alloc_rx_urbs() and update the error message accordingly. Yours sincerely, Vincent Mailhol

v2 · 3 messages

Szymon Wilczek author 23 Dec 2025

[PATCH v2] can: etas_es58x: allow partial RX URB allocation to succeed

Changes in v2: - Replaced the cleanup fix in es58x_open() with the logic fix in es58x_alloc_rx_urbs() to treat partial allocation as success, as suggested by Vincent Mailhol. ---

Vincent Mailhol reviewer 23 Dec 2025

Thanks for the fix! Reviewed-by: Vincent Mailhol <[email protected]> Yours sincerely, Vincent Mailhol
applied

Marc Kleine-Budde maintainer 24 Dec 2025

Applied to linux-can. Thanks, Marc P.S.: There's no need to send a vN+1 patch as reply to vN
the whole thread on lore.kernel.org
12/12
salina
aurum
herbarium
mysterium
parchment
whispergrove
M-x 0/0

keybindings & navigation

M-x / Alt+x Open Emacs command runner
Shift + W Jump to writings & essays (/writings)
Shift + R Jump to research & upstream work (/research)
Shift + T Choose colour theme (au-themes-select)
j / k Scroll down / up
g g Scroll to the top of page
Shift + G Scroll to the bottom of page
? Toggle this keybindings help cheat sheet
Esc / C-g Dismiss modal or close active menu