diff options
author | John Fastabend <john.fastabend@gmail.com> | 2018-10-16 10:36:01 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-17 02:29:15 +0200 |
commit | 3f4c3127d332000530349db4843deece27fe5e0c (patch) | |
tree | e9eb7a109cedfc88885cd074bf0364884402c1dc /include/linux/skmsg.h | |
parent | 9032c10e94fc44bb3245dc7f0d52aeeb3e8715b6 (diff) | |
download | lwn-3f4c3127d332000530349db4843deece27fe5e0c.tar.gz lwn-3f4c3127d332000530349db4843deece27fe5e0c.zip |
bpf: sockmap, fix skmsg recvmsg handler to track size correctly
When converting sockmap to new skmsg generic data structures we missed
that the recvmsg handler did not correctly use sg.size and instead was
using individual elements length. The result is if a sock is closed
with outstanding data we omit the call to sk_mem_uncharge() and can
get the warning below.
[ 66.728282] WARNING: CPU: 6 PID: 5783 at net/core/stream.c:206 sk_stream_kill_queues+0x1fa/0x210
To fix this correct the redirect handler to xfer the size along with
the scatterlist and also decrement the size from the recvmsg handler.
Now when a sock is closed the remaining 'size' will be decremented
with sk_mem_uncharge().
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/linux/skmsg.h')
-rw-r--r-- | include/linux/skmsg.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h index 0b919f0bc6d6..31df0d9fa536 100644 --- a/include/linux/skmsg.h +++ b/include/linux/skmsg.h @@ -176,6 +176,7 @@ static inline void sk_msg_xfer(struct sk_msg *dst, struct sk_msg *src, { dst->sg.data[which] = src->sg.data[which]; dst->sg.data[which].length = size; + dst->sg.size += size; src->sg.data[which].length -= size; src->sg.data[which].offset += size; } |