From 147d36b2b7bfb092f7f7da50277587c421932ae7 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 12 Oct 2012 15:22:42 +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