linux/drivers/block/zram
Jerome Marchand aee0848f2e zram: don't call idr_remove() from zram_remove()
commit 17ec4cd985 upstream.

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.

[akpm@linux-foundation.org: fix coding stype, per Sergey]
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2016-02-17 12:31:06 -08:00
..
Kconfig zram: remove obsolete ZRAM_DEBUG option 2015-06-25 17:00:35 -07:00
Makefile zram: add lz4 algorithm backend 2014-04-07 16:36:01 -07:00
zcomp.c zram/zcomp: use GFP_NOIO to allocate streams 2016-02-17 12:31:05 -08:00
zcomp.h zram: check comp algorithm availability earlier 2015-06-25 17:00:37 -07:00
zcomp_lz4.c zram: try vmalloc() after kmalloc() 2016-02-17 12:31:05 -08:00
zcomp_lz4.h zram: add lz4 algorithm backend 2014-04-07 16:36:01 -07:00
zcomp_lzo.c zram: try vmalloc() after kmalloc() 2016-02-17 12:31:05 -08:00
zcomp_lzo.h zram: introduce compressing backend abstraction 2014-04-07 16:36:01 -07:00
zram_drv.c zram: don't call idr_remove() from zram_remove() 2016-02-17 12:31:06 -08:00
zram_drv.h zsmalloc/zram: introduce zs_pool_stats api 2015-09-08 15:35:28 -07:00