linux-stable/net/netlink
Jakub Kicinski 154ba79c9f genetlink: correctly begin the iteration over policies
The return value from genl_op_iter_init() only tells us if
there are any policies but to begin the iteration (and therefore
load the first entry) we need to call genl_op_iter_next().
Note that it's safe to call genl_op_iter_next() on a family
with no ops, it will just return false.

This may lead to various crashes, a warning in
netlink_policy_dump_get_policy_idx() when policy is not found
or.. no problem at all if the kmalloc'ed memory happens to be
zeroed.

Fixes: b502b3185c ("genetlink: use iterator in the op to policy map dumping")
Link: https://lore.kernel.org/r/20221108204128.330287-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-11-09 10:26:51 -08:00
..
af_netlink.c netlink: Fix potential skb memleak in netlink_ack 2022-11-07 18:26:28 -08:00
af_netlink.h netlink: Add new socket option to enable strict checking on dumps 2018-10-08 10:39:04 -07:00
diag.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
genetlink.c genetlink: correctly begin the iteration over policies 2022-11-09 10:26:51 -08:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile netlink: add infrastructure to expose policies to userspace 2020-04-30 17:51:42 -07:00
policy.c net: genl: fix error path memory leak in policy dumping 2022-08-18 10:20:48 -07:00