datapath: flow: fix potential illegal memory access in __parse_flow_nlattrs
authorDaniel Borkmann <dborkman@redhat.com>
Mon, 9 Sep 2013 20:27:27 +0000 (13:27 -0700)
committerJesse Gross <jesse@nicira.com>
Mon, 9 Sep 2013 20:32:50 +0000 (13:32 -0700)
commit2758da116d204fe51c20801a2714aef1f78d5922
tree05dfb6fb625a7d736b5c38ab3c2ef320ca6871cd
parent7c16c8cbe6a2b701e66d52b407fee4b7ed2065b2
datapath: 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 03f0d916a ("openvswitch: Mega flow implementation").

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/flow.c