From patchwork Sat Oct 22 07:18:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1088061wrr; Sat, 22 Oct 2022 00:38:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DUA1sMKQ7s49nTgOzXJxTmGN/TkWjoCvmwpPtqYQFXoVsPUZ/4AKGZqD+MArRNazrJ4Lw X-Received: by 2002:a17:907:1b1e:b0:783:8e33:2d1c with SMTP id mp30-20020a1709071b1e00b007838e332d1cmr18800967ejc.304.1666424315417; Sat, 22 Oct 2022 00:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424315; cv=none; d=google.com; s=arc-20160816; b=EaCGSRnlhRrOFcBHHMnT3ZpSYBTpITj+tICpKfrCOzW0GGHbDLUHT4EgrLCkhUCWDQ KEMFHp7DD2XM+HbsVW+lJk0F72SxBavd8fQ4x7jr7P8q2xYtd54djeKeR161wMmFNQ73 vzR2fI/FBPvQNmGlHMJdhG73bZlZe9kmBVDjCc6jGroxgxurXHaGPlUFMBg07x+KnTSW p7jT/AsXhDgkb9silhvwROJOUTdNWH/Y68BA2ajnGxn+NY3AWpmbBPCby0mna4bPsMuP kBPFIu+sVfuOhhvWHFNjw2FSGnzEAReUjJQyV0euCzKdrm6DduZGLR8N1adAgB1hG8IS 2Dew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jLRnZqzM9F9BlYAleRvJUpTMU7vlux8xW73Go4JxDAY=; b=UYfvpawmR7ryC2UTbnX8fyqcQOSlzHWTALzlJR44inqFbsIIkL1+MEvM7kAlftfz0x mhchM6xv58+4S1lyFJrLhd7yGjDuEVt5Q5lNnOLD1D50oFGtYbgjQt2CngD3brpcfgVB 5WH1foxZET61Z5535p3a0GrePNuMQc/fDu7Z5VPmTRzEQz0bjZNgDM4QtkUl4GpS6msM peerl2/Y+9YCA9oP5J0hP8WFA1gmoU4q+T3/7Q3M7s42/ps5HjfBd6K298lbnZOHLrzb PRotDgWVQwpcSMSYo6fxsn0J0k1JKw501tyEUUCgLO1YRxckda58j3zd2c++ufI9HqT0 NN0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=laRFcud6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a056402191100b0045cfb63a018si24850772edz.31.2022.10.22.00.38.11; Sat, 22 Oct 2022 00:38:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=laRFcud6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbiJVHhj (ORCPT + 99 others); Sat, 22 Oct 2022 03:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbiJVHgx (ORCPT ); Sat, 22 Oct 2022 03:36:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D070A2527CD; Sat, 22 Oct 2022 00:35:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ABDBD60AD7; Sat, 22 Oct 2022 07:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7782C433C1; Sat, 22 Oct 2022 07:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424135; bh=AaxTY1K/uBZpdEq0piQ+Qb9lab+8zrIvUtBFpyqkGPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=laRFcud6hpjyhNzmMyTK5abp9m1VEYO4UsaruDGTugUOd+tFikxjwc92OxubaPx0B UJv0m5AcNvij7hCeaTO1KbYRl2VTMUdgSFhuNRbRvOIHHvukvXs3LVs7w9Wv7pN4da da8wzqwv5f1LAnmd0z3ZMfbdjE8Yllyg/biCsKzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Anssi Hannula , Marc Kleine-Budde Subject: [PATCH 5.19 031/717] can: kvaser_usb_leaf: Fix CAN state after restart Date: Sat, 22 Oct 2022 09:18:30 +0200 Message-Id: <20221022072420.628135573@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747372543398142534?= X-GMAIL-MSGID: =?utf-8?q?1747372543398142534?= From: Anssi Hannula commit 0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5 upstream. can_restart() expects CMD_START_CHIP to set the error state to ERROR_ACTIVE as it calls netif_carrier_on() immediately afterwards. Otherwise the user may immediately trigger restart again and hit a BUG_ON() in can_restart(). Fix kvaser_usb_leaf set_mode(CMD_START_CHIP) to set the expected state. Cc: stable@vger.kernel.org Fixes: 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices") Tested-by: Jimmy Assarsson Signed-off-by: Anssi Hannula Signed-off-by: Jimmy Assarsson Link: https://lore.kernel.org/all/20221010150829.199676-5-extja@kvaser.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -1430,6 +1430,8 @@ static int kvaser_usb_leaf_set_mode(stru err = kvaser_usb_leaf_simple_cmd_async(priv, CMD_START_CHIP); if (err) return err; + + priv->can.state = CAN_STATE_ERROR_ACTIVE; break; default: return -EOPNOTSUPP;