Skip to content

Commit a2a8fc2

Browse files
author
Trond Myklebust
committed
NFS: Fix up the automount fs_context to use the correct cred
When automounting, the fs_context should be fixed up to use the cred from the parent filesystem, since the operation is just extending the namespace. Authorisation to enter that namespace will already have been provided by the preceding lookup. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 2b09217 commit a2a8fc2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fs/nfs/namespace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ struct vfsmount *nfs_d_automount(struct path *path)
170170
if (!ctx->clone_data.fattr)
171171
goto out_fc;
172172

173+
if (fc->cred != server->cred) {
174+
put_cred(fc->cred);
175+
fc->cred = get_cred(server->cred);
176+
}
177+
173178
if (fc->net_ns != client->cl_net) {
174179
put_net(fc->net_ns);
175180
fc->net_ns = get_net(client->cl_net);

0 commit comments

Comments
 (0)