bpf: Only reply field should be writeable
authorLawrence Brakmo <brakmo@fb.com>
Fri, 26 Jan 2018 00:14:05 +0000 (16:14 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Jan 2018 00:41:13 +0000 (16:41 -0800)
commit2585cd62f0986a6e6d9c83363ed6dbcc66bc9f32
treec253c21199292459117b3e72e0a98701bab5c9fe
parente9dcd80b9d77a92bfae6ce42a451f5c5fd318832
bpf: Only reply field should be writeable

Currently, a sock_ops BPF program can write the op field and all the
reply fields (reply and replylong). This is a bug. The op field should
not have been writeable and there is currently no way to use replylong
field for indices >= 1. This patch enforces that only the reply field
(which equals replylong[0]) is writeable.

Fixes: 40304b2a1567 ("bpf: BPF support for sock_ops")
Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/core/filter.c