[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2eidda6bq.fsf@elisp.net>
Date: Wed, 01 Sep 2010 23:26:01 +0900
From: Naohiro Aota <naota@...sp.net>
To: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Cc: linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
Jiri Kosina <jkosina@...e.cz>,
Greg Kroah-Hartman <gregkh@...e.de>,
Naohiro Aota <naota@...sp.net>, Daniel Mack <daniel@...aq.de>,
linux-scsi@...r.kernel.org
Subject: [PATCH] bsg: call idr_pre_get() outside the lock.
The idr_pre_get() kernel-doc says "This function should be called
prior to locking and calling the idr_get_new* functions.", but the
idr_pre_get() calling in bsg_register_queue() is put inside
mutex_lock(). Let's fix it.
Signed-off-by: Naohiro Aota <naota@...sp.net>
---
block/bsg.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/block/bsg.c b/block/bsg.c
index 82d5882..5fd8dd1 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -1010,13 +1010,11 @@ int bsg_register_queue(struct request_queue *q, struct device *parent,
bcd = &q->bsg_dev;
memset(bcd, 0, sizeof(*bcd));
- mutex_lock(&bsg_mutex);
-
ret = idr_pre_get(&bsg_minor_idr, GFP_KERNEL);
- if (!ret) {
- ret = -ENOMEM;
- goto unlock;
- }
+ if (!ret)
+ return -ENOMEM;
+
+ mutex_lock(&bsg_mutex);
ret = idr_get_new(&bsg_minor_idr, bcd, &minor);
if (ret < 0)
--
1.7.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists