All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Grover <andy.grover@oracle.com>
To: Julia Lawall <julia@diku.dk>
Cc: "David S. Miller" <davem@davemloft.net>,
	rds-devel@oss.oracle.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Zach Brown <zach.brown@oracle.com>
Subject: Re: [PATCH 1/17] net/rds: Add missing mutex_unlock
Date: Wed, 26 May 2010 17:55:02 +0000	[thread overview]
Message-ID: <4BFD6076.9000005@oracle.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1005261754030.23743@ask.diku.dk>

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;
>   	}
>


WARNING: multiple messages have this Message-ID (diff)
From: Andy Grover <andy.grover@oracle.com>
To: Julia Lawall <julia@diku.dk>
Cc: "David S. Miller" <davem@davemloft.net>,
	rds-devel@oss.oracle.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Zach Brown <zach.brown@oracle.com>
Subject: Re: [PATCH 1/17] net/rds: Add missing mutex_unlock
Date: Wed, 26 May 2010 10:55:02 -0700	[thread overview]
Message-ID: <4BFD6076.9000005@oracle.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1005261754030.23743@ask.diku.dk>

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;
>   	}
>


  reply	other threads:[~2010-05-26 17:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 15:54 [PATCH 1/17] net/rds: Add missing mutex_unlock Julia Lawall
2010-05-26 15:54 ` Julia Lawall
2010-05-26 17:55 ` Andy Grover [this message]
2010-05-26 17:55   ` Andy Grover
2010-05-29  7:19   ` David Miller
2010-05-29  7:19     ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BFD6076.9000005@oracle.com \
    --to=andy.grover@oracle.com \
    --cc=davem@davemloft.net \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=zach.brown@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.