Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2327798pxk; Sat, 3 Oct 2020 17:02:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhW4Sw03T5BalGuZP26Q+Cb/DOaHcdhKUSdz2muR6VpghyLKEDMkZlF6Ws55WMQDWeg9Qj X-Received: by 2002:a17:906:3ac5:: with SMTP id z5mr8341212ejd.46.1601769735417; Sat, 03 Oct 2020 17:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601769735; cv=none; d=google.com; s=arc-20160816; b=vYDdLj/P+y8XeYQiFE7Ityv0iJHBKPS/8nQDBZ+DiUN2hUZcemKOMCsIOFfgvTHdWd pfSl5MATBenksAjvSeLh3ryzj3S4lmOrcolhHe4JgkY5nA270TGXEDTKkLVDCUasvx5e bkzEJiAERvFGDqgb7X7r1iLv70zxpyaRsAEf1pqxDLqwonifeQkJNr+fQzbGt10TEQB3 QfIryjA6EaiwXNux7EnlJj4algQioXunJnwzPbtRUwykJ3466VfoOarXirWDA6carpZx PVSBk760bIiuXK+5uwvgb6S8R/4TtzSpbGtxyNNNXG8pkOKgwYUptU0DxoJ46raYX323 whbQ== 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=yYZYrGRF84U52Seu03qPQeBX4cwnqX4nR8VXN9EQXzU=; b=HxQUPSN/maf1t440/gujuZpAneznYN/EOVpNbCG6GuQ9DaB67FrKCRCdnU1pS9QMYZ kYN80UczpfrGPp3Z1jl3ftB/uufplUlYwn093Qj/xUBsmrV/M5YQiJAHPKoXkKlPnVXH H2WfnxNs090kRYNr2MGtIjlD4iRVDvQyxFpALhsk1e4CEkUJQ4tGoTXgzNp5AW+CWPHK yfpAkEKi/wBgcJ4CD8J43ISHABWWhbUhskoNsPpOl957USjbkSYo9SsV4m45/Lz4+gD2 okvFZPq1SQZmPjJpHQnLamrBRF5/gTjUHuuGIROiZD8W3tuGIDaWOlkR2MKDog/clTmr pmBQ== 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 e17si904802edq.494.2020.10.03.17.01.52; Sat, 03 Oct 2020 17:02:15 -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 S1726114AbgJDAAp (ORCPT + 99 others); Sat, 3 Oct 2020 20:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbgJDAAp (ORCPT ); Sat, 3 Oct 2020 20:00:45 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E207C0613D0; Sat, 3 Oct 2020 17:00:45 -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 6A4DE11E3E4CA; Sat, 3 Oct 2020 16:43:56 -0700 (PDT) Date: Sat, 03 Oct 2020 17:00:42 -0700 (PDT) Message-Id: <20201003.170042.489590204097552946.davem@davemloft.net> To: gregkh@linuxfoundation.org Cc: netdev@vger.kernel.org, tuba@ece.ufl.edu, kuba@kernel.org, oneukum@suse.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v2] net: hso: do not call unregister if not registered From: David Miller In-Reply-To: <20201002114323.GA3296553@kroah.com> References: <20201002114323.GA3296553@kroah.com> 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]); Sat, 03 Oct 2020 16:43:56 -0700 (PDT) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg KH Date: Fri, 2 Oct 2020 13:43:23 +0200 > @@ -2366,7 +2366,8 @@ static void hso_free_net_device(struct hso_device *hso_dev, bool bailout) > > remove_net_device(hso_net->parent); > > - if (hso_net->net) > + if (hso_net->net && > + hso_net->net->reg_state == NETREG_REGISTERED) > unregister_netdev(hso_net->net); > > /* start freeing */ I really want to get out of the habit of drivers testing the internal netdev registration state to make decisions. Instead, please track this internally. You know if you registered the device or not, therefore use that to control whether you try to unregister it or not. Thank you.