In case of somebody opens a file with dentry_open(dentry, NULL, ...) we don't
want to stumble on the NULL pointer mnt in struct file.
Signed-off-by: Jan Blunck <[email protected]>
---
fs/namespace.c | 3 +++
1 file changed, 3 insertions(+)
Index: b/fs/namespace.c
===================================================================
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -253,6 +253,9 @@ void mnt_drop_write(struct vfsmount *mnt
int must_check_underflow = 0;
struct mnt_writer *cpu_writer;
+ if (!mnt)
+ return;
+
cpu_writer = &get_cpu_var(mnt_writers);
spin_lock(&cpu_writer->lock);
--
On Fri, 2007-10-12 at 17:50 +0200, Jan Blunck wrote:
> In case of somebody opens a file with dentry_open(dentry, NULL, ...) we don't
> want to stumble on the NULL pointer mnt in struct file.
...
> +++ b/fs/namespace.c
> @@ -253,6 +253,9 @@ void mnt_drop_write(struct vfsmount *mnt
> int must_check_underflow = 0;
> struct mnt_writer *cpu_writer;
>
> + if (!mnt)
> + return;
I kinda wish we'd fix these in the callers. I know we do something
similar to this with mntput(), but I worry a bit that this just
discourages people from using the right interfaces.
Do you have a case where we're actually getting a NULL mount in here?
We had at least one in reiser4 that really revealed some nastiness in
the fs that needed fixing.
-- Dave
On Fri, Oct 12, 2007 at 05:50:21PM +0200, Jan Blunck wrote:
> In case of somebody opens a file with dentry_open(dentry, NULL, ...) we don't
> want to stumble on the NULL pointer mnt in struct file.
We should just not allow a NULL vfsmount in dentry_open. Dave and I have
fixes for reiserfs, and I'll look at the uml use.