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=1796401796; b=KXCdo4XA/YcLfeJrT6Yx3NnIaAKKmeDMpdY9NSI+zWlEqlCml5SFK6oFxa0JF8PjhcBb 0StPX8PiVftxHa/KAPJwkkILY1HG+WPLUZLKraWsUx1Nv8IV/sHdhcaKJmhOEnw8wtfqe gKiMBiG+XXRQ6cWGSTlXakRXxo7z5MjVBdoryVyt6wM5CSvyv/VYUv5kzeD4eF4Ym/AjK WiECq9E7nGy2pJoa8A0iJuA0iVqpk8XWMgwAXbslYDA/3dT5uSpBsjwBbiJGMzKBCwl2W rknrklTDLtstWX/Go3Sna2KS2OD7xC2QAaFimQ8cNecwZgAoytB1hLWmC7OSI0ix90g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401796; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=moWPWtn/Vn71jnVPIf2u8ohm3cB6XIrjgXzmhc4jHwc=; b=pjuoyyo3WvKHYN8cho/1PzRxZUUapCTe7NrW3TEAkkkpI+qgQh+Rq0fnALgWJTOuRjKW hmmkXep8yqi529OvsmrG8ZPN+h7+4sMxVmZfP2N+bpfa7+6KdoLciD+ipZCkkRWlaThBn qLTpj4b3yK5lF1nPSN9r8Y78BlZUmZnX7kH8z8bioCG+jCE1READHMH6duNu/pQrpzgoV jSkoRdPktpIb4TaxL/8Lox8t0gPjX/0SGU51IeB5OsyxwmAaXHIZG+6XQSo3hwZ9JXR1o yg4eXRGyVYeXc4FsMbo9VBl6OMt65wK21QzBSmNBD6PQkOZl1U1jH1I6MVVixkmPt/Q== 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=glcjbIgr; 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 510E860A2610 for ; Fri, 4 Dec 2026 16:29:56 +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=glcjbIgr Received: by smtp.kernel.org (Postfix) with ESMTPSA id 940DB1F00A1A; Fri, 4 Dec 2026 16:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796401795; bh=moWPWtn/Vn71jnVPIf2u8ohm3cB6XIrjgXzmhc4jHwc=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=glcjbIgr4QAJrXWVyrZykvOnZGZnKngnbpD0hB+2U2BAsGK0s3Xg7kC6nO2IaifYg UFgHiJ4WQkOoRKmwfNXXoUZoHH7PP0adXIGI4pt8JwFx1+H4+DcvWTz9dN01JPL3ht kldsocTpwSZoINSTmA5JdVuHsf7qi1rL23pqHYQGkWnSsbJ7/UFaFWUhQQeGP8NYri hZCj2cUd4f/jbMLiqIIQo9rLPpfqH7hhJpdFesOnvxlAJDznNghMGbgFVn89Klpi1r 1tLw91s+tHLR/7McokS/DTR3aeGZe4BwFTKyiZVc00lkhcExoree+VuMU0nFbadgTX KU616I/GaM7NQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v16 2/5] can: j1939: fix possibility of UAF on j1939_session 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: <0f2790b7-4586-4a3c-80a3-d329a3fce1de@I-love.SAKURA.ne.jp> References: <02d9f333-d774-4cec-9d12-cb181395fd8a@I-love.SAKURA.ne.jp> <0f2790b7-4586-4a3c-80a3-d329a3fce1de@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 16:29:55 +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: - [Medium] can: j1939: unconditional WQ_HIGHPRI offload in j1939_session_destroy() -- commit ff8109ff98ecd01431b08fa480c06d1f155822f3 Author: Tetsuo Handa can: j1939: fix possibility of UAF on j1939_session upon module unload This commit defers the final teardown of struct j1939_session (hrtimer cancellation, netdev_put(), kfree(), and j1939_priv_put()) to j1939_wq so that module unload waits for session destruction to complete and neither hrtimer callback is still running before kfree(). > diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c > index fa30273df3263..4345921ede073 100644 > --- a/net/can/j1939/transport.c > +++ b/net/can/j1939/transport.c [ ... ] > @@ -283,9 +301,8 @@ static void j1939_session_destroy(struct j1939_sessio= n *session) > kfree_skb(skb); > } > __j1939_session_drop(session); > - netdev_put(session->priv->ndev, &session->priv_dev_tracker); > - j1939_priv_put(session->priv); > - kfree(session); > + INIT_WORK(&session->release_work, j1939_session_destroy_work); > + queue_work(j1939_wq, &session->release_work); > } [Severity: Medium] Does unconditionally queuing j1939_session_destroy_work() onto j1939_wq introduce a per-frame scheduling regression on the transmit path? Every j1939_sk_sendmsg() allocates a struct j1939_session via j1939_sk_send_loop() -> j1939_tp_send(), including single-frame J1939_SIMPLE messages. On loopback completion, j1939_can_recv() -> j1939_simple_recv() cancels the timers and calls j1939_session_put(). Because j1939_wq is allocated with WQ_HIGHPRI | WQ_PERCPU, every transmitted frame now wakes a nice -20 kworker on the local CPU, which can preempt normal tasks, adds a context switch, and defers kfree() out of softirq. In the common path, both timers are already inactive and callers like j1939_can_recv() still hold a priv reference. Could this check !hrtimer_active() on both timers and refcount_dec_not_one() on priv->kref.refcount to free inline, queueing work only otherwise? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/02d9f333-d774-4cec-= 9d12-cb181395fd8a@I-love.SAKURA.ne.jp?part=3D2