mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
netfilter: conntrack: fix ipv6 exthdr error check
smatch warnings:
net/netfilter/nf_conntrack_proto.c:167 nf_confirm() warn: unsigned 'protoff' is never less than zero.
We need to check if ipv6_skip_exthdr() returned an error, but protoff is
unsigned. Use a signed integer for this.
Fixes: a70e483460
("netfilter: conntrack: merge ipv4+ipv6 confirm functions")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
19e72b064f
commit
5eb119da94
@ -141,6 +141,7 @@ unsigned int nf_confirm(void *priv,
|
|||||||
struct nf_conn *ct;
|
struct nf_conn *ct;
|
||||||
bool seqadj_needed;
|
bool seqadj_needed;
|
||||||
__be16 frag_off;
|
__be16 frag_off;
|
||||||
|
int start;
|
||||||
u8 pnum;
|
u8 pnum;
|
||||||
|
|
||||||
ct = nf_ct_get(skb, &ctinfo);
|
ct = nf_ct_get(skb, &ctinfo);
|
||||||
@ -163,9 +164,11 @@ unsigned int nf_confirm(void *priv,
|
|||||||
break;
|
break;
|
||||||
case NFPROTO_IPV6:
|
case NFPROTO_IPV6:
|
||||||
pnum = ipv6_hdr(skb)->nexthdr;
|
pnum = ipv6_hdr(skb)->nexthdr;
|
||||||
protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum, &frag_off);
|
start = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum, &frag_off);
|
||||||
if (protoff < 0 || (frag_off & htons(~0x7)) != 0)
|
if (start < 0 || (frag_off & htons(~0x7)) != 0)
|
||||||
return nf_conntrack_confirm(skb);
|
return nf_conntrack_confirm(skb);
|
||||||
|
|
||||||
|
protoff = start;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return nf_conntrack_confirm(skb);
|
return nf_conntrack_confirm(skb);
|
||||||
|
Loading…
Reference in New Issue
Block a user