[CIFS] Don't allow a backslash in a path component

Unless Posix paths have been negotiated, the backslash, "\", is not a valid
character in a path component.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

+14
+14
fs/cifs/dir.c
··· 436 436 cifs_sb = CIFS_SB(parent_dir_inode->i_sb); 437 437 pTcon = cifs_sb->tcon; 438 438 439 + /* 440 + * Don't allow the separator character in a path component. 441 + * The VFS will not allow "/", but "\" is allowed by posix. 442 + */ 443 + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) { 444 + int i; 445 + for (i = 0; i < direntry->d_name.len; i++) 446 + if (direntry->d_name.name[i] == '\\') { 447 + cFYI(1, ("Invalid file name")); 448 + FreeXid(xid); 449 + return ERR_PTR(-EINVAL); 450 + } 451 + } 452 + 439 453 /* can not grab the rename sem here since it would 440 454 deadlock in the cases (beginning of sys_rename itself) 441 455 in which we already have the sb rename sem */