aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Henriques <[email protected]>2012-07-11 14:02:10 -0700
committerLinus Torvalds <[email protected]>2012-07-11 16:04:43 -0700
commita4e08d001f2e50bb8b3c4eebadcf08e5535f02ee (patch)
tree6ab47d995bd4c0a3a388dcbc11ffbe775274d88c
parent6b4fa63a9e5696fa43f25143f104ef0bea642222 (diff)
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 <[email protected]> Reported-by: Bret Towe <[email protected]> Tested-by: Bret Towe <[email protected]> Cc: Sunil Mushran <[email protected]> Acked-by: Joel Becker <[email protected]> Acked-by: Mark Fasheh <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--fs/ocfs2/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 98513c8ed589..7602783d7f41 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
if (ret < 0)
mlog_errno(ret);
- if (file->f_flags & O_SYNC)
+ if (file && (file->f_flags & O_SYNC))
handle->h_sync = 1;
ocfs2_commit_trans(osb, handle);