openvswitch: Validate IPv6 flow key and mask values.
authorJarno Rajahalme <jrajahalme@nicira.com>
Tue, 11 Nov 2014 22:36:30 +0000 (14:36 -0800)
committerPravin B Shelar <pshelar@nicira.com>
Fri, 14 Nov 2014 23:13:26 +0000 (15:13 -0800)
Reject flow label key and mask values with invalid bits set.
Introduced by commit 3fdbd1ce11e5 ("openvswitch: add ipv6 'set'
action").

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
net/openvswitch/flow_netlink.c

index dda040e693a3903e9c97fef13c063f26c514604e..fa4ec2e4a78b873ba4c819aa66a82b4be3142def 100644 (file)
@@ -689,6 +689,13 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs,
                                ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX);
                        return -EINVAL;
                }
+
+               if (ipv6_key->ipv6_label & htonl(0xFFF00000)) {
+                       OVS_NLERR("IPv6 flow label %x is out of range (max=%x).\n",
+                                 ntohl(ipv6_key->ipv6_label), (1 << 20) - 1);
+                       return -EINVAL;
+               }
+
                SW_FLOW_KEY_PUT(match, ipv6.label,
                                ipv6_key->ipv6_label, is_mask);
                SW_FLOW_KEY_PUT(match, ip.proto,