]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: sockmap missing NULL psock check
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 5 Jan 2018 04:02:09 +0000 (20:02 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 6 Jan 2018 23:01:46 +0000 (00:01 +0100)
commitf9e2a4f1a9217d3ff7323ec17d3ff07b55693a88
tree3a9d68d5c946353b0f0583e3440655e555826d60
parentae30eb1c557dbf03658301e3ead493cd61090ec8
bpf: sockmap missing NULL psock check

Add psock NULL check to handle a racing sock event that can get the
sk_callback_lock before this case but after xchg happens causing the
refcnt to hit zero and sock user data (psock) to be null and queued
for garbage collection.

Also add a comment in the code because this is a bit subtle and
not obvious in my opinion.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/sockmap.c