All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org, daniel@iogearbox.net,
	razor@blackwall.org, bobbyeshleman@meta.com, sdf@fomichev.me,
	Jakub Kicinski <kuba@kernel.org>, Joe Damato <joe@dama.to>
Subject: [PATCH net-next v2 3/3] netdev: don't use dev->flags for IFF_UP
Date: Mon, 31 Aug 2026 09:41:58 -0700	[thread overview]
Message-ID: <20260831164159.1124679-4-kuba@kernel.org> (raw)
In-Reply-To: <20260831164159.1124679-1-kuba@kernel.org>

dev->flags are not technically ops lock protected. The IFF_UP flag
will not change when dev->lock is held, but other flags may change
so KCSAN would probably not be impressed. Because of this we added
a dedicated dev->up which is safe to read under dev->lock.

qstats want to make sure device is up, use dev->up.

Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Reviewed-by: Joe Damato <joe@dama.to>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 net/core/netdev-genl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
index e427bab4c4d2..fa9edfdb32c2 100644
--- a/net/core/netdev-genl.c
+++ b/net/core/netdev-genl.c
@@ -775,7 +775,7 @@ netdev_nl_stats_by_queue(struct net_device *netdev, struct sk_buff *rsp,
 	const struct netdev_stat_ops *ops = netdev->stat_ops;
 	int i, err;
 
-	if (!(netdev->flags & IFF_UP))
+	if (!netdev->up)
 		return 0;
 
 	i = ctx->rxq_idx;
-- 
2.55.0


  parent reply	other threads:[~2026-08-31 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 16:41 [PATCH net-next v2 0/3] netdev: address a handful of nit picks Jakub Kicinski
2026-08-31 16:41 ` [PATCH net-next v2 1/3] netdev: correct error code in netdev_nl_queue_fill_lease() Jakub Kicinski
2026-09-01  6:58   ` Nikolay Aleksandrov
2026-08-31 16:41 ` [PATCH net-next v2 2/3] netdev: avoid skipping objects on race with device disappearance Jakub Kicinski
2026-09-01  6:58   ` Nikolay Aleksandrov
2026-09-01  9:15   ` Hangbin Liu
2026-09-01 15:02     ` Jakub Kicinski
2026-09-02  1:42       ` Hangbin Liu
2026-09-02 19:43   ` [net-next,v2,2/3] " netdev-bot+sashiko
2026-08-31 16:41 ` Jakub Kicinski [this message]
2026-09-01  6:59   ` [PATCH net-next v2 3/3] netdev: don't use dev->flags for IFF_UP Nikolay Aleksandrov
2026-09-03  2:20 ` [PATCH net-next v2 0/3] netdev: address a handful of nit picks patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831164159.1124679-4-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bobbyeshleman@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=joe@dama.to \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=sdf@fomichev.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.