public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Fries <David@Fries.net>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Evgeniy Polyakov <zbr@ioremap.net>,
	Matt Campbell <mattrcampbell@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2] w1: unlock correct lock on error in w1_seq_show()
Date: Tue, 2 Jun 2015 07:12:55 -0500	[thread overview]
Message-ID: <20150602121255.GA20149@spacedout.fries.net> (raw)
In-Reply-To: <20150601095632.GB897@mwanda>

Thanks for including me, I'm going to have to nack this though, it is
an error, but bus_mutex is correct, mutex is incorrect, so the other
two lock/unlock in that routine are the ones that need to be changed.

w1.h
 * @mutex:              protect most of w1_master
 * @bus_mutex:          pretect concurrent bus access

On Mon, Jun 01, 2015 at 12:56:32PM +0300, Dan Carpenter wrote:
> Smatch complains that we don't unlock "master->mutex" on this error
> path.  It looks like it is a typo and we unlock ->bus_mutext where
> ->mutex was intended.
> 
> Fixes: d9411e57dc7f ('w1: Add support for DS28EA00 sequence to w1-therm')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
> index 3351be6..79ecaf8 100644
> --- a/drivers/w1/slaves/w1_therm.c
> +++ b/drivers/w1/slaves/w1_therm.c
> @@ -412,7 +412,7 @@ static ssize_t w1_seq_show(struct device *device,
>  	c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq);
>  	return PAGE_SIZE - c;
>  error:
> -	mutex_unlock(&sl->master->bus_mutex);
> +	mutex_unlock(&sl->master->mutex);
>  	return -EIO;
>  }
>  

-- 
David Fries <david@fries.net>

  reply	other threads:[~2015-06-02 12:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01  9:56 [patch 2/2] w1: unlock correct lock on error in w1_seq_show() Dan Carpenter
2015-06-02 12:12 ` David Fries [this message]
     [not found]   ` <CA+gYwTGSBAjSPyUSUwknOmm8SoFzHFdJmoYPVA9yN61aWO7sdA@mail.gmail.com>
2015-06-03  1:07     ` David Fries
2015-06-03  1:54       ` Matt Campbell
2015-06-03  2:39         ` David Fries
2015-06-04  9:04   ` [patch] [patch 2/2 v2] w1: use " Dan Carpenter
2015-06-11 15:31     ` Evgeniy Polyakov
2015-06-11 23:41       ` David Fries

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=20150602121255.GA20149@spacedout.fries.net \
    --to=david@fries.net \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mattrcampbell@gmail.com \
    --cc=zbr@ioremap.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox