From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (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 534843D1CA0; Tue, 3 Feb 2026 16:11:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770135113; cv=none; b=GiRCj7THaS/aDKjh1nZyBM782VhIyVgJgIteZXrn12zIFVKRmedW+PwgTrPT74M8MMKTun/iGY7syv16JuYCvrgIlwO+fqz4clEnEIVvtClsbRTT5CbPWfQ8x7l/CeJPTTfyof+4vx6t1D+uoVgQWdWFDU0RMN+yMOMdmoqsgJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770135113; c=relaxed/simple; bh=9a6MDBZBr2S7DTcvsZmMvwhafM53LBpFJ/OzmyZ9jzo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M4N2Hzyx7mKELZJTx29IxWIrgh3p2QiyjDbj2PizUxQJe/MIYw/OlQh6gzXZLjdZEQ765O03PCpEcGFafyhm8bpGwJ5YrkJ8zJtQNvcDcCM0yGxwEbeBhc2Q3QXMOAYgN7xSGtc+EZR2iylLbYjsDCoqP7Te3kP9/sZIke1rRfk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kroah.com; spf=pass smtp.mailfrom=kroah.com; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b=qKAWEqHg; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=dHCHn4Fv; arc=none smtp.client-ip=103.168.172.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kroah.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kroah.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="qKAWEqHg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dHCHn4Fv" Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 548C0EC008E; Tue, 3 Feb 2026 11:11:50 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Tue, 03 Feb 2026 11:11:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1770135110; x=1770221510; bh=S8DdY7OHjj q7ubDcTpspMFvxxPIy4NvGM1w3tP/IR74=; b=qKAWEqHgEgF3XeY8GPtEyZ7xwV NTNMWTYphp6Diolc0wISxvpiKowIU9G2cSFmAl0oewdtfFUnl/ccD2gxr900ze1X fnMWAHPsPIdYB96/2v5YW9EYrL7IQUW4wXgVPIdEALiBVwTv33LmZ0BefBTsC7kW kXNBbsfq/dvMvOoyCU5Xb2SpXz7040mbvrAYuPXx3+AWOMurIPDneHTsuRd3l0QA Tf0jzZEdd1B5zbykggsw6aAiwZzJcC5ohj+ueIQJb0mKkN1Rdla4Lo1b074VYq2z l4jpYTYjB4Aacla9P2okZRFzVk4Oz1YVooDWgxhOmQPhDnXL2QVhklUd2WGg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1770135110; x=1770221510; bh=S8DdY7OHjjq7ubDcTpspMFvxxPIy4NvGM1w 3tP/IR74=; b=dHCHn4Fv8UUl8m5HwfBsUZbsNj9ZhzNjcrgwmKOr3omviw+dDvg Ferm8XdTRRohnx4jV5zGqQm1k1I2HcaTEpXB1C0mY1H5PZjRHvDJPPUwOAw2rFaG /8DF5YxRh2xTazJ8yJpGM1DBWdS63B81E3PDuMGybGOdXQ4b7ZrOLMCcYqJmGbL5 RaGEhq663nLtHawjELkoI3hH1yP/HyRxWNS2P7QUsewiiwpsgXdUy1JhawFGOQO2 wazvyz/2G7MHsg90RaZKU8MoX0tXMgh7kxmq/RetBhkYf2OWXpphiJqN+6Hgp+U0 hvvSi70YWq0hM7WCeGkN8A7k5UuqCsYjizA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukedthedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepifhrvghgucfm jfcuoehgrhgvgheskhhrohgrhhdrtghomheqnecuggftrfgrthhtvghrnhepjeetueehte ekuefhleehkeffffeiffeftedtieegkedviefggfefueffkefgueffnecuffhomhgrihhn pehmshhgihgurdhlihhnkhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhdpnhgspghrtghpthhtohepiedp mhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhklhesphgvnhhguhhtrhhonhhigi druggvpdhrtghpthhtohepshhtrggslhgvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhr tghpthhtoheplhhinhhugidqtggrnhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i787e41f1:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 3 Feb 2026 11:11:49 -0500 (EST) Date: Tue, 3 Feb 2026 17:11:47 +0100 From: Greg KH To: Marc Kleine-Budde Cc: stable@vger.kernel.org, linux-can@vger.kernel.org Subject: Re: [PATCH 5.15.y] can: gs_usb: gs_usb_receive_bulk_callback(): fix URB memory leak Message-ID: <2026020342-eats-clamor-2b83@gregkh> References: <2026012023-ranged-machinist-edb4@gregkh> <20260120132156.746174-1-mkl@pengutronix.de> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260120132156.746174-1-mkl@pengutronix.de> On Tue, Jan 20, 2026 at 02:21:56PM +0100, Marc Kleine-Budde wrote: > In gs_can_open(), the URBs for USB-in transfers are allocated, added to the > parent->rx_submitted anchor and submitted. In the complete callback > gs_usb_receive_bulk_callback(), the URB is processed and resubmitted. In > gs_can_close() the URBs are freed by calling > usb_kill_anchored_urbs(parent->rx_submitted). > > However, this does not take into account that the USB framework unanchors > the URB before the complete function is called. This means that once an > in-URB has been completed, it is no longer anchored and is ultimately not > released in gs_can_close(). > > Fix the memory leak by anchoring the URB in the > gs_usb_receive_bulk_callback() to the parent->rx_submitted anchor. > > Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices") > Cc: stable@vger.kernel.org > Link: https://patch.msgid.link/20260105-gs_usb-fix-memory-leak-v2-1-cc6ed6438034@pengutronix.de > Signed-off-by: Marc Kleine-Budde > (cherry picked from commit 7352e1d5932a0e777e39fa4b619801191f57e603) > --- > drivers/net/can/usb/gs_usb.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c > index ffa2a4d92d01..e36745fd2d3b 100644 > --- a/drivers/net/can/usb/gs_usb.c > +++ b/drivers/net/can/usb/gs_usb.c > @@ -402,6 +402,8 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) > usbcan > ); > > + usb_anchor_urb(urb, &parent->rx_submitted); > + Breaks the build :(