Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1304029rdb; Fri, 1 Dec 2023 12:16:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRkI/YkJxqz605+r5tqILLhfvTPCmXs3wvabISwdb4UxTDytvgmBfIp85xVKldbAgT16mr X-Received: by 2002:a05:6a20:3ca3:b0:18b:4dc2:a4c7 with SMTP id b35-20020a056a203ca300b0018b4dc2a4c7mr67345pzj.14.1701461788888; Fri, 01 Dec 2023 12:16:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701461788; cv=pass; d=google.com; s=arc-20160816; b=Num0fMLXhRL/L317Bj6yfcqLRd+jtCN7iaqMzJ82uOPUiPycLv4Zv4CWvAaqZ0cMWG Vnnghmedq3Hn9sJwK2h36MYMwjpunvsL6rXKEWZsc5qP+habYgh11TQ+c29XpjHCQrDM v3c0homjrz/3TpmshHhDNc0tkQXIjPmmmeZnanX3HPFdx5QZpo+mk+wvkRslIWnXNA7K G0NBnht02yNab7gRmqYVvEpeT1HdpWKHaj4P5XR2C8GFKpZntYsCu8cTgRCBYJA9ARjp iCluI4+SJFwXJgUgZvNlagynoIpMMkEiOyn5InQMfXI4aR49ZtkVS8B1cPoWOlsN8iyl sClg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=m/wB5Y3nXgp9MixbMHI6a5JCOkXDuSQevMM4zlDm3go=; fh=/6ummQAO4LNFza8JbSsLJ9YmkJ/hxgIrNTCHIbyk9Ys=; b=I76+10V7iwkK0SScq9tSQzu+KFCU8d50HE7FdX2jJZm07pGk+YqG3E7LZLzR1OIstY DVQpcqdAr+GAdLlBMhkI186JC7T6+yQg2L4tnkfqfEXKqDog+x86APrkpcbyN3TTpNIK BOThlLtc/g2DADuHNx+TBf7G7PEC+8zxWSqoI3356Y88hHMavN1X84JeJNM9gVkBKNSI b06g0B7LSwtqWeEchbD5SG4/O+1o1LPtrqkXF7dXUegQFk1fw9VttpUs/fempe/W4Bz2 aTi0TV19q5Yc5Tk/yyrTSJWCHHnUgajGKHH8dVmoLumT7UcZDngCh/CgZQdO9lcIxGDA fgHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=uhdpIcC8; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id e6-20020a63ee06000000b005c609c4fb47si3715494pgi.283.2023.12.01.12.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 12:16:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=selector1 header.b=uhdpIcC8; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 808E980765C6; Fri, 1 Dec 2023 12:15:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbjLAUOr (ORCPT + 99 others); Fri, 1 Dec 2023 15:14:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjLAUOq (ORCPT ); Fri, 1 Dec 2023 15:14:46 -0500 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2051.outbound.protection.outlook.com [40.107.8.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DF25A8; Fri, 1 Dec 2023 12:14:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jQXoy00uj/CKJk2FIyRdyQLGSQjuVscem8oH9b2PFERFZBtH/jl0kdbCaSMR05BypqlE17r8h0Aulr8a/VTixkzs9S5AdcC0Y1an/2lx2KpWCKoKQ7nZQhi5Y0WHa4/RlKS0E9m1oq9PlXI3x8T0aslU2Lrs9ETzcZhN2CZjzKiGcL6v0GV6pQ5v50UONlZeFDn9UunCPeeqO1XUkM/yRYYRyD1OUrTsiDBqRnFt138yCMSogeP0UeKFIQCWfs+pIySJmpeVsW0Ex4qqNwr6B0N9VSXDCqWSh0f5YnLBhB85dbh5G5fRFIytPw+DLbzy75/8SI9I9h+0hMYV2p431g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m/wB5Y3nXgp9MixbMHI6a5JCOkXDuSQevMM4zlDm3go=; b=XIBxhR4xKQknzWGiR324a94eE0DBNNcZD1Pzrjdxr1DncS+l1uAK+EggM2qLughhS7sqC0V7WN11ps/Wz6CBB0I1NTIzkYhrUFVifwDqTN2Y/39r4iWYt6NZyGZPSQBA+7gHB1QrBvCDwQ+A6/Cx4CfaVhSCwmb1mccwqSdY18IHIPAsrNaPyt8STI94EKssxzCe8ozE1ROIA4KXHKnYNOroeQtVzatI2rA5DqTKOY/lCdal/+Lh99J+znZmUIh48SFUBkanNNEEFxPNFztne9WSq+MK21hYlzC6LRKUeZuntTgqVldaEvYxJJvZJ6/wlS1N8EJY7Wg+5/af+RRV5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m/wB5Y3nXgp9MixbMHI6a5JCOkXDuSQevMM4zlDm3go=; b=uhdpIcC8GojWd5bRb9fAAFoeUTzHAm2ySz6K+QwyOJD0IMADIzV98YUUtaywzqhmQaGBz/DrrBVL1/n1N4xPRwMd42qtKtfcdNrXiRtSjiJKurxgP/o1MFjqPCsf/LYv4NKftprRgklUBP4fJQ+hk+ZrUOpLtoXQ/2tdMozoUBMPLhKMJ+iUiQqlQTg1fxm1wzUCqxOn4fbBwwH49KjJs/kYtKKZengeH4zE311LJCzZVEEioiWk/S+rGIHeZm/Fv5lGWkdErfMIhW+dwoqDE9hcuRHRry3HXjScjFY5AyP7vS0qopTrCACcSnjUproMg8ixuOANP5OyIaBN47Z9Ag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VE1PR04MB6478.eurprd04.prod.outlook.com (2603:10a6:803:12a::10) by AS8PR04MB7653.eurprd04.prod.outlook.com (2603:10a6:20b:299::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.13; Fri, 1 Dec 2023 20:14:49 +0000 Received: from VE1PR04MB6478.eurprd04.prod.outlook.com ([fe80::775f:9e9:ef9a:6a09]) by VE1PR04MB6478.eurprd04.prod.outlook.com ([fe80::775f:9e9:ef9a:6a09%4]) with mapi id 15.20.7046.015; Fri, 1 Dec 2023 20:14:48 +0000 Message-ID: <4ce32363-378c-4ea3-9a4e-d7274d4f7787@suse.com> Date: Fri, 1 Dec 2023 21:14:46 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] net: usb: ax88179_178a: avoid failed operations when device is disconnected To: Jose Ignacio Tornos Martinez , greg@kroah.com Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org, oneukum@suse.com, pabeni@redhat.com, stern@rowland.harvard.edu, stable@vger.kernel.org References: <2023120130-repair-tackle-698e@gregkh> <20231201132647.178979-1-jtornosm@redhat.com> Content-Language: en-US From: Oliver Neukum In-Reply-To: <20231201132647.178979-1-jtornosm@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BE1P281CA0192.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:8d::14) To VE1PR04MB6478.eurprd04.prod.outlook.com (2603:10a6:803:12a::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6478:EE_|AS8PR04MB7653:EE_ X-MS-Office365-Filtering-Correlation-Id: d719336f-4eb6-4cac-5d21-08dbf2aa2ad0 X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g73qm4NihvHGcQw++nsp+XWKhOSclthWWpF+9mixSS/l8FFg+x1jmN74awNAGqKMTHTocu2yYKni3/Siql4Tj00DklA9X2e6Sf2lEP3ySw/teg2Td/LuweN20QQ0rj+1nN7EMrY7zg+oruOXt+INaI0KEWzraUC/GQtQza6fB1Kk1BjkJGfi06VFy4QZs6oUvroF+cembDT+aCe17kDKbot+IRMCiF/abY+QdzJqIvgLwuSfqfigThHecxgNY0bhoK5+jZE7xV+pf3vnK97fd6yDv9q4tk/9396+WEJT4sONJNStEsWN2Tz3C1RXp7a/hfBv+uA3IiUjVpX5SPblqso+8P1lkr+ZXwLZxmBgVCjcgdML/1/kGZKu/LXpYoeAKoPk47UQW/I3O9itYPB3Q6Wne23NY9j0lLxpLykM7bpZjtMGtrin81v9eB3ToDaX1PBtZZmA4wzhY7wuWLfJF2mWNuwHmHgPe0UUCCTC9QpDfocYEtOTxW8v55ahzg7j8Alrm/wZ95uX3uaa4+/qInJ2KIs/otk5fj+MiNBlVmR4wOtWvMrpdcWOhbvq4bTOftr0XUlOyoPMZCNFl/WE5/sUeN0YiJgm0x2ai7uLe2FCGDLsOhf6Caqtm+a9KxqIAVMZM8W6kUoiiMO8boTvzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6478.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(376002)(396003)(39860400002)(346002)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(38100700002)(41300700001)(6512007)(83380400001)(2616005)(316002)(6486002)(508600001)(66556008)(66946007)(66476007)(6506007)(53546011)(36756003)(5660300002)(2906002)(7416002)(8676002)(4326008)(8936002)(31696002)(86362001)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N3NDMmdyZUJaajNGeHh2NFdVSXdIK1liM0d1cWhTbzZPZWIrbXFNc1c1U2N4?= =?utf-8?B?N2NxUS9JTnhQQytmanRldWFVanN1bGRuZXpUVlFZbWNISkVCZ3BPN0kwOU14?= =?utf-8?B?U0cxV0p4SnRmVlBNQzJMODVWL2ZMZjQyaG5v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WdEdWJJ?= =?utf-8?B?M0FqRVFLQXVQUmljNDB6R2lyM3ByQWlYNjZ0T1dTTStKQlM5K2h6aUs4Yk9h?= =?utf-8?B?d01GdkhrU2E3amcxWlEydzVWVEd6MWpGcjVaYkJ3cWtqQ2R6QysvWEkrVU5M?= =?utf-8?B?OU13bWtrQmVFb3RRa2FyWktvM0VBNis2NHlSSTdUWHFsLzZQa2R1Mzk5dFZw?= =?utf-8?B?dHJyYXhlR2FUck9qZHVTS05xb21tSHY1bEZzZUZPVU9EV2JRRG5RcFd5UTJF?= =?utf-8?Q?KYyXTV56a8vfnBqpUEu9kdEQjeuoaVAgLCQcEvPz+NTB?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: d719336f-4eb6-4cac-5d21-08dbf2aa2ad0 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6478.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2023 20:14:48.2663 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K5+dJYt0ZX8MGKNnBdfhtAEyqMMfUXCwW0IdogWOhT8eqK1TJCyiUdgPS1vwamxbcSoJ+odPa3pLWUyz4l54Vg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7653 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 12:15:09 -0800 (PST) On 01.12.23 14:26, Jose Ignacio Tornos Martinez wrote: Hi, this is much better. > @@ -1661,14 +1668,19 @@ static int ax88179_reset(struct usbnet *dev) > > static int ax88179_stop(struct usbnet *dev) > { > + struct ax88179_data *ax179_data = dev->driver_priv; > u16 tmp16; > > + ax179_data->stopping_unbinding = 1; This is problematic. ndo_stop() is not limited to disconnection. It is also used whenever an interface transitions from up to down. > + > ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, > 2, 2, &tmp16); > tmp16 &= ~AX_MEDIUM_RECEIVE_EN; > ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE, > 2, 2, &tmp16); > > + ax179_data->stopping_unbinding = 0; > + > return 0; > } > On a general note, you are going for a belt and suspenders approach. It seems to me that you have two options. 1. Do as Alan suggested and ignore ENODEV. You'd be acknowledging that these devices are hotpluggable and therefore -ENODEV is not an error 2. Use only a flag. But if you do that, you are setting it in the wrong place. It should be set in usbnet_disconnect() O and, well, this is a very mior issue, but you've introduced a memory ordering issue. You ought to use smp_wmb() after setting the flag and smp_rmb() before reading it. Regards Oliver