[PATCH] usb:REduce scope of BKL in usbdev_open()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 37c206da102cf33c2ea583b53df1e46b3ced1747 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@xxxxxxxxxx>
Date: Tue, 12 Jan 2010 13:26:56 +0100
Subject: [PATCH] usb:REduce scope of BKL in usbdev_open()

No need to allocate memory under BKL

Signed-off-by: Oliver Neukum <oliver@xxxxxxxxxx>
---
 drivers/usb/core/devio.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index bdb8611..429676c 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -653,13 +653,12 @@ static int usbdev_open(struct inode *inode, struct file *file)
 	const struct cred *cred = current_cred();
 	int ret;
 
-	lock_kernel();
-
 	ret = -ENOMEM;
 	ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL);
 	if (!ps)
-		goto out_free_ps;
-
+		goto out_no_lock;
+	
+	lock_kernel();
 	ret = -ENODEV;
 
 	/* Protect against simultaneous removal or release */
@@ -722,6 +721,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
  out_free_ps:
 	kfree(ps);
 	unlock_kernel();
+out_no_lock:
 	return ret;
 }
 
-- 
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux