aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/CHANGES8
-rw-r--r--fs/cifs/README30
-rw-r--r--fs/cifs/TODO4
-rw-r--r--fs/cifs/cifsfs.c23
-rw-r--r--fs/cifs/cifssmb.c25
-rw-r--r--fs/cifs/dir.c34
-rw-r--r--fs/cifs/inode.c50
-rw-r--r--fs/cifs/misc.c17
-rw-r--r--fs/cifs/netmisc.c4
-rw-r--r--fs/cifs/transport.c1
10 files changed, 157 insertions, 39 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 6bded10c0d50..943ef9b82244 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,10 +1,12 @@
1Version 1.39 1Version 1.39
2------------ 2------------
3Defer close of a file handle slightly if pending writes depend on that file handle 3Defer close of a file handle slightly if pending writes depend on that handle
4(this reduces the EBADF bad file handle errors that can be logged under heavy 4(this reduces the EBADF bad file handle errors that can be logged under heavy
5stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 5stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2
6Fix SFU style symlinks and mknod needed for servers which do not support the CIFS 6Fix SFU style symlinks and mknod needed for servers which do not support the
7Unix Extensions. Fix setfacl/getfacl on bigendian. 7CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative
8dentries so files that the client sees as deleted but that later get created
9on the server will be recognized. Add client side permission check on setattr.
8 10
9Version 1.38 11Version 1.38
10------------ 12------------
diff --git a/fs/cifs/README b/fs/cifs/README
index bb90941826ad..e5d09a2fc7a5 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -278,7 +278,9 @@ A partial list of the supported mount options follows:
278 (such as Windows), permissions can also be checked at the 278 (such as Windows), permissions can also be checked at the
279 client, and a crude form of client side permission checking 279 client, and a crude form of client side permission checking
280 can be enabled by specifying file_mode and dir_mode on 280 can be enabled by specifying file_mode and dir_mode on
281 the client 281 the client. Note that the mount.cifs helper must be
282 at version 1.10 or higher to support specifying the uid
283 (or gid) in non-numberic form.
282 gid If CIFS Unix extensions are not supported by the server 284 gid If CIFS Unix extensions are not supported by the server
283 this overrides the default gid for inodes. 285 this overrides the default gid for inodes.
284 file_mode If CIFS Unix extensions are not supported by the server 286 file_mode If CIFS Unix extensions are not supported by the server
@@ -345,7 +347,10 @@ A partial list of the supported mount options follows:
345 client system. It is typically only needed when the server 347 client system. It is typically only needed when the server
346 supports the CIFS Unix Extensions but the UIDs/GIDs on the 348 supports the CIFS Unix Extensions but the UIDs/GIDs on the
347 client and server system do not match closely enough to allow 349 client and server system do not match closely enough to allow
348 access by the user doing the mount. 350 access by the user doing the mount, but it may be useful with
351 non CIFS Unix Extension mounts for cases in which the default
352 mode is specified on the mount but is not to be enforced on the
353 client (e.g. perhaps when MultiUserMount is enabled)
349 Note that this does not affect the normal ACL check on the 354 Note that this does not affect the normal ACL check on the
350 target machine done by the server software (of the server 355 target machine done by the server software (of the server
351 ACL against the user name provided at mount time). 356 ACL against the user name provided at mount time).
@@ -368,15 +373,21 @@ A partial list of the supported mount options follows:
368 setuids If the CIFS Unix extensions are negotiated with the server 373 setuids If the CIFS Unix extensions are negotiated with the server
369 the client will attempt to set the effective uid and gid of 374 the client will attempt to set the effective uid and gid of
370 the local process on newly created files, directories, and 375 the local process on newly created files, directories, and
371 devices (create, mkdir, mknod). 376 devices (create, mkdir, mknod). If the CIFS Unix Extensions
377 are not negotiated, for newly created files and directories
378 instead of using the default uid and gid specified on the
379 the mount, cache the new file's uid and gid locally which means
380 that the uid for the file can change when the inode is
381 reloaded (or the user remounts the share).
372 nosetuids The client will not attempt to set the uid and gid on 382 nosetuids The client will not attempt to set the uid and gid on
373 on newly created files, directories, and devices (create, 383 on newly created files, directories, and devices (create,
374 mkdir, mknod) which will result in the server setting the 384 mkdir, mknod) which will result in the server setting the
375 uid and gid to the default (usually the server uid of the 385 uid and gid to the default (usually the server uid of the
376 user who mounted the share). Letting the server (rather than 386 user who mounted the share). Letting the server (rather than
377 the client) set the uid and gid is the default. This 387 the client) set the uid and gid is the default. If the CIFS
378 parameter has no effect if the CIFS Unix Extensions are not 388 Unix Extensions are not negotiated then the uid and gid for
379 negotiated. 389 new files will appear to be the uid (gid) of the mounter or the
390 uid (gid) parameter specified on the mount.
380 netbiosname When mounting to servers via port 139, specifies the RFC1001 391 netbiosname When mounting to servers via port 139, specifies the RFC1001
381 source name to use to represent the client netbios machine 392 source name to use to represent the client netbios machine
382 name when doing the RFC1001 netbios session initialize. 393 name when doing the RFC1001 netbios session initialize.
@@ -418,6 +429,13 @@ A partial list of the supported mount options follows:
418 byte range locks). 429 byte range locks).
419 remount remount the share (often used to change from ro to rw mounts 430 remount remount the share (often used to change from ro to rw mounts
420 or vice versa) 431 or vice versa)
432 sfu When the CIFS Unix Extensions are not negotiated, attempt to
433 create device files and fifos in a format compatible with
434 Services for Unix (SFU). In addition retrieve bits 10-12
435 of the mode via the SETFILEBITS extended attribute (as
436 SFU does). In the future the bottom 9 bits of the mode
437 mode also will be emulated using queries of the security
438 descriptor (ACL).
421 439
422The mount.cifs mount helper also accepts a few mount options before -o 440The mount.cifs mount helper also accepts a few mount options before -o
423including: 441including:
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index c909298d11ed..fc34c74ec4be 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -1,4 +1,4 @@
1version 1.37 October 9, 2005 1Version 1.39 November 30, 2005
2 2
3A Partial List of Missing Features 3A Partial List of Missing Features
4================================== 4==================================
@@ -58,7 +58,7 @@ o) Improve performance of readpages by sending more than one read
58at a time when 8 pages or more are requested. In conjuntion 58at a time when 8 pages or more are requested. In conjuntion
59add support for async_cifs_readpages. 59add support for async_cifs_readpages.
60 60
61p) Add support for storing symlink and fifo info to Windows servers 61p) Add support for storing symlink info to Windows servers
62in the Extended Attribute format their SFU clients would recognize. 62in the Extended Attribute format their SFU clients would recognize.
63 63
64q) Finish fcntl D_NOTIFY support so kde and gnome file list windows 64q) Finish fcntl D_NOTIFY support so kde and gnome file list windows
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 51548ed2e9cc..2a13a2bac8f1 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -32,6 +32,7 @@
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#include <linux/vfs.h> 33#include <linux/vfs.h>
34#include <linux/mempool.h> 34#include <linux/mempool.h>
35#include <linux/delay.h>
35#include "cifsfs.h" 36#include "cifsfs.h"
36#include "cifspdu.h" 37#include "cifspdu.h"
37#define DECLARE_GLOBALS_HERE 38#define DECLARE_GLOBALS_HERE
@@ -429,6 +430,11 @@ static void cifs_umount_begin(struct super_block * sblock)
429 { 430 {
430 cFYI(1,("wake up tasks now - umount begin not complete")); 431 cFYI(1,("wake up tasks now - umount begin not complete"));
431 wake_up_all(&tcon->ses->server->request_q); 432 wake_up_all(&tcon->ses->server->request_q);
433 wake_up_all(&tcon->ses->server->response_q);
434 msleep(1); /* yield */
435 /* we have to kick the requests once more */
436 wake_up_all(&tcon->ses->server->response_q);
437 msleep(1);
432 } 438 }
433/* BB FIXME - finish add checks for tidStatus BB */ 439/* BB FIXME - finish add checks for tidStatus BB */
434 440
@@ -895,6 +901,9 @@ static int cifs_oplock_thread(void * dummyarg)
895 901
896static int cifs_dnotify_thread(void * dummyarg) 902static int cifs_dnotify_thread(void * dummyarg)
897{ 903{
904 struct list_head *tmp;
905 struct cifsSesInfo *ses;
906
898 daemonize("cifsdnotifyd"); 907 daemonize("cifsdnotifyd");
899 allow_signal(SIGTERM); 908 allow_signal(SIGTERM);
900 909
@@ -903,7 +912,19 @@ static int cifs_dnotify_thread(void * dummyarg)
903 if(try_to_freeze()) 912 if(try_to_freeze())
904 continue; 913 continue;
905 set_current_state(TASK_INTERRUPTIBLE); 914 set_current_state(TASK_INTERRUPTIBLE);
906 schedule_timeout(39*HZ); 915 schedule_timeout(15*HZ);
916 read_lock(&GlobalSMBSeslock);
917 /* check if any stuck requests that need
918 to be woken up and wakeq so the
919 thread can wake up and error out */
920 list_for_each(tmp, &GlobalSMBSessionList) {
921 ses = list_entry(tmp, struct cifsSesInfo,
922 cifsSessionList);
923 if(ses && ses->server &&
924 atomic_read(&ses->server->inFlight))
925 wake_up_all(&ses->server->response_q);
926 }
927 read_unlock(&GlobalSMBSeslock);
907 } while(!signal_pending(current)); 928 } while(!signal_pending(current));
908 complete_and_exit (&cifs_dnotify_exited, 0); 929 complete_and_exit (&cifs_dnotify_exited, 0);
909} 930}
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index d179b0c3eee4..6867e556d37e 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -90,6 +90,18 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
90 check for tcp and smb session status done differently 90 check for tcp and smb session status done differently
91 for those three - in the calling routine */ 91 for those three - in the calling routine */
92 if(tcon) { 92 if(tcon) {
93 if(tcon->tidStatus == CifsExiting) {
94 /* only tree disconnect, open, and write,
95 (and ulogoff which does not have tcon)
96 are allowed as we start force umount */
97 if((smb_command != SMB_COM_WRITE_ANDX) &&
98 (smb_command != SMB_COM_OPEN_ANDX) &&
99 (smb_command != SMB_COM_TREE_DISCONNECT)) {
100 cFYI(1,("can not send cmd %d while umounting",
101 smb_command));
102 return -ENODEV;
103 }
104 }
93 if((tcon->ses) && (tcon->ses->status != CifsExiting) && 105 if((tcon->ses) && (tcon->ses->status != CifsExiting) &&
94 (tcon->ses->server)){ 106 (tcon->ses->server)){
95 struct nls_table *nls_codepage; 107 struct nls_table *nls_codepage;
@@ -187,6 +199,19 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
187 check for tcp and smb session status done differently 199 check for tcp and smb session status done differently
188 for those three - in the calling routine */ 200 for those three - in the calling routine */
189 if(tcon) { 201 if(tcon) {
202 if(tcon->tidStatus == CifsExiting) {
203 /* only tree disconnect, open, and write,
204 (and ulogoff which does not have tcon)
205 are allowed as we start force umount */
206 if((smb_command != SMB_COM_WRITE_ANDX) &&
207 (smb_command != SMB_COM_OPEN_ANDX) &&
208 (smb_command != SMB_COM_TREE_DISCONNECT)) {
209 cFYI(1,("can not send cmd %d while umounting",
210 smb_command));
211 return -ENODEV;
212 }
213 }
214
190 if((tcon->ses) && (tcon->ses->status != CifsExiting) && 215 if((tcon->ses) && (tcon->ses->status != CifsExiting) &&
191 (tcon->ses->server)){ 216 (tcon->ses->server)){
192 struct nls_table *nls_codepage; 217 struct nls_table *nls_codepage;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 16b21522e8fe..32cc96cafa3e 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -228,8 +228,15 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
228 else { 228 else {
229 rc = cifs_get_inode_info(&newinode, full_path, 229 rc = cifs_get_inode_info(&newinode, full_path,
230 buf, inode->i_sb,xid); 230 buf, inode->i_sb,xid);
231 if(newinode) 231 if(newinode) {
232 newinode->i_mode = mode; 232 newinode->i_mode = mode;
233 if((oplock & CIFS_CREATE_ACTION) &&
234 (cifs_sb->mnt_cifs_flags &
235 CIFS_MOUNT_SET_UID)) {
236 newinode->i_uid = current->fsuid;
237 newinode->i_gid = current->fsgid;
238 }
239 }
233 } 240 }
234 241
235 if (rc != 0) { 242 if (rc != 0) {
@@ -465,12 +472,20 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
465 direntry->d_op = &cifs_dentry_ops; 472 direntry->d_op = &cifs_dentry_ops;
466 d_add(direntry, newInode); 473 d_add(direntry, newInode);
467 474
468 /* since paths are not looked up by component - the parent directories are presumed to be good here */ 475 /* since paths are not looked up by component - the parent
476 directories are presumed to be good here */
469 renew_parental_timestamps(direntry); 477 renew_parental_timestamps(direntry);
470 478
471 } else if (rc == -ENOENT) { 479 } else if (rc == -ENOENT) {
472 rc = 0; 480 rc = 0;
481 direntry->d_time = jiffies;
482 if (pTcon->nocase)
483 direntry->d_op = &cifs_ci_dentry_ops;
484 else
485 direntry->d_op = &cifs_dentry_ops;
473 d_add(direntry, NULL); 486 d_add(direntry, NULL);
487 /* if it was once a directory (but how can we tell?) we could do
488 shrink_dcache_parent(direntry); */
474 } else { 489 } else {
475 cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s", 490 cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s",
476 rc,full_path)); 491 rc,full_path));
@@ -489,21 +504,20 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
489{ 504{
490 int isValid = 1; 505 int isValid = 1;
491 506
492/* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */
493
494 if (direntry->d_inode) { 507 if (direntry->d_inode) {
495 if (cifs_revalidate(direntry)) { 508 if (cifs_revalidate(direntry)) {
496 /* unlock_kernel(); */
497 return 0; 509 return 0;
498 } 510 }
499 } else { 511 } else {
500 cFYI(1, 512 cFYI(1, ("neg dentry 0x%p name = %s",
501 ("In cifs_d_revalidate with no inode but name = %s and dentry 0x%p", 513 direntry, direntry->d_name.name));
502 direntry->d_name.name, direntry)); 514 if(time_after(jiffies, direntry->d_time + HZ) ||
515 !lookupCacheEnabled) {
516 d_drop(direntry);
517 isValid = 0;
518 }
503 } 519 }
504 520
505/* unlock_kernel(); */
506
507 return isValid; 521 return isValid;
508} 522}
509 523
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 05b525812adb..411c1f7f84da 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -710,7 +710,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
710 char *full_path = NULL; 710 char *full_path = NULL;
711 struct inode *newinode = NULL; 711 struct inode *newinode = NULL;
712 712
713 cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p ", mode, inode)); 713 cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode));
714 714
715 xid = GetXid(); 715 xid = GetXid();
716 716
@@ -768,6 +768,17 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
768 /* BB to be implemented via Windows secrty descriptors 768 /* BB to be implemented via Windows secrty descriptors
769 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, 769 eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,
770 -1, -1, local_nls); */ 770 -1, -1, local_nls); */
771 if(direntry->d_inode) {
772 direntry->d_inode->i_mode = mode;
773 direntry->d_inode->i_mode |= S_IFDIR;
774 if(cifs_sb->mnt_cifs_flags &
775 CIFS_MOUNT_SET_UID) {
776 direntry->d_inode->i_uid =
777 current->fsuid;
778 direntry->d_inode->i_gid =
779 current->fsgid;
780 }
781 }
771 } 782 }
772 } 783 }
773 kfree(full_path); 784 kfree(full_path);
@@ -1039,14 +1050,20 @@ int cifs_revalidate(struct dentry *direntry)
1039 filemap_fdatawrite(direntry->d_inode->i_mapping); 1050 filemap_fdatawrite(direntry->d_inode->i_mapping);
1040 } 1051 }
1041 if (invalidate_inode) { 1052 if (invalidate_inode) {
1042 if (direntry->d_inode->i_mapping) 1053 /* shrink_dcache not necessary now that cifs dentry ops
1043 filemap_fdatawait(direntry->d_inode->i_mapping); 1054 are exported for negative dentries */
1044 /* may eventually have to do this for open files too */ 1055/* if(S_ISDIR(direntry->d_inode->i_mode))
1045 if (list_empty(&(cifsInode->openFileList))) { 1056 shrink_dcache_parent(direntry); */
1046 /* Has changed on server - flush read ahead pages */ 1057 if (S_ISREG(direntry->d_inode->i_mode)) {
1047 cFYI(1, ("Invalidating read ahead data on " 1058 if (direntry->d_inode->i_mapping)
1048 "closed file")); 1059 filemap_fdatawait(direntry->d_inode->i_mapping);
1049 invalidate_remote_inode(direntry->d_inode); 1060 /* may eventually have to do this for open files too */
1061 if (list_empty(&(cifsInode->openFileList))) {
1062 /* changed on server - flush read ahead pages */
1063 cFYI(1, ("Invalidating read ahead data on "
1064 "closed file"));
1065 invalidate_remote_inode(direntry->d_inode);
1066 }
1050 } 1067 }
1051 } 1068 }
1052/* up(&direntry->d_inode->i_sem); */ 1069/* up(&direntry->d_inode->i_sem); */
@@ -1105,9 +1122,20 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1105 1122
1106 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ", 1123 cFYI(1, ("In cifs_setattr, name = %s attrs->iavalid 0x%x ",
1107 direntry->d_name.name, attrs->ia_valid)); 1124 direntry->d_name.name, attrs->ia_valid));
1125
1108 cifs_sb = CIFS_SB(direntry->d_inode->i_sb); 1126 cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
1109 pTcon = cifs_sb->tcon; 1127 pTcon = cifs_sb->tcon;
1110 1128
1129 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
1130 /* check if we have permission to change attrs */
1131 rc = inode_change_ok(direntry->d_inode, attrs);
1132 if(rc < 0) {
1133 FreeXid(xid);
1134 return rc;
1135 } else
1136 rc = 0;
1137 }
1138
1111 down(&direntry->d_sb->s_vfs_rename_sem); 1139 down(&direntry->d_sb->s_vfs_rename_sem);
1112 full_path = build_path_from_dentry(direntry); 1140 full_path = build_path_from_dentry(direntry);
1113 up(&direntry->d_sb->s_vfs_rename_sem); 1141 up(&direntry->d_sb->s_vfs_rename_sem);
@@ -1147,7 +1175,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1147 1 /* 45 seconds */); 1175 1 /* 45 seconds */);
1148 cFYI(1,("Wrt seteof rc %d", rc)); 1176 cFYI(1,("Wrt seteof rc %d", rc));
1149 } 1177 }
1150 } 1178 } else
1179 rc = -EINVAL;
1180
1151 if (rc != 0) { 1181 if (rc != 0) {
1152 /* Set file size by pathname rather than by handle 1182 /* Set file size by pathname rather than by handle
1153 either because no valid, writeable file handle for 1183 either because no valid, writeable file handle for
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index ca27a82c54cd..94baf6c8ecbd 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -397,12 +397,12 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid)
397 if(smb->Command == SMB_COM_LOCKING_ANDX) 397 if(smb->Command == SMB_COM_LOCKING_ANDX)
398 return 0; 398 return 0;
399 else 399 else
400 cERROR(1, ("Rcvd Request not response ")); 400 cERROR(1, ("Rcvd Request not response"));
401 } 401 }
402 } else { /* bad signature or mid */ 402 } else { /* bad signature or mid */
403 if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) 403 if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff))
404 cERROR(1, 404 cERROR(1,
405 ("Bad protocol string signature header %x ", 405 ("Bad protocol string signature header %x",
406 *(unsigned int *) smb->Protocol)); 406 *(unsigned int *) smb->Protocol));
407 if (mid != smb->Mid) 407 if (mid != smb->Mid)
408 cERROR(1, ("Mids do not match")); 408 cERROR(1, ("Mids do not match"));
@@ -417,7 +417,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
417 __u32 len = smb->smb_buf_length; 417 __u32 len = smb->smb_buf_length;
418 __u32 clc_len; /* calculated length */ 418 __u32 clc_len; /* calculated length */
419 cFYI(0, 419 cFYI(0,
420 ("Entering checkSMB with Length: %x, smb_buf_length: %x ", 420 ("Entering checkSMB with Length: %x, smb_buf_length: %x",
421 length, len)); 421 length, len));
422 if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) || 422 if (((unsigned int)length < 2 + sizeof (struct smb_hdr)) ||
423 (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)) { 423 (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4)) {
@@ -451,9 +451,16 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
451 cERROR(1, ("bad smb size detected for Mid=%d", smb->Mid)); 451 cERROR(1, ("bad smb size detected for Mid=%d", smb->Mid));
452 /* Windows XP can return a few bytes too much, presumably 452 /* Windows XP can return a few bytes too much, presumably
453 an illegal pad, at the end of byte range lock responses 453 an illegal pad, at the end of byte range lock responses
454 so we allow for up to eight byte pad, as long as actual 454 so we allow for that three byte pad, as long as actual
455 received length is as long or longer than calculated length */ 455 received length is as long or longer than calculated length */
456 if((4+len > clc_len) && (len <= clc_len + 3)) 456 /* We have now had to extend this more, since there is a
457 case in which it needs to be bigger still to handle a
458 malformed response to transact2 findfirst from WinXP when
459 access denied is returned and thus bcc and wct are zero
460 but server says length is 0x21 bytes too long as if the server
461 forget to reset the smb rfc1001 length when it reset the
462 wct and bcc to minimum size and drop the t2 parms and data */
463 if((4+len > clc_len) && (len <= clc_len + 512))
457 return 0; 464 return 0;
458 else 465 else
459 return 1; 466 return 1;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index f7814689844b..5de74d216fdd 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -330,7 +330,7 @@ static const struct {
330 ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { 330 ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, {
331 ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, { 331 ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, {
332 ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, { 332 ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, {
333 ERRSRV, 2242, NT_STATUS_PASSWORD_EXPIRED}, { 333 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, {
334 ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, { 334 ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, {
335 ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { 335 ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, {
336 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { 336 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, {
@@ -676,7 +676,7 @@ static const struct {
676 ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, { 676 ERRDOS, 193, NT_STATUS_IMAGE_CHECKSUM_MISMATCH}, {
677 ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, { 677 ERRHRD, ERRgeneral, NT_STATUS_LOST_WRITEBEHIND_DATA}, {
678 ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, { 678 ERRHRD, ERRgeneral, NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID}, {
679 ERRSRV, 2242, NT_STATUS_PASSWORD_MUST_CHANGE}, { 679 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_MUST_CHANGE}, {
680 ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, { 680 ERRHRD, ERRgeneral, NT_STATUS_NOT_FOUND}, {
681 ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, { 681 ERRHRD, ERRgeneral, NT_STATUS_NOT_TINY_STREAM}, {
682 ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, { 682 ERRHRD, ERRgeneral, NT_STATUS_RECOVERY_FAILURE}, {
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 41a9659c16bc..f8871196098c 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -515,6 +515,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
515 *pbytes_returned = in_buf->smb_buf_length; 515 *pbytes_returned = in_buf->smb_buf_length;
516 516
517 /* BB special case reconnect tid and uid here? */ 517 /* BB special case reconnect tid and uid here? */
518 /* BB special case Errbadpassword and pwdexpired here */
518 rc = map_smb_to_linux_error(in_buf); 519 rc = map_smb_to_linux_error(in_buf);
519 520
520 /* convert ByteCount if necessary */ 521 /* convert ByteCount if necessary */