diff options
| author | Takashi Iwai <[email protected]> | 2018-01-19 13:57:33 +0100 |
|---|---|---|
| committer | Takashi Iwai <[email protected]> | 2018-01-19 13:57:33 +0100 |
| commit | c86d95cb6b7ecda7b7d56e40c24b7d8b9bf9159a (patch) | |
| tree | 3d868496a15be09dfb3a471e7b9dce24c0216d89 /kernel/bpf/sockmap.c | |
| parent | 388fdb8f882af67ff8394d9420c1e0e42ba35619 (diff) | |
| parent | 8f05b9c65d817dd288da5f1c6ecc134b66f8a190 (diff) | |
Merge tag 'asoc-v4.16-3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v4.16
Some final updates for the merge window, this brings in some
improvements to the ACPI GPIO handling for Intel and a bunch of fixes.
Diffstat (limited to 'kernel/bpf/sockmap.c')
| -rw-r--r-- | kernel/bpf/sockmap.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 5ee2e41893d9..1712d319c2d8 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -591,8 +591,15 @@ static void sock_map_free(struct bpf_map *map) write_lock_bh(&sock->sk_callback_lock); psock = smap_psock_sk(sock); - smap_list_remove(psock, &stab->sock_map[i]); - smap_release_sock(psock, sock); + /* This check handles 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. + */ + if (likely(psock)) { + smap_list_remove(psock, &stab->sock_map[i]); + smap_release_sock(psock, sock); + } write_unlock_bh(&sock->sk_callback_lock); } rcu_read_unlock(); |