From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 356DB2BE03C; Wed, 4 Feb 2026 15:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217725; cv=none; b=NtSpgyTLS2ygraBOA4BTRI4mDcrV4NzgyKiHvcAgVmW0K+CJ6UrsOUVK8lOuCrR011UA8Yfq19Xo0eFXKLcE+8Et3ikG/ageDiZVR5zrhkoN9IAw77xYP4o6HEx82iQtMIFTwsIZqbBqa5rdRrWUrluvn7TDZCeucgq+LTCx+TM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217725; c=relaxed/simple; bh=ChPN/YycDTW3xXFDiIeecIlBKAV8NFVP4GXfY+r4/Ok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z+dg+BfGw1DTi2BeuTSgJm4qQB2VQrExOC99QOBsm/0WPu5XYDBmVCAv8pFjAknDrOZMONIggU1EElaL7G8i11JuhVsoo9pTM7BWPlbcvvoBCpzRpOWiw0eDxaUQC2rIlYpyyN0CA5ZbvioBkyLBOqpea5uAlFeBltn/fwQtLNw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=r+cNoNaD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="r+cNoNaD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A18DEC4CEF7; Wed, 4 Feb 2026 15:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770217725; bh=ChPN/YycDTW3xXFDiIeecIlBKAV8NFVP4GXfY+r4/Ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+cNoNaD8REl7PQHVjM4TbRaqF2obWb5RzmItCp9TxaBNqKUarGu1XuYYEc4w5V3A De3yBv5SU1g5EZFVfD0z5YyXuHgy+Qdoi/fk8XaaQb7iDRumEvS1J5USpAsAWeY2xM q508CMePQsq9AGYXigknyKHCwb0aDKs1vTbp3A64= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jakub Kicinski , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 6.1 101/280] can: gs_usb: gs_usb_receive_bulk_callback(): unanchor URL on usb_submit_urb() error Date: Wed, 4 Feb 2026 15:37:55 +0100 Message-ID: <20260204143913.286556220@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143909.614719725@linuxfoundation.org> References: <20260204143909.614719725@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Kleine-Budde [ Upstream commit 79a6d1bfe1148bc921b8d7f3371a7fbce44e30f7 ] In commit 7352e1d5932a ("can: gs_usb: gs_usb_receive_bulk_callback(): fix URB memory leak"), the URB was re-anchored before usb_submit_urb() in gs_usb_receive_bulk_callback() to prevent a leak of this URB during cleanup. However, this patch did not take into account that usb_submit_urb() could fail. The URB remains anchored and usb_kill_anchored_urbs(&parent->rx_submitted) in gs_can_close() loops infinitely since the anchor list never becomes empty. To fix the bug, unanchor the URB when an usb_submit_urb() error occurs, also print an info message. Fixes: 7352e1d5932a ("can: gs_usb: gs_usb_receive_bulk_callback(): fix URB memory leak") Reported-by: Jakub Kicinski Closes: https://lore.kernel.org/all/20260110223836.3890248-1-kuba@kernel.org/ Link: https://patch.msgid.link/20260116-can_usb-fix-reanchor-v1-1-9d74e7289225@pengutronix.de Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/usb/gs_usb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c index da05c2aa90d7b..f782c3aa179e0 100644 --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -660,6 +660,10 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) usb_anchor_urb(urb, &parent->rx_submitted); rc = usb_submit_urb(urb, GFP_ATOMIC); + if (!rc) + return; + + usb_unanchor_urb(urb); /* USB failure take down all interfaces */ if (rc == -ENODEV) { @@ -668,6 +672,9 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) if (parent->canch[rc]) netif_device_detach(parent->canch[rc]->netdev); } + } else if (rc != -ESHUTDOWN && net_ratelimit()) { + netdev_info(netdev, "failed to re-submit IN URB: %pe\n", + ERR_PTR(urb->status)); } } -- 2.51.0