This is a note to let you know that I've just added the patch titled

    zram: fix race between reset and flushing pending work

to the 3.13-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     zram-fix-race-between-reset-and-flushing-pending-work.patch
and it can be found in the queue-3.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From da4a04126baa3be03bc566d4a2ee0944c5e783d0 Mon Sep 17 00:00:00 2001
From: Minchan Kim <[email protected]>
Date: Thu, 30 Jan 2014 15:45:58 -0800
Subject: zram: fix race between reset and flushing pending work

From: Minchan Kim <[email protected]>

commit da4a04126baa3be03bc566d4a2ee0944c5e783d0 upstream.

Dan and Sergey reported that there is a racy between reset and flushing
of pending work so that it could make oops by freeing zram->meta in
reset while zram_slot_free can access zram->meta if new request is
adding during the race window.

This patch moves flush after taking init_lock so it prevents new request
so that it closes the race.

Signed-off-by: Minchan Kim <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Cc: Nitin Gupta <[email protected]>
Cc: Jerome Marchand <[email protected]>
Tested-by: Sergey Senozhatsky <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/staging/zram/zram_drv.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -552,14 +552,14 @@ static void zram_reset_device(struct zra
        size_t index;
        struct zram_meta *meta;
 
-       flush_work(&zram->free_work);
-
        down_write(&zram->init_lock);
        if (!zram->init_done) {
                up_write(&zram->init_lock);
                return;
        }
 
+       flush_work(&zram->free_work);
+
        meta = zram->meta;
        zram->init_done = 0;
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.13/zram-fix-race-between-reset-and-flushing-pending-work.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to