Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp807066pxk; Wed, 23 Sep 2020 17:23:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnUIkz1ljabc5G4iv0a5fXGNY9x4+Rufgjf52oImtJLdeG7mFf46GzXx9YZro20dcv4Wwf X-Received: by 2002:a17:906:841a:: with SMTP id n26mr2084923ejx.213.1600907010174; Wed, 23 Sep 2020 17:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600907010; cv=none; d=google.com; s=arc-20160816; b=ITgDMAlr50NgoUb6BDpbHhW2Q81SLRAtVxvDjKlcT0JR/CLAVy847R0up6moyj0OVi +RDgfLa0DyLex+0OXWrWnnun4+cS3hNjKecvhGrX9JnRX1hIOS5LEeCMjWZgAiDLRudd Qf9lnq7Ljh8Usit/TXqDdcrhmK85WyQKpm8xv4TXQHMSmB6LSQaPGylvFTiYHPiOvjOi 0vOEe8TS2if/ECogJs5to5yt7JMQx5C98rbWAvtidjaUA4vB9u5oC/y9Fa6PTfMdsWge Ym8wjiuwCxQCa/m8oYLSGTuTu/dLOFKOzFkColkcDqjjdydTSPjF4ge1mKmDJeW9hMcO lM9g== 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 :references:in-reply-to:from:subject:cc:to:message-id:date; bh=T/hkX0S3y3MIXs4JsS8TONNPnTtu5oOirflpGp+QHFE=; b=pb08pkyYq6tMniiiumeymZRCYibjugFNcm/GxZ1b2x7sd81IFImZC3JW8nfhrwBw+a qfbmN9xNn7fBPKBbu5Su11OopySEmseJRvxJCy9XZQZqpFpFHyc+KeyeAiY2TGAr7QP+ DRzElMwWBKNUSrtmSNiUFbG3dstaxxTFkD/toRvz8fI4Adx/UP5ssE1TkGm7/2A9dOkN mbjIHi5mafJZsQggZkgxzmZQeWGzCdnkt18ncBu/rE0WZl/qA/EYfTCG4U902xjgY5o4 hCCKRtzRE9MtR2gc2s8yDjDa3y/8t+yOB6V5RXILsxFiCvnox1LdI+GIKmcBJtIHn8ZG +/uQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si1075774edx.238.2020.09.23.17.22.54; Wed, 23 Sep 2020 17:23:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbgIXAV1 (ORCPT + 99 others); Wed, 23 Sep 2020 20:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726605AbgIXAV1 (ORCPT ); Wed, 23 Sep 2020 20:21:27 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65290C0613CE; Wed, 23 Sep 2020 17:21:27 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 17AAA11E49F6E; Wed, 23 Sep 2020 17:04:39 -0700 (PDT) Date: Wed, 23 Sep 2020 17:21:25 -0700 (PDT) Message-Id: <20200923.172125.1341776337290371000.davem@davemloft.net> To: saeed@kernel.org Cc: hkallweit1@gmail.com, geert+renesas@glider.be, f.fainelli@gmail.com, andrew@lunn.ch, kuba@kernel.org, gaku.inami.xh@renesas.com, yoshihiro.shimoda.uh@renesas.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Revert "net: linkwatch: add check for netdevice being present to linkwatch_do_dev" From: David Miller In-Reply-To: References: <20200923.131529.637266321442993059.davem@davemloft.net> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [2620:137:e000::1:9]); Wed, 23 Sep 2020 17:04:39 -0700 (PDT) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Saeed Mahameed Date: Wed, 23 Sep 2020 15:42:17 -0700 > Maybe we need to clear IFF_UP before calling ops->ndo_stop(dev), > instead of after on __dev_close_many(). Assuming no driver is checking > IFF_UP state on its own ndo_stop(), other than this, the order > shouldn't really matter, since clearing the flag and calling ndo_stop() > should be considered as one atomic operation. This is my biggest concern, that some ndo_stop, or some helper called by ndo_stop, checks IFF_UP or similar. There is also something else. We have both synchronous and async code that checks state like IFF_UP and 'present' and makes a decision based upon that. If an async code path tests 'present', gets true, and then the RTNL holding synchronous code path puts the device into D3hot immediately afterwards, the async code path will still continue and access the chips registers and fault. I'm saying all of this because the only way this bug makes sense is if the ->ndo_stop() sequence that marks the device !present and then clears IFF_UP runs with the RTNL mutex held, and the code path that tests this state in the linkwatch bits in question do not.