+ zram-avoid-kunmap_atomic-a-null-pointer.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: zram: avoid kunmap_atomic() of a NULL pointer
has been added to the -mm tree.  Its filename is
     zram-avoid-kunmap_atomic-a-null-pointer.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/zram-avoid-kunmap_atomic-a-null-pointer.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/zram-avoid-kunmap_atomic-a-null-pointer.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Weijie Yang <weijie.yang@xxxxxxxxxxx>
Subject: 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@xxxxxxxxxxx>
Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
Cc: Dan Streetman <ddstreet@xxxxxxxx>
Cc: Nitin Gupta <ngupta@xxxxxxxxxx>
Cc: Weijie Yang <weijie.yang.kh@xxxxxxxxx>
Acked-by: Jerome Marchand <jmarchan@xxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 drivers/block/zram/zram_drv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/block/zram/zram_drv.c~zram-avoid-kunmap_atomic-a-null-pointer drivers/block/zram/zram_drv.c
--- a/drivers/block/zram/zram_drv.c~zram-avoid-kunmap_atomic-a-null-pointer
+++ a/drivers/block/zram/zram_drv.c
@@ -560,7 +560,8 @@ static int zram_bvec_write(struct zram *
 	}
 
 	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);
_

Patches currently in -mm which might be from weijie.yang@xxxxxxxxxxx are

origin.patch
zram-avoid-kunmap_atomic-a-null-pointer.patch
linux-next.patch

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]