summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-13 10:17:18 +0200
committerJan Kara <jack@suse.cz>2010-10-28 01:30:04 +0200
commit2a0e33889b3f5e3c270dd1b746f4c0a75efa4790 (patch)
tree322394e75daccaf692a4adb388efa596a231a59b
parentext3: Use DIV_ROUND_UP() on group desc block counting (diff)
downloadlinux-2a0e33889b3f5e3c270dd1b746f4c0a75efa4790.tar.xz
linux-2a0e33889b3f5e3c270dd1b746f4c0a75efa4790.zip
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 <namhyung@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/jbd/journal.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index e56117651826..ac1840415a65 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");