From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Wed, 11 Jul 2012 06:34:43 +0000 Subject: [patch] iio: double unlock on error path Message-Id: <20120711063443.GE11812@elgon.mountain> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org We should be holding the mutex when we goto error_free_chans. Signed-off-by: Dan Carpenter 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: From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 11 Jul 2012 09:34:43 +0300 From: Dan Carpenter To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] iio: double unlock on error path Message-ID: <20120711063443.GE11812@elgon.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-ID: We should be holding the mutex when we goto error_free_chans. Signed-off-by: Dan Carpenter 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: