autofs4: autofs4_wait() vs. autofs4_catatonic_mode() race
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jan 2012 03:20:12 +0000 (22:20 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Feb 2018 18:32:18 +0000 (18:32 +0000)
commit2394d99fcee6228f73dd6ecf5b7222024075d0aa
tree1e331573e1924f94aad4bdb2dd362b76e510c5b9
parent111dcf9430d8d3dca94fe9e27db5dde81ab0229f
autofs4: autofs4_wait() vs. autofs4_catatonic_mode() race

commit 4041bcdc7bef06a2fb29c57394c713a74bd13b08 upstream.

We need to recheck ->catatonic after autofs4_wait() got ->wq_mutex
for good, or we might end up with wq inserted into queue after
autofs4_catatonic_mode() had done its thing.  It will stick there
forever, since there won't be anything to clear its ->name.name.

A bit of a complication: validate_request() drops and regains ->wq_mutex.
It actually ends up the most convenient place to stick the check into...

Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/autofs4/waitq.c