summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-02-15 14:37:24 -0800
committerAl Viro <viro@zeniv.linux.org.uk>2008-03-19 06:50:44 -0400
commit322ee5b36eac42e762526b0df7fa432beba6e7a0 (patch)
tree2499695b67123a8d463a1e59e91aa793f4803c10 /fs
parent3227e14c3cab5ef7972c72eb13c13de444b5bfbc (diff)
downloadop-kernel-dev-322ee5b36eac42e762526b0df7fa432beba6e7a0.zip
op-kernel-dev-322ee5b36eac42e762526b0df7fa432beba6e7a0.tar.gz
[PATCH] check for null vfsmount in dentry_open()
Make sure no-one calls dentry_open with a NULL vfsmount argument and crap out with a stacktrace otherwise. A NULL file->f_vfsmnt has always been problematic, but with the per-mount r/o tracking we can't accept anymore at all. [AV] the last place that passed NULL had been eliminated by the previous patch (reiserfs xattr stuff) Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/open.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/open.c b/fs/open.c
index 5419853..a4b1202 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -903,6 +903,18 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
int error;
struct file *f;
+ /*
+ * We must always pass in a valid mount pointer. Historically
+ * callers got away with not passing it, but we must enforce this at
+ * the earliest possible point now to avoid strange problems deep in the
+ * filesystem stack.
+ */
+ if (!mnt) {
+ printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
+ dump_stack();
+ return ERR_PTR(-EINVAL);
+ }
+
error = -ENFILE;
f = get_empty_filp();
if (f == NULL) {
OpenPOWER on IntegriCloud