ext4: add ext4_mb_unload_buddy in the error path
authorSalman Qazi <sqazi@google.com>
Fri, 1 Jun 2012 03:51:27 +0000 (23:51 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 10 Jun 2012 13:41:52 +0000 (14:41 +0100)
commit 02b7831019ea4e7994968c84b5826fa8b248ffc8 upstream.

ext4_free_blocks fails to pair an ext4_mb_load_buddy with a matching
ext4_mb_unload_buddy when it fails a memory allocation.

Signed-off-by: Salman Qazi <sqazi@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/mballoc.c

index e2d8be8..382e4fc 100644 (file)
@@ -4693,6 +4693,7 @@ do_more:
                 */
                new_entry = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS);
                if (!new_entry) {
+                       ext4_mb_unload_buddy(&e4b);
                        err = -ENOMEM;
                        goto error_return;
                }