[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2e4fa39d-3d1d-4336-af99-4ecdf8a9482f@icloud.com>
Date: Thu, 10 Apr 2025 08:52:29 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Kuniyuki Iwashima <kuniyu@...zon.com>, Paolo Abeni <pabeni@...hat.com>,
Willem de Bruijn <willemb@...gle.com>, "David S. Miller"
<davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Simon Horman <horms@...nel.org>, Pavel Emelyanov <xemul@...nvz.org>,
Eric Dumazet <dada1@...mosbay.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH net-next] sock: Correct error checking condition for
assign|release_proto_idx()
On 2025/4/9 03:06, Eric Dumazet wrote:
>> {
>> - this_cpu_add(net->core.prot_inuse->val[prot->inuse_idx], val);
>> + unsigned int idx = prot->inuse_idx;
>> +
>> + if (likely(idx < PROTO_INUSE_NR))
>> + this_cpu_add(net->core.prot_inuse->val[idx], val);
>> }
> I do not think we are going to add such a test in the fast path, for a
> bug that can not happen.
>
agree.
> Please give us a reproducer ?
will remove that check in v2 provided @prot->inuse_idx will never be
used if @prot fails to be registered.
thank you for code review.
Powered by blists - more mailing lists