[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+UsejDXBJv-SqPJTCb-jO7p_+28zVLOOxvHoyV2MKwCQ@mail.gmail.com>
Date: Thu, 29 Jan 2026 14:16:56 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Andrew Lunn <andrew@...n.ch>, Vladimir Oltean <olteanv@...il.com>
Cc: netdev <netdev@...r.kernel.org>, Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: [BUG dsa] lack of barriers in netdev_uses_dsa()
Hi dsa experts
It seems netdev_uses_dsa() does not have any barrier.
A compiler could read dev->dsa_ptr and get a NULL the second time.
include/net/dsa.h:1336:static inline bool netdev_uses_dsa(const struct
net_device *dev)
include/net/dsa.h-1337-{
include/net/dsa.h-1338-#if IS_ENABLED(CONFIG_NET_DSA)
include/net/dsa.h-1339- return dev->dsa_ptr && dev->dsa_ptr->rcv;
include/net/dsa.h-1340-#endif
include/net/dsa.h-1341- return false;
include/net/dsa.h-1342-}
I was looking at this because I wanted to inline eth_type_trans().
Note the wmb() in dsa_conduit_teardown(), which is not good enough.
Any suggestions?
Ideally, it would be nice if netdev_uses_dsa() could test a single bit
in "struct net_device",
without a dereference of dsa_ptr.
Thanks.
Powered by blists - more mailing lists