* Patch "netlink: put module reference if dump start fails" has been added to the 4.14-stable tree
@ 2018-03-07 3:30 gregkh
2018-03-07 17:12 ` Jason A. Donenfeld
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2018-03-07 3:30 UTC (permalink / raw)
To: Jason, davem, gregkh; +Cc: stable, stable-commits
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.14-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.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From foo@baz Tue Mar 6 19:02:12 PST 2018
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Wed, 21 Feb 2018 04:41:59 +0100
Subject: netlink: put module reference if dump start fails
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
[ Upstream commit b87b6194be631c94785fe93398651e804ed43e28 ]
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: 41c87425a1ac ("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>
---
net/netlink/af_netlink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2276,7 +2276,7 @@ int __netlink_dump_start(struct sock *ss
if (cb->start) {
ret = cb->start(cb);
if (ret)
- goto error_unlock;
+ goto error_put;
}
nlk->cb_running = true;
@@ -2296,6 +2296,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 Jason@zx2c4.com are
queue-4.14/netlink-put-module-reference-if-dump-start-fails.patch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch "netlink: put module reference if dump start fails" has been added to the 4.14-stable tree
2018-03-07 3:30 Patch "netlink: put module reference if dump start fails" has been added to the 4.14-stable tree gregkh
@ 2018-03-07 17:12 ` Jason A. Donenfeld
2018-03-07 17:39 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2018-03-07 17:12 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: stable
On Wed, Mar 7, 2018 at 4:30 AM, <gregkh@linuxfoundation.org> wrote:
> queue-4.14/netlink-put-module-reference-if-dump-start-fails.patch
FYI, this patch is useful for 4.16-rc0+, 4.15+, 4.14+, 4.13.14+, and
4.9.63+. Looks like 16, 15, and 14 you have covered, and 13 you don't
care about anymore. But you might want to apply this to 4.9, as it
affects the in-tree net/ipv6/ila/ila_xlat.c driver, which is a
tristate, meaning its refcount is affected by the bug this patch
fixes. The patch appears to apply cleanly.
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch "netlink: put module reference if dump start fails" has been added to the 4.14-stable tree
2018-03-07 17:12 ` Jason A. Donenfeld
@ 2018-03-07 17:39 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2018-03-07 17:39 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: stable
On Wed, Mar 07, 2018 at 06:12:13PM +0100, Jason A. Donenfeld wrote:
> On Wed, Mar 7, 2018 at 4:30 AM, <gregkh@linuxfoundation.org> wrote:
> > queue-4.14/netlink-put-module-reference-if-dump-start-fails.patch
>
> FYI, this patch is useful for 4.16-rc0+, 4.15+, 4.14+, 4.13.14+, and
> 4.9.63+. Looks like 16, 15, and 14 you have covered, and 13 you don't
> care about anymore. But you might want to apply this to 4.9, as it
> affects the in-tree net/ipv6/ila/ila_xlat.c driver, which is a
> tristate, meaning its refcount is affected by the bug this patch
> fixes. The patch appears to apply cleanly.
Thanks for letting me know, now queued up.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-07 17:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07 3:30 Patch "netlink: put module reference if dump start fails" has been added to the 4.14-stable tree gregkh
2018-03-07 17:12 ` Jason A. Donenfeld
2018-03-07 17:39 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox