From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7474E361DA8 for ; Mon, 6 Jul 2026 01:48:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783302505; cv=none; b=CNqfMOk+Ycx+FXvPdBlSH5FVqWGfaV88UeFqorTSfCX3qrOYMn5L289aNE1eJTVu/p0XP6/Ln2m5ZE/R2UdPrNZaLfweqYIyWJHAY8dw8zlkjQRTQmJhd/AHRvLWnfea/3vt9e2IafAQSlHHh21ESDsXyk+eqTyY+jrRrvqAhvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783302505; c=relaxed/simple; bh=KYj7zOd2O8d1m5PjjympWJGMKsel6RN9WHkUQo5FhEU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=J84PkN9iOvq0jZ21VyRWa0n1G182T12P0uOoQg3+YeBqDQtO+ISeyGQJL0aiXfARqN9ck8X/DxIfHKOHW5gdj1xE+FCMQP3m5b+u+bJH23JDTBmetACK9rYSZEY7K5fxMJJuEO+LxrLi6BcU9jQi/zh1vMVcMKoMxf5eL33vsvg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EUsN8KTw; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EUsN8KTw" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-84783bce476so1643665b3a.0 for ; Sun, 05 Jul 2026 18:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783302504; x=1783907304; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=866Vhq4TH5S1XsLtiE/a+HlLaZeRw/Uowkrpcrs94iE=; b=EUsN8KTws25uY9OSxIEQlQMIauN1uQnjU89Z5GfA4dB+CvdypLH4S0D+o5C24y0okk rgTCoIv5r+uzDqRh44780HWz/Ht0RLLjiyHnMz2a0sNBacnVN6mXfHdZ8zhw5Tu4WHZc KUPHf+ouiqcGzgsEMXVEqp+dXrREPmj4nZx40k+ZVjatWhEd/820C78H/uBkiqWZ3lC8 l3anBvxjPOiZ48YfwN8uTdoE4xdZD7IzRKuqrLCGZ0pu46hw+YVBVWZw29LR0TTkCpEf BzSx50q9UzxVf/jIeXjNTjjKPDUZJqc6bn3J9A2cfw3jTFKpOAQbDLD/ODBbXXrISyQg 7aEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783302504; x=1783907304; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=866Vhq4TH5S1XsLtiE/a+HlLaZeRw/Uowkrpcrs94iE=; b=gL3j7WzXE6h2opk3j8Xl0g6E9eb3JrhrSSJwQAUGsmtRBCEGuXy0skegxW3eAb1NEt ammdmWspN4Vp2S2QhPSvx7+To9JyEQCpFunC4+BlLCHUGvAeVB9A7lFdgegvyDCze3IZ GeDPp1kzlTWZ4HP9Fud5X9zcuyUfhXvDNO+gebUyFIIRNrAjTqDNTyIpXu7Q+tmKSXY3 NXPH5Nwixo0RbuqMZRS/1imdl41gVuSmP7CXXQVbxpT0yhfoIlDPxM+tKCF4kLvpFynY 7U7/IkIRJswzw1JT639MtMSWEjcGMOFSOvxlh59qT0fAaIFRt6r+OoXF1vA5NjAOPG9U zvUA== X-Forwarded-Encrypted: i=1; AHgh+Rq8CRZGl/cMYYBjEnrJ5GPMLJ7zSCfgxxUiK2nggsyqB3z2YgazHdKznB0ydbrE555sSxmRDKs0skMytSs=@vger.kernel.org X-Gm-Message-State: AOJu0YwgkXnqakKdk/itmghff6ozzYZgOlG4eOr+7XH60K4vqzZLSKwE +/hUS/gCgquIEtv02plKrqt0u4Y0VfvraXz1TLjXJfg5T/u5YA2on5P4 X-Gm-Gg: AfdE7cnMH2dbnLo7ZEABxCqYahw7WwwY3RZYiKy5kX2XvJ4PMYk+21+d8JxTfP3KiqV 86KkRRbEnz9TFeMym6vuQhHUpVEJIkVUpSePGJcKWTMUdAtosttT2tnfc3BDx4Ypc7yYn5HzDfk a9o19YDaXBIzxYMyYfzHfq5CwL73YPSMUOdD8RGc7AyG2ssfrfT3jiyFSSUkvtngmOrYPJIb9RK 3l/rOTYufMrh8cXm2Q9G4xMEhoOTPzQZYNK9ZQME/WQhoIqudi6dkoQ243PMzLNhoXj/fVqELwC 0GtLSQEjhz7iSMI1/fz5beqAie1qkNFyrnP9k+rvmkKvQE5ajn0gw3RhfRniMkeNpv2Grd5Qec/ 1e8EtW5SYDt1WCIi3+7FzHfi6Dr5vvtfRfeUT/NlQUxsP94TguUJAjqKgNBXxE9Xp44MVRoQ= X-Received: by 2002:a05:6a00:a1d:b0:847:83bd:6676 with SMTP id d2e1a72fcca58-847f6dd39fdmr7486553b3a.17.1783302503847; Sun, 05 Jul 2026 18:48:23 -0700 (PDT) Received: from lgs.. ([2001:250:5800:1000::f280]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6d49614sm2803285b3a.35.2026.07.05.18.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2026 18:48:23 -0700 (PDT) From: Guangshuo Li To: Vincent Mailhol , Marc Kleine-Budde , Greg Kroah-Hartman , linux-can@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Subject: [PATCH v3] can: usb: etas_es58x: Fix RX buffer leak on URB resubmit failure Date: Mon, 6 Jul 2026 09:46:01 +0800 Message-ID: <20260706014601.415445-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit es58x_read_bulk_callback() resubmits the RX URB after processing a received packet. If the resubmit succeeds, the URB remains anchored and will be handled by the normal RX path or by teardown. However, if usb_submit_urb() fails, the callback unanchors the URB and then returns directly. This skips the existing free_urb path, so the coherent transfer buffer allocated with usb_alloc_coherent() is not released. Reuse the existing free_urb path after a resubmit failure so that the RX coherent buffer is freed before leaving the callback. Fixes: 5eaad4f76826 ("can: usb: etas_es58x: correctly anchor the urb in the read bulk callback") Signed-off-by: Guangshuo Li Reviewed-by: Vincent Mailhol --- v3: - Regenerate the patch against the correct base so it removes the original return statement instead of the v1-added goto. - Add the missing changelog. No functional change intended. v2: - Remove the redundant goto and let the error path fall through to free_urb, as suggested by Vincent Mailhol. - Add Vincent's Reviewed-by tag drivers/net/can/usb/etas_es58x/es58x_core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index b259f6109808..e1724ae79c5a 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -1476,7 +1476,6 @@ static void es58x_read_bulk_callback(struct urb *urb) dev_err_ratelimited(dev, "Failed resubmitting read bulk urb: %pe\n", ERR_PTR(ret)); - return; free_urb: usb_free_coherent(urb->dev, urb->transfer_buffer_length, -- 2.43.0