From 1db1adface236660c3db4c20c4c3e85a489bcd82 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 25 Oct 2012 12:14:35 +1100 Subject: [PATCH] memstick: use after free in msb_disk_release() The original code dereferenced "msb" after freeing it. Signed-off-by: Dan Carpenter Acked-by: Maxim Levitsky Cc: Jens Axboe Signed-off-by: Andrew Morton --- drivers/memstick/core/ms_block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index 71e59376c0c3..4a751c9e5eff 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1983,9 +1983,9 @@ static int msb_disk_release(struct gendisk *disk) msb->usage_count--; if (!msb->usage_count) { - kfree(msb); disk->private_data = NULL; idr_remove(&msb_disk_idr, msb->disk_id); + kfree(msb); put_disk(disk); } } -- 2.39.5