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 5E3062C9C for ; Tue, 7 Feb 2023 13:05:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3434C433D2; Tue, 7 Feb 2023 13:05:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675775140; bh=xTgWYW4047ZdZNMuBPKL5pL3N9LIJxIDOgYlbf98YXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDvd00oolXv4htM3HYQZE4PDsBPpsZva8StEMDhlS/a0jwj9Xvo9XG3/1QAkt6oyu 53HJmjQe/yjbES/lYPC6VOpN4WdeNJeoIsCK5T0Uq7Qsf6Jug9s5341vcejyYBYyrj YYuSteZXAowrldjhUzQRnoWhxmTNquou0XKP55Iw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Oliver Hartkopp , Marc Kleine-Budde Subject: [PATCH 6.1 121/208] can: isotp: handle wait_event_interruptible() return values Date: Tue, 7 Feb 2023 13:56:15 +0100 Message-Id: <20230207125639.889060164@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230207125634.292109991@linuxfoundation.org> References: <20230207125634.292109991@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Oliver Hartkopp commit 823b2e42720f96f277940c37ea438b7c5ead51a4 upstream. When wait_event_interruptible() has been interrupted by a signal the tx.state value might not be ISOTP_IDLE. Force the state machines into idle state to inhibit the timer handlers to continue working. Fixes: 866337865f37 ("can: isotp: fix tx state handling for echo tx processing") Cc: stable@vger.kernel.org Signed-off-by: Oliver Hartkopp Link: https://lore.kernel.org/all/20230112192347.1944-1-socketcan@hartkopp.net Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- net/can/isotp.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -1152,6 +1152,10 @@ static int isotp_release(struct socket * /* wait for complete transmission of current pdu */ wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE); + /* force state machines to be idle also when a signal occurred */ + so->tx.state = ISOTP_IDLE; + so->rx.state = ISOTP_IDLE; + spin_lock(&isotp_notifier_lock); while (isotp_busy_notifier == so) { spin_unlock(&isotp_notifier_lock);