* [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace()
@ 2025-05-06 14:28 Eelco Chaudron
2025-05-06 15:24 ` Ilya Maximets
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eelco Chaudron @ 2025-05-06 14:28 UTC (permalink / raw)
To: netdev
Cc: dev, aconole, echaudro, i.maximets, davem, edumazet, kuba, pabeni,
horms
This patch replaces the manual Netlink attribute iteration in
output_userspace() with nla_for_each_nested(), which ensures that only
well-formed attributes are processed.
Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---
net/openvswitch/actions.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 61fea7baae5d..2f22ca59586f 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -975,8 +975,7 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
upcall.cmd = OVS_PACKET_CMD_ACTION;
upcall.mru = OVS_CB(skb)->mru;
- for (a = nla_data(attr), rem = nla_len(attr); rem > 0;
- a = nla_next(a, &rem)) {
+ nla_for_each_nested(a, attr, rem) {
switch (nla_type(a)) {
case OVS_USERSPACE_ATTR_USERDATA:
upcall.userdata = a;
--
2.47.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace()
2025-05-06 14:28 [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace() Eelco Chaudron
@ 2025-05-06 15:24 ` Ilya Maximets
2025-05-06 19:38 ` Aaron Conole
2025-05-08 0:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ilya Maximets @ 2025-05-06 15:24 UTC (permalink / raw)
To: Eelco Chaudron, netdev
Cc: i.maximets, dev, aconole, davem, edumazet, kuba, pabeni, horms
On 5/6/25 4:28 PM, Eelco Chaudron wrote:
> This patch replaces the manual Netlink attribute iteration in
> output_userspace() with nla_for_each_nested(), which ensures that only
> well-formed attributes are processed.
>
> Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
> net/openvswitch/actions.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Should probably add a Reported-by tag referencing the report id
and mention the reporter in the commit message.
Otherwise, LGTM. Thanks!
Acked-by: Ilya Maximets <i.maximets@ovn.org>
>
> diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> index 61fea7baae5d..2f22ca59586f 100644
> --- a/net/openvswitch/actions.c
> +++ b/net/openvswitch/actions.c
> @@ -975,8 +975,7 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
> upcall.cmd = OVS_PACKET_CMD_ACTION;
> upcall.mru = OVS_CB(skb)->mru;
>
> - for (a = nla_data(attr), rem = nla_len(attr); rem > 0;
> - a = nla_next(a, &rem)) {
> + nla_for_each_nested(a, attr, rem) {
> switch (nla_type(a)) {
> case OVS_USERSPACE_ATTR_USERDATA:
> upcall.userdata = a;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace()
2025-05-06 14:28 [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace() Eelco Chaudron
2025-05-06 15:24 ` Ilya Maximets
@ 2025-05-06 19:38 ` Aaron Conole
2025-05-08 0:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Aaron Conole @ 2025-05-06 19:38 UTC (permalink / raw)
To: Eelco Chaudron
Cc: netdev, dev, i.maximets, davem, edumazet, kuba, pabeni, horms
Eelco Chaudron <echaudro@redhat.com> writes:
> This patch replaces the manual Netlink attribute iteration in
> output_userspace() with nla_for_each_nested(), which ensures that only
> well-formed attributes are processed.
>
> Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
Acked-by: Aaron Conole <aconole@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace()
2025-05-06 14:28 [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace() Eelco Chaudron
2025-05-06 15:24 ` Ilya Maximets
2025-05-06 19:38 ` Aaron Conole
@ 2025-05-08 0:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-08 0:10 UTC (permalink / raw)
To: Eelco Chaudron
Cc: netdev, dev, aconole, i.maximets, davem, edumazet, kuba, pabeni,
horms
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 6 May 2025 16:28:54 +0200 you wrote:
> This patch replaces the manual Netlink attribute iteration in
> output_userspace() with nla_for_each_nested(), which ensures that only
> well-formed attributes are processed.
>
> Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
>
> [...]
Here is the summary with links:
- [net] openvswitch: Fix unsafe attribute parsing in output_userspace()
https://git.kernel.org/netdev/net/c/6beb6835c1fb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-08 0:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 14:28 [PATCH net] openvswitch: Fix unsafe attribute parsing in output_userspace() Eelco Chaudron
2025-05-06 15:24 ` Ilya Maximets
2025-05-06 19:38 ` Aaron Conole
2025-05-08 0:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).