Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] new cifs endianness bugs

* missing cpu_to_le64() for ChangeTime (introduced by
[CIFS] Legacy time handling for Win9x and OS/2 part 1)
* missing le16_to_cpu() for DialectIndex (introduced by
[CIFS] Do not send newer QFSInfo to legacy servers which can not support it)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Al Viro and committed by
Linus Torvalds
733f99ac 645408d1

+7 -5
+7 -5
fs/cifs/cifssmb.c
··· 399 399 struct TCP_Server_Info * server; 400 400 u16 count; 401 401 unsigned int secFlags; 402 + u16 dialect; 402 403 403 404 if(ses->server) 404 405 server = ses->server; ··· 439 438 if (rc != 0) 440 439 goto neg_err_exit; 441 440 442 - cFYI(1,("Dialect: %d", pSMBr->DialectIndex)); 441 + dialect = le16_to_cpu(pSMBr->DialectIndex); 442 + cFYI(1,("Dialect: %d", dialect)); 443 443 /* Check wct = 1 error case */ 444 - if((pSMBr->hdr.WordCount < 13) || (pSMBr->DialectIndex == BAD_PROT)) { 444 + if((pSMBr->hdr.WordCount < 13) || (dialect == BAD_PROT)) { 445 445 /* core returns wct = 1, but we do not ask for core - otherwise 446 446 small wct just comes when dialect index is -1 indicating we 447 447 could not negotiate a common dialect */ ··· 450 448 goto neg_err_exit; 451 449 #ifdef CONFIG_CIFS_WEAK_PW_HASH 452 450 } else if((pSMBr->hdr.WordCount == 13) 453 - && ((pSMBr->DialectIndex == LANMAN_PROT) 454 - || (pSMBr->DialectIndex == LANMAN2_PROT))) { 451 + && ((dialect == LANMAN_PROT) 452 + || (dialect == LANMAN2_PROT))) { 455 453 __s16 tmp; 456 454 struct lanman_neg_rsp * rsp = (struct lanman_neg_rsp *)pSMBr; 457 455 ··· 2945 2943 ts.tv_nsec = 0; 2946 2944 ts.tv_sec = time; 2947 2945 /* decode time fields */ 2948 - pFinfo->ChangeTime = cifs_UnixTimeToNT(ts); 2946 + pFinfo->ChangeTime = cpu_to_le64(cifs_UnixTimeToNT(ts)); 2949 2947 pFinfo->LastWriteTime = pFinfo->ChangeTime; 2950 2948 pFinfo->LastAccessTime = 0; 2951 2949 pFinfo->AllocationSize =