[MTD] fix use after free in register_mtd_blktrans

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Apr 3 05:59:02 EDT 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2cf3a11494b15949835ff92a7af15f979ac37bbd
Commit:     2cf3a11494b15949835ff92a7af15f979ac37bbd
Parent:     61dd7eb876344904aece6b1837da6ea1cbadbc07
Author:     Marcin Slusarz <marcin.slusarz at gmail.com>
AuthorDate: Sat Mar 28 18:44:24 2009 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Fri Apr 3 10:36:23 2009 +0100

    [MTD] fix use after free in register_mtd_blktrans
    
    Reported-by: Dan Carpenter <error27 at gmail.com>
    Cc: Christoph Hellwig <hch at lst.de>
    Signed-off-by: Marcin Slusarz <marcin.slusarz at gmail.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/mtd_blkdevs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 1409f01..4109e0b 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -382,11 +382,12 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
 	tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
 			"%sd", tr->name);
 	if (IS_ERR(tr->blkcore_priv->thread)) {
+		int ret = PTR_ERR(tr->blkcore_priv->thread);
 		blk_cleanup_queue(tr->blkcore_priv->rq);
 		unregister_blkdev(tr->major, tr->name);
 		kfree(tr->blkcore_priv);
 		mutex_unlock(&mtd_table_mutex);
-		return PTR_ERR(tr->blkcore_priv->thread);
+		return ret;
 	}
 
 	INIT_LIST_HEAD(&tr->devs);



More information about the linux-mtd-cvs mailing list