Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nexthop: fix uninitialized variable in nla_put_nh_group_stats()

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>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/f08ac289-d57f-4a1a-830f-cf9a0563cb9c@moroto.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dan Carpenter and committed by
Jakub Kicinski
9145e224 f6c8f5e8

+3 -1
+3 -1
net/ipv4/nexthop.c
··· 768 768 struct net *net = nh->net; 769 769 int err; 770 770 771 - if (nexthop_notifiers_is_empty(net)) 771 + if (nexthop_notifiers_is_empty(net)) { 772 + *hw_stats_used = false; 772 773 return 0; 774 + } 773 775 774 776 err = nh_notifier_grp_hw_stats_init(&info, nh); 775 777 if (err)