Commit f040249c authored by Peter Oskolkov's avatar Peter Oskolkov Committed by Greg Kroah-Hartman

bpf: bpf_setsockopt: reset sock dst on SO_MARK changes

[ Upstream commit f4924f24da8c7ef64195096817f3cde324091d97 ]

In sock_setsockopt() (net/core/sock.h), when SO_MARK option is used
to change sk_mark, sk_dst_reset(sk) is called. The same should be
done in bpf_setsockopt().

Fixes: 8c4b4c7e ("bpf: Add setsockopt helper function to bpf")
Reported-by: default avatarMaciej Żenczykowski <>
Signed-off-by: default avatarPeter Oskolkov <>
Acked-by: default avatarMartin KaFai Lau <>
Reviewed-by: default avatarMaciej Żenczykowski <>
Signed-off-by: default avatarDaniel Borkmann <>
Signed-off-by: default avatarSasha Levin <>
parent caa27a81
......@@ -3102,7 +3102,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
sk->sk_rcvlowat = val ? : 1;
case SO_MARK:
if (sk->sk_mark != val) {
sk->sk_mark = val;
ret = -EINVAL;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment