* [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
@ 2022-11-29 1:39 Yuan Can
2022-11-29 3:09 ` David Ahern
2022-11-29 17:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Yuan Can @ 2022-11-29 1:39 UTC (permalink / raw)
To: davem, yoshfuji, dsahern, edumazet, kuba, pabeni, netdev; +Cc: yuancan
As the nla_nest_start() may fail with NULL returned, the return value needs
to be checked.
Fixes: c7d759eb7b12 ("ethtool: add tunnel info interface")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
Changes in v2:
- return directly without calling nla_nest_cancel if nest_start fails
net/ipv4/udp_tunnel_nic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c
index bc3a043a5d5c..029219749785 100644
--- a/net/ipv4/udp_tunnel_nic.c
+++ b/net/ipv4/udp_tunnel_nic.c
@@ -624,6 +624,8 @@ __udp_tunnel_nic_dump_write(struct net_device *dev, unsigned int table,
continue;
nest = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
+ if (!nest)
+ return -EMSGSIZE;
if (nla_put_be16(skb, ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT,
utn->entries[table][j].port) ||
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
2022-11-29 1:39 [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write() Yuan Can
@ 2022-11-29 3:09 ` David Ahern
2022-11-29 16:50 ` Jakub Kicinski
2022-11-29 17:00 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: David Ahern @ 2022-11-29 3:09 UTC (permalink / raw)
To: Yuan Can, davem, yoshfuji, edumazet, kuba, pabeni, netdev
On 11/28/22 6:39 PM, Yuan Can wrote:
> As the nla_nest_start() may fail with NULL returned, the return value needs
> to be checked.
>
> Fixes: c7d759eb7b12 ("ethtool: add tunnel info interface")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> Changes in v2:
> - return directly without calling nla_nest_cancel if nest_start fails
>
> net/ipv4/udp_tunnel_nic.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
2022-11-29 3:09 ` David Ahern
@ 2022-11-29 16:50 ` Jakub Kicinski
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-11-29 16:50 UTC (permalink / raw)
To: David Ahern; +Cc: Yuan Can, davem, yoshfuji, edumazet, pabeni, netdev
On Mon, 28 Nov 2022 20:09:52 -0700 David Ahern wrote:
> On 11/28/22 6:39 PM, Yuan Can wrote:
> > As the nla_nest_start() may fail with NULL returned, the return value needs
> > to be checked.
> >
> > Fixes: c7d759eb7b12 ("ethtool: add tunnel info interface")
> > Signed-off-by: Yuan Can <yuancan@huawei.com>
>
> Reviewed-by: David Ahern <dsahern@kernel.org>
Applying to net-next without the Fixes tag, FWIW. The next put will
fail and we'll bail all the same, this patch is pretty much a noop.
But not the first "fix" like this we go so probably not point fighting
it.
Yuan, please try to find some other error checking to run your bots on,
I doubt any of the nla_nest_start() uses actually need error checking.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
2022-11-29 1:39 [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write() Yuan Can
2022-11-29 3:09 ` David Ahern
@ 2022-11-29 17:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-11-29 17:00 UTC (permalink / raw)
To: Yuan Can; +Cc: davem, yoshfuji, dsahern, edumazet, kuba, pabeni, netdev
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 29 Nov 2022 01:39:34 +0000 you wrote:
> As the nla_nest_start() may fail with NULL returned, the return value needs
> to be checked.
>
> Fixes: c7d759eb7b12 ("ethtool: add tunnel info interface")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> Changes in v2:
> - return directly without calling nla_nest_cancel if nest_start fails
>
> [...]
Here is the summary with links:
- [v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
https://git.kernel.org/netdev/net-next/c/7a945ce0c19b
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:[~2022-11-29 17:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 1:39 [PATCH v2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write() Yuan Can
2022-11-29 3:09 ` David Ahern
2022-11-29 16:50 ` Jakub Kicinski
2022-11-29 17:00 ` 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).