]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Bpf_skc_to_* casting helpers require a NULL check on sk
authorMartin KaFai Lau <kafai@fb.com>
Tue, 15 Sep 2020 18:29:59 +0000 (11:29 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 16 Sep 2020 01:09:43 +0000 (18:09 -0700)
commit89a1b6e556ff3241cf3ca20af746d5e08361bde2
treed0e5a578f850ece30d077d78a24ba6a2b34ab58b
parentb4aaea2cc5a6742e33f753e9149ead987fd61723
bpf: Bpf_skc_to_* casting helpers require a NULL check on sk

The bpf_skc_to_* type casting helpers are available to
BPF_PROG_TYPE_TRACING.  The traced PTR_TO_BTF_ID may be NULL.
For example, the skb->sk may be NULL.  Thus, these casting helpers
need to check "!sk" also and this patch fixes them.

Fixes: a45d869f0e36 ("bpf: Add bpf_skc_to_udp6_sock() helper")
Fixes: 4a3efe694dc8 ("bpf: Add bpf_skc_to_{tcp, tcp_timewait, tcp_request}_sock() helpers")
Fixes: ec1657675e07 ("bpf: Add bpf_skc_to_tcp6_sock() helper")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20200915182959.241101-1-kafai@fb.com
net/core/filter.c