[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHTyZGzk-WUPm9v_kXoQfs6Vsk8ZG=gwTD+Q190012YFHV5X4w@mail.gmail.com>
Date: Mon, 23 Sep 2024 17:48:20 +0200
From: ericnetdev dumazet <erdnetdev@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: netdev@...r.kernel.org, Cong Wang <cong.wang@...edance.com>,
syzbot+c75d1de73d3b8b76272f@...kaller.appspotmail.com,
Wenjia Zhang <wenjia@...ux.ibm.com>, Jan Karcher <jaka@...ux.ibm.com>,
"D. Wythe" <alibuda@...ux.alibaba.com>, Tony Lu <tonylu@...ux.alibaba.com>,
Wen Gu <guwen@...ux.alibaba.com>
Subject: Re: [Patch net] smc: use RCU version of lower netdev searching
Le jeu. 12 sept. 2024 à 02:05, Cong Wang <xiyou.wangcong@...il.com> a écrit :
>
> From: Cong Wang <cong.wang@...edance.com>
>
> Both netdev_walk_all_lower_dev() and netdev_lower_get_next() have a
> RCU version, which are netdev_walk_all_lower_dev_rcu() and
> netdev_next_lower_dev_rcu(). Switching to the RCU version would
> eliminate the need for RTL lock, thus could amend the deadlock
> complaints from syzbot. And it could also potentially speed up its
> callers like smc_connect().
>
> Reported-by: syzbot+c75d1de73d3b8b76272f@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=c75d1de73d3b8b76272f
> Cc: Wenjia Zhang <wenjia@...ux.ibm.com>
> Cc: Jan Karcher <jaka@...ux.ibm.com>
> Cc: "D. Wythe" <alibuda@...ux.alibaba.com>
> Cc: Tony Lu <tonylu@...ux.alibaba.com>
> Cc: Wen Gu <guwen@...ux.alibaba.com>
> Signed-off-by: Cong Wang <cong.wang@...edance.com>
> ---
> net/smc/smc_core.c | 6 +++---
> net/smc/smc_pnet.c | 14 +++++++-------
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index 3b95828d9976..574039b7d456 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -1850,9 +1850,9 @@ int smc_vlan_by_tcpsk(struct socket *clcsock, struct smc_init_info *ini)
> }
>
> priv.data = (void *)&ini->vlan_id;
> - rtnl_lock();
> - netdev_walk_all_lower_dev(ndev, smc_vlan_by_tcpsk_walk, &priv);
> - rtnl_unlock();
> + rcu_read_lock();
> + netdev_walk_all_lower_dev_rcu(ndev, smc_vlan_by_tcpsk_walk, &priv);
It seems smc_vlan_by_tcpsk_walk() depends on RTNL.
We should at least add a READ_ONCE() in is_vlan_dev() :
return READ_ONCE(dev->priv_flags) & IFF_802_1Q_VLAN;
> + rcu_read_unlock();
>
> out_rel:
>
Powered by blists - more mailing lists