Thread (7 messages) flat view 7 messages, 3 authors, 22d ago

Re: [PATCH bpf-next 2/2] bpf, sockmap: Use sock_hold() instead of refcount_inc_not_zero() in lookup

From: Jakub Sitnicki <jakub@cloudflare.com>
Date: 2026-08-14 10:42:41
Also in: bpf, lkml

On Thu, Aug 13, 2026 at 02:42 PM +02, Michal Luczaj wrote:
psock's hold on the looked up socket isn't dropped until sk_psock_drop() ->
queue_rcu_work() -> sk_psock_destroy() runs, which happens only after the
entry is unlinked and an RCU grace period elapses. Since the lookup runs
under RCU, a non-NULL result guarantees sk_refcnt >= 1:
refcount_inc_not_zero() can never fail here. Use sock_hold() instead.

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Signed-off-by: Michal Luczaj <redacted>
---
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help