Jerome Marchand 17ec4cd985 zram: don't call idr_remove() from zram_remove()
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>
Cc: <stable@vger.kernel.org>	[4.2+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-15 17:56:32 -08:00
..
2016-01-13 19:15:14 -08:00
2015-12-29 15:32:24 -05:00
2015-12-12 16:43:44 -08:00
2016-01-15 13:18:47 -08:00
2016-01-15 13:18:47 -08:00
2016-01-15 13:18:47 -08:00
2016-01-13 10:59:52 -08:00
2016-01-01 18:31:34 +01:00
2015-12-21 11:44:00 +09:00
2016-01-14 10:53:15 -08:00
2016-01-13 10:23:36 -08:00
2016-01-12 12:17:28 +01:00
2016-01-15 12:28:00 -08:00
2016-01-14 10:53:15 -08:00
2016-01-15 13:18:47 -08:00
2016-01-05 18:04:58 +01:00
2016-01-13 11:25:54 -08:00
2016-01-14 11:13:28 -08:00
2016-01-03 16:32:59 -08:00
2015-12-26 17:01:18 -08:00
2016-01-12 01:12:40 +01:00
2016-01-15 12:14:47 -08:00
2016-01-15 13:18:47 -08:00
2016-01-13 19:37:36 -08:00
2016-01-15 13:18:47 -08:00
2016-01-15 13:18:47 -08:00
2016-01-15 13:18:47 -08:00
2016-01-15 13:18:47 -08:00
2015-12-01 14:26:33 -08:00
2016-01-14 10:34:33 -08:00
2016-01-07 13:21:53 +00:00