mtd: cfi_cmdset_0002, fix lock imbalance

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Dec 10 08:59:01 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=caf0e8e028516253afce6e40c52f0c193a221f8a
Commit:     caf0e8e028516253afce6e40c52f0c193a221f8a
Parent:     51eeb878155cdea73e7a1f0372b266018bd7a424
Author:     Jiri Slaby <jslaby at suse.cz>
AuthorDate: Thu Dec 10 14:23:57 2009 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Dec 10 13:33:53 2009 +0000

    mtd: cfi_cmdset_0002, fix lock imbalance
    
    Stanse found a double unlock in get_chip. get_chip is called with
    chip->mutex held and caller is responsible for unlocking it too.
    
    Do not unlock the lock in get_chip on a fail path. This would mean
    a double unlock.
    
    Signed-off-by: Jiri Slaby <jslaby at suse.cz>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/chips/cfi_cmdset_0002.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 1d49e18..f3600e8 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -569,7 +569,6 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
 
 			if (time_after(jiffies, timeo)) {
 				printk(KERN_ERR "Waiting for chip to be ready timed out.\n");
-				spin_unlock(chip->mutex);
 				return -EIO;
 			}
 			spin_unlock(chip->mutex);



More information about the linux-mtd-cvs mailing list