Article View: linux.kernel.netdev
Article #7764Re: [PATCH] can: gs_usb: kill RX URBs before destroying the netdevs
From: Marc Kleine-Budde
Date: Tue, 27 Oct 2026 07:15
Date: Tue, 27 Oct 2026 07:15
74 lines
13141 bytes
13141 bytes
--ekwsdgna56i73eu4 Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] can: gs_usb: kill RX URBs before destroying the netdevs MIME-Version: 1.0 On 26.10.2026 22:09:08, Marc Kleine-Budde wrote: > > diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c > > index ec9a7cb..663746d 100644 > > --- a/drivers/net/can/usb/gs_usb.c > > +++ b/drivers/net/can/usb/gs_usb.c > > @@ -1595,10 +1595,10 @@ static int gs_usb_probe(struct usb_interface *i= ntf, > > > > /* on failure destroy previously created candevs */ > > icount =3D i; > > + usb_kill_anchored_urbs(&parent->rx_submitted); > > I've fixed the root cause of this problem. Do not register an interface, > before all interfaces are setup: > > https://lore.kernel.org/all/20261026-gs_usb-fixes-v4-2-59e3b6360053@pengu= tronix.de/ > > > for (i =3D 0; i < icount; i++) > > gs_destroy_candev(parent->canch[i]); > > > > - usb_kill_anchored_urbs(&parent->rx_submitted); > > kfree(parent); > > return rc; > > } > > @@ -1636,6 +1636,8 @@ static void gs_usb_disconnect(struct usb_interfac= e *intf) > > return; > > } > > > > + usb_kill_anchored_urbs(&parent->rx_submitted); > > + > > The USB core disables all endpoints before calling gs_usb_disconnect(), > so this isn't needed. This is not 100% correct. There is a small race window, that the URB's callbacks have not completed. I'll fix this by first un-registering the netdev and then freeing the ressources. > > > for (i =3D 0; i < parent->channel_cnt; i++) > > if (parent->canch[i]) > > gs_destroy_candev(parent->canch[i]); Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung N=C3=BCrnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 | --ekwsdgna56i73eu4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSl+MghEFFAdY3pYJLMOmT6rpmt0gUCauBPnAAKCRDMOmT6rpmt 0mWfAPsFl1MLE7QpUizLHq2sq/5RnZkerQrNKXXjmgZuNMvCggEAi+gLEGr1gfS1 1YPQfzYKsEGvejWC//ZP3U2LjMPRzQQ= =sMYZ -----END PGP SIGNATURE----- --ekwsdgna56i73eu4--
Technical Details
Message-ID:
<20261027-artichoke-stork-of-cleaning-01979c-mkl@pengutronix.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352255-linux-kernel-netdev=dewy.ruReferences:
<20260923070352.487595-1-fanwu01@zju.edu.cn> <20261026-armadillo-of-uplifting-excitement-9bcdba-mkl@pengutronix.de>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352255-linux-kernel-netdev=dewy.ru From: mkl@pengutronix.de (Marc Kleine-Budde) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH] can: gs_usb: kill RX URBs before destroying the netdevs Date: Tue, 27 Oct 2026 08:15:43 +0100 Organization: Usenet Network Message-ID: <20261027-artichoke-stork-of-cleaning-01979c-mkl@pengutronix.de> References: <20260923070352.487595-1-fanwu01@zju.edu.cn> <20261026-armadillo-of-uplifting-excitement-9bcdba-mkl@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ekwsdgna56i73eu4" Injection-Info: usenet.network; logging-data="1484026"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:pt3tI3v3spBueaj90MMhCoeX2+U= sha256:34ayv2Xeyx3CwYRsBWKQtr+fJHRlJjestOylzxD8xvU= sha1:nhIOeuNYJKSOcwkj405oQD0aAiw= sha256:XPfuIpcww5CZSN7374Q3S9HPs+Xg4NFKf+UGOUccWDQ= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2493E125BDE; Tue, 27 Oct 2026 10:21:00 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.049 X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=pengutronix.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7PRt0aTmk9Xh; Tue, 27 Oct 2026 10:20:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352255-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=pengutronix.de X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 0D3C9125BDD; Tue, 27 Oct 2026 10:20:46 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id AA0BB26F9F; Tue, 27 Oct 2026 07:16:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793085360; b=V4LLkGJ0aRCwgmFo7IYWomv0l7O6eXEtrIp36cvoYsF6fOQiityo53cYcb+Q7x1PnUry VsbFTlzFiiMLRbZDhHHzk4lypSnRWbB5M8HYA1Be7MQakIuObGzqS+zjwPH6E55oP1KNb Zj85EZSjTn3a7aXNXtKZo5YaHs0Jn8/qX90MPbE1XkVdxcavxcaXG7fsPygCJUTwmm2jR NNOyzsj9f9wIG9DWhGg8Y6DojyzVG7nxLo3M6apQ6YQ0d4CbW/h10U4h6nASGtHHoVOrb Rd2Tbh0WTM1H+XN6KmmkgbhurNEFUlPGnb8kFqMR7KTvd59FrYPW5EAceNpBB2OkaBA== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793085360; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received: Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=R+oWYu6/QfEBhFYUPjNxhFKQR9WYE+mlse/QW0U2HJ8=; b=tMFzLCy2xjv3i59U/v8B4K92upSwps4SZHnDmimAXr9+tZfR4TH4rJro9YxytVXYDwxu RTi7tdiWlQicwvoCTBaYUvilXMpvzX7m9kW94Cbxp6y8iJR7JmqJfQTsGoE4IqIVB4/44 gamtCm2176ZTGLSWUkT7ecpuLdwJJYUc86hwS05WmweU6Rs+ovZf3kf0U2dnQO7pCaBc8 SDO1skvpRI5/RX3+wegysh4P9RPsr0TCkLG8UiZ3wPszlZPPwFWQt8yf7A3SqZIQ8KLtI woC1zPqOONfquYZcLNEt0XbFyTwY63JNui1jGQcPKE+nWcg2e9gb93lRGde4n2lyHGQ== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=BbK3uUll; dmarc=none header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AF1A606A325; Tue, 27 Oct 2026 07:16:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=BbK3uUll X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793085349; b=qwT80hIadZOMSolJPE+MTXbE1jhlqifLZazJB7IDcH6a+Yy6ZPmgV7FwGM2d9eS7CV6h /hdV45mZj4dTTIn5MBlbaENdpA+KrWPTuBvBAJDUp4JsuelqsiMCewJwGJQ9ZRhcUESfd cfIdmETF/zobbHX12pUaM0fpD+rDY5qz7hrAsIU5uQPKKsduMjIkqcK3cyuaNFb1MTHc0 1y8n4DPRKOW+gMmzDpSEeHlpdNyU3/NjufD4ajK5J4Nsk046Y3lR/4bjfa9Zvl/qyNR3f EgsAfFDC7+sqjfSZTXa8JwxPq1w24/SMn1SxkZkCpAYxcBsjywTOTEQNgnOyUT9ilZA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793085349; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Date:From:To: Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=R+oWYu6/QfEBhFYUPjNxhFKQR9WYE+mlse/QW0U2HJ8=; b=G5ddEKp7m/GwRS9WEbdWavWntuveAi7lqJfj72zD/FMlg14q9pasWkSCERPRU7pa3rXF RbJHFvWhcGT6xbtH0zW1GW0d+NrXTX3V5eCghTfJTNyEKDPgMoqIf7iQvD5kyJQhq0sWy 4hwX/7nV9qiktydr0/zcMAXHTLvI3Oxh71WmLOe1zGemkh6Xe79gYRuFnSo68r83p4a8G me+R+0SL6+OipjGY7cie4GP1UtzPzGzrnQO2XLaUGGl/UnVAC7gJa1bDtSYW/JJ89LuS6 ohreMlT3QrP8io63vtGvjd4owPU9c/ebGH7JJdYOg9+fb6OBPYhHYVQ6SN9vLHtEk1A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=BbK3uUll; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13 X-Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3045D606A31A; Tue, 27 Oct 2026 07:15:46 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3045D606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de X-Received: from drehscheibe.grey.stw.pengutronix.de (drehscheibe.grey.stw.pengutronix.de [IPv6:2a0a:edc0:0:c01:1d::a2]) (Authenticated sender: relay-from-drehscheibe.grey.stw.pengutronix.de) by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id E934B20155D; Tue, 27 Oct 2026 08:15:44 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1793085344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=R+oWYu6/QfEBhFYUPjNxhFKQR9WYE+mlse/QW0U2HJ8=; b=BbK3uUllsCAxO+pmnHKOyBY2CIdCbsiL4S7SaR4Y0s+M8lB3VUluZ7SH/NaBQc6bMBssrZ GjiMcymmleV0kowClq+iZiUyyB7E/vWO8A1OR63zPgv0VmV1G3PIz55bcor2j0xRTyFIVe ztGcjxEO4DR22s8Yux1xs7ZUtSSbiNfeTNZfdZNY33OVa/kc7jITzojwzvBGliy22+D1Ml pCWSJsQGc0cvau672Go6b0xCb9cSdTemturVhsZKc4m0TKNnEG18d8pTtYpBS8jNT3KEHO v7XITcY9VhnY2N+YNuMAgaqg7ApX34SbOE5spHtLdMCAmIdvcRj9g6J9QH7HcQ== X-ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1793085344; a=rsa-sha256; cv=none; b=a6MnpAQpRxddvep7N8jqcgc21uO+NmcGQM6SXfM4MWsWmElThzbXYTC8G3NzuWh6SFDbKB NMs6A354j6vVsaKkll4UyEK9b/GAh4cH+2f3Si9g12pImxCPWsoJ6TPpAYjXPwNUZdO2Dp 2gQ4NfdUnUJnFhTDnpshTBlKXN5JkFy0x6l+lQ4w3AiJ+qMxaMZ9XC+EPDlnF5nHRTBZ7h ytvAbWCZce3qW5Jn7uFyVOlrSB+z5WTlRXNqkzyGRQsRcVMvNSVC3Nq6kdxgixPmOLiHN1 v97etZ4uf2oYYeLdO7ZZtjLlmMcYKtRhrF3uCiGGOyLkG5TyyQNhgANG6x2U4Q== X-ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=relay-from-drehscheibe.grey.stw.pengutronix.de smtp.mailfrom=mkl@pengutronix.de X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de; s=20260414; t=1793085344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=R+oWYu6/QfEBhFYUPjNxhFKQR9WYE+mlse/QW0U2HJ8=; b=g9P7NoRI5NLPlzTCz1h8c6WsjZFdj60m24gQWQghj+zAGHvNQVnsMFqSQclWPPcoX59XMp P9KcCLk16P6/rvHN7Y82pHvPPSKNDKJJCmu5POIbk/zGvmjmi6cVqGciZdweVKvGeIwPC7 VSJhxidHqJk0GAJrTpeQ1RtZIrPAbvViTJH6mMqT6hr2FHZPk/zmwVFn6pn7saMfsth7ja OPAQY5McDqGfpICZS2HVuJAQSNp9MG2gL1fd7dv8gDYO22JJwlqkE2yl5oN37rcRo7ADPD 4zVTbRddUFPlkeRrD9Zv+8dvUE57e2h+UY/W+IwDiENz7Gnub6QamI/2LgVfLg== X-Received: from moin.white.stw.pengutronix.de ([2a0a:edc0:0:b01:1d::7b] helo=bjornoya.blackshift.org) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <mkl@pengutronix.de>) id 1xLbPM-001Ocq-2g; Tue, 27 Oct 2026 08:15:44 +0100 X-Received: from pengutronix.de (p4ffb23c7.dip0.t-ipconnect.de [79.251.35.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: mkl-all@blackshift.org) by smtp.blackshift.org (Postfix) with ESMTPSA id 8791A5D78DA; Tue, 27 Oct 2026 07:15:44 +0000 (UTC) X-Cc: Vincent Mailhol <mailhol@kernel.org>, linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Song Li <songl@zju.edu.cn> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261026-armadillo-of-uplifting-excitement-9bcdba-mkl@pengutronix.de>