From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796402071; b=IZbPogAbwP+BVsCI/wGZ7ibgUt3C70udP1NX9C6cEAKV87doXZmc7+7N+5ywSOT/8X75 CUwpjirJh6FsaLApRPMAwXnJx+z23tlxfSu1eDcFVkO1nJYz3TFdTCrrP1NWDU867X86p rfhwxEqNGX4NrqV0gEta72x8K2Vmo98MYwM0LyUIg3aJg+snqZDSth7EXQbUDqcR3Ci5a xkvXW451Qe4F9wlx+Rs2BCdjX01DS98uBkB4qJtN3vCnKSV4zrkTwY2EiZxlZZ5kzK9QA SvvsYN7S959aQVaUd31JqaJTlqWkTz/tY92IE6XDNhtPksPE5vTHyGYenqRe2OmBMIg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796402071; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=JVolAVnfoVDLkwHiodauIjXSCuIyVK6RVgERq3DdqdM=; b=1dEBqc6FIoZGPHBgvZafeAfY0LWy+oNERf7SLs5HgeC+rmqRpBCaybJoXQEXcQdi6LGI 88dhs0lwCkfrvqVvh3WqpOQ6F5cJjbH7fqr7vvWNrzpn9o0y4LoDrqM68DuhfNu+rVRV6 /UMhcQwZw+zfP6r+tY+sFRhVaq29WMyn+g8PNXEAnaI/3moKKTlKfK6gWPOoD6JF22s2C T8UAtG0FhiKJwenzBeZX6hNRkqn9KdU6dAVBM//CDU+vQXRmmGZl0qeDM4SXuZvmJj9sx zTXb1V229ZcnLZxEj5eJKiurY3+kibHX7hcELPAVoLjyDk11DM0K1Sh4Z972S/Ja0mQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MZijcpCU; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 40AAE606A32C for ; Fri, 4 Dec 2026 16:34:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MZijcpCU Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8363D1F000CE; Fri, 4 Dec 2026 16:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796402070; bh=JVolAVnfoVDLkwHiodauIjXSCuIyVK6RVgERq3DdqdM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=MZijcpCUZQ2SyhtmBv0gmFicvufN7d6j0Y5V3PMIx81USRGH/qoxM5iyfAc6/p8En imlO8qAOWwbHupIwlbrRFw7FMdK+AU+yEvVmT5MOKXpGVvI84IWpZNB/UzCE7tSdhE v5K9+tdcV+PVnVRGLt31js4ruf7+/r0LmGVt8WlOit1CVpdHWqhdHKJf+sIaQufLC5 awAe7XrRKbWQ/uJH0Lo/Vofrs6RhKqgps4wJePupCncVkJYP54jC607ZObYZjXS4Bi k6gNaxktMJ0qqlbXjTlY9T8rvpHr1ygrrGUJGMxmM/ndS8I4puMqHRZ3q9c7RPDWdw +P5j+/cDyLJPA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v16 1/5] can: j1939: fix possibility of UAF on j1939_priv upon module unload Reply-To: sashiko-reviews@lists.linux.dev To: "Tetsuo Handa" , linux-can@vger.kernel.org Cc: "Marc Kleine-Budde" , "Oliver Hartkopp" , "Vincent Mailhol" , "Oleksij Rempel" In-Reply-To: References: <02d9f333-d774-4cec-9d12-cb181395fd8a@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 16:34:30 +0000 X-Mailing-List: linux-can@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] can: j1939: unbounded wait_event() in j1939_module_exit() hangs rmmod -- commit acd386211cb084e36e0fd335311a953078fa035b Author: Tetsuo Handa can: j1939: fix possibility of UAF on j1939_priv upon module unload This commit tracks active struct j1939_priv instances with an atomic counter, defers __j1939_priv_release() to a module-local workqueue, and waits in j1939_module_exit() for all instances and release work to finish before unloading. > diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c > index d9384cf0e356f..858f9fa1a02ff 100644 > --- a/net/can/j1939/main.c > +++ b/net/can/j1939/main.c [ ... ] > @@ -416,14 +441,28 @@ static __init int j1939_module_init(void) > fail_sk: > unregister_netdevice_notifier(&j1939_netdev_notifier); > fail_notifier: > + destroy_workqueue(j1939_wq); > + fail_wq: > return ret; > } > =20 > static __exit void j1939_module_exit(void) > { > +#if defined(MODULE) && defined(CONFIG_MODULE_UNLOAD) > + /* Wait until all "struct j1939_priv", "struct j1939_ecu" and > + * "struct j1939_session" are released. > + */ > + wait_event(j1939_unload_wait, !atomic_read(&j1939_unload_blocker_count)= ); > +#endif [Severity: High] Can this unbounded wait_event() permanently hang rmmod and wedge the module? delete_module() transitions the module to MODULE_STATE_GOING before calling j1939_module_exit(). If a struct j1939_priv reference leaks, rmmod can_j1939 hangs forever in uninterruptible sleep and later module loads fail with -EBUSY until reboot. Such a leak is reachable via j1939_xtp_rx_dat_one(), which calls j1939_tp_schedule_txtimer(session, 0) without canceling a pending txtimer. Two back-to-back block-boundary frames before the timer fires take two j1939_session_get() refs while j1939_tp_txtimer() drops one. That leaks session->kref and its reference on priv->kref, keeping j1939_unload_blocker_count non-zero. Even without a leak, __j1939_rx_release() leaves active RX sessions running when the last socket detaches, stalling rmmod until they time out and send aborts. Pinning the module with try_module_get()/module_put() so rmmod returns -EBUSY while j1939_priv instances exist, or synchronously canceling active sessions and timers in __j1939_rx_release(), would avoid blocking indefinitely in module_exit(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/02d9f333-d774-4cec-= 9d12-cb181395fd8a@I-love.SAKURA.ne.jp?part=3D1