[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250108104040.GA7706@kernel.org>
Date: Wed, 8 Jan 2025 10:40:40 +0000
From: Simon Horman <horms@...nel.org>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Xiao Liang <shaw.leon@...il.com>,
Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org,
Pablo Neira Ayuso <pablo@...filter.org>,
Harald Welte <laforge@...monks.org>
Subject: Re: [PATCH v1 net 1/3] gtp: Use for_each_netdev_rcu() in
gtp_genl_dump_pdp().
On Wed, Jan 08, 2025 at 03:28:32PM +0900, Kuniyuki Iwashima wrote:
> gtp_newlink() links the gtp device to a list in dev_net(dev).
>
> However, even after the gtp device is moved to another netns,
> it stays on the list but should be invisible.
>
> Let's use for_each_netdev_rcu() for netdev traversal in
> gtp_genl_dump_pdp().
>
> Note that gtp_dev_list is no longer used under RCU, so list
> helpers are converted to the non-RCU variant.
>
> Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
> Reported-by: Xiao Liang <shaw.leon@...il.com>
> Closes: https://lore.kernel.org/netdev/CABAhCOQdBL6h9M2C+kd+bGivRJ9Q72JUxW+-gur0nub_=PmFPA@mail.gmail.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> Cc: Pablo Neira Ayuso <pablo@...filter.org>
> Cc: Harald Welte <laforge@...monks.org>
...
> @@ -2280,7 +2281,10 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,
> return 0;
>
> rcu_read_lock();
> - list_for_each_entry_rcu(gtp, &gn->gtp_dev_list, list) {
> + for_each_netdev_rcu(net, dev) {
> + if (dev->rtnl_link_ops != >p_link_ops)
> + continue;
> +
> if (last_gtp && last_gtp != gtp)
> continue;
> else
Hi Iwashima-san,
With this change gtp seems to be uninitialised here.
And, also, it looks like gn is now set but otherwise unused in this function.
Flagged by W=1 builds with clang-19.
...
Powered by blists - more mailing lists