Skip to contentSkip to conversation

target: unlock on error path in configfs

PATCH In review Dan Carpenter 2 participants 2 messages Jan 3, 2011 – Jan 4, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 target: unlock on error path in configfs

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

drivers/target/target_core_configfs.c +1 -0
index d7b977d..2764510 100644
@@ -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;						\
#1 lore raw
Quoted 3 lines · Dan Carpenter

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

Quoted 14 lines
drivers/target/target_core_configfs.c +1 -0
index d7b977d..2764510 100644
@@ -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;						\