]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Don't leak memory in bpf getsockopt when optlen == 0
authorStanislav Fomichev <sdf@google.com>
Tue, 12 Jan 2021 16:28:29 +0000 (08:28 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 12 Jan 2021 20:05:07 +0000 (21:05 +0100)
commitf16fc6b1fb66229f0abd6e80822403b7a13350c5
tree56edf55becb44f23194f3f528a3ba1d7ebc2c359
parent025e89901a20ab418219913f069726907be20303
bpf: Don't leak memory in bpf getsockopt when optlen == 0

optlen == 0 indicates that the kernel should ignore BPF buffer
and use the original one from the user. We, however, forget
to free the temporary buffer that we've allocated for BPF.

Fixes: 0e957ac1238e ("bpf: Don't return EINVAL from {get,set}sockopt when optlen > PAGE_SIZE")
Reported-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210112162829.775079-1-sdf@google.com
kernel/bpf/cgroup.c