linux-stable/net/netlink
Jason A. Donenfeld b87b6194be netlink: put module reference if dump start fails
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>
2018-02-22 14:01:38 -05: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
af_netlink.c netlink: put module reference if dump start fails 2018-02-22 14:01:38 -05:00
af_netlink.h af_netlink: ensure that NLMSG_DONE never fails in dumps 2017-11-13 10:17:13 +09:00
diag.c rhashtable: Change rhashtable_walk_start to return void 2017-12-11 09:58:38 -05:00
genetlink.c netlink: ensure to loop over all netns in genlmsg_multicast_allns() 2018-02-08 14:03:18 -05:00