From patchwork Thu Dec 10 13:23:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/1] MTD: cfi chip, fix lock imbalance Date: Thu, 10 Dec 2009 03:23:57 -0000 From: Jiri Slaby X-Patchwork-Id: 40804 Message-Id: <1260451437-29645-1-git-send-email-jslaby@suse.cz> To: dwmw2@infradead.org Cc: linux-mtd@lists.infradead.org, jirislaby@gmail.com, linux-kernel@vger.kernel.org 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 --- 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);