Patch "netlink: put module reference if dump start fails" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
netlink: put module reference if dump start fails
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
netlink-put-module-reference-if-dump-start-fails.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
b87b6194be631c94785fe93398651e804ed43e28Mon Sep 17 00:00:00 2001
From: "Jason A. Donenfeld" <[email protected]>
Date: Wed, 21 Feb 2018 04:41:59 +0100
Subject: netlink: put module reference if dump start fails
From: Jason A. Donenfeld <[email protected]>
commit b87b6194be631c94785fe93398651e804ed43e28 upstream.
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.
--- net/netlink/af_netlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netlink/af_netlink.c +3 -1
@@ -2258,7 +2258,7 @@ int __netlink_dump_start(struct sock *ssif (cb->start) { ret = cb->start (cb);if (ret) - goto error_unlock; + goto error_put; } nlk->cb_running = true;
@@ -2278,6 +2278,8 @@ int __netlink_dump_start(struct sock *ss*/ return -EINTR ; +error_put: +module_put (control->module); error_unlock:sock_put (sk);mutex_unlock (nlk->cb_mutex);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/netlink-put-module-reference-if-dump-start-fails.patch