Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54c6957d authored by Ilya Maximets's avatar Ilya Maximets Committed by Greg Kroah-Hartman
Browse files

net: openvswitch: fix nested key length validation in the set() action



[ Upstream commit 65d91192aa66f05710cfddf6a14b5a25ee554dba ]

It's not safe to access nla_len(ovs_key) if the data is smaller than
the netlink header.  Check that the attribute is OK first.

Fixes: ccb1352e ("net: Add Open vSwitch kernel components.")
Reported-by: default avatar <syzbot+b07a9da40df1576b8048@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=b07a9da40df1576b8048


Tested-by: default avatar <syzbot+b07a9da40df1576b8048@syzkaller.appspotmail.com>
Signed-off-by: default avatarIlya Maximets <i.maximets@ovn.org>
Reviewed-by: default avatarEelco Chaudron <echaudro@redhat.com>
Acked-by: default avatarAaron Conole <aconole@redhat.com>
Link: https://patch.msgid.link/20250412104052.2073688-1-i.maximets@ovn.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d00e4cf3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2741,7 +2741,8 @@ static int validate_set(const struct nlattr *a,
	size_t key_len;

	/* There can be only one key in a action */
	if (nla_total_size(nla_len(ovs_key)) != nla_len(a))
	if (!nla_ok(ovs_key, nla_len(a)) ||
	    nla_total_size(nla_len(ovs_key)) != nla_len(a))
		return -EINVAL;

	key_len = nla_len(ovs_key);