OSDN Git Service

xfrm: fix rcu usage in xfrm_get_type_offload
authorSabrina Dubroca <sd@queasysnail.net>
Sun, 31 Dec 2017 15:18:56 +0000 (16:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:07:46 +0000 (11:07 +0100)
commite8370258ca0bc9e630043157db862be2c5c341a6
tree390b90f3d540b04cf9df193de4d224ec761f3b90
parent85c31887a20da06fe2803b4ec1031b9af89c1899
xfrm: fix rcu usage in xfrm_get_type_offload

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