livepatch: fix RCU usage in klp_find_external_symbol()

While one must hold RCU-sched (aka. preempt_disable) for find_symbol()
one must equally hold it over the use of the object returned.

The moment you release the RCU-sched read lock, the object can be dead
and gone.

[ change subject line to be aligned with other patches]
Cc: Seth Jennings <>
Cc: Josh Poimboeuf <>
Cc: Masami Hiramatsu <>
Cc: Miroslav Benes <>
Cc: Petr Mladek <>
Cc: Jiri Kosina <>
Cc: "Paul E. McKenney" <>
Cc: Rusty Russell <>
Signed-off-by: Peter Zijlstra (Intel) <>
Reviewed-by: Masami Hiramatsu <>
Acked-by: Paul E. McKenney <>
Acked-by: Josh Poimboeuf <>
Signed-off-by: Jiri Kosina <>
1 file changed