Răsfoiți Sursa

ext4: Add error checking to kmem_cache_alloc() call in ext4_free_blocks()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o 14 ani în urmă
părinte
comite
b72143ab3e
1 a modificat fișierele cu 5 adăugiri și 1 ștergeri
  1. 5 1
      fs/ext4/mballoc.c

+ 5 - 1
fs/ext4/mballoc.c

@@ -4626,7 +4626,11 @@ do_more:
 		 * blocks being freed are metadata. these blocks shouldn't
 		 * blocks being freed are metadata. these blocks shouldn't
 		 * be used until this transaction is committed
 		 * be used until this transaction is committed
 		 */
 		 */
-		new_entry  = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS);
+		new_entry = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS);
+		if (!new_entry) {
+			err = -ENOMEM;
+			goto error_return;
+		}
 		new_entry->start_blk = bit;
 		new_entry->start_blk = bit;
 		new_entry->group  = block_group;
 		new_entry->group  = block_group;
 		new_entry->count = count;
 		new_entry->count = count;