From: Namhyung Kim Date: Wed, 13 Oct 2010 08:17:18 +0000 (+0900) Subject: jbd: Check return value of __getblk() X-Git-Tag: v2.6.37-rc1~78^2~8 X-Git-Url: https://bbs.cooldavid.org/git/?p=net-next-2.6.git;a=commitdiff_plain;h=2a0e33889b3f5e3c270dd1b746f4c0a75efa4790 jbd: Check return value of __getblk() Fail journal creation if __getblk() returns NULL. unlikely() is added because it is called in a loop and we've been OK without the check until now. Signed-off-by: Namhyung Kim Signed-off-by: Jan Kara --- diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index e5611765182..ac1840415a6 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -952,6 +952,8 @@ int journal_create(journal_t *journal) if (err) return err; bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); + if (unlikely(!bh)) + return -ENOMEM; lock_buffer(bh); memset (bh->b_data, 0, journal->j_blocksize); BUFFER_TRACE(bh, "marking dirty");