All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "xfrm: fix rcu usage in xfrm_get_type_offload" has been added to the 4.14-stable tree
@ 2018-02-22 21:13 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2018-02-22 21:13 UTC (permalink / raw)
  To: sd, gregkh, steffen.klassert; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    xfrm: fix rcu usage in xfrm_get_type_offload

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:
     xfrm-fix-rcu-usage-in-xfrm_get_type_offload.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 2f10a61cee8fdb9f8da90f5db687e1862b22cf06 Mon Sep 17 00:00:00 2001
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Sun, 31 Dec 2017 16:18:56 +0100
Subject: xfrm: fix rcu usage in xfrm_get_type_offload

From: Sabrina Dubroca <sd@queasysnail.net>

commit 2f10a61cee8fdb9f8da90f5db687e1862b22cf06 upstream.

request_module can sleep, thus we cannot hold rcu_read_lock() while
calling it. The function also jumps back and takes rcu_read_lock()
again (in xfrm_state_get_afinfo()), resulting in an imbalance.

This codepath is triggered whenever a new offloaded state is created.

Fixes: ffdb5211da1c ("xfrm: Auto-load xfrm offload modules")
Reported-by: syzbot+ca425f44816d749e8eb49755567a75ee48cf4a30@syzkaller.appspotmail.com
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/xfrm/xfrm_state.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -313,13 +313,14 @@ retry:
 	if ((type && !try_module_get(type->owner)))
 		type = NULL;
 
+	rcu_read_unlock();
+
 	if (!type && try_load) {
 		request_module("xfrm-offload-%d-%d", family, proto);
 		try_load = 0;
 		goto retry;
 	}
 
-	rcu_read_unlock();
 	return type;
 }
 


Patches currently in stable-queue which might be from sd@queasysnail.net are

queue-4.14/xfrm-fix-rcu-usage-in-xfrm_get_type_offload.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-02-22 21:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-22 21:13 Patch "xfrm: fix rcu usage in xfrm_get_type_offload" has been added to the 4.14-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.