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 A3AAF34D3A1; Wed, 21 Jan 2026 18:31:05 +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=1769020265; cv=none; b=aX/x1tIff5bdFEqANPUbX4k4GSE97o7nJNCY9x5pOwjWv6xXbduwTs0spdlrr0z2xHVNztvwY7aij4zTYM8z18Ct5qZSwMwGug3L9YKx0NQOcPWFr6c5bJ1SZ510hDENaHy+vtlsnucf0nUxoGSb9h8bkrIVbL7rGsmUv4ZpqM4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769020265; c=relaxed/simple; bh=xSxUOWDF/ivA7sK6PNzzqtkRC1AvuHxcglLRIAZSNf0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tEvOEpLjCcl8BnLiv3fBvxZPaQ6Y8/tOlPC77BbYEC3MdAtIEGdVffYh1c0a9Ju4B+0K06nhkeVn3kC/WWG+e4A/sjlI8cRLb5bzAlGzekorT6wpkhFyDR5Ja4OeDrwnAoLqeAt5svLw4eAeMCwBNORxJlq65DBRuKHXujjKAkY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=c2krc/yk; 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="c2krc/yk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7C0BC4CEF1; Wed, 21 Jan 2026 18:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769020265; bh=xSxUOWDF/ivA7sK6PNzzqtkRC1AvuHxcglLRIAZSNf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c2krc/ykojPnWhnWd/e/pgpV7drE1257L5pIBoY0mpcGfCNki7hhexw0oD5LErSiv xsf8DcD/EJ/L1tQD5ab+qXEJ40vCySyCKN8J1PinQyuaIWL3fPcizX/zk0vkFbKXCB H0qRDZWwr9P29HjMtpVj0AhomUCjTt534plKi6Hg= 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.18 100/198] net: can: j1939: j1939_xtp_rx_rts_session_active(): deactivate session upon receiving the second rts Date: Wed, 21 Jan 2026 19:15:28 +0100 Message-ID: <20260121181422.153524196@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260121181418.537774329@linuxfoundation.org> References: <20260121181418.537774329@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.18-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 @@ -1695,8 +1695,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; }