mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
openvswitch: fix potential out of bound access in parse_ct
[ Upstream commit69ec932e36] 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:7f8a436eaa("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
59e76ed179
commit
d53ff3816d
@@ -1088,8 +1088,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,
|
||||
@@ -1097,6 +1097,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)",
|
||||
|
||||
Reference in New Issue
Block a user