From: Pablo Neira Ayuso Date: Wed, 5 May 2021 20:25:24 +0000 (+0200) Subject: netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check X-Git-Tag: accepted/tizen/unified/20230118.172025~7255^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e024c325406470d1165a09c6feaf8ec897936be;p=platform%2Fkernel%2Flinux-rpi.git netfilter: nfnetlink_osf: Fix a missing skb_header_pointer() NULL check Do not assume that the tcph->doff field is correct when parsing for TCP options, skb_header_pointer() might fail to fetch these bits. Fixes: 11eeef41d5f6 ("netfilter: passive OS fingerprint xtables match") Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nfnetlink_osf.c b/net/netfilter/nfnetlink_osf.c index e8f8875..0fa2e20 100644 --- a/net/netfilter/nfnetlink_osf.c +++ b/net/netfilter/nfnetlink_osf.c @@ -186,6 +186,8 @@ static const struct tcphdr *nf_osf_hdr_ctx_init(struct nf_osf_hdr_ctx *ctx, ctx->optp = skb_header_pointer(skb, ip_hdrlen(skb) + sizeof(struct tcphdr), ctx->optsize, opts); + if (!ctx->optp) + return NULL; } return tcp;