Commit 322ee5b36eac42e762526b0df7fa432beba6e7a0
Committed by
Al Viro
1 parent
3227e14c3c
Exists in
master
and in
7 other branches
[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>
Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff
fs/open.c
... | ... | @@ -903,6 +903,18 @@ |
903 | 903 | int error; |
904 | 904 | struct file *f; |
905 | 905 | |
906 | + /* | |
907 | + * We must always pass in a valid mount pointer. Historically | |
908 | + * callers got away with not passing it, but we must enforce this at | |
909 | + * the earliest possible point now to avoid strange problems deep in the | |
910 | + * filesystem stack. | |
911 | + */ | |
912 | + if (!mnt) { | |
913 | + printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__); | |
914 | + dump_stack(); | |
915 | + return ERR_PTR(-EINVAL); | |
916 | + } | |
917 | + | |
906 | 918 | error = -ENFILE; |
907 | 919 | f = get_empty_filp(); |
908 | 920 | if (f == NULL) { |