From patchwork Mon Oct 24 11:26:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp441681wru; Mon, 24 Oct 2022 06:06:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72LEFY38ABSyH95lyM/x3LGtWwRS0uCoZ9dftfQcpp7Ws8uDqHJS3MarI3zMKm3KMBNCsI X-Received: by 2002:a17:902:8601:b0:181:6c26:110d with SMTP id f1-20020a170902860100b001816c26110dmr32469249plo.27.1666616746976; Mon, 24 Oct 2022 06:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616746; cv=none; d=google.com; s=arc-20160816; b=Edy79odJ0LzU2Oh3yW1dd1LqtrBzlYjAHOvG3mA8JTFG7n5BwZMqCh6vR8SjA0riWE IQuQ8/ZFaE1KU8iLQ57V3QRdzpEQPAN2dk61EVok64kLJxk3BmJWPf69iou1FX7xlLbA /iR78JiZ+mrWagkYyQ8619NYrhzCBUO80bEFrogXKqG0x7I7OmbNEdrhZeTWKh+hM6eZ z/J4+GnUPDdKXfbCNZ0AENJ2n/KfONwH97kK5NqiSm0DvJOYcFZVMXiMP/VVZkBTOO3N SMHwSQWZw1FEVwebSRrCuTFzJX2VCJJTCpedolBSHC5H6M4wr2dKgsX+pd5DZrCP7pS5 y8nA== 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=hoUM3PtTjdj5flcqPYgUguof09mEGjVck1OMhGQQFiP/w6ZE5vU5MCbxq1/gm32cxF o8PsvpQXt9BoWDXhqdIYuSN86LtjMLULgkIT9iM6lNLGWJAVHnA1tGm239qTtROTLnqq jtfIz+RHdRbGBeCLkweKNIXo0Zgu833DkkG3HE92971sWTB2FZ3tArGq607WKkyjeuJU 1T0cbJXzAZRxmxJ3scaDsO3A7fbFhUKI9PNNM4JJ7RGhE4CSflnWuPWYiJxBFvlH5dj0 JHedmsBbYlaNbPLWs2U+t66kVna7ZFkVwCo5tkAdylwM5hKqTlqLaFnwrUXkmnP1z8V6 0ojA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S3cq3+HI; 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 y124-20020a626482000000b0056b52859251si9622319pfb.315.2022.10.24.06.05.23; Mon, 24 Oct 2022 06:05:46 -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=S3cq3+HI; 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 S235423AbiJXNEp (ORCPT + 99 others); Mon, 24 Oct 2022 09:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234946AbiJXNBJ (ORCPT ); Mon, 24 Oct 2022 09:01:09 -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 4232D237C4; Mon, 24 Oct 2022 05:19:45 -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 2ACEE612BF; Mon, 24 Oct 2022 12:18:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CC15C433C1; Mon, 24 Oct 2022 12:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613884; bh=tuRrGyRDE5pfd9u7YgYcnNL8Vy+H8he/V121FPx+c8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S3cq3+HI7JAeIxf9YVurfkgVBuz0Btfmd/DJ8HPWjEHEvM79+ORAD0wdGt9ZWDe/1 Hmyy+jIrCze4dMEBTgaf2x4BVqLt4GGmLjRNermfoTuX4o0V+Mv5e58FbLk074kJ5b zSrmPD3cKCsIQ1kzvb4Ge/8gX2baFEFCCYptxW8k= 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.10 021/390] can: kvaser_usb_leaf: Fix CAN state after restart Date: Mon, 24 Oct 2022 13:26:58 +0200 Message-Id: <20221024113023.449163692@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747574322040964741?= X-GMAIL-MSGID: =?utf-8?q?1747574322040964741?= 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;