[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <051302b5ef5e5ac8801bbef5a20ef2ab15b997a2.1746696747.git.echaudro@redhat.com>
Date: Thu, 8 May 2025 11:32:27 +0200
From: Eelco Chaudron <echaudro@...hat.com>
To: netdev@...r.kernel.org
Cc: dev@...nvswitch.org,
aconole@...hat.com,
echaudro@...hat.com,
i.maximets@....org,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
horms@...nel.org
Subject: [PATCH net-next] openvswitch: Fix userspace attribute length validation
The current implementation of validate_userspace() does not verify
whether all Netlink attributes fit within the parent attribute. This
is because nla_parse_nested_deprecated() stops processing Netlink
attributes as soon as an invalid one is encountered.
To address this, we use nla_parse_deprecated_strict() which will
return an error upon encountering attributes with an invalid size.
Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
---
net/openvswitch/flow_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 518be23e48ea..ad64bb9ab5e2 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -3049,7 +3049,8 @@ static int validate_userspace(const struct nlattr *attr)
struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1];
int error;
- error = nla_parse_nested_deprecated(a, OVS_USERSPACE_ATTR_MAX, attr,
+ error = nla_parse_deprecated_strict(a, OVS_USERSPACE_ATTR_MAX,
+ nla_data(attr), nla_len(attr),
userspace_policy, NULL);
if (error)
return error;
--
2.47.1
Powered by blists - more mailing lists