From d38a3c15d8dd35ce55fc10e5eebd7219718179cf Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Thu, 8 Apr 2021 13:31:03 -0300 Subject: [PATCH 4.19] cifs: fix prefix path in dfs mounts When chasing dfs referrals we update the volume info accordingly so we can build new dfs full paths from them, but we missed to update the final prefix path in superblock that is used in most places. Signed-off-by: Paulo Alcantara (SUSE) --- fs/cifs/connect.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 632249ce61eb..e342ab94f79d 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -4283,6 +4283,16 @@ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) goto mount_fail_check; } + kfree(cifs_sb->prepath); + cifs_sb->prepath = NULL; + if (volume_info->prepath) { + cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); + if (!cifs_sb->prepath) { + rc = -ENOMEM; + goto mount_fail_check; + } + } + tlink->tl_uid = ses->linux_uid; tlink->tl_tcon = tcon; tlink->tl_time = jiffies; -- 2.30.2