net/rds: Add missing mutex_unlock
PATCH 1/17 net/rds: Add missing mutex_unlock
From: Julia Lawall <[email protected]>
Add a mutex_unlock missing on the error path. In each case, whenever the label out is reached from elsewhere in the function, mutex is not locked.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression E1;
@@
* mutex_lock(E1);
<+... when != E1
if (...) {
... when != E1* return ...;
}
...+>
* mutex_unlock(E1);
// </smpl>
--- net/rds/ib_cm.c | 1 + net/rds/iw_cm.c | 1 + 2 files changed, 2 insertions(+)
net/rds/ib_cm.c +1 -0
@@ -475,6 +475,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id, err =rds_ib_setup_qp (conn);if (err) {rds_ib_conn_error (conn,"rds_ib_setup_qp failed (%d)\n" , err); +mutex_unlock (&conn->c_cm_lock); goto out; }
net/rds/iw_cm.c +1 -0
@@ -452,6 +452,7 @@ int rds_iw_cm_handle_connect(struct rdma_cm_id *cm_id, err =rds_iw_setup_qp (conn);if (err) {rds_iw_conn_error (conn,"rds_iw_setup_qp failed (%d)\n" , err); +mutex_unlock (&conn->c_cm_lock); goto out; }
-- Andy
Quoted 54 lines · Julia Lawall
From: Julia Lawall<[email protected]>
Add a
mutex_unlockmissing on the error path. In each case, whenever the label out is reached from elsewhere in the function, mutex is not locked.The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)//<smpl>
@@
expression E1;
@@* mutex_lock(E1); <+... when != E1 if (...) { ... when != E1 * return ...; } ...+>*
mutex_unlock(E1);
//</smpl>Signed-off-by Julia Lawall<[email protected]>--- net/rds/ib_cm.c | 1 + net/rds/iw_cm.c | 1 + 2 files changed, 2 insertions(+)net/rds/ib_cm.c +1
-0@@ -475,6 +475,7 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id, err =rds_ib_setup_qp (conn);if (err) {rds_ib_conn_error (conn,"rds_ib_setup_qp failed (%d)\n" , err); +mutex_unlock (&conn->c_cm_lock); goto out; }net/rds/iw_cm.c +1
-0@@ -452,6 +452,7 @@ int rds_iw_cm_handle_connect(struct rdma_cm_id *cm_id, err =rds_iw_setup_qp (conn);if (err) {rds_iw_conn_error (conn,"rds_iw_setup_qp failed (%d)\n" , err); +mutex_unlock (&conn->c_cm_lock); goto out; }
From: Andy Grover <[email protected]>
Date: Wed, 26 May 2010 10:55:02 -0700
Quoted 2 lines
Reviewed-by Zach Brown <[email protected]>Acked-by Andy Grover <[email protected]>
Applied.