Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

openvswitch: Stricter validation for the userspace action

This change enhances the robustness of validate_userspace() by ensuring
that all Netlink attributes are fully contained within the parent
attribute. The previous use of nla_parse_nested_deprecated() could
silently skip trailing or malformed attributes, as it stops parsing at
the first invalid entry.

By switching to nla_parse_deprecated_strict(), we make sure only fully
validated attributes are copied for later use.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Link: https://patch.msgid.link/67eb414e2d250e8408bb8afeb982deca2ff2b10b.1747037304.git.echaudro@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eelco Chaudron and committed by
Jakub Kicinski
88906f55 73d95284

+2 -1
+2 -1
net/openvswitch/flow_netlink.c
··· 3049 3049 struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; 3050 3050 int error; 3051 3051 3052 - error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr, 3052 + error = nla_parse_deprecated_strict(a, OVS_USERSPACE_ATTR_MAX, 3053 + nla_data(attr), nla_len(attr), 3053 3054 userspace_policy, NULL); 3054 3055 if (error) 3055 3056 return error;