Skip to contentSkip to conversation

Handle possible bio_alloc failure in submit_bh

PATCH NAK Nikanth Karthikesan 1 participant 1 message Apr 14, 2009 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 Handle possible bio_alloc failure in submit_bh

Handle possible bio_alloc failure in submit_bh.

---

fs/buffer.c +2 -0
Index: linux-2.6/fs/buffer.c
===================================================================
@@ -2922,6 +2922,8 @@ int submit_bh(int rw, struct buffer_head
 	 * submit_bio -> generic_make_request may further map this bio around
 	 */
 	bio = bio_alloc(GFP_NOIO, 1);
+	if (unlikely(!bio))
+		panic("Failed to allocate bio\n");
 
 	bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
 	bio->bi_bdev = bh->b_bdev;