lkml.org 
[lkml]   [2014]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] zram: avoid null access when fail to alloc meta
On 02/25/2014 02:08 AM, Minchan Kim wrote:
> zram_meta_alloc could be failed so caller should check it.
> Otherwise, your system will be hang.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Minchan Kim <minchan@kernel.org>

Acked-by: Jerome Marchand <jmarchan@redhat.com>

> ---
> drivers/block/zram/zram_drv.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 5ec61be793d2..21aee3edcb25 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -554,6 +554,8 @@ static ssize_t disksize_store(struct device *dev,
>
> disksize = PAGE_ALIGN(disksize);
> meta = zram_meta_alloc(disksize);
> + if (!meta)
> + return -ENOMEM;
> down_write(&zram->init_lock);
> if (init_done(zram)) {
> up_write(&zram->init_lock);
>



\
 
 \ /
  Last update: 2014-02-25 14:41    [W:0.058 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site