linux-stable/net/netlink
Jason A. Donenfeld eec434c573 netlink: put module reference if dump start fails
[ Upstream commit b87b6194be ]

Before, if cb->start() failed, the module reference would never be put,
because cb->cb_running is intentionally false at this point. Users are
generally annoyed by this because they can no longer unload modules that
leak references. Also, it may be possible to tediously wrap a reference
counter back to zero, especially since module.c still uses atomic_inc
instead of refcount_inc.

This patch expands the error path to simply call module_put if
cb->start() fails.

Fixes: 41c87425a1 ("netlink: do not set cb_running if dump's start() errs")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-08 22:41:17 -08:00
..
af_netlink.c netlink: put module reference if dump start fails 2018-03-08 22:41:17 -08:00
af_netlink.h af_netlink: ensure that NLMSG_DONE never fails in dumps 2017-11-24 08:37:03 +01:00
diag.c netlink/diag: report flags for netlink sockets 2017-04-05 07:13:56 -07:00
genetlink.c netlink: ensure to loop over all netns in genlmsg_multicast_allns() 2018-03-08 22:41:09 -08:00
Kconfig netlink: remove mmapped netlink support 2016-02-18 11:42:18 -05:00
Makefile netlink: Diag core and basic socket info dumping (v2) 2013-03-21 12:38:03 -04:00