linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL
@ 2013-10-11  6:36 Yasuaki Ishimatsu
  2013-10-11 15:54 ` Greg KH
  2013-10-11 16:31 ` Toshi Kani
  0 siblings, 2 replies; 5+ messages in thread
From: Yasuaki Ishimatsu @ 2013-10-11  6:36 UTC (permalink / raw)
  To: linux-kernel, linux-mm; +Cc: toshi.kani, sjenning, gregkh

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.

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
CC: Toshi Kani <toshi.kani@hp.com>
CC: Seth Jennings <sjenning@linux.vnet.ibm.com>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/memory.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 9e59f65..bece691 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL
  2013-10-11  6:36 [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL Yasuaki Ishimatsu
@ 2013-10-11 15:54 ` Greg KH
  2013-10-15  1:42   ` Yasuaki Ishimatsu
  2013-10-11 16:31 ` Toshi Kani
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2013-10-11 15:54 UTC (permalink / raw)
  To: Yasuaki Ishimatsu; +Cc: linux-kernel, linux-mm, toshi.kani, sjenning

On Fri, Oct 11, 2013 at 03:36:25PM +0900, Yasuaki Ishimatsu wrote:
> 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.
> 
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> CC: Toshi Kani <toshi.kani@hp.com>
> CC: Seth Jennings <sjenning@linux.vnet.ibm.com>
> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

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

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

* Re: [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL
  2013-10-11  6:36 [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL Yasuaki Ishimatsu
  2013-10-11 15:54 ` Greg KH
@ 2013-10-11 16:31 ` Toshi Kani
  2013-10-17  2:24   ` Yasuaki Ishimatsu
  1 sibling, 1 reply; 5+ messages in thread
From: Toshi Kani @ 2013-10-11 16:31 UTC (permalink / raw)
  To: Yasuaki Ishimatsu; +Cc: linux-kernel, linux-mm, sjenning, gregkh

On Fri, 2013-10-11 at 15:36 +0900, Yasuaki Ishimatsu wrote:
> 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.
> 
> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> CC: Toshi Kani <toshi.kani@hp.com>
> CC: Seth Jennings <sjenning@linux.vnet.ibm.com>
> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Good catch!

Reviewed-by: Toshi Kani <toshi.kani@hp.com>

Thanks,
-Toshi

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

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

* Re: [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL
  2013-10-11 15:54 ` Greg KH
@ 2013-10-15  1:42   ` Yasuaki Ishimatsu
  0 siblings, 0 replies; 5+ messages in thread
From: Yasuaki Ishimatsu @ 2013-10-15  1:42 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, linux-mm, toshi.kani, sjenning

Hi Greg,

(2013/10/12 0:54), Greg KH wrote:
> On Fri, Oct 11, 2013 at 03:36:25PM +0900, Yasuaki Ishimatsu wrote:
>> 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.
>>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> CC: Toshi Kani <toshi.kani@hp.com>
>> CC: Seth Jennings <sjenning@linux.vnet.ibm.com>
>> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> 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

>
> thanks,
>
> greg k-h
>


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

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

* Re: [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL
  2013-10-11 16:31 ` Toshi Kani
@ 2013-10-17  2:24   ` Yasuaki Ishimatsu
  0 siblings, 0 replies; 5+ messages in thread
From: Yasuaki Ishimatsu @ 2013-10-17  2:24 UTC (permalink / raw)
  To: Toshi Kani; +Cc: linux-kernel, linux-mm, sjenning, gregkh

(2013/10/12 1:31), Toshi Kani wrote:
> On Fri, 2013-10-11 at 15:36 +0900, Yasuaki Ishimatsu wrote:
>> 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.
>>
>> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
>> CC: Toshi Kani <toshi.kani@hp.com>
>> CC: Seth Jennings <sjenning@linux.vnet.ibm.com>
>> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> Good catch!
>
> Reviewed-by: Toshi Kani <toshi.kani@hp.com>

Thank you for your review.

Thanks,
Yasuaki Ishimatsu



>
> Thanks,
> -Toshi
>


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

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

end of thread, other threads:[~2013-10-17  2:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11  6:36 [PATCH] Release device_hotplug_lock when store_mem_state returns EINVAL Yasuaki Ishimatsu
2013-10-11 15:54 ` Greg KH
2013-10-15  1:42   ` Yasuaki Ishimatsu
2013-10-11 16:31 ` Toshi Kani
2013-10-17  2:24   ` Yasuaki Ishimatsu

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).