]> git.itanic.dy.fi Git - linux-stable/commit
afs: Fix dynamic root lookup DNS check
authorDavid Howells <dhowells@redhat.com>
Mon, 11 Dec 2023 15:15:02 +0000 (15:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jan 2024 10:29:44 +0000 (11:29 +0100)
commiteec7ef60d29791f11bea4ea5636fc67f96a17358
tree519c6bfcb267145cb983dfcffc21c88ee3fb992e
parent82d64cbe487c17b5740ffcf10cfec323069caefc
afs: Fix dynamic root lookup DNS check

[ Upstream commit 74cef6872ceaefb5b6c5c60641371ea28702d358 ]

In the afs dynamic root directory, the ->lookup() function does a DNS check
on the cell being asked for and if the DNS upcall reports an error it will
report an error back to userspace (typically ENOENT).

However, if a failed DNS upcall returns a new-style result, it will return
a valid result, with the status field set appropriately to indicate the
type of failure - and in that case, dns_query() doesn't return an error and
we let stat() complete with no error - which can cause confusion in
userspace as subsequent calls that trigger d_automount then fail with
ENOENT.

Fix this by checking the status result from a valid dns_query() and
returning an error if it indicates a failure.

Fixes: bbb4c4323a4d ("dns: Allow the dns resolver to retrieve a server set")
Reported-by: Markus Suvanto <markus.suvanto@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=216637
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Markus Suvanto <markus.suvanto@gmail.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/afs/dynroot.c