Skip to contentSkip to conversation

Unlock on error path in rv_unregister_reactor()

PATCH New Dan Carpenter 1 participant 1 message Aug 4, 2022

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

PATCH 1/1 Unlock on error path in rv_unregister_reactor()

Unlock the "rv_interface_lock" mutex before returning.

Fixes 04acadcb4453 ("rv: Add runtime reactors interface")
---
 kernel/trace/rv/rv_reactors.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
kernel/trace/rv/rv_reactors.c +4 -2
index a6522c196382..6aae106695b6 100644
@@ -329,6 +329,7 @@ int rv_register_reactor(struct rv_reactor *reactor)
 int rv_unregister_reactor(struct rv_reactor *reactor)
 {
 	struct rv_reactor_def *ptr, *next;
+	int ret = 0;
 
 	mutex_lock(&rv_interface_lock);
 
@@ -343,13 +344,14 @@ int rv_unregister_reactor(struct rv_reactor *reactor)
 				       ptr->reactor->name, ptr->counter);
 				printk(KERN_WARNING "rv: the rv_reactor %s cannot be removed\n",
 				       ptr->reactor->name);
-				return -EBUSY;
+				ret = -EBUSY;
+				break;
 			}
 		}
 	}
 
 	mutex_unlock(&rv_interface_lock);
-	return 0;
+	return ret;
 }
 
 /*
Signature · 1 line
2.35.1