[MTD] Always initialise mutex in new mtd_blktrans_dev.

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Dec 3 08:59:01 EST 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ce37ab42ad8b38ef2f36c31c6b4c39b87f36b792
Commit:     ce37ab42ad8b38ef2f36c31c6b4c39b87f36b792
Parent:     846fc31d06e54ad94026da11da0668c050fe777e
Author:     David Woodhouse <dwmw2 at infradead.org>
AuthorDate: Mon Dec 3 12:46:12 2007 +0000
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Mon Dec 3 12:46:12 2007 +0000

    [MTD] Always initialise mutex in new mtd_blktrans_dev.
    
    We were only initialising the mutex in the case where the new device was
    automatically allocated the highest minor number. If the caller
    specified a minor number, or if it filled in a free slot which was made
    by a previous device deregistering, the mutex wouldn't get initialised
    when we jumped out of the loop.
    
    Reported by Monte Copeland <catboat at texas.net>
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/mtd_blkdevs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 74d9d30..839eed8 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -248,9 +248,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 		return -EBUSY;
 	}
 
-	mutex_init(&new->lock);
 	list_add_tail(&new->list, &tr->devs);
  added:
+	mutex_init(&new->lock);
 	if (!tr->writesect)
 		new->readonly = 1;
 



More information about the linux-mtd-cvs mailing list