Skip to contentSkip to conversation

autofs4 - detect invalid direct mount requests

PATCH In review Ian Kent 3 participants 10 messages Jun 20, 2008 – Jul 3, 2008

Subsystems (2)
lore
Share & tools
lore

Ian Kent

author maintainer
#0 lore raw

PATCH 1/1 autofs4 - detect invalid direct mount requests

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

---

 fs/autofs4/waitq.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/autofs4/waitq.c +4 -0
index cd21fd4..ae637d9 100644
@@ -307,6 +307,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 	if (sbi->catatonic)
 		return -ENOENT;
 
+	if (!dentry->d_inode &&
+	    (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET)))
+		return -ENOENT;
+
 	name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;
#1 lore raw
Quoted 4 lines · Ian Kent

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

What are the conditions that lead us here in that case?

-Jeff

author maintainer
#2 lore raw
Quoted 8 lines · Jeff Moyer
Quoted 4 lines · Ian Kent

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

What are the conditions that lead us here in that case?

v5 doesn't need to get those dir/otherdir messages that we can't avoid for v4.

Basically, attempts to access a non-existent directory in multi-mount tree leads to a negative dentry being sent to the wait queue, but v5 direct and offset mounts must always have an existing (non-negative dentry) directory upon which to mount. This is only relevant for multi-mounts that don't have an explicit multi-mount root so that the lookups occur within the autofs file system.

Sorry, I still can't think of a way to avoid this for v4.

Ian

author maintainer
#3 lore raw
In reply to Jeff Moyer
Quoted 8 lines · Jeff Moyer
Quoted 4 lines · Ian Kent

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

What are the conditions that lead us here in that case?

A multi-mount that has no root mount gets a lookup for an offset that doesn't exist (ie. the trigger hasn't been mounted). Then ->lookup() will create a negative dentry and send a mount request to the daemon. It is a bit of a special case but it helps a little.

Ian

#4 lore raw
In reply to Ian Kent
Quoted 18 lines · On Fri, 20 Jun 2008 13:13:03 +0800 Ian Kent <[email protected]> wrote:

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

---

 fs/autofs4/waitq.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/autofs4/waitq.c +0 -0
index cd21fd4..ae637d9 100644

fs/autofs4/waitq.c int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, · line 316

Quoted 10 lines
fs/autofs4/waitq.c +4 -0
@@ -307,6 +307,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 	if (sbi->catatonic)
 		return -ENOENT;
 
+	if (!dentry->d_inode &&
+	    (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET)))
+		return -ENOENT;
+
 	name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;

A good changelog would allow little old me to determine whether this patch should be merged into 2.6.25 and/or 2.6.26 and/or 2.6.27. This wasn't a good changelog :(

author maintainer
#5 lore raw
Quoted 24 lines · Andrew Morton
Quoted 21 lines · On Fri, 20 Jun 2008 13:13:03 +0800 Ian Kent <[email protected]> wrote:

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

---

 fs/autofs4/waitq.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/autofs4/waitq.c +0 -0
index cd21fd4..ae637d9 100644
@@ -307,6 +307,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 	if (sbi->catatonic)
 		return -ENOENT;
 
Quoted 11 lines

fs/autofs4/waitq.c int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, · line 316

Quoted 7 lines
fs/autofs4/waitq.c +4 -0
+	if (!dentry->d_inode &&
+	    (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET)))
+		return -ENOENT;
+
 	name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;

A good changelog would allow little old me to determine whether this patch should be merged into 2.6.25 and/or 2.6.26 and/or 2.6.27. This wasn't a good changelog :(

Sorry, I guess I shouldn't have included it along with the other more serious bug fixes. It gets rid of an annoyance more than anything as the daemon still has to check for it.

It isn't important or urgent, just useful.

Ian

#6 lore raw
Quoted 37 lines · Ian Kent
Quoted 24 lines · Andrew Morton
Quoted 21 lines · On Fri, 20 Jun 2008 13:13:03 +0800 Ian Kent <[email protected]> wrote:

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

---

 fs/autofs4/waitq.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/autofs4/waitq.c +0 -0
index cd21fd4..ae637d9 100644
@@ -307,6 +307,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 	if (sbi->catatonic)
 		return -ENOENT;
 
Quoted 11 lines

fs/autofs4/waitq.c int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, · line 316

Quoted 7 lines
fs/autofs4/waitq.c +4 -0
+	if (!dentry->d_inode &&
+	    (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET)))
+		return -ENOENT;
+
 	name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;

A good changelog would allow little old me to determine whether this patch should be merged into 2.6.25 and/or 2.6.26 and/or 2.6.27. This wasn't a good changelog :(

Quoted 5 lines

Sorry, I guess I shouldn't have included it along with the other more serious bug fixes. It gets rid of an annoyance more than anything as the daemon still has to check for it.

It isn't important or urgent, just useful.

And I'd still like to see a comment in there! ;)

-jeff

author maintainer
#7 lore raw
Quoted 39 lines · Jeff Moyer
Quoted 37 lines · Ian Kent
Quoted 35 lines · Andrew Morton
Quoted 18 lines · On Fri, 20 Jun 2008 13:13:03 +0800 Ian Kent <[email protected]> wrote:

autofs v5 dierct and offset mounts within an autofs filesystem are triggered by existing autofs triger mounts so the mount point dentry must be positive. If the mount point dentry is negative then the trigger doesn't exist so we can return fail immediately.

---

 fs/autofs4/waitq.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/autofs4/waitq.c +0 -0
index cd21fd4..ae637d9 100644

fs/autofs4/waitq.c int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, · line 316

Quoted 10 lines
fs/autofs4/waitq.c +4 -0
@@ -307,6 +307,10 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
 	if (sbi->catatonic)
 		return -ENOENT;
 
+	if (!dentry->d_inode &&
+	    (sbi->type & (AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET)))
+		return -ENOENT;
+
 	name = kmalloc(NAME_MAX + 1, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;

A good changelog would allow little old me to determine whether this patch should be merged into 2.6.25 and/or 2.6.26 and/or 2.6.27. This wasn't a good changelog :(

Quoted 7 lines
Quoted 5 lines

Sorry, I guess I shouldn't have included it along with the other more serious bug fixes. It gets rid of an annoyance more than anything as the daemon still has to check for it.

It isn't important or urgent, just useful.

And I'd still like to see a comment in there! ;)

OK.

Andrew, could you drop that patch and I'll re-submit it with a better change log entry.

Ian

#8 lore raw
Quoted 11 lines · On Wed, 02 Jul 2008 21:50:21 +0800 Ian Kent <[email protected]> wrote:
Quoted 6 lines
Quoted 4 lines

serious bug fixes. It gets rid of an annoyance more than anything as the daemon still has to check for it.

It isn't important or urgent, just useful.

And I'd still like to see a comment in there! ;)

OK.

Andrew, could you drop that patch and I'll re-submit it with a better change log entry.

nope ;)

Today is try-to-get-rc8-mm1-to-work day and that's likely the last 2.6.26-rcX-mmY. We need to get everything we can runtime tested a bit.

author maintainer
#9 lore raw
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Wed, 02 Jul 2008 21:50:21 +0800 Ian Kent <[email protected]> wrote:
Quoted 5 lines
Quoted 4 lines

serious bug fixes. It gets rid of an annoyance more than anything as the daemon still has to check for it.

It isn't important or urgent, just useful.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

And I'd still like to see a comment in there! ;)

OK.

Andrew, could you drop that patch and I'll re-submit it with a better change log entry.

nope ;)

Hahahaha, OK.

Quoted 3 lines

Today is try-to-get-rc8-mm1-to-work day and that's likely the last 2.6.26-rcX-mmY. We need to get everything we can runtime tested a bit.

Yep, understood.

Ian