summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Lagerwall <ross.lagerwall@citrix.com>2019-01-31 13:16:17 -0800
committerBen Pfaff <blp@ovn.org>2019-02-04 13:49:02 -0800
commitc9b69c128b99395b80cce6e49c6eb80305dc245e (patch)
tree2c8a5bfb873d580d406873017f1cee3cbb0326c6
parent843e459c2d79ba97796e315b9d74a534aa2e7c12 (diff)
downloadopenvswitch-c9b69c128b99395b80cce6e49c6eb80305dc245e.tar.gz
datapath: Avoid OOB read when parsing flow nlattrs
Upstream commit: commit 04a4af334b971814eedf4e4a413343ad3287d9a9 Author: Ross Lagerwall <ross.lagerwall@citrix.com> Date: Mon Jan 14 09:16:56 2019 +0000 openvswitch: Avoid OOB read when parsing flow nlattrs 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> Cc: Ross Lagerwall <ross.lagerwall@citrix.com> Signed-off-by: Greg Rose <gvrose8192@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--datapath/flow_netlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index f24ed5c6f..aa68dba98 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -411,7 +411,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 |= 1ULL << type;
a[type] = nla;
}