Commit 4ef300c9 authored by Ross Lagerwall's avatar Ross Lagerwall Committed by Stefan Bader

openvswitch: Avoid OOB read when parsing flow nlattrs

BugLink: https://bugs.launchpad.net/bugs/1818803

[ Upstream commit 04a4af33 ]

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: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
Acked-by: default avatarPravin B Shelar <pshelar@ovn.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 2d359008
...@@ -409,7 +409,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr, ...@@ -409,7 +409,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr,
return -EINVAL; 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; attrs |= 1 << type;
a[type] = nla; a[type] = nla;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment