From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39F36C0018A for ; Mon, 6 Nov 2023 13:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232824AbjKFNeF (ORCPT ); Mon, 6 Nov 2023 08:34:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232917AbjKFNd7 (ORCPT ); Mon, 6 Nov 2023 08:33:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0E1D6D; Mon, 6 Nov 2023 05:33:53 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACF96C433C7; Mon, 6 Nov 2023 13:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1699277633; bh=kUJ9ewnJ7DOKQgvPYdKSY3plzzhUuZpFPvrO/LPtOZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=elq3d8/8zc40sTsFTGiq21X2V5535e9fI/iqUpSI8eeUhPbQURI7O/YGvQB+33yUy 858gD8H4iY09rCEUDIzxd211dbNwG+munilZhffV98zJhUSzxRO3YZhoCKxhvFNJ49 OD+O6jDDi1RKl+MqondXH2Vd0nLE4BtPF+VW5vT8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "linux-can@vger.kernel.org, lukas.magel@posteo.net, patches@lists.linux.dev, maxime.jayat@mobile-devices.fr, mkl@pengutronix.de, michal.sojka@cvut.cz, Oliver Hartkopp" , Marc Kleine-Budde , Oliver Hartkopp Subject: [PATCH 5.10 84/95] can: isotp: handle wait_event_interruptible() return values Date: Mon, 6 Nov 2023 14:04:52 +0100 Message-ID: <20231106130307.782288442@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231106130304.678610325@linuxfoundation.org> References: <20231106130304.678610325@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-can@vger.kernel.org 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ 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 @@ -1071,6 +1071,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);