Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7334250rwi; Mon, 24 Oct 2022 13:07:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5pEgLOMP7OMLpYCSMW2ad4gya4QZR6gG98t/4MFWOM1DZSy4CC4ZMpjw4vdQbO0rrbt9HW X-Received: by 2002:a17:906:8457:b0:78d:b793:5511 with SMTP id e23-20020a170906845700b0078db7935511mr28917041ejy.393.1666642056560; Mon, 24 Oct 2022 13:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642056; cv=none; d=google.com; s=arc-20160816; b=kw7qwCpnt8ni0ZdyT8I1OVLo0kNE+swm9xG57WqWvJHfw33FNuqHiHPznmYCfgkLv4 2n7OzGJhrDRPNzhfpvFvAjm72RRO6A/cTG13/WcrL/7+5roxU8vKoGzL34njUD2YubxT VnzH7fRvGX7OMiUFxh3b71Or1r4mvIu3oTqcSlRMADsFkuc5Qfq6NIXDj6SH4bfkwdlN kYzaXEICTlhNF8Inm+qOReBBBzl9OMjmJOZtKMjLTrNZ2I0W7IH1vaVKNW3b9IntQUqP 2h1BHtnA1gelIyK4qZ/y5kUA069ts6GFTddTx+e089ozsBJSS95ThH4IpoVO7Og/Kzrk XhjA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l15-20020a170906794f00b00791a67e4c00si766291ejo.835.2022.10.24.13.07.10; Mon, 24 Oct 2022 13:07:36 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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;