diff options
author | Greg Rose <gvrose8192@gmail.com> | 2017-07-25 08:40:58 -0700 |
---|---|---|
committer | Joe Stringer <joe@ovn.org> | 2017-07-26 14:37:57 -0700 |
commit | fb296f42b762d4597da00a58da04f7de61c71375 (patch) | |
tree | 60433af574881d6e35c99352c042825e0a3fc290 /datapath | |
parent | 941d80b48aed94eaafcad5549296445d55b67e92 (diff) | |
download | openvswitch-fb296f42b762d4597da00a58da04f7de61c71375.tar.gz |
datapath: fix potential out of bound access in parse_ct
Upstream commit:
commit 69ec932e364b1ba9c3a2085fe96b76c8a3f71e7c
Author: Liping Zhang <zlpnobody@gmail.com>
Date: Sun Jul 23 17:52:23 2017 +0800
openvswitch: fix potential out of bound access in parse_ct
Before the 'type' is validated, we shouldn't use it to fetch the
ovs_ct_attr_lens's minlen and maxlen, else, out of bound access
may happen.
Fixes: 7f8a436eaa2c ("openvswitch: Add conntrack action")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Acked-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Pick up an upstream bug fix.
Fixes: a94ebc39996b ("datapath: Add conntrack action")
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
Diffstat (limited to 'datapath')
-rw-r--r-- | datapath/conntrack.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/datapath/conntrack.c b/datapath/conntrack.c index bba9bfe98..b645ab101 100644 --- a/datapath/conntrack.c +++ b/datapath/conntrack.c @@ -1356,8 +1356,8 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info, nla_for_each_nested(a, attr, rem) { int type = nla_type(a); - int maxlen = ovs_ct_attr_lens[type].maxlen; - int minlen = ovs_ct_attr_lens[type].minlen; + int maxlen; + int minlen; if (type > OVS_CT_ATTR_MAX) { OVS_NLERR(log, @@ -1365,6 +1365,9 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info, type, OVS_CT_ATTR_MAX); return -EINVAL; } + + maxlen = ovs_ct_attr_lens[type].maxlen; + minlen = ovs_ct_attr_lens[type].minlen; if (nla_len(a) < minlen || nla_len(a) > maxlen) { OVS_NLERR(log, "Conntrack attr type has unexpected length (type=%d, length=%d, expected=%d)", |