Skip to contentSkip to conversation

Release device_hotplug_lock when store_mem_state returns EINVAL

PATCH In review Yasuaki Ishimatsu 3 participants 5 messages Oct 11, 2013 – Oct 17, 2013

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

PATCH 1/1 Release device_hotplug_lock when store_mem_state returns EINVAL

When inserting a wrong value to /sys/devices/system/memory/memoryX/state file, following messages are shown. And device_hotplug_lock is never released.

================================================
[ BUG: lock held when returning to user space! ]
3.12.0-rc4-debug+ #3 Tainted: G W
------------------------------------------------
bash/6442 is leaving the kernel with locks still held!
1 lock held by bash/6442:
#0: (device_hotplug_lock){+.+.+.}, at: [<ffffffff8146cbb5>] lock_device_hotplug_sysfs+0x15/0x50

This issue was introdued by commit fa2be40 (drivers: base: use standard device online/offline for state change).

This patch releases device_hotplug_lcok when store_mem_state returns EINVAL.

CC Toshi Kani <[email protected]>
CC Seth Jennings <[email protected]>
CC Greg Kroah-Hartman <[email protected]>
---
 drivers/base/memory.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/base/memory.c +5 -2
index 9e59f65..bece691 100644
@@ -333,8 +333,10 @@ store_mem_state(struct device *dev,
 		online_type = ONLINE_KEEP;
 	else if (!strncmp(buf, "offline", min_t(int, count, 7)))
 		online_type = -1;
-	else
-		return -EINVAL;
+	else {
+		ret = -EINVAL;
+		goto err;
+	}
 
 	switch (online_type) {
 	case ONLINE_KERNEL:
@@ -357,6 +359,7 @@ store_mem_state(struct device *dev,
 		ret = -EINVAL; /* should never happen */
 	}
 
+err:
 	unlock_device_hotplug();
 
 	if (ret)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#1 lore raw
Quoted 14 lines · Yasuaki Ishimatsu

When inserting a wrong value to /sys/devices/system/memory/memoryX/state file, following messages are shown. And device_hotplug_lock is never released.

================================================
[ BUG: lock held when returning to user space! ]
3.12.0-rc4-debug+ #3 Tainted: G W
------------------------------------------------
bash/6442 is leaving the kernel with locks still held!
1 lock held by bash/6442:
#0: (device_hotplug_lock){+.+.+.}, at: [<ffffffff8146cbb5>] lock_device_hotplug_sysfs+0x15/0x50

This issue was introdued by commit fa2be40 (drivers: base: use standard device online/offline for state change).

Quoted 6 lines

This patch releases device_hotplug_lcok when store_mem_state returns EINVAL.

CC Toshi Kani <[email protected]>
CC Seth Jennings <[email protected]>
CC Greg Kroah-Hartman <[email protected]>

Is this needed in 3.12-final, and possibly older kernel releases as well (3.10, 3.11, etc.)? Or is it ok for 3.13?

thanks,

greg k-h

#2 lore raw

Hi Greg,

Quoted 17 lines · Greg KH
Quoted 16 lines · Yasuaki Ishimatsu

When inserting a wrong value to /sys/devices/system/memory/memoryX/state file, following messages are shown. And device_hotplug_lock is never released.

================================================
[ BUG: lock held when returning to user space! ]
3.12.0-rc4-debug+ #3 Tainted: G W
------------------------------------------------
bash/6442 is leaving the kernel with locks still held!
1 lock held by bash/6442:
#0: (device_hotplug_lock){+.+.+.}, at: [<ffffffff8146cbb5>] lock_device_hotplug_sysfs+0x15/0x50

This issue was introdued by commit fa2be40 (drivers: base: use standard device online/offline for state change).

This patch releases device_hotplug_lcok when store_mem_state returns EINVAL.

Quoted 7 lines
Quoted 4 lines
CC Toshi Kani <[email protected]>
CC Seth Jennings <[email protected]>
CC Greg Kroah-Hartman <[email protected]>

Is this needed in 3.12-final, and possibly older kernel releases as well (3.10, 3.11, etc.)? Or is it ok for 3.13?

The patch is needed in 3.12 because this problem has occurred since 3.12-rc1.

Thanks,
Yasuaki Ishimatsu

Quoted 5 lines

thanks,

greg k-h

Reviewed-by on v1 1/1
#3 lore raw
In reply to Yasuaki Ishimatsu
Quoted 14 lines · Yasuaki Ishimatsu

When inserting a wrong value to /sys/devices/system/memory/memoryX/state file, following messages are shown. And device_hotplug_lock is never released.

================================================
[ BUG: lock held when returning to user space! ]
3.12.0-rc4-debug+ #3 Tainted: G W
------------------------------------------------
bash/6442 is leaving the kernel with locks still held!
1 lock held by bash/6442:
#0: (device_hotplug_lock){+.+.+.}, at: [<ffffffff8146cbb5>] lock_device_hotplug_sysfs+0x15/0x50

This issue was introdued by commit fa2be40 (drivers: base: use standard device online/offline for state change).

Quoted 6 lines

This patch releases device_hotplug_lcok when store_mem_state returns EINVAL.

CC Toshi Kani <[email protected]>
CC Seth Jennings <[email protected]>
CC Greg Kroah-Hartman <[email protected]>

Good catch!

Thanks,
-Toshi

#4 lore raw
Quoted 17 lines · Toshi Kani
Quoted 16 lines · Yasuaki Ishimatsu

When inserting a wrong value to /sys/devices/system/memory/memoryX/state file, following messages are shown. And device_hotplug_lock is never released.

================================================
[ BUG: lock held when returning to user space! ]
3.12.0-rc4-debug+ #3 Tainted: G W
------------------------------------------------
bash/6442 is leaving the kernel with locks still held!
1 lock held by bash/6442:
#0: (device_hotplug_lock){+.+.+.}, at: [<ffffffff8146cbb5>] lock_device_hotplug_sysfs+0x15/0x50

This issue was introdued by commit fa2be40 (drivers: base: use standard device online/offline for state change).

This patch releases device_hotplug_lcok when store_mem_state returns EINVAL.

Quoted 8 lines
Quoted 4 lines
CC Toshi Kani <[email protected]>
CC Seth Jennings <[email protected]>
CC Greg Kroah-Hartman <[email protected]>

Good catch!

Thank you for your review.

Thanks,
Yasuaki Ishimatsu

Quoted 4 lines

Thanks,
-Toshi