diff mbox

[rdma-core] iwpmd: fix double mutex unlock

Message ID 1517413071-20438-1-git-send-email-bharat@chelsio.com (mailing list archive)
State Accepted
Delegated to: Leon Romanovsky
Headers show

Commit Message

Potnuri Bharat Teja Jan. 31, 2018, 3:37 p.m. UTC
pthread_mutex_unlock() is used twice and this patch fixes it.

Fixes: be3fbf85b ("iwpmd: use ccan list.h for pending_messages")
Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
---
 iwpmd/iwarp_pm_helper.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Steve Wise Jan. 31, 2018, 3:40 p.m. UTC | #1
> 
> pthread_mutex_unlock() is used twice and this patch fixes it.
> 
> Fixes: be3fbf85b ("iwpmd: use ccan list.h for pending_messages")
> Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> ---
>  iwpmd/iwarp_pm_helper.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/iwpmd/iwarp_pm_helper.c b/iwpmd/iwarp_pm_helper.c
> index bebc151f329b..b8c230189d50 100644
> --- a/iwpmd/iwarp_pm_helper.c
> +++ b/iwpmd/iwarp_pm_helper.c
> @@ -578,7 +578,6 @@ int add_iwpm_pending_msg(iwpm_send_msg
> *send_msg)
> 
>  	pthread_mutex_lock(&pending_msg_mutex);
>  	list_add(&pending_messages, &pending_msg->entry);
> - 	pthread_mutex_unlock(&pending_msg_mutex);
>  	pthread_mutex_unlock(&pending_msg_mutex);
>  	/* signal the thread that a new message has been posted */
>  	pthread_cond_signal(&cond_pending_msg);

Good catch.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Wise Jan. 31, 2018, 4:04 p.m. UTC | #2
> >
> > pthread_mutex_unlock() is used twice and this patch fixes it.
> >
> > Fixes: be3fbf85b ("iwpmd: use ccan list.h for pending_messages")
> > Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> > ---
> >  iwpmd/iwarp_pm_helper.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/iwpmd/iwarp_pm_helper.c b/iwpmd/iwarp_pm_helper.c
> > index bebc151f329b..b8c230189d50 100644
> > --- a/iwpmd/iwarp_pm_helper.c
> > +++ b/iwpmd/iwarp_pm_helper.c
> > @@ -578,7 +578,6 @@ int add_iwpm_pending_msg(iwpm_send_msg
> > *send_msg)
> >
> >  	pthread_mutex_lock(&pending_msg_mutex);
> >  	list_add(&pending_messages, &pending_msg->entry);
> > - 	pthread_mutex_unlock(&pending_msg_mutex);
> >  	pthread_mutex_unlock(&pending_msg_mutex);
> >  	/* signal the thread that a new message has been posted */
> >  	pthread_cond_signal(&cond_pending_msg);
> 
> Good catch.
> 
> Reviewed-by: Steve Wise <swise@opengridcomputing.com>

And this definitely needs to flow to stable.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Jan. 31, 2018, 9:06 p.m. UTC | #3
On Wed, 2018-01-31 at 10:04 -0600, Steve Wise wrote:
> > > 
> > > pthread_mutex_unlock() is used twice and this patch fixes it.
> > > 
> > > Fixes: be3fbf85b ("iwpmd: use ccan list.h for pending_messages")
> > > Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> > > ---
> > >  iwpmd/iwarp_pm_helper.c | 1 -
> > >  1 file changed, 1 deletion(-)
> > > 
> > > diff --git a/iwpmd/iwarp_pm_helper.c b/iwpmd/iwarp_pm_helper.c
> > > index bebc151f329b..b8c230189d50 100644
> > > --- a/iwpmd/iwarp_pm_helper.c
> > > +++ b/iwpmd/iwarp_pm_helper.c
> > > @@ -578,7 +578,6 @@ int add_iwpm_pending_msg(iwpm_send_msg
> > > *send_msg)
> > > 
> > >  	pthread_mutex_lock(&pending_msg_mutex);
> > >  	list_add(&pending_messages, &pending_msg->entry);
> > > - 	pthread_mutex_unlock(&pending_msg_mutex);
> > >  	pthread_mutex_unlock(&pending_msg_mutex);
> > >  	/* signal the thread that a new message has been posted */
> > >  	pthread_cond_signal(&cond_pending_msg);
> > 
> > Good catch.
> > 
> > Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> 
> And this definitely needs to flow to stable.
> 

Applied to master branch, thanks.
Steve Wise Jan. 31, 2018, 9:12 p.m. UTC | #4
> Subject: Re: [PATCH rdma-core] iwpmd: fix double mutex unlock
> 
> On Wed, 2018-01-31 at 10:04 -0600, Steve Wise wrote:
> > > >
> > > > pthread_mutex_unlock() is used twice and this patch fixes it.
> > > >
> > > > Fixes: be3fbf85b ("iwpmd: use ccan list.h for pending_messages")
> > > > Signed-off-by: Potnuri Bharat Teja <bharat@chelsio.com>
> > > > ---
> > > >  iwpmd/iwarp_pm_helper.c | 1 -
> > > >  1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/iwpmd/iwarp_pm_helper.c b/iwpmd/iwarp_pm_helper.c
> > > > index bebc151f329b..b8c230189d50 100644
> > > > --- a/iwpmd/iwarp_pm_helper.c
> > > > +++ b/iwpmd/iwarp_pm_helper.c
> > > > @@ -578,7 +578,6 @@ int add_iwpm_pending_msg(iwpm_send_msg
> > > > *send_msg)
> > > >
> > > >  	pthread_mutex_lock(&pending_msg_mutex);
> > > >  	list_add(&pending_messages, &pending_msg->entry);
> > > > - 	pthread_mutex_unlock(&pending_msg_mutex);
> > > >  	pthread_mutex_unlock(&pending_msg_mutex);
> > > >  	/* signal the thread that a new message has been posted */
> > > >  	pthread_cond_signal(&cond_pending_msg);
> > >
> > > Good catch.
> > >
> > > Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> >
> > And this definitely needs to flow to stable.
> >
> 
> Applied to master branch, thanks.
> 

Thanks Doug.  Do I need to do some process magic to get it into stable and spin a 16.x.y point release for the EWG to pull into OFED-4.8-2?  

Steve.



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Jan. 31, 2018, 9:28 p.m. UTC | #5
On Wed, 2018-01-31 at 15:12 -0600, Steve Wise wrote:
> > Applied to master branch, thanks.
> > 
> 
> Thanks Doug.  Do I need to do some process magic to get it into stable and spin a 16.x.y point release for the EWG to pull into OFED-4.8-2?  

I added a comment to the commit on github and tagged you and Nicolas. 
He should pull it back for you.
Steve Wise Jan. 31, 2018, 9:56 p.m. UTC | #6
> 
> On Wed, 2018-01-31 at 15:12 -0600, Steve Wise wrote:
> > > Applied to master branch, thanks.
> > >
> >
> > Thanks Doug.  Do I need to do some process magic to get it into stable and
> spin a 16.x.y point release for the EWG to pull into OFED-4.8-2?
> 
> I added a comment to the commit on github and tagged you and Nicolas.
> He should pull it back for you.
> 

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/iwpmd/iwarp_pm_helper.c b/iwpmd/iwarp_pm_helper.c
index bebc151f329b..b8c230189d50 100644
--- a/iwpmd/iwarp_pm_helper.c
+++ b/iwpmd/iwarp_pm_helper.c
@@ -578,7 +578,6 @@  int add_iwpm_pending_msg(iwpm_send_msg *send_msg)
 
 	pthread_mutex_lock(&pending_msg_mutex);
 	list_add(&pending_messages, &pending_msg->entry);
- 	pthread_mutex_unlock(&pending_msg_mutex);
 	pthread_mutex_unlock(&pending_msg_mutex);
 	/* signal the thread that a new message has been posted */
 	pthread_cond_signal(&cond_pending_msg);