Commit a4e08d00 authored by Luis Henriques's avatar Luis Henriques Committed by Linus Torvalds

ocfs2: fix NULL pointer dereference in __ocfs2_change_file_space()

As ocfs2_fallocate() will invoke __ocfs2_change_file_space() with a NULL
as the first parameter (file), it may trigger a NULL pointer dereferrence
due to a missing check.

Addresses default avatarLuis Henriques <>
Reported-by: default avatarBret Towe <>
Tested-by: default avatarBret Towe <>
Cc: Sunil Mushran <>
Acked-by: default avatarJoel Becker <>
Acked-by: default avatarMark Fasheh <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 6b4fa63a
......@@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
if (ret < 0)
if (file->f_flags & O_SYNC)
if (file && (file->f_flags & O_SYNC))
handle->h_sync = 1;
ocfs2_commit_trans(osb, handle);
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