[patch 2/2] [SCSI] target: unlock on error path in configfs

Previous thread: [patch 1/2] [SCSI] target: remove an unused variable by Dan Carpenter on Sunday, January 2, 2011 - 10:57 pm. (1 message)

Next thread: Re: [34-longterm 078/260] x86, tsc: Fix a preemption leak in restore_sched_clock_state() by Nico Schottelius on Monday, January 3, 2011 - 1:03 am. (1 message)
From: Dan Carpenter
Date: Sunday, January 2, 2011 - 10:59 pm

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;						\
--

Previous thread: [patch 1/2] [SCSI] target: remove an unused variable by Dan Carpenter on Sunday, January 2, 2011 - 10:57 pm. (1 message)

Next thread: Re: [34-longterm 078/260] x86, tsc: Fix a preemption leak in restore_sched_clock_state() by Nico Schottelius on Monday, January 3, 2011 - 1:03 am. (1 message)