WSL2-Linux-Kernel/net/netlink
Jakub Kicinski b0672895d8 net: genl: fix error path memory leak in policy dumping
commit 249801360d upstream.

If construction of the array of policies fails when recording
non-first policy we need to unwind.

netlink_policy_dump_add_policy() itself also needs fixing as
it currently gives up on error without recording the allocated
pointer in the pstate pointer.

Reported-by: syzbot+dc54d9ba8153b216cae0@syzkaller.appspotmail.com
Fixes: 50a896cf2d ("genetlink: properly support per-op policy dumping")
Link: https://lore.kernel.org/r/20220816161939.577583-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:40:25 +02: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
af_netlink.c netlink: do not reset transport header in netlink_recvmsg() 2022-05-18 10:26:49 +02:00
af_netlink.h
diag.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
genetlink.c net: genl: fix error path memory leak in policy dumping 2022-08-25 11:40:25 +02:00
policy.c net: genl: fix error path memory leak in policy dumping 2022-08-25 11:40:25 +02:00