* [PATCH 1/17] net/rds: Add missing mutex_unlock
@ 2010-05-26 15:54 Julia Lawall
2010-05-26 17:55 ` Andy Grover
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2010-05-26 15:54 UTC (permalink / raw)
To: Andy Grover, David S. Miller, rds-devel, netdev, linux-kernel,
kernel-janitors
From: Julia Lawall <julia@diku.dk>
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>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
net/rds/ib_cm.c | 1 +
net/rds/iw_cm.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 10ed0d5..f688327 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -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;
}
diff --git a/net/rds/iw_cm.c b/net/rds/iw_cm.c
index a9d951b..b5dd6ac 100644
--- a/net/rds/iw_cm.c
+++ b/net/rds/iw_cm.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/17] net/rds: Add missing mutex_unlock
2010-05-26 15:54 [PATCH 1/17] net/rds: Add missing mutex_unlock Julia Lawall
@ 2010-05-26 17:55 ` Andy Grover
2010-05-29 7:19 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Andy Grover @ 2010-05-26 17:55 UTC (permalink / raw)
To: Julia Lawall
Cc: David S. Miller, rds-devel, netdev, linux-kernel, kernel-janitors,
Zach Brown
Reviewed-by: Zach Brown <zach.brown@oracle.com>
Acked-by: Andy Grover <andy.grover@oracle.com>
-- Andy
On 05/26/2010 08:54 AM, Julia Lawall wrote:
> From: Julia Lawall<julia@diku.dk>
>
> 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>
>
> Signed-off-by: Julia Lawall<julia@diku.dk>
>
> ---
> net/rds/ib_cm.c | 1 +
> net/rds/iw_cm.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
> index 10ed0d5..f688327 100644
> --- a/net/rds/ib_cm.c
> +++ b/net/rds/ib_cm.c
> @@ -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;
> }
>
> diff --git a/net/rds/iw_cm.c b/net/rds/iw_cm.c
> index a9d951b..b5dd6ac 100644
> --- a/net/rds/iw_cm.c
> +++ b/net/rds/iw_cm.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/17] net/rds: Add missing mutex_unlock
2010-05-26 17:55 ` Andy Grover
@ 2010-05-29 7:19 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-05-29 7:19 UTC (permalink / raw)
To: andy.grover
Cc: julia, rds-devel, netdev, linux-kernel, kernel-janitors,
zach.brown
From: Andy Grover <andy.grover@oracle.com>
Date: Wed, 26 May 2010 10:55:02 -0700
> Reviewed-by: Zach Brown <zach.brown@oracle.com>
> Acked-by: Andy Grover <andy.grover@oracle.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-29 7:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 15:54 [PATCH 1/17] net/rds: Add missing mutex_unlock Julia Lawall
2010-05-26 17:55 ` Andy Grover
2010-05-29 7:19 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).