Skip to content

Commit

Permalink
net: ovs: flow: fix potential illegal memory access in __parse_flow_n…
Browse files Browse the repository at this point in the history
…lattrs

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>
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Sep 11, 2013
1 parent df9f1b9 commit 3bf4b5b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/openvswitch/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ static int __parse_flow_nlattrs(const struct nlattr *attr,
if (type > OVS_KEY_ATTR_MAX) {
OVS_NLERR("Unknown key attribute (type=%d, max=%d).\n",
type, OVS_KEY_ATTR_MAX);
return -EINVAL;
}

if (attrs & (1 << type)) {
Expand Down

0 comments on commit 3bf4b5b

Please sign in to comment.