From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 164B22D738F; Wed, 4 Feb 2026 15:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217526; cv=none; b=M3Emrv8+lLRAKWsAWMMIY5k3ljgSA10NzO2AJ4AYgkRMaKJ5C+QamDTpSngm8Ut66JA6iVztoRHwDBDzFSZFs0NTVX73cSJ2TBgwaVtQ8Sv7BKRvgnZI2eGbiULLsGcU/qu2DwfPPJ0pdEN34ApPEi7wHi15s4ViC3nzPJ/mqIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217526; c=relaxed/simple; bh=Pfl9TIzKhGSFcjeCjGJuAqHmqXAq2E2c/Ed1Egke+U4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kQFEKYxEr5xJs6FTWsYoAAgi02tbtpViin3aVlgzKHfJwF43gLeFcBrjO/UTXkHlDqq1m181gosMYw5xVnB0iEEdVnGbB11F1ToWOsfKU4gSAA6ODPInTXa8zmDgLb1capaWDPqRXSvuaO8ttUjQ7kEm+MR2y6x6M3Z0zv6ka5I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eE3nZWuw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eE3nZWuw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CDF0C4CEF7; Wed, 4 Feb 2026 15:05:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770217526; bh=Pfl9TIzKhGSFcjeCjGJuAqHmqXAq2E2c/Ed1Egke+U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eE3nZWuwRYaPCHXLW+ldES1475fV8Ctr3KUt6MIa20C2UDoZCqKxUa9HG/COHcLGg /NBg3GUSaYWt68q5m4Aqi8nWcXQ/3fKKC9qtJgms30HLp11MKbMU6N9jbqGmoNNgKi fbpCHEKnyJhbIwMo/noFpx/3iBUDHDY170nslH+4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot , Tetsuo Handa , Oleksij Rempel , Marc Kleine-Budde Subject: [PATCH 6.1 041/280] net: can: j1939: j1939_xtp_rx_rts_session_active(): deactivate session upon receiving the second rts Date: Wed, 4 Feb 2026 15:36:55 +0100 Message-ID: <20260204143911.115950855@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143909.614719725@linuxfoundation.org> References: <20260204143909.614719725@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tetsuo Handa commit 1809c82aa073a11b7d335ae932d81ce51a588a4a upstream. Since j1939_session_deactivate_activate_next() in j1939_tp_rxtimer() is called only when the timer is enabled, we need to call j1939_session_deactivate_activate_next() if we cancelled the timer. Otherwise, refcount for j1939_session leaks, which will later appear as | unregister_netdevice: waiting for vcan0 to become free. Usage count = 2. problem. Reported-by: syzbot Closes: https://syzkaller.appspot.com/bug?extid=881d65229ca4f9ae8c84 Signed-off-by: Tetsuo Handa Tested-by: Oleksij Rempel Acked-by: Oleksij Rempel Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Link: https://patch.msgid.link/b1212653-8fa1-44e1-be9d-12f950fb3a07@I-love.SAKURA.ne.jp Cc: stable@vger.kernel.org Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- net/can/j1939/transport.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -1699,8 +1699,16 @@ static int j1939_xtp_rx_rts_session_acti j1939_session_timers_cancel(session); j1939_session_cancel(session, J1939_XTP_ABORT_BUSY); - if (session->transmission) + if (session->transmission) { j1939_session_deactivate_activate_next(session); + } else if (session->state == J1939_SESSION_WAITING_ABORT) { + /* Force deactivation for the receiver. + * If we rely on the timer starting in j1939_session_cancel, + * a second RTS call here will cancel that timer and fail + * to restart it because the state is already WAITING_ABORT. + */ + j1939_session_deactivate_activate_next(session); + } return -EBUSY; }