Skip to content

Commit 04a4af3

Browse files
rosslagerwalldavem330
authored andcommitted
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 <[email protected]> Acked-by: Pravin B Shelar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9098f21 commit 04a4af3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/openvswitch/flow_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr,
500500
return -EINVAL;
501501
}
502502

503-
if (!nz || !is_all_zero(nla_data(nla), expected_len)) {
503+
if (!nz || !is_all_zero(nla_data(nla), nla_len(nla))) {
504504
attrs |= 1 << type;
505505
a[type] = nla;
506506
}

0 commit comments

Comments
 (0)