cifs: fix dfs-links
[sfrench/cifs-2.6.git] / fs / cifs / connect.c
index 10fe6d6d2dee49b068c84ee977092451974e399f..76e4d8d8b3a6ce665c5923fd2448df036d2ddc8d 100644 (file)
@@ -2983,6 +2983,14 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
                        rc = PTR_ERR(mdata);
                        mdata = NULL;
                } else {
+                       /*
+                        * We can not clear out the whole structure since we
+                        * no longer have an explicit function to parse
+                        * a mount-string. Instead we need to clear out the
+                        * individual fields that are no longer valid.
+                        */
+                       kfree(ctx->prepath);
+                       ctx->prepath = NULL;
                        rc = cifs_setup_volume_info(ctx, mdata, fake_devname);
                }
                kfree(fake_devname);