Skip to content

Commit a4e08d0

Browse files
Luis Henriquestorvalds
authored andcommitted
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 http://bugs.launchpad.net/bugs/1006012 Signed-off-by: Luis Henriques <luis.henriques@canonical.com> Reported-by: Bret Towe <magnade@gmail.com> Tested-by: Bret Towe <magnade@gmail.com> Cc: Sunil Mushran <sunil.mushran@oracle.com> Acked-by: Joel Becker <jlbec@evilplan.org> Acked-by: Mark Fasheh <mfasheh@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6b4fa63 commit a4e08d0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/ocfs2/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
19501950
if (ret < 0)
19511951
mlog_errno(ret);
19521952

1953-
if (file->f_flags & O_SYNC)
1953+
if (file && (file->f_flags & O_SYNC))
19541954
handle->h_sync = 1;
19551955

19561956
ocfs2_commit_trans(osb, handle);

0 commit comments

Comments
 (0)