From patchwork Mon Oct 24 11:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10039 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622592wru; Mon, 24 Oct 2022 12:45:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59n9xT1vmz2yHE1IwEpgd1Dqspb2N6p/6aIIZyKxsvjfsELj3r7NFaQuM3WMLLO7jQMEzD X-Received: by 2002:a17:907:3e95:b0:792:e5b3:5a19 with SMTP id hs21-20020a1709073e9500b00792e5b35a19mr23741544ejc.766.1666640750690; Mon, 24 Oct 2022 12:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640750; cv=none; d=google.com; s=arc-20160816; b=U0K6pvFhknCTPVbcJO9un2vtSmH79x5Go3RmCJxH3Bkp3ChDEr4ZYRpC9GeykO6/4a IjFXLtit0EKGijLHaaY/qeQhV7GNc2MlLRd61pvDPWzxV3PweHANPryuDA0keYQaTRjW 7H8ckH/j1n+S64VHX+jLotmRLV468ekvA+d0c9QW+0sUX1Z2AEHRlc+cAazHLRUxFFrM 0aTB0huu3bg7fkxbROnx1pw5ojtnMwMclUgcTGRtAQ18I4MnZ51AWZtCE4MM5I4m7Ubt G/q2rrvWMNCZGylV82bQyrlGvnPWQ/Oi6ZIWING4Vr08PzYYHoiXNIKLJg05mgTs7ETF QqCA== 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=vN+CgVtYtcqDm+eDdaDfnVwlg+RuOg1/We6A3w/O6rc=; b=Ob0iSWraQgVkQslJun9OUBsSZHKt7edUQI9w90L7HFHQpl/IElOvowmdp0h0XauxJk o95iiQoc2FHBv+qhfCLkgcuNYBgwg4hAuMm6nTLlIZQDp9GTzAXJX6bH1+fNqQjEeexM QpTlvcbY5FqjdZxIULMqHuKeDFDnN9Kox3of7CJKMB7cqXOC4LGPJLobb7bzSZVe355/ Y9+KLClsdONrpZBikCNT2nllPGc0FTyFOuCRgoHPv83Yaa7zUR5gdecGcyvqqBHBBsoJ IureY3FYN4QTb/9QU0gBnI74j7YJfiUZRWPxxtzUonGxkYm7ZByUnzRGJPFq8P+gQCYf e7QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HcnpmHE7; 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 js5-20020a17090797c500b0078d27c1c8f4si662332ejc.696.2022.10.24.12.45.25; Mon, 24 Oct 2022 12:45:50 -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=HcnpmHE7; 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 S233319AbiJXTmF (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbiJXTlQ (ORCPT ); Mon, 24 Oct 2022 15:41:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DDEDD895; Mon, 24 Oct 2022 11:11:07 -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 ams.source.kernel.org (Postfix) with ESMTPS id CD739B811CC; Mon, 24 Oct 2022 11:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 323A3C433D7; Mon, 24 Oct 2022 11:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612587; bh=tuRrGyRDE5pfd9u7YgYcnNL8Vy+H8he/V121FPx+c8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HcnpmHE7hA7IxIR+AauBtCXPGKgTyiGo6MyDhsDfsRPXS/9AhJiSf6CQEyFmfcxHZ mGnhJUxa+C5hKLhqqdl2y7AQAJDUS32ClCCZ8IB5LzhCvBe5zmcP7Ac60iD/XI7aDv mAi8sBJJxAf0uDg5Wl1ioaeMJMcIx09dbnbj+Y58= 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 4.19 043/229] can: kvaser_usb_leaf: Fix CAN state after restart Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024113000.483163493@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747599492172948185?= X-GMAIL-MSGID: =?utf-8?q?1747599492172948185?= 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 @@ -1435,6 +1435,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;