All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] iio: double unlock on error path
Date: Wed, 11 Jul 2012 06:34:43 +0000	[thread overview]
Message-ID: <20120711063443.GE11812@elgon.mountain> (raw)

We should be holding the mutex when we goto error_free_chans.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index e2aded0..b5afc2f 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -198,11 +198,12 @@ struct iio_channel *iio_channel_get_all(const char *name)
 		iio_device_get(chans[mapind].indio_dev);
 		mapind++;
 	}
-	mutex_unlock(&iio_map_list_lock);
 	if (mapind = 0) {
 		ret = -ENODEV;
 		goto error_free_chans;
 	}
+	mutex_unlock(&iio_map_list_lock);
+
 	return chans;
 
 error_free_chans:

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] iio: double unlock on error path
Date: Wed, 11 Jul 2012 09:34:43 +0300	[thread overview]
Message-ID: <20120711063443.GE11812@elgon.mountain> (raw)

We should be holding the mutex when we goto error_free_chans.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index e2aded0..b5afc2f 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -198,11 +198,12 @@ struct iio_channel *iio_channel_get_all(const char *name)
 		iio_device_get(chans[mapind].indio_dev);
 		mapind++;
 	}
-	mutex_unlock(&iio_map_list_lock);
 	if (mapind == 0) {
 		ret = -ENODEV;
 		goto error_free_chans;
 	}
+	mutex_unlock(&iio_map_list_lock);
+
 	return chans;
 
 error_free_chans:

             reply	other threads:[~2012-07-11  6:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11  6:34 Dan Carpenter [this message]
2012-07-11  6:34 ` [patch] iio: double unlock on error path Dan Carpenter
2012-07-12 19:24 ` Jonathan Cameron
2012-07-12 19:24   ` Jonathan Cameron

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=20120711063443.GE11812@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=jic23@cam.ac.uk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    /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.