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 39FE1368297; Wed, 28 Jan 2026 15:29:07 +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=1769614147; cv=none; b=Yt6Qrl56eonyo/2lfEt/xcKSHZDZHbGzE6dF5hgqgkjV1JHFUMKUSzHV/l0zxeMYz5GtUmCVc0NNU+oZ6cShxt38/qLZCG3pIM2n7B1920FX4hgCB2u4Zl/kyMACvwSff6pSEgbkEzYueZ24QfQCkaCjsP3yCswwZtsy00FAFh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769614147; c=relaxed/simple; bh=fSzSRdWOyxPHTOD9vJ5uIBLRRYLUWSQK3zzDgfRLNog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YDAVi4crtY9Lklv5S2U2rdUnWWHSLrfYcCI8nJoW43MIUUxQpQZl8VtDSPkwXqooi6kN8+Ak5i6A6uz+UPKW10RXxSBfZ9re53iYAobN3EFzh5jRaY8zpJqGattYFUcIMS+fswErMPoCe/+ydUpdgqJF3LDVOlCHFLClLOePsMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OyqW40ZB; 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="OyqW40ZB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2F55C4CEF1; Wed, 28 Jan 2026 15:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769614147; bh=fSzSRdWOyxPHTOD9vJ5uIBLRRYLUWSQK3zzDgfRLNog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OyqW40ZBXNn7hRGL19PsOLo/kq2h4msIJKH87UT26vqkpTnExsTzRWxLTTKRIsEQ2 RrK05yakG2a8ddmi5xuXCiWjmPCTnCKsn6VmXLvTsvulnZsqhwc9RrxtM2LZftAvUq 4sb88yhIDBAAa5nNS04PJ1gBzbzaMCtap9DmdFys= 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.6 050/254] net: can: j1939: j1939_xtp_rx_rts_session_active(): deactivate session upon receiving the second rts Date: Wed, 28 Jan 2026 16:20:26 +0100 Message-ID: <20260128145346.501220584@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260128145344.698118637@linuxfoundation.org> References: <20260128145344.698118637@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.6-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; }