From: Jeff Liu <jeff.liu@oracle.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfs: Add readpage() check up for mmap file at xfs_file_mmap()
Date: Wed, 18 Jul 2012 22:47:28 +0800 [thread overview]
Message-ID: <5006CC80.3070208@oracle.com> (raw)
Hello,
When studying XFS code, I found xfs_file_mmap() does not check whether a specific file has readpage() or not.
Actually, I have no idea of which kind of file does not supply page reading function, but Btrfs/Ext4
as well as generic_file_mmap() all do this check at first, do we also need a defense here?
Thanks,
-Jeff
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/xfs/xfs_file.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 9f7ec15..92ad4a5 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -945,6 +945,11 @@ xfs_file_mmap(
struct file *filp,
struct vm_area_struct *vma)
{
+ struct address_space *mapping = file->f_mapping;
+
+ if (!mapping->a_ops->readpage)
+ return -ENOEXEC;
+
vma->vm_ops = &xfs_file_vm_ops;
vma->vm_flags |= VM_CAN_NONLINEAR;
--
1.7.9
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2012-07-18 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 14:47 Jeff Liu [this message]
2012-07-18 15:11 ` [PATCH] xfs: Add readpage() check up for mmap file at xfs_file_mmap() Christoph Hellwig
2012-07-19 2:59 ` Jeff Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5006CC80.3070208@oracle.com \
--to=jeff.liu@oracle.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox