linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs: check f_op before dereference its field
@ 2013-01-24 14:53 Jiang Fang
  2013-01-24 15:28 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Jiang Fang @ 2013-01-24 14:53 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel

I don't know whether we can have NULL f_op today, but a quick
grep of '!file->f_op->' in fs directory shows most of times we
do the check. So fix the missing one.

Signed-off-by: Jiang Fang <jiang.xx.fang@gmail.com>
---
 fs/open.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/open.c b/fs/open.c
index 9b33c0c..192dd86 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -275,7 +275,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0))
 		return -EFBIG;
 
-	if (!file->f_op->fallocate)
+	if (!file->f_op || !file->f_op->fallocate)
 		return -EOPNOTSUPP;
 
 	sb_start_write(inode->i_sb);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-24 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-24 14:53 [PATCH] fs: check f_op before dereference its field Jiang Fang
2013-01-24 15:28 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).