lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Dec 2017 19:15:42 +0530
From:   shrikant.maurya@...hveda.org
To:     rjw@...ysocki.net, pavel@....cz, len.brown@...el.com,
        gregkh@...uxfoundation.org
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        sunil.m@...hveda.org, karthik@...hveda.org, raghu@...hveda.org,
        Shrikant Maurya <shrikant.maurya@...hveda.org>
Subject: [PATCH] drivers: base: power: Fix GFP_KERNEL in spinlock context

From: Shrikant Maurya <shrikant.maurya@...hveda.org>

As reported by Jia-Ju Bai (https://lkml.org/lkml/2017/12/11/872):
API's are using GFP_KERNEL to allocate memory which may sleep.

To ensure atomicity such allocations must be avoided in critical
sections under spinlock.
Fixed by replacing GFP_KERNEL to GFP_ATOMIC.

Reported-by: Jia-Ju Bai <baijiaju1990@...il.com>
Signed-off-by: Shrikant Maurya <shrikant.maurya@...hveda.org>
Signed-off-by: Suniel Mahesh <sunil.m@...hveda.org>
Signed-off-by: Raghu Bharadwaj <raghu@...hveda.org>
Signed-off-by: Karthik Tummala <karthik@...hveda.org>
---
Note:
- Patch was compile tested and built(ARCH=arm) on linux-next
  (latest).
- No build issues reported.
---
 drivers/base/power/wakeup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 38559f0..de56952 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -92,11 +92,11 @@ struct wakeup_source *wakeup_source_create(const char *name)
 {
 	struct wakeup_source *ws;
 
-	ws = kmalloc(sizeof(*ws), GFP_KERNEL);
+	ws = kmalloc(sizeof(*ws), GFP_ATOMIC);
 	if (!ws)
 		return NULL;
 
-	wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_KERNEL) : NULL);
+	wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_ATOMIC) : NULL);
 	return ws;
 }
 EXPORT_SYMBOL_GPL(wakeup_source_create);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ