odp-util: Fix segfault in MPLS attribute parsing.
authorJoe Stringer <joestringer@nicira.com>
Fri, 31 Oct 2014 21:05:46 +0000 (14:05 -0700)
committerJoe Stringer <joestringer@nicira.com>
Fri, 31 Oct 2014 22:41:50 +0000 (15:41 -0700)
commitaee532378943ad5990b99857f832d532fe702237
tree35bd6848e8b89cbfe9b50f5197b4493b061aa892
parentdd0147d0c81787ad039548315188feb71dd32e90
odp-util: Fix segfault in MPLS attribute parsing.

Just because the ethertype is MPLS, this doesn't mean that the datapath
understands and provides OVS_KEY_ATTR_MPLS attributes for the flow.
Previously we would check the size of the OVS_KEY_ATTR_MPLS attribute
before checking whether the attribute is present. This would cause a
segfault in nl_attr_get_size(), usually triggered from a handler thread.

This patch brings the MPLS parsing code more in line with the rest of
the parse_l2_5_onward() function, by only processing MPLS if the
attribute is present.

Reported-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/odp-util.c