回复: [PATCH net-next] ipvs: properly derefer ence pe in ip_vs_add_service

"Hanxiao Chen (Fujitsu)" <[email protected]>
Newsgroups org.kernel.vger.lvs-devel,org.kernel.vger.netdev,org.kernel.vger.netfilter-devel
Message-ID <TYWPR01MB120859EC748253B757BC413AAE6D72@TYWPR01MB12085.jpnprd01.prod.outlook.com>

> -----邮件原件-----
> 发件人: Julian Anastasov <[email protected]>
> 发送时间: 2024年6月27日 1:54
> 收件人: Chen, Hanxiao<[email protected]>
> 抄送: Simon Horman <[email protected]>; Pablo Neira Ayuso
> <[email protected]>; Jozsef Kadlecsik <[email protected]>; David S . Miller
> <[email protected]>; Eric Dumazet <[email protected]>; Jakub
> Kicinski <[email protected]>; Paolo Abeni <[email protected]>;
> [email protected]; [email protected];
> [email protected]
> 主题: Re: [PATCH net-next] ipvs: properly dereference pe in ip_vs_add_service
> 
> 
> 	Hello,
> 
> On Wed, 26 Jun 2024, Chen Hanxiao wrote:
> 
> > Use rcu_dereference_protected to resolve sparse warning:
> >
> >   net/netfilter/ipvs/ip_vs_ctl.c:1471:27: warning: dereference of noderef
> expression
> >
> > Fixes: 39b972231536 ("ipvs: handle connections started by real-servers")
> > Signed-off-by: Chen Hanxiao <[email protected]>
> > ---
...
> > -	if (svc->pe && svc->pe->conn_out)
> > +	tmp_pe = rcu_dereference_protected(svc->pe, 1);
> > +	if (tmp_pe && tmp_pe->conn_out)
> >  		atomic_inc(&ipvs->conn_out_counter);
> 
> 	Alternative option would be to use 'pe' above and to move
> the RCU_INIT_POINTER and pe = NULL with their comment here.
> It is up to you to decide which option is better...
> 
Thanks for the advice.
Using pe instead of RCU dereference looks like a better choice.
v2 will come soon.

Regards,
- Chen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.