Re: [PATCH v2] zram: fix null dereference of handle

From: Sergey Senozhatsky
Date: Wed Sep 20 2017 - 02:29:45 EST


On (09/20/17 15:02), Minchan Kim wrote:
> For the testing, I found handle passed to zs_map_object in __zram_bvec_read
> is NULL so that kernel goes the Oops by pin_object.
>
> The reason is there is no routine to check the slot's freeing
> after getting the slot's lock. This patch fixes it.
>
> * From v1:
> * remove unlikely branch - Sergey
> * In !handle case, use 0 instead of zram_get_element - Sergey
>
> Fixes: 1f7319c74275 ("zram: partial IO refactoring")
> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky.work@xxxxxxxxx>

-ss