Skip to content

Commit

Permalink
autofs: fix wait name hash calculation in autofs_wait()
Browse files Browse the repository at this point in the history
commit 25f54d0 upstream.

There's a mistake in commit 2be7828 ("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: 2be7828 ("get rid of autofs_getpath()")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Kent authored and Greg Kroah-Hartman committed Oct 27, 2021
1 parent 1009f09 commit ff261f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/autofs/waitq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ff261f9

Please sign in to comment.