projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2c54396
)
zram: avoid kunmap_atomic() of a NULL pointer
author
Weijie Yang
<
[email protected]
>
Thu, 13 Nov 2014 23:19:05 +0000
(15:19 -0800)
committer
Linus Torvalds
<
[email protected]
>
Fri, 14 Nov 2014 00:17:05 +0000
(16:17 -0800)
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 <
[email protected]
>
Cc: Sergey Senozhatsky <
[email protected]
>
Cc: Dan Streetman <
[email protected]
>
Cc: Nitin Gupta <
[email protected]
>
Cc: Weijie Yang <
[email protected]
>
Acked-by: Jerome Marchand <
[email protected]
>
Cc: <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/block/zram/zram_drv.c
patch
|
blob
|
history
diff --git
a/drivers/block/zram/zram_drv.c
b/drivers/block/zram/zram_drv.c
index 2ad0b5bce44be89494d9cb5f75da19b9e459cd10..3920ee45aa5942dd816a775180eeb16f662e804c 100644
(file)
--- a/
drivers/block/zram/zram_drv.c
+++ b/
drivers/block/zram/zram_drv.c
@@
-560,7
+560,8
@@
static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
}
if (page_zero_filled(uncmem)) {
- kunmap_atomic(user_mem);
+ if (user_mem)
+ kunmap_atomic(user_mem);
/* Free memory associated with this sector now. */
bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value);
zram_free_page(zram, index);