linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] autofs: fix wait name hash calculation in autofs_wait()
@ 2021-09-23  7:13 Ian Kent
  2021-10-14 15:11 ` Justin Forbes
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Kent @ 2021-09-23  7:13 UTC (permalink / raw)
  To: Al Viro, autofs mailing list, Kernel Mailing List, linux-fsdevel

There's a mistake in commit 2be7828c9fefc ("get rid of autofs_getpath()")
that affects kernels from v5.13.0, basically missed because of me not
fully testing the change for Al.

The problem is that the hash calculation for the wait name qstr hasn't
been updated to account for the change to use dentry_path_raw(). This
prevents the correct matching an existing wait resulting in multiple
notifications being sent to the daemon for the same mount which must
not occur.

The problem wasn't discovered earlier because it only occurs when
multiple processes trigger a request for the same mount concurrently
so it only shows up in more aggressive testing.

Fixes: 2be7828c9fefc ("get rid of autofs_getpath()")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Kent <raven@themaw.net>
---
 fs/autofs/waitq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
index 16b5fca0626e..54c1f8b8b075 100644
--- a/fs/autofs/waitq.c
+++ b/fs/autofs/waitq.c
@@ -358,7 +358,7 @@ int autofs_wait(struct autofs_sb_info *sbi,
 		qstr.len = strlen(p);
 		offset = p - name;
 	}
-	qstr.hash = full_name_hash(dentry, name, qstr.len);
+	qstr.hash = full_name_hash(dentry, qstr.name, qstr.len);
 
 	if (mutex_lock_interruptible(&sbi->wq_mutex)) {
 		kfree(name);



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] autofs: fix wait name hash calculation in autofs_wait()
  2021-09-23  7:13 [PATCH] autofs: fix wait name hash calculation in autofs_wait() Ian Kent
@ 2021-10-14 15:11 ` Justin Forbes
  2021-10-15  0:08   ` Ian Kent
  0 siblings, 1 reply; 3+ messages in thread
From: Justin Forbes @ 2021-10-14 15:11 UTC (permalink / raw)
  To: Ian Kent; +Cc: Al Viro, autofs mailing list, Kernel Mailing List, linux-fsdevel

On Thu, Sep 23, 2021 at 2:20 AM Ian Kent <raven@themaw.net> wrote:
>
> There's a mistake in commit 2be7828c9fefc ("get rid of autofs_getpath()")
> that affects kernels from v5.13.0, basically missed because of me not
> fully testing the change for Al.
>
> The problem is that the hash calculation for the wait name qstr hasn't
> been updated to account for the change to use dentry_path_raw(). This
> prevents the correct matching an existing wait resulting in multiple
> notifications being sent to the daemon for the same mount which must
> not occur.
>
> The problem wasn't discovered earlier because it only occurs when
> multiple processes trigger a request for the same mount concurrently
> so it only shows up in more aggressive testing.

I suppose it shows up in more than just testing, as we have a bug
where this is impacting a user doing regular desktop things.

Justin

> Fixes: 2be7828c9fefc ("get rid of autofs_getpath()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ian Kent <raven@themaw.net>
> ---
>  fs/autofs/waitq.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
> index 16b5fca0626e..54c1f8b8b075 100644
> --- a/fs/autofs/waitq.c
> +++ b/fs/autofs/waitq.c
> @@ -358,7 +358,7 @@ int autofs_wait(struct autofs_sb_info *sbi,
>                 qstr.len = strlen(p);
>                 offset = p - name;
>         }
> -       qstr.hash = full_name_hash(dentry, name, qstr.len);
> +       qstr.hash = full_name_hash(dentry, qstr.name, qstr.len);
>
>         if (mutex_lock_interruptible(&sbi->wq_mutex)) {
>                 kfree(name);
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] autofs: fix wait name hash calculation in autofs_wait()
  2021-10-14 15:11 ` Justin Forbes
@ 2021-10-15  0:08   ` Ian Kent
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Kent @ 2021-10-15  0:08 UTC (permalink / raw)
  To: Justin Forbes
  Cc: Al Viro, autofs mailing list, Kernel Mailing List, linux-fsdevel

On Thu, 2021-10-14 at 10:11 -0500, Justin Forbes wrote:
> On Thu, Sep 23, 2021 at 2:20 AM Ian Kent <raven@themaw.net> wrote:
> > 
> > There's a mistake in commit 2be7828c9fefc ("get rid of
> > autofs_getpath()")
> > that affects kernels from v5.13.0, basically missed because of me
> > not
> > fully testing the change for Al.
> > 
> > The problem is that the hash calculation for the wait name qstr
> > hasn't
> > been updated to account for the change to use dentry_path_raw().
> > This
> > prevents the correct matching an existing wait resulting in
> > multiple
> > notifications being sent to the daemon for the same mount which
> > must
> > not occur.
> > 
> > The problem wasn't discovered earlier because it only occurs when
> > multiple processes trigger a request for the same mount
> > concurrently
> > so it only shows up in more aggressive testing.
> 
> I suppose it shows up in more than just testing, as we have a bug
> where this is impacting a user doing regular desktop things.

Yes, but what the patch description is talking about is my not
discovering the problem when I tested the original change.

I have a similar Fedora bug too but that came in some time after
I discovered the problem when testing a new autofs release.

All it takes is multiple processes concurrently triggering an
autofs automount point. Because the qstr hash doesn't match
duplicate mount requests are sent to the daemon which is a
problem.

> 
> Justin
> 
> > Fixes: 2be7828c9fefc ("get rid of autofs_getpath()")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Ian Kent <raven@themaw.net>
> > ---
> >  fs/autofs/waitq.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
> > index 16b5fca0626e..54c1f8b8b075 100644
> > --- a/fs/autofs/waitq.c
> > +++ b/fs/autofs/waitq.c
> > @@ -358,7 +358,7 @@ int autofs_wait(struct autofs_sb_info *sbi,
> >                 qstr.len = strlen(p);
> >                 offset = p - name;
> >         }
> > -       qstr.hash = full_name_hash(dentry, name, qstr.len);
> > +       qstr.hash = full_name_hash(dentry, qstr.name, qstr.len);
> > 
> >         if (mutex_lock_interruptible(&sbi->wq_mutex)) {
> >                 kfree(name);
> > 
> > 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-15  0:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23  7:13 [PATCH] autofs: fix wait name hash calculation in autofs_wait() Ian Kent
2021-10-14 15:11 ` Justin Forbes
2021-10-15  0:08   ` Ian Kent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).