summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2019-01-14 12:16:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-31 10:14:32 +0300
commit3d997bf0074e0643842f0d554c732447a5f31e85 (patch)
tree0c6fac135c0d21c95a6f3643be86c26498fee96e /net
parent916c27c8cf883e4650c280223db520cd7a5f161b (diff)
downloadlinux-3d997bf0074e0643842f0d554c732447a5f31e85.tar.xz
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 <ross.lagerwall@citrix.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/openvswitch/flow_netlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 865ecef68196..c7b6010b2c09 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -500,7 +500,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;
}