Skip to content

Commit 3bf4b5b

Browse files
Daniel Borkmanndavem330
authored andcommitted
net: ovs: flow: fix potential illegal memory access in __parse_flow_nlattrs
In function __parse_flow_nlattrs(), we check for condition (type > OVS_KEY_ATTR_MAX) and if true, print an error, but we do not return from this function as in other checks. It seems this has been forgotten, as otherwise, we could access beyond the memory of ovs_key_lens, which is of ovs_key_lens[OVS_KEY_ATTR_MAX + 1]. Hence, a maliciously prepared nla_type from user space could access beyond this upper limit. Introduced by 03f0d91 ("openvswitch: Mega flow implementation"). Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Cc: Andy Zhou <azhou@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent df9f1b9 commit 3bf4b5b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎net/openvswitch/flow.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr,
11781178
if (type > OVS_KEY_ATTR_MAX) {
11791179
OVS_NLERR("Unknown key attribute (type=%d, max=%d).\n",
11801180
type, OVS_KEY_ATTR_MAX);
1181+
return -EINVAL;
11811182
}
11821183

11831184
if (attrs & (1 << type)) {

0 commit comments

Comments
 (0)