From: Marcin Slusarz Date: Sat, 28 Mar 2009 17:44:24 +0000 (+0100) Subject: [MTD] fix use after free in register_mtd_blktrans X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2cf3a11494b15949835ff92a7af15f979ac37bbd;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [MTD] fix use after free in register_mtd_blktrans Reported-by: Dan Carpenter Cc: Christoph Hellwig Signed-off-by: Marcin Slusarz Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 1409f01406f6..4109e0bb94f5 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);