zram: avoid kunmap_atomic() of a NULL pointer
authorWeijie Yang <weijie.yang@samsung.com>
Thu, 13 Nov 2014 23:19:05 +0000 (15:19 -0800)
committerAlex Shi <alex.shi@linaro.org>
Mon, 11 May 2015 13:31:02 +0000 (21:31 +0800)
commit7aecdc886e2e9bacfaf2377067072fa63d649b21
tree85d8eb775fe3a65b6feb88dd995ac9c527d17c60
parentea56241654a2c7ef9a1122a7ad5c751527ed9b17
zram: avoid kunmap_atomic() of a NULL pointer

zram could kunmap_atomic() a NULL pointer in a rare situation: a zram
page becomes a full-zeroed page after a partial write io.  The current
code doesn't handle this case and performs kunmap_atomic() on a NULL
pointer, which panics the kernel.

This patch fixes this issue.

Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Weijie Yang <weijie.yang.kh@gmail.com>
Acked-by: Jerome Marchand <jmarchan@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit c406515239376fc93a30d5d03192182160cbd3fb)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
drivers/block/zram/zram_drv.c