]> git.baikalelectronics.ru Git - kernel.git/commit
netlink: put module reference if dump start fails
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 21 Feb 2018 03:41:59 +0000 (04:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Feb 2018 19:01:38 +0000 (14:01 -0500)
commitc6b0a35367bc6ca313c650b84abb7bbd8edf12c6
tree35c9afc8955c9e340ffa87a8e9cbc67ffde817bd
parentf36ff77ade3923dedd6be21995dd312e9ffa8170
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: e088b65d39ef ("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>
net/netlink/af_netlink.c