rcutorture: Avoid fake-writer use of undefined primitives
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 8 Dec 2017 18:48:41 +0000 (10:48 -0800)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 21 Feb 2018 00:21:56 +0000 (16:21 -0800)
commiteb0339934f1d468ff09d9be1c608c89cb1da850b
tree1ee5394b2d8046eccd2165a853ee1ff5a5338965
parente0d31a34c6db6381bfc630a9ee93f05b9447dcc3
rcutorture: Avoid fake-writer use of undefined primitives

Currently the rcu_torture_fakewriter() function invokes cur_ops->sync()
and cur_ops->exp_sync() without first checking to see if they are in
fact non-NULL.  This results in kernel NULL pointer dereferences when
testing RCU implementations that choose not to provide the full set of
primitives.  Given that it is perfectly reasonable to have specialized
RCU implementations that provide only a subset of the RCU API, this is
a bug in rcutorture.

This commit therefore makes rcu_torture_fakewriter() check function
pointers before invoking them, thus allowing it to test subsetted
RCU implementations.

Reported-by: Lihao Liang <lianglihao@huawei.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
kernel/rcu/rcutorture.c