Skip to contentSkip to conversation

rcutorture: Fix error codes in rcu_torture_read_exit_init()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcutorture: Fix error codes in rcu_torture_read_exit_init()

The rcu_torture_read_exit_init() function is supposed to return negative error codes which get propagated back down the call tree but the current code returns true on failure.

Fixes e02882cd57e3 ("rcutorture: Add races with task-exit processing")
---
 kernel/rcu/rcutorture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/rcutorture.c +2 -2
index 269881e51dc6d..5270674128029 100644
@@ -2434,10 +2434,10 @@ static int rcu_torture_read_exit(void *unused)
 	return 0;
 }
 
-static bool rcu_torture_read_exit_init(void)
+static int rcu_torture_read_exit_init(void)
 {
 	if (read_exit <= 0)
-		return true;
+		return -EINVAL;
 	init_waitqueue_head(&read_exit_wq);
 	read_exit_child_stop = false;
 	read_exit_child_stopped = false;
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 6 lines · Dan Carpenter

The rcu_torture_read_exit_init() function is supposed to return negative error codes which get propagated back down the call tree but the current code returns true on failure.

Fixes e02882cd57e3 ("rcutorture: Add races with task-exit processing")

Good catch! Talk about code sort of working by accident!!!

Thank you, and I folded this into the original commit with attribution.

Thanx, Paul

Quoted 24 lines
---
 kernel/rcu/rcutorture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/rcutorture.c +2 -2
index 269881e51dc6d..5270674128029 100644
@@ -2434,10 +2434,10 @@ static int rcu_torture_read_exit(void *unused)
 	return 0;
 }
 
-static bool rcu_torture_read_exit_init(void)
+static int rcu_torture_read_exit_init(void)
 {
 	if (read_exit <= 0)
-		return true;
+		return -EINVAL;
 	init_waitqueue_head(&read_exit_wq);
 	read_exit_child_stop = false;
 	read_exit_child_stopped = false;
Signature · 1 line
2.26.2