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=1796401404; b=QHqmQTRzIvK7E0Q6JDk1JvCTSpFsh2oeBU66D6BTrWCyTLjQaAOEVV1D373LWZw3di+v 1rVw6a+0ZCDcXb/g5VsdxAXTZ1I4gJqqtkav5T+uZ7kjTP0MXKfTtB3TYNZYbS8xnc8Gn 21xOfWXK+H6aNWFviyda6mg3GcVaoiWpClcPjzbtqcZcVd523C1RBskppn/9RtrA+pf+c +VUE+3/E3z9EerM0auA88kvfyHxcvs7Of2GlYnmZnk50LKU4ldGzyItCH+HoODM/N/gV8 PIwwfwhiAOVQEs3cZw0D3udXkosTsizJb+A0JUpckaz5YBowfwRNzBtpJWf6xcmJ1hw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401404; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=OMHmmrf5LIlzAArdwM1cvu/HU49mp0+5wl8osT7fkP0=; b=ZlXLTKcd1tjI5y7ZUTkPZIZieatWBzT+cp9UK7pPI4nkFwf6ZPBRwPxzM3pU4Ija/LLK bApGKdyqfZr6jxxmC30S0RT7RLQdyIwN+DtckB3zk5V0N87yutpNYvb+EnWilayRB+dIc GReEb/eZAKnEu+pwhB025dzDPJotKrDBdRiHPlnxQMk54mxdKgM4KFpBlw/uGQzQ8Juog qouGpmcFifjoxeUD3TcFYCa1l8i2LcII5z3Du1cTOUVo+QLLcpfDXAlINQfWZdsB6eB5E TNYkLC/bYt4hN6chHPJMrjF/7gCb0z+fO+mgS+B8TS1OAB7Vc/IkM+Lhk7ZUUz28UIw== 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="SzN0e/cB"; 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 F00A2606A32C for ; Fri, 4 Dec 2026 16:23:23 +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=SzN0e/cB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A3091F000C2; Fri, 4 Dec 2026 16:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796401403; bh=OMHmmrf5LIlzAArdwM1cvu/HU49mp0+5wl8osT7fkP0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=SzN0e/cBIgtZWoNlBfvFy401bvlomLh3rORm/ArDfUiUeAOMuL4sGvdr/ujZvVF3g i4uLuGw0AIR0esn4pbY56K+N0sohCSIaf/+v7tu7WWXN17oYiUDw/iN3ffmfjDXDLr aF04Ke3WrNliHb5C2KF53/DDiTXydefszrSM99tMVf5r4sqG5pfreVQQZN3yB6d3hB lTT1+FG1tHQEv+eCqXXepPLkt32fkIKjICC7h89BCDueele9feiH6TAoLSs8h+eQoY CMRUtqoOQPDSP4Z/gHhP1CvEhI6QRQNkP9XsWZiUHlbg6kJpw0VCJGRYPnwV7YykAW mniEVMUMUXErg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v16 4/5] can: j1939: fix "struct j1939_ecu" refcount leak 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: <29d5b6ac-93c1-4925-97ec-f94047d26a14@I-love.SAKURA.ne.jp> References: <02d9f333-d774-4cec-9d12-cb181395fd8a@I-love.SAKURA.ne.jp> <29d5b6ac-93c1-4925-97ec-f94047d26a14@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 16:23:22 +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 2 potential issues to consider: - [Medium] can: j1939: undocumented stable dependency in j1939_ecu_map_locked() fix - [Low] can: j1939: commit message omits testing description required by netdev policy -- commit 37da636ba3209e2bc000b307361a6b7796d12a7f Author: Tetsuo Handa > can: j1939: fix "struct j1939_ecu" refcount leak > > syzbot is reporting "struct j1939_ecu" refcount leak, for > > j1939_ecu_get(ecu); > priv->ents[ecu->addr] =3D ecu; > > in j1939_ecu_map_locked() from j1939_ecu_timer_handler() can succeed > even after > > priv->ents[ecu->addr] =3D NULL; > j1939_ecu_put(ecu); > > in j1939_ecu_unmap_locked() from j1939_ecu_unmap_all() from > __j1939_rx_release() from j1939_netdev_stop() has completed. > > Fix this problem by making j1939_ecu_map_locked() no-op > when __j1939_rx_release() was already called (indicated by > ecu->priv->rx_kref =3D=3D 0). > > Reported-by: syzbot+e2af46126e0644cbebdd@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=3De2af46126e0644cbebdd > Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") > Cc: stable@vger.kernel.org > Signed-off-by: Tetsuo Handa [Severity: Low] As reported by Oleksij Rempel on v15 [1], the commit message still omits how the fix was tested. Documentation/process/maintainer-netdev.rst requires every bug fix to state how it was tested. > diff --git a/net/can/j1939/bus.c b/net/can/j1939/bus.c > index 7e22a7f7ecad5..b8e517c6ad1ce 100644 > --- a/net/can/j1939/bus.c > +++ b/net/can/j1939/bus.c > @@ -74,6 +74,8 @@ static void j1939_ecu_map_locked(struct j1939_ecu *ecu) > struct j1939_addr_ent *ent; > =20 > lockdep_assert_held(&priv->lock); > + if (!kref_read(&priv->rx_kref)) > + return; > =20 > if (!j1939_address_is_unicast(ecu->addr)) > return; [Severity: Medium] As reported by Oleksij Rempel on v15 [1], can this patch cause a use-after-free in j1939_ecu_timer_handler() if backported to stable without earlier commits from this series? This two-line diff carries Cc: stable@vger.kernel.org and applies cleanly on older trees. Without commit "can: j1939: fix possibility of UAF on j1939_ecu upon module unload", skipping the map lets j1939_ecu_put(ecu) call kfree(priv) before write_unlock(&priv->lock), causing a use-after-free. Preceding this fix with kfree_rcu() for j1939_priv (as suggested on v15) would keep it safe for standalone backporting; otherwise the commit message should note the dependency on the earlier workqueue release commits. [1] https://lore.kernel.org/r/awv_tkJZbviq3RBT@pengutronix.de --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/02d9f333-d774-4cec-= 9d12-cb181395fd8a@I-love.SAKURA.ne.jp?part=3D4