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

    UBI: fix a horrible memory deallocation bug

to the 3.4-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:
     ubi-fix-a-horrible-memory-deallocation-bug.patch
and it can be found in the queue-3.4 subdirectory.

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


>From [email protected]  Thu Sep 27 17:05:58 2012
From: Artem Bityutskiy <[email protected]>
Date: Wed, 12 Sep 2012 09:05:22 +0200
Subject: UBI: fix a horrible memory deallocation bug
To: [email protected]
Cc: Artem Bityutskiy <[email protected]>, Richard Genoud 
<[email protected]>
Message-ID: <[email protected]>

From: Artem Bityutskiy <[email protected]>

commit 78b495c39add820ab66ab897af9bd77a5f2e91f6 upstream

UBI was mistakingly using 'kfree()' instead of 'kmem_cache_free()' when
freeing "attach eraseblock" structures in vtbl.c. Thankfully, this happened
only when we were doing auto-format, so many systems were unaffected. However,
there are still many users affected.

It is strange, but the system did not crash and nothing bad happened when
the SLUB memory allocator was used. However, in case of SLOB we observed an
crash right away.

This problem was introduced in 2.6.39 by commit
"6c1e875 UBI: add slab cache for ubi_scan_leb objects"

Reported-by: Richard Genoud <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: Richard Genoud <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/mtd/ubi/vtbl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -346,7 +346,7 @@ retry:
         */
        err = ubi_scan_add_used(ubi, si, new_seb->pnum, new_seb->ec,
                                vid_hdr, 0);
-       kfree(new_seb);
+       kmem_cache_free(si->scan_leb_slab, new_seb);
        ubi_free_vid_hdr(ubi, vid_hdr);
        return err;
 
@@ -359,7 +359,7 @@ write_error:
                list_add(&new_seb->u.list, &si->erase);
                goto retry;
        }
-       kfree(new_seb);
+       kmem_cache_free(si->scan_leb_slab, new_seb);
 out_free:
        ubi_free_vid_hdr(ubi, vid_hdr);
        return err;


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

queue-3.4/ubi-fix-a-horrible-memory-deallocation-bug.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