Re: [PATCH] zram: don't call idr_remove() from zram_remove()

From: Minchan Kim
Date: Thu Jan 14 2016 - 21:57:38 EST


On Thu, Jan 14, 2016 at 02:03:47PM +0100, Jerome Marchand wrote:
> The use of idr_remove() is forbidden in the callback functions of
> idr_for_each(). It is therefore unsafe to call idr_remove in
> zram_remove().
> This patch moves the call to idr_remove() from zram_remove() to
> hot_remove_store(). In the detroy_devices() path, idrs are removed by
> idr_destroy().
> This solves an use-after-free detected by KASan.
>
> Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx>

Acked-by: Minchan Kim <minchan@xxxxxxxxxx> with Sergey's nitpick

Thanks!