]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix sg shift repair start offset in bpf_msg_pull_data
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 29 Aug 2018 14:50:36 +0000 (16:50 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 29 Aug 2018 17:47:17 +0000 (10:47 -0700)
commitbe25aa1ba001bc62d0353ab529e697ecd4d4d33b
treedaa8c87faa188cf123e905140f1ab3e995439fc4
parent12d5734dff7f30998b390513984d35f28a9a73c3
bpf: fix sg shift repair start offset in bpf_msg_pull_data

When we perform the sg shift repair for the scatterlist ring, we
currently start out at i = first_sg + 1. However, this is not
correct since the first_sg could point to the sge sitting at slot
MAX_SKB_FRAGS - 1, and a subsequent i = MAX_SKB_FRAGS will access
the scatterlist ring (sg) out of bounds. Add the sk_msg_iter_var()
helper for iterating through the ring, and apply the same rule
for advancing to the next ring element as we do elsewhere. Later
work will use this helper also in other places.

Fixes: b20b48b5b56e ("bpf: sk_msg program helper bpf_sk_msg_pull_data")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/core/filter.c