net: openvswitch: fix nested key length validation in the set() action
Subsystems (3)
Ilya Maximets
maintainerPATCH 1/1 net: openvswitch: fix nested key length validation in the set() action
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.
--- net/openvswitch/flow_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/flow_netlink.c +2 -1
@@ -2876,7 +2876,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);
Signature · 1 line
2.49.0
Quoted 8 lines · Ilya Maximets
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 ccb1352e76cf ("net: Add Open vSwitch kernel components.")Reported-by [email protected]Tested-by [email protected]Signed-off-by Ilya Maximets <[email protected]>
The patch looks good to me.
Quoted 9 lines · Ilya Maximets
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 ccb1352e76cf ("net: Add Open vSwitch kernel components.")Reported-by [email protected]Tested-by [email protected]Signed-off-by Ilya Maximets <[email protected]>---
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Sat, 12 Apr 2025 12:40:18 +0200 you wrote:
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 ccb1352e76cf ("net: Add Open vSwitch kernel components.")Reported-by [email protected]Tested-by [email protected]Signed-off-by Ilya Maximets <[email protected]>[...]
Here is the summary with links:
- [net] net: openvswitch: fix nested key length validation in the set() action
https://git.kernel.org/netdev/net/c/65d91192aa66
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html