openvswitch: Avoid OOB read when parsing flow nlattrs
Subsystems (3)
PATCH 1/1 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.
--- net/openvswitch/flow_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/flow_netlink.c +1 -1
@@ -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; }
Signature · 1 line
2.17.2
Quoted 17 lines · Ross Lagerwall
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 <[email protected]>--- net/openvswitch/flow_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/openvswitch/flow_netlink.c +0
-0
net/openvswitch/flow_netlink.c static int __parse_flow_nlattrs(const struct nlattr *attr, · line 506
Quoted 8 lines
net/openvswitch/flow_netlink.c +1
-1@@ -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; }
Good Catch.
From: Ross Lagerwall <[email protected]>
Date: Mon, 14 Jan 2019 09:16:56 +0000
Quoted 7 lines
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 <[email protected]>
Applied.