From patchwork Mon Oct 24 11:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp456314wru; Mon, 24 Oct 2022 06:34:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6J2r2PCd3o3WW1ECaXWiquogMVfoJ+YDNlHDmHqcDc2JLMMJ2jhUPpVyVWfZpJScSGwPV2 X-Received: by 2002:a17:90a:ae01:b0:20c:2630:528a with SMTP id t1-20020a17090aae0100b0020c2630528amr38064100pjq.37.1666618440292; Mon, 24 Oct 2022 06:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618440; cv=none; d=google.com; s=arc-20160816; b=AYx+4OiN7W/Gfb9hO0WYkohs/EN2foM+ltXJX6OPTOoem9rnhCn36aXve5YTq58hdw 2A9CK03h5VBT3P2ZuEYwMPVA9oixNDAlbrBmCXWcqBcfnvFo9uWchfR8mrS6e/sLf+QX TE1CI6FSo4MqzMGgrsxRT+i+8r/rTlfigQe+pWp9S5YHqtWVjDuTirhs3OXWJ6itocfy QX/eU3BY0rmraKPHamnJ0qF8p5QHnJFAWXOs4tNy2vu8frLZnxCEDu++jBkLIRR6KFfw UEaePlS+6xmJWMNPxVhNP1x7bsbLWQLhRKkC43ncAu2SbCIjjnylrwb5q5cvAlys//I+ EIIw== 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=QKcyFtDUXoNZnNUk2jY1X4C+3IsX5vWaXbMHdFH4+FyCyvtx6cE289jLLOJ2fy+As1 yXf0/Jyy+60gDF9V9IAYlGDLb7A6a6Wv0oP5KcbgrEgnhP011HTGWKacte8FuB6p4vPc eTV5Uq+bBfw/5sUp8av2ryCuX/LI2EXTTRJaeWTPZV/wpsDJiEb3afoyRDXZXeXcIqIW 3Y6CxOTAF/qlZL/cs+D4Aes4FKHCOx/E682pmeTcb8Ii93FFABvJ4mX29oF6QufhtATa WPM4d59NUE+kcNNoTiWutmEI33LmLvzi22mDp12JzxQlVban84cDELtFEuxGAcDmGFwH +6Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WMIaN0oD; 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 u4-20020a170902e5c400b001846e0e0511si42941064plf.226.2022.10.24.06.33.41; Mon, 24 Oct 2022 06:34:00 -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=WMIaN0oD; 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 S232330AbiJXNU4 (ORCPT + 99 others); Mon, 24 Oct 2022 09:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236022AbiJXNTC (ORCPT ); Mon, 24 Oct 2022 09:19:02 -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 7D4A1A5722; Mon, 24 Oct 2022 05:27:34 -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 539C4B811BE; Mon, 24 Oct 2022 12:05:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8EA6C433D6; Mon, 24 Oct 2022 12:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613127; bh=tuRrGyRDE5pfd9u7YgYcnNL8Vy+H8he/V121FPx+c8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMIaN0oDx1KSUEeScdOwn3kXgJYgYLyEMgh0lljyU5pvTmyQtztpvO2evEAM4bLKL /AMI34kxHKnRzxd91rXks5lwch8GM8RR6J67pcqhlT3R97ecHOT2Inpq0T70gLUcuG cJxOGJPgrAU7B+KFJMjf7ERCF4NBjUSLE04DC/zU= 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.4 019/255] can: kvaser_usb_leaf: Fix CAN state after restart Date: Mon, 24 Oct 2022 13:28:49 +0200 Message-Id: <20221024113003.075321750@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747576097589593584?= X-GMAIL-MSGID: =?utf-8?q?1747576097589593584?= 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;