Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f10a61c authored by Sabrina Dubroca's avatar Sabrina Dubroca Committed by Steffen Klassert
Browse files

xfrm: fix rcu usage in xfrm_get_type_offload



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: ffdb5211 ("xfrm: Auto-load xfrm offload modules")
Reported-by: default avatar <syzbot+ca425f44816d749e8eb49755567a75ee48cf4a30@syzkaller.appspotmail.com>
Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 4e765b49
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -313,13 +313,14 @@ xfrm_get_type_offload(u8 proto, unsigned short family, bool try_load)
	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;
}