Re: [patch 1/2] memstick: use after free in msb_disk_release()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2012-09-29 at 10:11 +0300, Dan Carpenter wrote: 
> The original code dereferenced "msb" after freeing it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
> index c815fe5..a8e8915 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);
>  		}
>  	}

Oops, I added this bug in latest iteration, when removed support for
major.
Acked-by: Maxim Levitsky <maximlevitsly@xxxxxxxxx>

Best regards,
Maxim Levitsky

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux