Commit 2a0e3388 authored by Namhyung Kim's avatar Namhyung Kim Committed by Jan Kara

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: default avatarNamhyung Kim <namhyung@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 81a4e320
...@@ -952,6 +952,8 @@ int journal_create(journal_t *journal) ...@@ -952,6 +952,8 @@ int journal_create(journal_t *journal)
if (err) if (err)
return err; return err;
bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize); bh = __getblk(journal->j_dev, blocknr, journal->j_blocksize);
if (unlikely(!bh))
return -ENOMEM;
lock_buffer(bh); lock_buffer(bh);
memset (bh->b_data, 0, journal->j_blocksize); memset (bh->b_data, 0, journal->j_blocksize);
BUFFER_TRACE(bh, "marking dirty"); BUFFER_TRACE(bh, "marking dirty");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment