srcu: Take early exit on memory-allocation failure
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 10 Sep 2020 18:54:42 +0000 (11:54 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 20 Nov 2020 03:37:17 +0000 (19:37 -0800)
commit50edb988534c621a56ca103c0c16ac59e7399f01
treef923f4e709fdfeb57409ea54367190a79649e4a4
parent56292e8609e39537297a7468dda4d87b9bd81d6a
srcu: Take early exit on memory-allocation failure

It turns out that init_srcu_struct() can be invoked from usermode tasks,
and that fatal signals received by these tasks can cause memory-allocation
failures.  These failures are not handled well by init_srcu_struct(),
so much so that NULL pointer dereferences can result.  This commit
therefore causes init_srcu_struct() to take an early exit upon detection
of memory-allocation failure.

Link: https://lore.kernel.org/lkml/20200908144306.33355-1-aik@ozlabs.ru/
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/srcutree.c