diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 06bfe61d3cd3..c4eb06d37ae9 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2959,6 +2959,10 @@ __call_rcu(struct rcu_head *head, rcu_callback_t func) /* Misaligned rcu_head! */ WARN_ON_ONCE((unsigned long)head & (sizeof(void *) - 1)); + /* Avoid NULL dereference if callback is NULL. */ + if (WARN_ON_ONCE(!func)) + return; + if (debug_rcu_head_queue(head)) { /* * Probable double call_rcu(), so leak the callback.