From: Ross Lagerwall Date: Mon, 14 Jan 2019 09:16:56 +0000 (+0000) Subject: openvswitch: Avoid OOB read when parsing flow nlattrs X-Git-Tag: v3.18.134~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af9ab785576527aa4fbcfef6f33846068755cabd;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-3.18-exynos7270.git openvswitch: Avoid OOB read when parsing flow nlattrs [ Upstream commit 04a4af334b971814eedf4e4a413343ad3287d9a9 ] For nested and variable attributes, the expected length of an attribute is not known and marked by a negative number. This results in an OOB read when the expected length is later used to check if the attribute is all zeros. Fix this by using the actual length of the attribute rather than the expected length. Signed-off-by: Ross Lagerwall Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 918e966..b5133dc 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c @@ -314,7 +314,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr, return -EINVAL; } - if (!nz || !is_all_zero(nla_data(nla), expected_len)) { + if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) { attrs |= 1 << type; a[type] = nla; }