cifs: fix buffer format byte on NT Rename/hardlink
authorJeff Layton <jlayton@tupile.poochiereds.net>
Sat, 28 Feb 2009 17:59:03 +0000 (12:59 -0500)
committerSteve French <sfrench@us.ibm.com>
Thu, 12 Mar 2009 01:36:21 +0000 (01:36 +0000)
Discovered at Connnectathon 2009...

The buffer format byte and the pad are transposed in NT_RENAME calls
(which are used to set hardlinks). Most servers seem to ignore this
fact, but NetApp filers throw back an error due to this problem. This
patch fixes it.

CC: Stable <stable@kernel.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/cifssmb.c

index 4c344fe7a152da6a42333045c7403c134976ab8f..bc09c998631f48dae30c6b004d9f6abdcba5b4ac 100644 (file)
@@ -2377,8 +2377,10 @@ winCreateHardLinkRetry:
                                     PATH_MAX, nls_codepage, remap);
                name_len++;     /* trailing null */
                name_len *= 2;
-               pSMB->OldFileName[name_len] = 0;        /* pad */
-               pSMB->OldFileName[name_len + 1] = 0x04;
+
+               /* protocol specifies ASCII buffer format (0x04) for unicode */
+               pSMB->OldFileName[name_len] = 0x04;
+               pSMB->OldFileName[name_len + 1] = 0x00; /* pad */
                name_len2 =
                    cifsConvertToUCS((__le16 *)&pSMB->OldFileName[name_len + 2],
                                     toName, PATH_MAX, nls_codepage, remap);