mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Add flag __GFP_NOFAIL when allocating block
@ 2006-09-29  1:53 Zhang, Yanmin
  2006-09-29  6:10 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Yanmin @ 2006-09-29  1:53 UTC (permalink / raw)
  To: LKML

From: Zhang, Yanmin <yanmin.zhang@intel.com>

Function journal_write_metadata_buffer doesn't estimate the return
value of jbd_slab_alloc. If the allocation fails, later jbd_slab_free
or memcpy will cause kernel oops.

Add flag __GFP_NOFAIL when allocating block. The patch is against
2.6.18-mm1.

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>

---

--- linux-2.6.18_mm1/fs/jbd/journal.c	2006-09-29 07:19:49.000000000 -0600
+++ linux-2.6.18_mm1_fix/fs/jbd/journal.c	2006-09-30 03:01:38.000000000 -0600
@@ -329,7 +329,7 @@ repeat:
 		char *tmp;
 
 		jbd_unlock_bh_state(bh_in);
-		tmp = jbd_slab_alloc(bh_in->b_size, GFP_NOFS);
+		tmp = jbd_slab_alloc(bh_in->b_size, GFP_NOFS|__GFP_NOFAIL);
 		jbd_lock_bh_state(bh_in);
 		if (jh_in->b_frozen_data) {
 			jbd_slab_free(tmp, bh_in->b_size);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-29  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-29  1:53 [PATCH] Add flag __GFP_NOFAIL when allocating block Zhang, Yanmin
2006-09-29  6:10 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®