From patchwork Sat Jan 11 06:59:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13935812 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 736A98BEC for ; Sat, 11 Jan 2025 06:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736578799; cv=none; b=IZwhomwAdOCA+qMweOHy4BOv5i3Mq5TzkxB7YFoHGLfYZ3BqYpFDfFGww4as1ZD8cQ8zgtVaj4bqKCYExmgvfztzADh8yVL0sPaB0Ih8mDl1+QeTTzb0aciyEJRqoeuIDItxBhLZ/Aexh3bAYWSluh3/+1qjjezy/CUbMCNL3Jo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736578799; c=relaxed/simple; bh=5l0fQJ7DPlvXaohSWGaF8ws/A766Cq6crpcxs8Q+0u0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VYjkgpZNah/B7mcbeJI2mXFYrREWzpd5xgTDaSKCcz/J2sitVcmm6YKZMum4TPcDvuVeZFigHmPTE2f+FFcMqX6B2GQ45bt5SCyp96w8hKCyw8ws487hr0zqNgk0RLc3/J84ljdFihFpEbnttqv2stiqafFSxN1WAdkx4L8BsV8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DMpzlRvx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DMpzlRvx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0F38C4CED2; Sat, 11 Jan 2025 06:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736578799; bh=5l0fQJ7DPlvXaohSWGaF8ws/A766Cq6crpcxs8Q+0u0=; h=From:To:Cc:Subject:Date:From; b=DMpzlRvxjmlrI0D163ElgsgafyOlUddKU5wWecg43yulTyB4S9Fx+tNhZOfwwPLOF Puo7SWMFlx2IMcdu+NIkM05w4CP6TrJTxCZGtJ+tCylrpHi7YE1xjfeRSCU3b56dBL nRxTTYH4iIAHQPjOI+1kMwuYm0JmT8HDXnsMb2oA3udEbeJfvMBZhry4bfaCTzP9pU 7cWtnsAuPlCS2HhlOXEggJVMX/U+cqUmlkoCpYvPR6c+BGlgcEi/svx9tvey6afB6i fO5ehHyQvCtRnlP+N1+9VeYMBGPPYZn3oIH+JR165HEPHcdtG4grg+hksNAIY8/P/U MyfvuAlnaYiug== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, Jakub Kicinski Subject: [PATCH net-next 1/2] net: un-export init_dummy_netdev() Date: Fri, 10 Jan 2025 22:59:54 -0800 Message-ID: <20250111065955.3698801-1-kuba@kernel.org> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org There are no in-tree module callers of init_dummy_netdev(), AFAICT. Signed-off-by: Jakub Kicinski --- net/core/dev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 1a90ed8cc6cc..23e7f6a3925b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10782,7 +10782,6 @@ void init_dummy_netdev(struct net_device *dev) memset(dev, 0, sizeof(struct net_device)); init_dummy_netdev_core(dev); } -EXPORT_SYMBOL_GPL(init_dummy_netdev); /** * register_netdev - register a network device From patchwork Sat Jan 11 06:59:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13935813 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E75E915C14B for ; Sat, 11 Jan 2025 06:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736578800; cv=none; b=pXRuxD5yq6TkmMiXh6GwFosALaAefQTF9wBZbuBG3Db8nxihWrAfGB7tyOQoXvcNEAZhzo5L2mTsXgWJlAEZshelxxfx2fqpRwnfbSHXiGGZPr9TCuaAVv4z4d9i80gSwD2WzDa/5yzo/8p9GAJSXOJ1+os7sfT5YtEQtHpA8o4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736578800; c=relaxed/simple; bh=5bjW9UykZ73QaYBBneKCgwiFbjOIELdWmUp3WpwdnOU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=slmufF6z0kaEsKbjwBRGpqQdqj2DjquWja84pHYq0xy6txQ40jrSdeHgEHBhK1IaM5XYWd+Rpw7V5/bY10sUmSezNjSGb04BZZ2XxaGWG/BWOUHrQzOOhVDS08RYQaagzCxYmIstWyz2OnFpB8twfXecQsnddkwZx0WRlW5Bups= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rOEAy8UV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rOEAy8UV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CFEDC4CED3; Sat, 11 Jan 2025 06:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736578799; bh=5bjW9UykZ73QaYBBneKCgwiFbjOIELdWmUp3WpwdnOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rOEAy8UV7C62wjQiZWsV/mGLfclkNLU59b+aFTrq5sUY0/OGPSfjMqp7oP6mcP2oS Mb7SLM+g+hA9rR6O/A8bB5XdUs49QzU+Qwm7u4NCM70ZrForXL6IP2wyldfbnbQsIh w3gkHuGHGgNtuKeqiWoH+/5kYJb5uE17FrdQh9bQ02Fpci8LHcW3EuQM6cqZmJUkY3 7/rpqltgv44/uFm3qUVBOeG/DzYlvyQ4ebPNpFkFBv3XNaBomix3sBgQgpjYpVwh6W AHvh/ShHwxX2azLJWckiEgkZ2I8EHvYBJSGN6VWKGeErNOOqpjILTeyjeCPbrrTIHI jkWW3uObLO2xw== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, Jakub Kicinski Subject: [PATCH net-next 2/2] net: initialize netdev->lock on dummy devices Date: Fri, 10 Jan 2025 22:59:55 -0800 Message-ID: <20250111065955.3698801-2-kuba@kernel.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250111065955.3698801-1-kuba@kernel.org> References: <20250111065955.3698801-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Make sure netdev->lock is always valid, even on dummy netdevs. Apparently it's legal to call mutex_destroy() on an uninitialized mutex (and we do that in free_netdev()), but it doesn't seem right. Plus we'll soon want to take netdev->lock on more paths which dummy netdevs may reach. Signed-off-by: Jakub Kicinski --- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/dev.c b/net/core/dev.c index 23e7f6a3925b..00552197d601 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10756,6 +10756,8 @@ static void init_dummy_netdev_core(struct net_device *dev) /* napi_busy_loop stats accounting wants this */ dev_net_set(dev, &init_net); + mutex_init(&dev->lock); + /* Note : We dont allocate pcpu_refcnt for dummy devices, * because users of this 'device' dont need to change * its refcount.