Commit cc570605 authored by Joe Stringer's avatar Joe Stringer Committed by David S. Miller

openvswitch: Fix IPv6 exthdr handling with ct helpers.

Static code analysis reveals the following bug:

        net/openvswitch/conntrack.c:281 ovs_ct_helper()
        warn: unsigned 'protoff' is never less than zero.

This signedness bug breaks error handling for IPv6 extension headers when
using conntrack helpers. Fix the error by using a local signed variable.

Fixes:  cae3a262: "openvswitch: Allow attaching helpers to ct
action"
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJoe Stringer <joestringer@nicira.com>
Acked-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 37a1d361
...@@ -275,13 +275,15 @@ static int ovs_ct_helper(struct sk_buff *skb, u16 proto) ...@@ -275,13 +275,15 @@ static int ovs_ct_helper(struct sk_buff *skb, u16 proto)
case NFPROTO_IPV6: { case NFPROTO_IPV6: {
u8 nexthdr = ipv6_hdr(skb)->nexthdr; u8 nexthdr = ipv6_hdr(skb)->nexthdr;
__be16 frag_off; __be16 frag_off;
int ofs;
protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), ofs = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr,
&nexthdr, &frag_off); &frag_off);
if (protoff < 0 || (frag_off & htons(~0x7)) != 0) { if (ofs < 0 || (frag_off & htons(~0x7)) != 0) {
pr_debug("proto header not found\n"); pr_debug("proto header not found\n");
return NF_ACCEPT; return NF_ACCEPT;
} }
protoff = ofs;
break; break;
} }
default: default:
......
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