* [PATCH v1 net] mctp: Use __mctp_dev_get() in mctp_fill_link_af().
@ 2024-08-15 20:42 Kuniyuki Iwashima
2024-08-16 1:39 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-15 20:42 UTC (permalink / raw)
To: Jeremy Kerr, Matt Johnston, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Kuniyuki Iwashima, Kuniyuki Iwashima, netdev
Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
af_ops->fill_link_af() is called under RCU.
mctp_fill_link_af() calls mctp_dev_get_rtnl() that uses
rtnl_dereference(), so lockdep should complain about it.
Let's use __mctp_dev_get() instead.
Fixes: 583be982d934 ("mctp: Add device handling and netlink interface")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
---
net/mctp/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mctp/device.c b/net/mctp/device.c
index acb97b257428..7ffddab01e97 100644
--- a/net/mctp/device.c
+++ b/net/mctp/device.c
@@ -366,7 +366,7 @@ static int mctp_fill_link_af(struct sk_buff *skb,
{
struct mctp_dev *mdev;
- mdev = mctp_dev_get_rtnl(dev);
+ mdev = __mctp_dev_get(dev);
if (!mdev)
return -ENODATA;
if (nla_put_u32(skb, IFLA_MCTP_NET, mdev->net))
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1 net] mctp: Use __mctp_dev_get() in mctp_fill_link_af().
2024-08-15 20:42 [PATCH v1 net] mctp: Use __mctp_dev_get() in mctp_fill_link_af() Kuniyuki Iwashima
@ 2024-08-16 1:39 ` Jakub Kicinski
2024-08-16 3:08 ` Kuniyuki Iwashima
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2024-08-16 1:39 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: Jeremy Kerr, Matt Johnston, David S. Miller, Eric Dumazet,
Paolo Abeni, Kuniyuki Iwashima, netdev
On Thu, 15 Aug 2024 13:42:54 -0700 Kuniyuki Iwashima wrote:
> Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
> af_ops->fill_link_af() is called under RCU.
>
> mctp_fill_link_af() calls mctp_dev_get_rtnl() that uses
> rtnl_dereference(), so lockdep should complain about it.
>
> Let's use __mctp_dev_get() instead.
And this is what crashes kunit tests, I reckon.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1 net] mctp: Use __mctp_dev_get() in mctp_fill_link_af().
2024-08-16 1:39 ` Jakub Kicinski
@ 2024-08-16 3:08 ` Kuniyuki Iwashima
0 siblings, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2024-08-16 3:08 UTC (permalink / raw)
To: kuba; +Cc: davem, edumazet, jk, kuni1840, kuniyu, matt, netdev, pabeni
From: Jakub Kicinski <kuba@kernel.org>
Date: Thu, 15 Aug 2024 18:39:46 -0700
> On Thu, 15 Aug 2024 13:42:54 -0700 Kuniyuki Iwashima wrote:
> > Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"),
> > af_ops->fill_link_af() is called under RCU.
> >
> > mctp_fill_link_af() calls mctp_dev_get_rtnl() that uses
> > rtnl_dereference(), so lockdep should complain about it.
> >
> > Let's use __mctp_dev_get() instead.
>
> And this is what crashes kunit tests, I reckon.
Exactly, I missed that the helper increments the dev refcnt.
I'll use bare rcu_dereference().
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-16 3:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 20:42 [PATCH v1 net] mctp: Use __mctp_dev_get() in mctp_fill_link_af() Kuniyuki Iwashima
2024-08-16 1:39 ` Jakub Kicinski
2024-08-16 3:08 ` Kuniyuki Iwashima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).