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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----邮件原件-----
> 发件人: Julian Anastasov <ja@xxxxxx>
> 发送时间: 2024年6月27日 1:54
> 收件人: Chen, Hanxiao<chenhx.fnst@xxxxxxxxxxx>
> 抄送: Simon Horman <horms@xxxxxxxxxxxx>; Pablo Neira Ayuso
> <pablo@xxxxxxxxxxxxx>; Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx>; David S . Miller
> <davem@xxxxxxxxxxxxx>; Eric Dumazet <edumazet@xxxxxxxxxx>; Jakub
> Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>;
> netdev@xxxxxxxxxxxxxxx; lvs-devel@xxxxxxxxxxxxxxx;
> netfilter-devel@xxxxxxxxxxxxxxx
> 主题: 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 <chenhx.fnst@xxxxxxxxxxx>
> > ---
...
> > -	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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux