* [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats()
@ 2024-03-21 14:42 Dan Carpenter
2024-03-21 15:35 ` Jiri Pirko
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-03-21 14:42 UTC (permalink / raw)
To: Ido Schimmel
Cc: David Ahern, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Petr Machata, Kees Cook, netdev, linux-kernel,
kernel-janitors
The "*hw_stats_used" value needs to be set on the success paths to prevent
an uninitialized variable bug in the caller, nla_put_nh_group_stats().
Fixes: 5072ae00aea4 ("net: nexthop: Expose nexthop group HW stats to user space")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: Set the variable in nh_grp_hw_stats_update() instead of
nla_put_nh_group_stats().
net/ipv4/nexthop.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
index 74928a9d1aa4..535856b0f0ed 100644
--- a/net/ipv4/nexthop.c
+++ b/net/ipv4/nexthop.c
@@ -768,8 +768,10 @@ static int nh_grp_hw_stats_update(struct nexthop *nh, bool *hw_stats_used)
struct net *net = nh->net;
int err;
- if (nexthop_notifiers_is_empty(net))
+ if (nexthop_notifiers_is_empty(net)) {
+ *hw_stats_used = false;
return 0;
+ }
err = nh_notifier_grp_hw_stats_init(&info, nh);
if (err)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats()
2024-03-21 14:42 [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats() Dan Carpenter
@ 2024-03-21 15:35 ` Jiri Pirko
2024-03-21 17:36 ` Ido Schimmel
2024-03-23 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2024-03-21 15:35 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ido Schimmel, David Ahern, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Petr Machata, Kees Cook, netdev,
linux-kernel, kernel-janitors
Thu, Mar 21, 2024 at 03:42:18PM CET, dan.carpenter@linaro.org wrote:
>The "*hw_stats_used" value needs to be set on the success paths to prevent
>an uninitialized variable bug in the caller, nla_put_nh_group_stats().
>
>Fixes: 5072ae00aea4 ("net: nexthop: Expose nexthop group HW stats to user space")
>Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats()
2024-03-21 14:42 [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats() Dan Carpenter
2024-03-21 15:35 ` Jiri Pirko
@ 2024-03-21 17:36 ` Ido Schimmel
2024-03-23 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2024-03-21 17:36 UTC (permalink / raw)
To: Dan Carpenter
Cc: David Ahern, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Petr Machata, Kees Cook, netdev, linux-kernel,
kernel-janitors
On Thu, Mar 21, 2024 at 05:42:18PM +0300, Dan Carpenter wrote:
> The "*hw_stats_used" value needs to be set on the success paths to prevent
> an uninitialized variable bug in the caller, nla_put_nh_group_stats().
>
> Fixes: 5072ae00aea4 ("net: nexthop: Expose nexthop group HW stats to user space")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats()
2024-03-21 14:42 [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats() Dan Carpenter
2024-03-21 15:35 ` Jiri Pirko
2024-03-21 17:36 ` Ido Schimmel
@ 2024-03-23 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-03-23 1:10 UTC (permalink / raw)
To: Dan Carpenter
Cc: idosch, dsahern, davem, edumazet, kuba, pabeni, petrm, keescook,
netdev, linux-kernel, kernel-janitors
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 21 Mar 2024 17:42:18 +0300 you wrote:
> The "*hw_stats_used" value needs to be set on the success paths to prevent
> an uninitialized variable bug in the caller, nla_put_nh_group_stats().
>
> Fixes: 5072ae00aea4 ("net: nexthop: Expose nexthop group HW stats to user space")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: Set the variable in nh_grp_hw_stats_update() instead of
> nla_put_nh_group_stats().
>
> [...]
Here is the summary with links:
- [v2,net] nexthop: fix uninitialized variable in nla_put_nh_group_stats()
https://git.kernel.org/netdev/net/c/9145e2249ed6
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:[~2024-03-23 1:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21 14:42 [PATCH v2 net] nexthop: fix uninitialized variable in nla_put_nh_group_stats() Dan Carpenter
2024-03-21 15:35 ` Jiri Pirko
2024-03-21 17:36 ` Ido Schimmel
2024-03-23 1: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).