]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
bpf: sockmap, free memory on sock close with cork data
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 2 Apr 2018 19:50:46 +0000 (12:50 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 4 Apr 2018 09:04:31 +0000 (11:04 +0200)
commit820ed3fb2e6e986144465082d041e6a403a94135
treeb300991177e0620ecb4211d3849bc8a8e83223e2
parent4608f064532c28c0ea3c03fe26a3a5909852811a
bpf: sockmap, free memory on sock close with cork data

If a socket with pending cork data is closed we do not return the
memory to the socket until the garbage collector free's the psock
structure. The garbage collector though can run after the sock has
completed its close operation. If this ordering happens the sock code
will through a WARN_ON because there is still outstanding memory
accounted to the sock.

To resolve this ensure we return memory to the sock when a socket
is closed.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Fixes: 91843d540a13 ("bpf: sockmap, add msg_cork_bytes() helper")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/sockmap.c