udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
Subsystems (2)
PATCH v2 1/1 udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
As the nla_nest_start() may fail with NULL returned, the return value needs to be checked.
---
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(+)
net/ipv4/udp_tunnel_nic.c +2 -0
@@ -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) ||
Signature · 1 line
2.17.1
Quoted 12 lines · Yuan Can
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 <[email protected]>---
Changes in v2:
- return directly without callingnla_nest_cancelifnest_startfailsnet/ipv4/udp_tunnel_nic.c | 2 ++ 1 file changed, 2 insertions(+)
Jakub Kicinski
maintainerQuoted 8 lines · On Mon, 28 Nov 2022 20:09:52 -0700 David Ahern wrote:
Quoted 5 lines · Yuan Can
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 <[email protected]>Reviewed-by David Ahern <[email protected]>
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.
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · 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 <[email protected]>---
Changes in v2:
- return directly without callingnla_nest_cancelifnest_startfails[...]
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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html