]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcutorture: Complain when invalid SRCU reader_flavor is specified
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 9 Jan 2025 18:14:53 +0000 (10:14 -0800)
committerBoqun Feng <boqun.feng@gmail.com>
Wed, 5 Feb 2025 15:14:40 +0000 (07:14 -0800)
Currently, rcutorture ignores reader_flavor bits that are not in the
SRCU_READ_FLAVOR_ALL bitmask, which could confuse rcutorture users into
believing buggy patches had been fully tested.  This commit therefore
produces a splat in this case.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
kernel/rcu/rcutorture.c

index 9c9a349b9c7f871e332c02004e40539b3e8e64f7..be4e3c6b912fe36342583d16cc00f237f8b193e5 100644 (file)
@@ -689,6 +689,8 @@ static int srcu_torture_read_lock(void)
        int idx;
        int ret = 0;
 
+       WARN_ON_ONCE(reader_flavor & ~SRCU_READ_FLAVOR_ALL);
+
        if ((reader_flavor & SRCU_READ_FLAVOR_NORMAL) || !(reader_flavor & SRCU_READ_FLAVOR_ALL)) {
                idx = srcu_read_lock(srcu_ctlp);
                WARN_ON_ONCE(idx & ~0x1);