linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/2] [SCSI] target: unlock on error path in configfs
@ 2011-01-03  5:59 Dan Carpenter
  2011-01-04 23:40 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-01-03  5:59 UTC (permalink / raw)
  To: Nicholas A. Bellinger
  Cc: James Bottomley, linux-kernel, kernel-janitors, linux-scsi

If the user wrote a wrong value to the file the it would lead to a dead
lock eventually.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index d7b977d..2764510 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -660,6 +660,7 @@ static ssize_t target_core_dev_store_attr_##_name(			\
 	}								\
 	ret = strict_strtoul(page, 0, &val);				\
 	if (ret < 0) {							\
+		spin_unlock(&se_dev->se_dev_lock);                      \
 		printk(KERN_ERR "strict_strtoul() failed with"		\
 			" ret: %d\n", ret);				\
 		return -EINVAL;						\

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 2/2] [SCSI] target: unlock on error path in configfs
  2011-01-03  5:59 [patch 2/2] [SCSI] target: unlock on error path in configfs Dan Carpenter
@ 2011-01-04 23:40 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2011-01-04 23:40 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: James Bottomley, linux-kernel, kernel-janitors, linux-scsi

On Mon, 2011-01-03 at 08:59 +0300, Dan Carpenter wrote:
> If the user wrote a wrong value to the file the it would lead to a dead
> lock eventually.
> 

Good catch on this one.  Commited as 827447968 and pushed into
lio-core-2.6.git.

Thanks!

--nab

> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
> index d7b977d..2764510 100644
> --- a/drivers/target/target_core_configfs.c
> +++ b/drivers/target/target_core_configfs.c
> @@ -660,6 +660,7 @@ static ssize_t target_core_dev_store_attr_##_name(			\
>  	}								\
>  	ret = strict_strtoul(page, 0, &val);				\
>  	if (ret < 0) {							\
> +		spin_unlock(&se_dev->se_dev_lock);                      \
>  		printk(KERN_ERR "strict_strtoul() failed with"		\
>  			" ret: %d\n", ret);				\
>  		return -EINVAL;						\

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-04 23:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-03  5:59 [patch 2/2] [SCSI] target: unlock on error path in configfs Dan Carpenter
2011-01-04 23:40 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).