From patchwork Wed Oct 19 08:22:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp204668wrs; Wed, 19 Oct 2022 01:46:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7DOSmu7HEFZVTmCRoFD1wOg3dRNCQvTgkWO09wI3hAEwbNWxOOJs4uBeIN13yf7KuH+Qdy X-Received: by 2002:a62:52d8:0:b0:562:3c8d:d427 with SMTP id g207-20020a6252d8000000b005623c8dd427mr7561254pfb.44.1666169209950; Wed, 19 Oct 2022 01:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666169209; cv=none; d=google.com; s=arc-20160816; b=fD6HnHUmdzK6JUldaq7VhHcS90DEhWYyVJlPI45eQ/poCcyKfJDDOTcfMwe8vZKDFn gESWhvB/8h6qibvzDTwBrS9PicXL4WVpslHIPmSVLA0qM2fwTMnLHXrKLJstcuKeYnvc h37svEHOOdIWqVQvnf11qgPvOwlZgsE8SYqkXnAS1QKdvxY8OCa1aAWx1iJzcCeygvNl aWEuNXWlR9BrppXQei+TgYrYHSD97Zv2mpk89jiQwyxRSJgF1gYfdrpptFvZEu/6lRwi yOSeZdfLzTjNkW5IFAO15giqVWwNIYbO7bLVuGn2p4xFIuF8zk6miLZN1nFHjOHx4gpm 2EZg== 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=L8g3F59D/XAZ2BCynqpXESPqD6tezmcyEtLEOJVquhc=; b=hTmoNoKCUpJWdz0B0BpMXhr/9eUP1SIXRUWyOD9jRkQiZvqO7sXhKbR5GdYVaA4LjG DUXwN/6uIagK+AoGeG6hTRhqxoOKO4zJBLM0+s5fvORP4ilkYO0Dm7/5VH9oy4WJgS9L vUYJKcJp1BWrT1urE61jrlVg+OtIK+51KdGxncwM2uQiPhd58ot9zjkx6Xdw10ddYLIO 3bAmUhBSQ9SDeh6PJwoAAICkGIc45AVvApTl74abOtILotnuiHY6CqEldlyua6rh7qWC eBROe4n197DfcgBBcUs44pT3TBgimTE9TSjH2Fow8XsLUO4L50lAayF2nGYP+Bh0cqSt y8gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qR9zoQAr; 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 n34-20020a17090a5aa500b00203917479dcsi21526727pji.107.2022.10.19.01.46.34; Wed, 19 Oct 2022 01:46:49 -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=qR9zoQAr; 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 S231485AbiJSIqM (ORCPT + 99 others); Wed, 19 Oct 2022 04:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231521AbiJSIoV (ORCPT ); Wed, 19 Oct 2022 04:44:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0592B8990F; Wed, 19 Oct 2022 01:43:27 -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 E4E1BB822CE; Wed, 19 Oct 2022 08:40:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 417E8C433C1; Wed, 19 Oct 2022 08:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168847; bh=IqOeSFRkEtFe8p7jE88Il7lUnL9BT5aOsb6MHv3D1WQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qR9zoQAreLe/Q0PBOyIrzFV3CLrNAQ8w2KxHps38V5Q2XtAI6g/N7ZD9SU1QJF4Wf MP4FgkBpYHJows8ruCyMrWIp6+Fa3hTxBAPODNU2HAVguQ8r7bP+nZre9o3sVwgVHY vC1pebbL1655t1uAEaZg2llNW9NUC7KulUHcx81M= 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 6.0 036/862] can: kvaser_usb_leaf: Fix CAN state after restart Date: Wed, 19 Oct 2022 10:22:03 +0200 Message-Id: <20221019083251.610456071@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747105045629083877?= X-GMAIL-MSGID: =?utf-8?q?1747105045629083877?= 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 @@ -1431,6 +1431,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;