Thread (6 messages) 6 messages, 4 authors, 2009-10-06
STALE6080d

[PATCH][UHCI-DEBUG] Don't kmalloc with BKL held

From: Sven-Thorsten Dietrich <hidden>
Date: 2009-10-02 09:12:28
Also in: lkml
Subsystem: the rest, usb subsystem, usb uhci driver · Maintainers: Linus Torvalds, Greg Kroah-Hartman, Alan Stern

Subject: Don't kmalloc with BKL held.
From: Sven-Thorsten Dietrich <redacted>

I'm eyeballing this file for complete removal of lock_kernel but 
at first glance, we definitely don't need BKL to kmalloc(). 

Signed-off-by: Sven-Thorsten Dietrich <redacted>

diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index e52b954..325d508 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -497,7 +497,6 @@ static int uhci_debug_open(struct inode *inode, struct file *file)
 	int ret = -ENOMEM;
 	unsigned long flags;
 
-	lock_kernel();
 	up = kmalloc(sizeof(*up), GFP_KERNEL);
 	if (!up)
 		goto out;
@@ -509,6 +508,8 @@ static int uhci_debug_open(struct inode *inode, struct file *file)
 	}
 
 	up->size = 0;
+
+	lock_kernel();
 	spin_lock_irqsave(&uhci->lock, flags);
 	if (uhci->is_initialized)
 		up->size = uhci_sprint_schedule(uhci, up->data, MAX_OUTPUT);

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help