Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
26f57364
Commit
26f57364
authored
Aug 30, 2007
by
Steve French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] formatting cleanup found by checkpatch
Signed-off-by:
Steve French
<
sfrench@us.ibm.com
>
parent
f01d5e14
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
80 additions
and
105 deletions
+80
-105
fs/cifs/asn1.c
fs/cifs/asn1.c
+4
-6
fs/cifs/cifsfs.c
fs/cifs/cifsfs.c
+10
-10
fs/cifs/cifsfs.h
fs/cifs/cifsfs.h
+1
-1
fs/cifs/cifspdu.h
fs/cifs/cifspdu.h
+3
-3
fs/cifs/cifsproto.h
fs/cifs/cifsproto.h
+1
-1
fs/cifs/cifssmb.c
fs/cifs/cifssmb.c
+20
-24
fs/cifs/connect.c
fs/cifs/connect.c
+20
-28
fs/cifs/readdir.c
fs/cifs/readdir.c
+1
-1
fs/cifs/sess.c
fs/cifs/sess.c
+10
-17
fs/cifs/transport.c
fs/cifs/transport.c
+10
-14
No files found.
fs/cifs/asn1.c
View file @
26f57364
...
@@ -385,10 +385,9 @@ asn1_oid_decode(struct asn1_ctx *ctx,
...
@@ -385,10 +385,9 @@ asn1_oid_decode(struct asn1_ctx *ctx,
unsigned
long
*
optr
;
unsigned
long
*
optr
;
size
=
eoc
-
ctx
->
pointer
+
1
;
size
=
eoc
-
ctx
->
pointer
+
1
;
*
oid
=
kmalloc
(
size
*
sizeof
(
unsigned
long
),
GFP_ATOMIC
);
*
oid
=
kmalloc
(
size
*
sizeof
(
unsigned
long
),
GFP_ATOMIC
);
if
(
*
oid
==
NULL
)
{
if
(
*
oid
==
NULL
)
return
0
;
return
0
;
}
optr
=
*
oid
;
optr
=
*
oid
;
...
@@ -581,9 +580,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
...
@@ -581,9 +580,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
return
0
;
return
0
;
}
else
if
((
cls
!=
ASN1_UNI
)
||
(
con
!=
ASN1_CON
)
}
else
if
((
cls
!=
ASN1_UNI
)
||
(
con
!=
ASN1_CON
)
||
(
tag
!=
ASN1_SEQ
))
{
||
(
tag
!=
ASN1_SEQ
))
{
cFYI
(
1
,
cFYI
(
1
,
(
"cls = %d con = %d tag = %d end = %p (%d)"
,
(
"Exit 6 cls = %d con = %d tag = %d end = %p (%d)"
,
cls
,
con
,
tag
,
end
,
*
end
));
cls
,
con
,
tag
,
end
,
*
end
));
}
}
if
(
asn1_header_decode
(
&
ctx
,
&
end
,
&
cls
,
&
con
,
&
tag
)
==
0
)
{
if
(
asn1_header_decode
(
&
ctx
,
&
end
,
&
cls
,
&
con
,
&
tag
)
==
0
)
{
...
...
fs/cifs/cifsfs.c
View file @
26f57364
...
@@ -240,9 +240,9 @@ static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd)
...
@@ -240,9 +240,9 @@ static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd)
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
cifs_sb
=
CIFS_SB
(
inode
->
i_sb
);
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_PERM
)
{
if
(
cifs_sb
->
mnt_cifs_flags
&
CIFS_MOUNT_NO_PERM
)
return
0
;
return
0
;
}
else
/* file mode might have been restricted at mount time
else
/* file mode might have been restricted at mount time
on the client (above and beyond ACL on servers) for
on the client (above and beyond ACL on servers) for
servers which do not support setting and viewing mode bits,
servers which do not support setting and viewing mode bits,
so allowing client to check permissions is useful */
so allowing client to check permissions is useful */
...
@@ -716,7 +716,7 @@ static int
...
@@ -716,7 +716,7 @@ static int
cifs_init_inodecache
(
void
)
cifs_init_inodecache
(
void
)
{
{
cifs_inode_cachep
=
kmem_cache_create
(
"cifs_inode_cache"
,
cifs_inode_cachep
=
kmem_cache_create
(
"cifs_inode_cache"
,
sizeof
(
struct
cifsInodeInfo
),
sizeof
(
struct
cifsInodeInfo
),
0
,
(
SLAB_RECLAIM_ACCOUNT
|
0
,
(
SLAB_RECLAIM_ACCOUNT
|
SLAB_MEM_SPREAD
),
SLAB_MEM_SPREAD
),
cifs_init_once
);
cifs_init_once
);
...
@@ -816,8 +816,8 @@ static int
...
@@ -816,8 +816,8 @@ static int
cifs_init_mids
(
void
)
cifs_init_mids
(
void
)
{
{
cifs_mid_cachep
=
kmem_cache_create
(
"cifs_mpx_ids"
,
cifs_mid_cachep
=
kmem_cache_create
(
"cifs_mpx_ids"
,
sizeof
(
struct
mid_q_entry
),
0
,
sizeof
(
struct
mid_q_entry
),
0
,
SLAB_HWCACHE_ALIGN
,
NULL
);
SLAB_HWCACHE_ALIGN
,
NULL
);
if
(
cifs_mid_cachep
==
NULL
)
if
(
cifs_mid_cachep
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -829,8 +829,8 @@ cifs_init_mids(void)
...
@@ -829,8 +829,8 @@ cifs_init_mids(void)
}
}
cifs_oplock_cachep
=
kmem_cache_create
(
"cifs_oplock_structs"
,
cifs_oplock_cachep
=
kmem_cache_create
(
"cifs_oplock_structs"
,
sizeof
(
struct
oplock_q_entry
),
0
,
sizeof
(
struct
oplock_q_entry
),
0
,
SLAB_HWCACHE_ALIGN
,
NULL
);
SLAB_HWCACHE_ALIGN
,
NULL
);
if
(
cifs_oplock_cachep
==
NULL
)
{
if
(
cifs_oplock_cachep
==
NULL
)
{
mempool_destroy
(
cifs_mid_poolp
);
mempool_destroy
(
cifs_mid_poolp
);
kmem_cache_destroy
(
cifs_mid_cachep
);
kmem_cache_destroy
(
cifs_mid_cachep
);
...
@@ -882,7 +882,8 @@ static int cifs_oplock_thread(void *dummyarg)
...
@@ -882,7 +882,8 @@ static int cifs_oplock_thread(void *dummyarg)
the call */
the call */
/* mutex_lock(&inode->i_mutex);*/
/* mutex_lock(&inode->i_mutex);*/
if
(
S_ISREG
(
inode
->
i_mode
))
{
if
(
S_ISREG
(
inode
->
i_mode
))
{
rc
=
filemap_fdatawrite
(
inode
->
i_mapping
);
rc
=
filemap_fdatawrite
(
inode
->
i_mapping
);
if
(
CIFS_I
(
inode
)
->
clientCanCacheRead
if
(
CIFS_I
(
inode
)
->
clientCanCacheRead
==
0
)
{
==
0
)
{
filemap_fdatawait
(
inode
->
i_mapping
);
filemap_fdatawait
(
inode
->
i_mapping
);
...
@@ -907,8 +908,7 @@ static int cifs_oplock_thread(void *dummyarg)
...
@@ -907,8 +908,7 @@ static int cifs_oplock_thread(void *dummyarg)
0
/* len */
,
0
/* offset */
,
0
,
0
/* len */
,
0
/* offset */
,
0
,
0
,
LOCKING_ANDX_OPLOCK_RELEASE
,
0
,
LOCKING_ANDX_OPLOCK_RELEASE
,
0
/* wait flag */
);
0
/* wait flag */
);
cFYI
(
1
,
cFYI
(
1
,
(
"Oplock release rc = %d"
,
rc
));
(
"Oplock release rc = %d "
,
rc
));
}
}
}
else
}
else
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
...
...
fs/cifs/cifsfs.h
View file @
26f57364
...
@@ -99,7 +99,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
...
@@ -99,7 +99,7 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t
,
int
);
size_t
,
int
);
extern
ssize_t
cifs_getxattr
(
struct
dentry
*
,
const
char
*
,
void
*
,
size_t
);
extern
ssize_t
cifs_getxattr
(
struct
dentry
*
,
const
char
*
,
void
*
,
size_t
);
extern
ssize_t
cifs_listxattr
(
struct
dentry
*
,
char
*
,
size_t
);
extern
ssize_t
cifs_listxattr
(
struct
dentry
*
,
char
*
,
size_t
);
extern
int
cifs_ioctl
(
struct
inode
*
inode
,
struct
file
*
filep
,
extern
int
cifs_ioctl
(
struct
inode
*
inode
,
struct
file
*
filep
,
unsigned
int
command
,
unsigned
long
arg
);
unsigned
int
command
,
unsigned
long
arg
);
#define CIFS_VERSION "1.50"
#define CIFS_VERSION "1.50"
#endif
/* _CIFSFS_H */
#endif
/* _CIFSFS_H */
fs/cifs/cifspdu.h
View file @
26f57364
...
@@ -360,10 +360,10 @@ struct smb_hdr {
...
@@ -360,10 +360,10 @@ struct smb_hdr {
__u8
WordCount
;
__u8
WordCount
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
/* given a pointer to an smb_hdr retrieve the value of byte count */
/* given a pointer to an smb_hdr retrieve the value of byte count */
#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2
* smb_var->WordCount) )
)
#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2
* smb_var->WordCount))
)
#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2
* smb_var->WordCount) )
)
#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2
* smb_var->WordCount))
)
/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2
* smb_var->WordCount) + 2
)
#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2
* smb_var->WordCount) + 2
)
/*
/*
* Computer Name Length (since Netbios name was length 16 with last byte 0x20)
* Computer Name Length (since Netbios name was length 16 with last byte 0x20)
...
...
fs/cifs/cifsproto.h
View file @
26f57364
...
@@ -304,7 +304,7 @@ extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn,
...
@@ -304,7 +304,7 @@ extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn,
const
char
*
pass
);
const
char
*
pass
);
extern
int
CalcNTLMv2_partial_mac_key
(
struct
cifsSesInfo
*
,
extern
int
CalcNTLMv2_partial_mac_key
(
struct
cifsSesInfo
*
,
const
struct
nls_table
*
);
const
struct
nls_table
*
);
extern
void
CalcNTLMv2_response
(
const
struct
cifsSesInfo
*
,
char
*
);
extern
void
CalcNTLMv2_response
(
const
struct
cifsSesInfo
*
,
char
*
);
extern
void
setup_ntlmv2_rsp
(
struct
cifsSesInfo
*
,
char
*
,
extern
void
setup_ntlmv2_rsp
(
struct
cifsSesInfo
*
,
char
*
,
const
struct
nls_table
*
);
const
struct
nls_table
*
);
#ifdef CONFIG_CIFS_WEAK_PW_HASH
#ifdef CONFIG_CIFS_WEAK_PW_HASH
...
...
fs/cifs/cifssmb.c
View file @
26f57364
...
@@ -94,9 +94,8 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon)
...
@@ -94,9 +94,8 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon)
write_lock
(
&
GlobalSMBSeslock
);
write_lock
(
&
GlobalSMBSeslock
);
list_for_each_safe
(
tmp
,
tmp1
,
&
pTcon
->
openFileList
)
{
list_for_each_safe
(
tmp
,
tmp1
,
&
pTcon
->
openFileList
)
{
open_file
=
list_entry
(
tmp
,
struct
cifsFileInfo
,
tlist
);
open_file
=
list_entry
(
tmp
,
struct
cifsFileInfo
,
tlist
);
if
(
open_file
)
{
if
(
open_file
)
open_file
->
invalidHandle
=
TRUE
;
open_file
->
invalidHandle
=
TRUE
;
}
}
}
write_unlock
(
&
GlobalSMBSeslock
);
write_unlock
(
&
GlobalSMBSeslock
);
/* BB Add call to invalidate_inodes(sb) for all superblocks mounted
/* BB Add call to invalidate_inodes(sb) for all superblocks mounted
...
@@ -1112,7 +1111,7 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags,
...
@@ -1112,7 +1111,7 @@ CIFSPOSIXCreate(const int xid, struct cifsTconInfo *tcon, __u32 posix_flags,
}
}
memcpy
((
char
*
)
pRetData
,
memcpy
((
char
*
)
pRetData
,
(
char
*
)
psx_rsp
+
sizeof
(
OPEN_PSX_RSP
),
(
char
*
)
psx_rsp
+
sizeof
(
OPEN_PSX_RSP
),
sizeof
(
FILE_UNIX_BASIC_INFO
));
sizeof
(
FILE_UNIX_BASIC_INFO
));
}
}
psx_create_err:
psx_create_err:
...
@@ -1193,9 +1192,9 @@ SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
...
@@ -1193,9 +1192,9 @@ SMBLegacyOpen(const int xid, struct cifsTconInfo *tcon,
}
}
if
(
*
pOplock
&
REQ_OPLOCK
)
if
(
*
pOplock
&
REQ_OPLOCK
)
pSMB
->
OpenFlags
=
cpu_to_le16
(
REQ_OPLOCK
);
pSMB
->
OpenFlags
=
cpu_to_le16
(
REQ_OPLOCK
);
else
if
(
*
pOplock
&
REQ_BATCHOPLOCK
)
{
else
if
(
*
pOplock
&
REQ_BATCHOPLOCK
)
pSMB
->
OpenFlags
=
cpu_to_le16
(
REQ_BATCHOPLOCK
);
pSMB
->
OpenFlags
=
cpu_to_le16
(
REQ_BATCHOPLOCK
);
}
pSMB
->
OpenFlags
|=
cpu_to_le16
(
REQ_MORE_INFO
);
pSMB
->
OpenFlags
|=
cpu_to_le16
(
REQ_MORE_INFO
);
/* BB fixme add conversion for access_flags to bits 0 - 2 of mode */
/* BB fixme add conversion for access_flags to bits 0 - 2 of mode */
/* 0 = read
/* 0 = read
...
@@ -1310,9 +1309,8 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
...
@@ -1310,9 +1309,8 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
}
}
if
(
*
pOplock
&
REQ_OPLOCK
)
if
(
*
pOplock
&
REQ_OPLOCK
)
pSMB
->
OpenFlags
=
cpu_to_le32
(
REQ_OPLOCK
);
pSMB
->
OpenFlags
=
cpu_to_le32
(
REQ_OPLOCK
);
else
if
(
*
pOplock
&
REQ_BATCHOPLOCK
)
{
else
if
(
*
pOplock
&
REQ_BATCHOPLOCK
)
pSMB
->
OpenFlags
=
cpu_to_le32
(
REQ_BATCHOPLOCK
);
pSMB
->
OpenFlags
=
cpu_to_le32
(
REQ_BATCHOPLOCK
);
}
pSMB
->
DesiredAccess
=
cpu_to_le32
(
access_flags
);
pSMB
->
DesiredAccess
=
cpu_to_le32
(
access_flags
);
pSMB
->
AllocationSize
=
0
;
pSMB
->
AllocationSize
=
0
;
/* set file as system file if special file such
/* set file as system file if special file such
...
@@ -1446,11 +1444,11 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
...
@@ -1446,11 +1444,11 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
*
nbytes
=
0
;
*
nbytes
=
0
;
}
else
{
}
else
{
pReadData
=
(
char
*
)
(
&
pSMBr
->
hdr
.
Protocol
)
+
pReadData
=
(
char
*
)
(
&
pSMBr
->
hdr
.
Protocol
)
+
le16_to_cpu
(
pSMBr
->
DataOffset
);
le16_to_cpu
(
pSMBr
->
DataOffset
);
/*
if (rc = copy_to_user(buf, pReadData, data_length)) {
/*
if (rc = copy_to_user(buf, pReadData, data_length)) {
cERROR(1,("Faulting on read rc = %d",rc));
cERROR(1,("Faulting on read rc = %d",rc));
rc = -EFAULT;
rc = -EFAULT;
}*/
/* can not use copy_to_user when using page cache*/
}*/
/* can not use copy_to_user when using page cache*/
if
(
*
buf
)
if
(
*
buf
)
memcpy
(
*
buf
,
pReadData
,
data_length
);
memcpy
(
*
buf
,
pReadData
,
data_length
);
}
}
...
@@ -2538,7 +2536,7 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata,
...
@@ -2538,7 +2536,7 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata,
cFYI
(
1
,
(
"data starts after end of smb"
));
cFYI
(
1
,
(
"data starts after end of smb"
));
return
-
EINVAL
;
return
-
EINVAL
;
}
else
if
(
data_count
+
*
ppdata
>
end_of_smb
)
{
}
else
if
(
data_count
+
*
ppdata
>
end_of_smb
)
{
cFYI
(
1
,(
"data %p + count %d (%p) ends after end of smb %p start %p"
,
cFYI
(
1
,
(
"data %p + count %d (%p) ends after end of smb %p start %p"
,
*
ppdata
,
data_count
,
(
data_count
+
*
ppdata
),
*
ppdata
,
data_count
,
(
data_count
+
*
ppdata
),
end_of_smb
,
pSMBr
));
end_of_smb
,
pSMBr
));
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -2615,7 +2613,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
...
@@ -2615,7 +2613,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
reparse_buf
->
TargetNameOffset
+
reparse_buf
->
TargetNameOffset
+
reparse_buf
->
TargetNameLen
)
>
reparse_buf
->
TargetNameLen
)
>
end_of_smb
)
{
end_of_smb
)
{
cFYI
(
1
,
(
"reparse buf goes
beyond SMB"
));
cFYI
(
1
,
(
"reparse buf
beyond SMB"
));
rc
=
-
EIO
;
rc
=
-
EIO
;
goto
qreparse_out
;
goto
qreparse_out
;
}
}
...
@@ -3883,12 +3881,10 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
...
@@ -3883,12 +3881,10 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
pSMB
->
hdr
.
Mid
=
GetNextMid
(
ses
->
server
);
pSMB
->
hdr
.
Mid
=
GetNextMid
(
ses
->
server
);
pSMB
->
hdr
.
Tid
=
ses
->
ipc_tid
;
pSMB
->
hdr
.
Tid
=
ses
->
ipc_tid
;
pSMB
->
hdr
.
Uid
=
ses
->
Suid
;
pSMB
->
hdr
.
Uid
=
ses
->
Suid
;
if
(
ses
->
capabilities
&
CAP_STATUS32
)
{
if
(
ses
->
capabilities
&
CAP_STATUS32
)
pSMB
->
hdr
.
Flags2
|=
SMBFLG2_ERR_STATUS
;
pSMB
->
hdr
.
Flags2
|=
SMBFLG2_ERR_STATUS
;
}
if
(
ses
->
capabilities
&
CAP_DFS
)
if
(
ses
->
capabilities
&
CAP_DFS
)
{
pSMB
->
hdr
.
Flags2
|=
SMBFLG2_DFS
;
pSMB
->
hdr
.
Flags2
|=
SMBFLG2_DFS
;
}
if
(
ses
->
capabilities
&
CAP_UNICODE
)
{
if
(
ses
->
capabilities
&
CAP_UNICODE
)
{
pSMB
->
hdr
.
Flags2
|=
SMBFLG2_UNICODE
;
pSMB
->
hdr
.
Flags2
|=
SMBFLG2_UNICODE
;
...
@@ -4265,7 +4261,7 @@ CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon)
...
@@ -4265,7 +4261,7 @@ CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon)
*
)
(((
char
*
)
&
pSMBr
->
hdr
.
Protocol
)
+
*
)
(((
char
*
)
&
pSMBr
->
hdr
.
Protocol
)
+
data_offset
);
data_offset
);
memcpy
(
&
tcon
->
fsAttrInfo
,
response_data
,
memcpy
(
&
tcon
->
fsAttrInfo
,
response_data
,
sizeof
(
FILE_SYSTEM_ATTRIBUTE_INFO
));
sizeof
(
FILE_SYSTEM_ATTRIBUTE_INFO
));
}
}
}
}
cifs_buf_release
(
pSMB
);
cifs_buf_release
(
pSMB
);
...
@@ -4334,7 +4330,7 @@ CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon)
...
@@ -4334,7 +4330,7 @@ CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon)
(((
char
*
)
&
pSMBr
->
hdr
.
Protocol
)
+
(((
char
*
)
&
pSMBr
->
hdr
.
Protocol
)
+
data_offset
);
data_offset
);
memcpy
(
&
tcon
->
fsDevInfo
,
response_data
,
memcpy
(
&
tcon
->
fsDevInfo
,
response_data
,
sizeof
(
FILE_SYSTEM_DEVICE_INFO
));
sizeof
(
FILE_SYSTEM_DEVICE_INFO
));
}
}
}
}
cifs_buf_release
(
pSMB
);
cifs_buf_release
(
pSMB
);
...
@@ -4402,7 +4398,7 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
...
@@ -4402,7 +4398,7 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
*
)
(((
char
*
)
&
pSMBr
->
hdr
.
Protocol
)
+
*
)
(((
char
*
)
&
pSMBr
->
hdr
.
Protocol
)
+
data_offset
);
data_offset
);
memcpy
(
&
tcon
->
fsUnixInfo
,
response_data
,
memcpy
(
&
tcon
->
fsUnixInfo
,
response_data
,
sizeof
(
FILE_SYSTEM_UNIX_INFO
));
sizeof
(
FILE_SYSTEM_UNIX_INFO
));
}
}
}
}
cifs_buf_release
(
pSMB
);
cifs_buf_release
(
pSMB
);
...
@@ -4612,7 +4608,7 @@ CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
...
@@ -4612,7 +4608,7 @@ CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
strncpy
(
pSMB
->
FileName
,
fileName
,
name_len
);
strncpy
(
pSMB
->
FileName
,
fileName
,
name_len
);
}
}
params
=
6
+
name_len
;
params
=
6
+
name_len
;
data_count
=
sizeof
(
struct
file_end_of_file_info
);
data_count
=
sizeof
(
struct
file_end_of_file_info
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxDataCount
=
cpu_to_le16
(
4100
);
pSMB
->
MaxDataCount
=
cpu_to_le16
(
4100
);
pSMB
->
MaxSetupCount
=
0
;
pSMB
->
MaxSetupCount
=
0
;
...
@@ -4800,7 +4796,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
...
@@ -4800,7 +4796,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
data_offset
=
(
char
*
)
(
&
pSMB
->
hdr
.
Protocol
)
+
offset
;
data_offset
=
(
char
*
)
(
&
pSMB
->
hdr
.
Protocol
)
+
offset
;
count
=
sizeof
(
FILE_BASIC_INFO
);
count
=
sizeof
(
FILE_BASIC_INFO
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxDataCount
=
cpu_to_le16
(
1000
);
/* BB find max SMB PDU from sess */
pSMB
->
MaxDataCount
=
cpu_to_le16
(
1000
);
/* BB find max SMB PDU from sess */
pSMB
->
SetupCount
=
1
;
pSMB
->
SetupCount
=
1
;
...
@@ -4871,7 +4867,7 @@ CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
...
@@ -4871,7 +4867,7 @@ CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
}
}
params
=
6
+
name_len
;
params
=
6
+
name_len
;
count
=
sizeof
(
FILE_BASIC_INFO
);
count
=
sizeof
(
FILE_BASIC_INFO
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxDataCount
=
cpu_to_le16
(
1000
);
/* BB find exact max SMB PDU from sess structure BB */
pSMB
->
MaxDataCount
=
cpu_to_le16
(
1000
);
/* BB find exact max SMB PDU from sess structure BB */
pSMB
->
MaxSetupCount
=
0
;
pSMB
->
MaxSetupCount
=
0
;
...
@@ -4900,7 +4896,7 @@ CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
...
@@ -4900,7 +4896,7 @@ CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
pSMB
->
InformationLevel
=
cpu_to_le16
(
SMB_SET_FILE_BASIC_INFO
);
pSMB
->
InformationLevel
=
cpu_to_le16
(
SMB_SET_FILE_BASIC_INFO
);
pSMB
->
Reserved4
=
0
;
pSMB
->
Reserved4
=
0
;
pSMB
->
hdr
.
smb_buf_length
+=
byte_count
;
pSMB
->
hdr
.
smb_buf_length
+=
byte_count
;
memcpy
(
data_offset
,
data
,
sizeof
(
FILE_BASIC_INFO
));
memcpy
(
data_offset
,
data
,
sizeof
(
FILE_BASIC_INFO
));
pSMB
->
ByteCount
=
cpu_to_le16
(
byte_count
);
pSMB
->
ByteCount
=
cpu_to_le16
(
byte_count
);
rc
=
SendReceive
(
xid
,
tcon
->
ses
,
(
struct
smb_hdr
*
)
pSMB
,
rc
=
SendReceive
(
xid
,
tcon
->
ses
,
(
struct
smb_hdr
*
)
pSMB
,
(
struct
smb_hdr
*
)
pSMBr
,
&
bytes_returned
,
0
);
(
struct
smb_hdr
*
)
pSMBr
,
&
bytes_returned
,
0
);
...
@@ -5003,7 +4999,7 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
...
@@ -5003,7 +4999,7 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
}
}
params
=
6
+
name_len
;
params
=
6
+
name_len
;
count
=
sizeof
(
FILE_UNIX_BASIC_INFO
);
count
=
sizeof
(
FILE_UNIX_BASIC_INFO
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxParameterCount
=
cpu_to_le16
(
2
);
pSMB
->
MaxDataCount
=
cpu_to_le16
(
1000
);
/* BB find exact max SMB PDU from sess structure BB */
pSMB
->
MaxDataCount
=
cpu_to_le16
(
1000
);
/* BB find exact max SMB PDU from sess structure BB */
pSMB
->
MaxSetupCount
=
0
;
pSMB
->
MaxSetupCount
=
0
;
...
...
fs/cifs/connect.c
View file @
26f57364
...
@@ -124,7 +124,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
...
@@ -124,7 +124,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
struct
mid_q_entry
*
mid_entry
;
struct
mid_q_entry
*
mid_entry
;
spin_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
if
(
kthread_should_stop
()
)
{
if
(
kthread_should_stop
()
)
{
/* the demux thread will exit normally
/* the demux thread will exit normally
next time through the loop */
next time through the loop */
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
...
@@ -151,9 +151,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
...
@@ -151,9 +151,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
}
}
list_for_each
(
tmp
,
&
GlobalTreeConnectionList
)
{
list_for_each
(
tmp
,
&
GlobalTreeConnectionList
)
{
tcon
=
list_entry
(
tmp
,
struct
cifsTconInfo
,
cifsConnectionList
);
tcon
=
list_entry
(
tmp
,
struct
cifsTconInfo
,
cifsConnectionList
);
if
((
tcon
)
&&
(
tcon
->
ses
)
&&
(
tcon
->
ses
->
server
==
server
))
{
if
((
tcon
)
&&
(
tcon
->
ses
)
&&
(
tcon
->
ses
->
server
==
server
))
tcon
->
tidStatus
=
CifsNeedReconnect
;
tcon
->
tidStatus
=
CifsNeedReconnect
;
}
}
}
read_unlock
(
&
GlobalSMBSeslock
);
read_unlock
(
&
GlobalSMBSeslock
);
/* do not want to be sending data on a socket we are freeing */
/* do not want to be sending data on a socket we are freeing */
...
@@ -187,7 +186,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
...
@@ -187,7 +186,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
up
(
&
server
->
tcpSem
);
up
(
&
server
->
tcpSem
);
while
(
(
!
kthread_should_stop
())
&&
(
server
->
tcpStatus
!=
CifsGood
))
{
while
((
!
kthread_should_stop
())
&&
(
server
->
tcpStatus
!=
CifsGood
))
{
try_to_freeze
();
try_to_freeze
();
if
(
server
->
protocolType
==
IPV6
)
{
if
(
server
->
protocolType
==
IPV6
)
{
rc
=
ipv6_connect
(
&
server
->
addr
.
sockAddr6
,
rc
=
ipv6_connect
(
&
server
->
addr
.
sockAddr6
,
...
@@ -204,7 +203,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
...
@@ -204,7 +203,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
}
else
{
}
else
{
atomic_inc
(
&
tcpSesReconnectCount
);
atomic_inc
(
&
tcpSesReconnectCount
);
spin_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
if
(
!
kthread_should_stop
()
)
if
(
!
kthread_should_stop
()
)
server
->
tcpStatus
=
CifsGood
;
server
->
tcpStatus
=
CifsGood
;
server
->
sequence_number
=
0
;
server
->
sequence_number
=
0
;
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
...
@@ -358,11 +357,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -358,11 +357,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
length
=
tcpSesAllocCount
.
counter
;
length
=
tcpSesAllocCount
.
counter
;
write_unlock
(
&
GlobalSMBSeslock
);
write_unlock
(
&
GlobalSMBSeslock
);
complete
(
&
cifsd_complete
);
complete
(
&
cifsd_complete
);
if
(
length
>
1
)
{
if
(
length
>
1
)
mempool_resize
(
cifs_req_poolp
,
mempool_resize
(
cifs_req_poolp
,
length
+
cifs_min_rcv
,
length
+
cifs_min_rcv
,
GFP_KERNEL
);
GFP_KERNEL
);
}
set_freezable
();
set_freezable
();
while
(
!
kthread_should_stop
())
{
while
(
!
kthread_should_stop
())
{
...
@@ -378,7 +375,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -378,7 +375,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
}
}
}
else
if
(
isLargeBuf
)
{
}
else
if
(
isLargeBuf
)
{
/* we are reusing a dirty large buf, clear its start */
/* we are reusing a dirty large buf, clear its start */
memset
(
bigbuf
,
0
,
sizeof
(
struct
smb_hdr
));
memset
(
bigbuf
,
0
,
sizeof
(
struct
smb_hdr
));
}
}
if
(
smallbuf
==
NULL
)
{
if
(
smallbuf
==
NULL
)
{
...
@@ -391,7 +388,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -391,7 +388,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
}
}
/* beginning of smb buffer is cleared in our buf_get */
/* beginning of smb buffer is cleared in our buf_get */
}
else
/* if existing small buf clear beginning */
}
else
/* if existing small buf clear beginning */
memset
(
smallbuf
,
0
,
sizeof
(
struct
smb_hdr
));
memset
(
smallbuf
,
0
,
sizeof
(
struct
smb_hdr
));
isLargeBuf
=
FALSE
;
isLargeBuf
=
FALSE
;
isMultiRsp
=
FALSE
;
isMultiRsp
=
FALSE
;
...
@@ -406,7 +403,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -406,7 +403,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
kernel_recvmsg
(
csocket
,
&
smb_msg
,
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
pdu_length
,
0
/* BB other flags? */
);
&
iov
,
1
,
pdu_length
,
0
/* BB other flags? */
);
if
(
kthread_should_stop
()
)
{
if
(
kthread_should_stop
()
)
{
break
;
break
;
}
else
if
(
server
->
tcpStatus
==
CifsNeedReconnect
)
{
}
else
if
(
server
->
tcpStatus
==
CifsNeedReconnect
)
{
cFYI
(
1
,
(
"Reconnect after server stopped responding"
));
cFYI
(
1
,
(
"Reconnect after server stopped responding"
));
...
@@ -505,7 +502,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -505,7 +502,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
/* else we have an SMB response */
/* else we have an SMB response */
if
((
pdu_length
>
CIFSMaxBufSize
+
MAX_CIFS_HDR_SIZE
-
4
)
||
if
((
pdu_length
>
CIFSMaxBufSize
+
MAX_CIFS_HDR_SIZE
-
4
)
||
(
pdu_length
<
sizeof
(
struct
smb_hdr
)
-
1
-
4
))
{
(
pdu_length
<
sizeof
(
struct
smb_hdr
)
-
1
-
4
))
{
cERROR
(
1
,
(
"Invalid size SMB length %d pdu_length %d"
,
cERROR
(
1
,
(
"Invalid size SMB length %d pdu_length %d"
,
length
,
pdu_length
+
4
));
length
,
pdu_length
+
4
));
cifs_reconnect
(
server
);
cifs_reconnect
(
server
);
...
@@ -529,7 +526,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -529,7 +526,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
total_read
+=
length
)
{
total_read
+=
length
)
{
length
=
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
length
=
kernel_recvmsg
(
csocket
,
&
smb_msg
,
&
iov
,
1
,
pdu_length
-
total_read
,
0
);
pdu_length
-
total_read
,
0
);
if
(
kthread_should_stop
()
||
if
(
kthread_should_stop
()
||
(
length
==
-
EINTR
))
{
(
length
==
-
EINTR
))
{
/* then will exit */
/* then will exit */
reconnect
=
2
;
reconnect
=
2
;
...
@@ -632,9 +629,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -632,9 +629,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
/* Was previous buf put in mpx struct for multi-rsp? */
/* Was previous buf put in mpx struct for multi-rsp? */
if
(
!
isMultiRsp
)
{
if
(
!
isMultiRsp
)
{
/* smb buffer will be freed by user thread */
/* smb buffer will be freed by user thread */
if
(
isLargeBuf
)
{
if
(
isLargeBuf
)
bigbuf
=
NULL
;
bigbuf
=
NULL
;
}
else
else
smallbuf
=
NULL
;
smallbuf
=
NULL
;
}
}
wake_up_process
(
task_to_wake
);
wake_up_process
(
task_to_wake
);
...
@@ -703,9 +700,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -703,9 +700,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
cifsSessionList
);
if
(
ses
->
server
==
server
)
{
if
(
ses
->
server
==
server
)
ses
->
status
=
CifsExiting
;
ses
->
status
=
CifsExiting
;
}
}
}
spin_lock
(
&
GlobalMid_Lock
);
spin_lock
(
&
GlobalMid_Lock
);
...
@@ -715,9 +711,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -715,9 +711,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
cFYI
(
1
,
(
"Clearing Mid 0x%x - waking up "
,
cFYI
(
1
,
(
"Clearing Mid 0x%x - waking up "
,
mid_entry
->
mid
));
mid_entry
->
mid
));
task_to_wake
=
mid_entry
->
tsk
;
task_to_wake
=
mid_entry
->
tsk
;
if
(
task_to_wake
)
{
if
(
task_to_wake
)
wake_up_process
(
task_to_wake
);
wake_up_process
(
task_to_wake
);
}
}
}
}
}
spin_unlock
(
&
GlobalMid_Lock
);
spin_unlock
(
&
GlobalMid_Lock
);
...
@@ -750,18 +745,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
...
@@ -750,18 +745,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
list_for_each
(
tmp
,
&
GlobalSMBSessionList
)
{
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
ses
=
list_entry
(
tmp
,
struct
cifsSesInfo
,
cifsSessionList
);
cifsSessionList
);
if
(
ses
->
server
==
server
)
{
if
(
ses
->
server
==
server
)
ses
->
server
=
NULL
;
ses
->
server
=
NULL
;
}
}
}
write_unlock
(
&
GlobalSMBSeslock
);
write_unlock
(
&
GlobalSMBSeslock
);
kfree
(
server
);
kfree
(
server
);
if
(
length
>
0
)
{
if
(
length
>
0
)
mempool_resize
(
cifs_req_poolp
,
mempool_resize
(
cifs_req_poolp
,
length
+
cifs_min_rcv
,
length
+
cifs_min_rcv
,
GFP_KERNEL
);
GFP_KERNEL
);
}
return
0
;
return
0
;
}
}
...
...
fs/cifs/readdir.c
View file @
26f57364
...
@@ -1067,7 +1067,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
...
@@ -1067,7 +1067,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
for
(
i
=
0
;
(
i
<
num_to_fill
)
&&
(
rc
==
0
);
i
++
)
{
for
(
i
=
0
;
(
i
<
num_to_fill
)
&&
(
rc
==
0
);
i
++
)
{
if
(
current_entry
==
NULL
)
{
if
(
current_entry
==
NULL
)
{
/* evaluate whether this case is an error */
/* evaluate whether this case is an error */
cERROR
(
1
,
(
"past end of SMB
num to fill %d i %d"
,
cERROR
(
1
,
(
"past SMB end,
num to fill %d i %d"
,
num_to_fill
,
i
));
num_to_fill
,
i
));
break
;
break
;
}
}
...
...
fs/cifs/sess.c
View file @
26f57364
...
@@ -67,9 +67,8 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
...
@@ -67,9 +67,8 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
pSMB
->
req
.
hdr
.
Flags2
|=
SMBFLG2_DFS
;
pSMB
->
req
.
hdr
.
Flags2
|=
SMBFLG2_DFS
;
capabilities
|=
CAP_DFS
;
capabilities
|=
CAP_DFS
;
}
}
if
(
ses
->
capabilities
&
CAP_UNIX
)
{
if
(
ses
->
capabilities
&
CAP_UNIX
)
capabilities
|=
CAP_UNIX
;
capabilities
|=
CAP_UNIX
;
}
/* BB check whether to init vcnum BB */
/* BB check whether to init vcnum BB */
return
capabilities
;
return
capabilities
;
...
@@ -203,14 +202,11 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
...
@@ -203,14 +202,11 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
if
(
len
>=
words_left
)
if
(
len
>=
words_left
)
return
rc
;
return
rc
;
if
(
ses
->
serverOS
)
kfree
(
ses
->
serverOS
);
kfree
(
ses
->
serverOS
);
/* UTF-8 string will not grow more than four times as big as UCS-16 */
/* UTF-8 string will not grow more than four times as big as UCS-16 */
ses
->
serverOS
=
kzalloc
(
4
*
len
,
GFP_KERNEL
);
ses
->
serverOS
=
kzalloc
(
4
*
len
,
GFP_KERNEL
);
if
(
ses
->
serverOS
!=
NULL
)
{
if
(
ses
->
serverOS
!=
NULL
)
cifs_strfromUCS_le
(
ses
->
serverOS
,
(
__le16
*
)
data
,
len
,
cifs_strfromUCS_le
(
ses
->
serverOS
,
(
__le16
*
)
data
,
len
,
nls_cp
);
nls_cp
);
}
data
+=
2
*
(
len
+
1
);
data
+=
2
*
(
len
+
1
);
words_left
-=
len
+
1
;
words_left
-=
len
+
1
;
...
@@ -220,8 +216,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
...
@@ -220,8 +216,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
if
(
len
>=
words_left
)
if
(
len
>=
words_left
)
return
rc
;
return
rc
;
if
(
ses
->
serverNOS
)
kfree
(
ses
->
serverNOS
);
kfree
(
ses
->
serverNOS
);
ses
->
serverNOS
=
kzalloc
(
4
*
len
,
GFP_KERNEL
);
/* BB this is wrong length FIXME BB */
ses
->
serverNOS
=
kzalloc
(
4
*
len
,
GFP_KERNEL
);
/* BB this is wrong length FIXME BB */
if
(
ses
->
serverNOS
!=
NULL
)
{
if
(
ses
->
serverNOS
!=
NULL
)
{
cifs_strfromUCS_le
(
ses
->
serverNOS
,
(
__le16
*
)
data
,
len
,
cifs_strfromUCS_le
(
ses
->
serverNOS
,
(
__le16
*
)
data
,
len
,
...
@@ -240,8 +235,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
...
@@ -240,8 +235,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
if
(
len
>
words_left
)
if
(
len
>
words_left
)
return
rc
;
return
rc
;
if
(
ses
->
serverDomain
)
kfree
(
ses
->
serverDomain
);
kfree
(
ses
->
serverDomain
);
ses
->
serverDomain
=
kzalloc
(
2
*
(
len
+
1
),
GFP_KERNEL
);
/* BB FIXME wrong length */
ses
->
serverDomain
=
kzalloc
(
2
*
(
len
+
1
),
GFP_KERNEL
);
/* BB FIXME wrong length */
if
(
ses
->
serverDomain
!=
NULL
)
{
if
(
ses
->
serverDomain
!=
NULL
)
{
cifs_strfromUCS_le
(
ses
->
serverDomain
,
(
__le16
*
)
data
,
len
,
cifs_strfromUCS_le
(
ses
->
serverDomain
,
(
__le16
*
)
data
,
len
,
...
@@ -271,8 +265,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
...
@@ -271,8 +265,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
if
(
len
>=
bleft
)
if
(
len
>=
bleft
)
return
rc
;
return
rc
;
if
(
ses
->
serverOS
)
kfree
(
ses
->
serverOS
);
kfree
(
ses
->
serverOS
);
ses
->
serverOS
=
kzalloc
(
len
+
1
,
GFP_KERNEL
);
ses
->
serverOS
=
kzalloc
(
len
+
1
,
GFP_KERNEL
);
if
(
ses
->
serverOS
)
if
(
ses
->
serverOS
)
...
@@ -289,8 +282,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
...
@@ -289,8 +282,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
if
(
len
>=
bleft
)
if
(
len
>=
bleft
)
return
rc
;
return
rc
;
if
(
ses
->
serverNOS
)
kfree
(
ses
->
serverNOS
);
kfree
(
ses
->
serverNOS
);
ses
->
serverNOS
=
kzalloc
(
len
+
1
,
GFP_KERNEL
);
ses
->
serverNOS
=
kzalloc
(
len
+
1
,
GFP_KERNEL
);
if
(
ses
->
serverNOS
)
if
(
ses
->
serverNOS
)
...
@@ -479,7 +471,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
...
@@ -479,7 +471,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
if
(
ses
->
capabilities
&
CAP_UNICODE
)
{
if
(
ses
->
capabilities
&
CAP_UNICODE
)
{
if
(
iov
[
0
].
iov_len
%
2
)
{
if
(
iov
[
0
].
iov_len
%
2
)
{
*
bcc_ptr
=
0
;
*
bcc_ptr
=
0
;
}
bcc_ptr
++
;
bcc_ptr
++
;
}
unicode_ssetup_strings
(
&
bcc_ptr
,
ses
,
nls_cp
);
unicode_ssetup_strings
(
&
bcc_ptr
,
ses
,
nls_cp
);
}
else
}
else
ascii_ssetup_strings
(
&
bcc_ptr
,
ses
,
nls_cp
);
ascii_ssetup_strings
(
&
bcc_ptr
,
ses
,
nls_cp
);
...
...
fs/cifs/transport.c
View file @
26f57364
...
@@ -55,7 +55,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
...
@@ -55,7 +55,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
if
(
temp
==
NULL
)
if
(
temp
==
NULL
)
return
temp
;
return
temp
;
else
{
else
{
memset
(
temp
,
0
,
sizeof
(
struct
mid_q_entry
));
memset
(
temp
,
0
,
sizeof
(
struct
mid_q_entry
));
temp
->
mid
=
smb_buffer
->
Mid
;
/* always LE */
temp
->
mid
=
smb_buffer
->
Mid
;
/* always LE */
temp
->
pid
=
current
->
pid
;
temp
->
pid
=
current
->
pid
;
temp
->
command
=
smb_buffer
->
Command
;
temp
->
command
=
smb_buffer
->
Command
;
...
@@ -158,7 +158,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
...
@@ -158,7 +158,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
iov
.
iov_len
=
len
;
iov
.
iov_len
=
len
;
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_namelen
=
sizeof
(
struct
sockaddr
);
smb_msg
.
msg_namelen
=
sizeof
(
struct
sockaddr
);
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_flags
=
MSG_DONTWAIT
+
MSG_NOSIGNAL
;
/* BB add more flags?*/
smb_msg
.
msg_flags
=
MSG_DONTWAIT
+
MSG_NOSIGNAL
;
/* BB add more flags?*/
...
@@ -228,7 +228,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
...
@@ -228,7 +228,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
return
-
ENOTSOCK
;
/* BB eventually add reconnect code here */
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_name
=
sin
;
smb_msg
.
msg_namelen
=
sizeof
(
struct
sockaddr
);
smb_msg
.
msg_namelen
=
sizeof
(
struct
sockaddr
);
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_control
=
NULL
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_controllen
=
0
;
smb_msg
.
msg_flags
=
MSG_DONTWAIT
+
MSG_NOSIGNAL
;
/* BB add more flags?*/
smb_msg
.
msg_flags
=
MSG_DONTWAIT
+
MSG_NOSIGNAL
;
/* BB add more flags?*/
...
@@ -363,9 +363,8 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
...
@@ -363,9 +363,8 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
}
/* else ok - we are setting up session */
}
/* else ok - we are setting up session */
}
}
*
ppmidQ
=
AllocMidQEntry
(
in_buf
,
ses
);
*
ppmidQ
=
AllocMidQEntry
(
in_buf
,
ses
);
if
(
*
ppmidQ
==
NULL
)
{
if
(
*
ppmidQ
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
}
return
0
;
return
0
;
}
}
...
@@ -572,9 +571,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -572,9 +571,8 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
rc
=
map_smb_to_linux_error
(
midQ
->
resp_buf
);
rc
=
map_smb_to_linux_error
(
midQ
->
resp_buf
);
/* convert ByteCount if necessary */
/* convert ByteCount if necessary */
if
(
receive_len
>=
if
(
receive_len
>=
sizeof
(
struct
smb_hdr
)
-
4
sizeof
(
struct
smb_hdr
)
-
/* do not count RFC1001 header */
+
4
/* do not count RFC1001 header */
+
(
2
*
midQ
->
resp_buf
->
WordCount
)
+
2
/* bcc */
)
(
2
*
midQ
->
resp_buf
->
WordCount
)
+
2
/* bcc */
)
BCC
(
midQ
->
resp_buf
)
=
BCC
(
midQ
->
resp_buf
)
=
le16_to_cpu
(
BCC_LE
(
midQ
->
resp_buf
));
le16_to_cpu
(
BCC_LE
(
midQ
->
resp_buf
));
...
@@ -752,9 +750,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
...
@@ -752,9 +750,8 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
rc
=
map_smb_to_linux_error
(
out_buf
);
rc
=
map_smb_to_linux_error
(
out_buf
);
/* convert ByteCount if necessary */
/* convert ByteCount if necessary */
if
(
receive_len
>=
if
(
receive_len
>=
sizeof
(
struct
smb_hdr
)
-
4
sizeof
(
struct
smb_hdr
)
-
/* do not count RFC1001 header */
+
4
/* do not count RFC1001 header */
+
(
2
*
out_buf
->
WordCount
)
+
2
/* bcc */
)
(
2
*
out_buf
->
WordCount
)
+
2
/* bcc */
)
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
}
else
{
}
else
{
...
@@ -996,9 +993,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
...
@@ -996,9 +993,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
rc
=
map_smb_to_linux_error
(
out_buf
);
rc
=
map_smb_to_linux_error
(
out_buf
);
/* convert ByteCount if necessary */
/* convert ByteCount if necessary */
if
(
receive_len
>=
if
(
receive_len
>=
sizeof
(
struct
smb_hdr
)
-
4
sizeof
(
struct
smb_hdr
)
-
/* do not count RFC1001 header */
+
4
/* do not count RFC1001 header */
+
(
2
*
out_buf
->
WordCount
)
+
2
/* bcc */
)
(
2
*
out_buf
->
WordCount
)
+
2
/* bcc */
)
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
BCC
(
out_buf
)
=
le16_to_cpu
(
BCC_LE
(
out_buf
));
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment