Skip to content

Commit 5f66d2b

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: CIFS: Cleanup demupltiplex thread exiting code CIFS: Move mid search to a separate function CIFS: Move RFC1002 check to a separate function CIFS: Simplify socket reading in demultiplex thread CIFS: Move buffer allocation to a separate function cifs: remove unneeded variable initialization in cifs_reconnect_tcon cifs: simplify refcounting for oplock breaks cifs: fix compiler warning in CIFSSMBQAllEAs cifs: fix name parsing in CIFSSMBQAllEAs cifs: don't start signing too early cifs: trivial: goto out here is unnecessary cifs: advertise the right receive buffer size to the server
2 parents 4a2d732 + 762dfd1 commit 5f66d2b

File tree

9 files changed

+370
-376
lines changed

9 files changed

+370
-376
lines changed

fs/cifs/cifsencrypt.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,15 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server,
8787
if ((cifs_pdu == NULL) || (server == NULL))
8888
return -EINVAL;
8989

90-
if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0)
90+
if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
91+
server->tcpStatus == CifsNeedNegotiate)
9192
return rc;
9293

94+
if (!server->session_estab) {
95+
strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
96+
return rc;
97+
}
98+
9399
cifs_pdu->Signature.Sequence.SequenceNumber =
94100
cpu_to_le32(server->sequence_number);
95101
cifs_pdu->Signature.Sequence.Reserved = 0;
@@ -178,9 +184,15 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
178184
if ((cifs_pdu == NULL) || (server == NULL))
179185
return -EINVAL;
180186

181-
if ((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0)
187+
if (!(cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) ||
188+
server->tcpStatus == CifsNeedNegotiate)
182189
return rc;
183190

191+
if (!server->session_estab) {
192+
strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
193+
return rc;
194+
}
195+
184196
cifs_pdu->Signature.Sequence.SequenceNumber =
185197
cpu_to_le32(server->sequence_number);
186198
cifs_pdu->Signature.Sequence.Reserved = 0;

fs/cifs/cifsfs.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,6 @@ extern mempool_t *cifs_sm_req_poolp;
8686
extern mempool_t *cifs_req_poolp;
8787
extern mempool_t *cifs_mid_poolp;
8888

89-
void
90-
cifs_sb_active(struct super_block *sb)
91-
{
92-
struct cifs_sb_info *server = CIFS_SB(sb);
93-
94-
if (atomic_inc_return(&server->active) == 1)
95-
atomic_inc(&sb->s_active);
96-
}
97-
98-
void
99-
cifs_sb_deactive(struct super_block *sb)
100-
{
101-
struct cifs_sb_info *server = CIFS_SB(sb);
102-
103-
if (atomic_dec_and_test(&server->active))
104-
deactivate_super(sb);
105-
}
106-
10789
static int
10890
cifs_read_super(struct super_block *sb)
10991
{

fs/cifs/cifsfs.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ extern struct file_system_type cifs_fs_type;
4141
extern const struct address_space_operations cifs_addr_ops;
4242
extern const struct address_space_operations cifs_addr_ops_smallbuf;
4343

44-
/* Functions related to super block operations */
45-
extern void cifs_sb_active(struct super_block *sb);
46-
extern void cifs_sb_deactive(struct super_block *sb);
47-
4844
/* Functions related to inodes */
4945
extern const struct inode_operations cifs_dir_inode_ops;
5046
extern struct inode *cifs_root_iget(struct super_block *);

fs/cifs/cifsglob.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -942,8 +942,6 @@ GLOBAL_EXTERN spinlock_t siduidlock;
942942
GLOBAL_EXTERN spinlock_t sidgidlock;
943943

944944
void cifs_oplock_break(struct work_struct *work);
945-
void cifs_oplock_break_get(struct cifsFileInfo *cfile);
946-
void cifs_oplock_break_put(struct cifsFileInfo *cfile);
947945

948946
extern const struct slow_work_ops cifs_oplock_break_ops;
949947

fs/cifs/cifssmb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static void mark_open_files_invalid(struct cifs_tcon *pTcon)
107107
static int
108108
cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
109109
{
110-
int rc = 0;
110+
int rc;
111111
struct cifs_ses *ses;
112112
struct TCP_Server_Info *server;
113113
struct nls_table *nls_codepage;
@@ -5720,6 +5720,7 @@ CIFSSMBQAllEAs(const int xid, struct cifs_tcon *tcon,
57205720
char *temp_ptr;
57215721
char *end_of_smb;
57225722
__u16 params, byte_count, data_offset;
5723+
unsigned int ea_name_len = ea_name ? strlen(ea_name) : 0;
57235724

57245725
cFYI(1, "In Query All EAs path %s", searchName);
57255726
QAllEAsRetry:
@@ -5837,7 +5838,8 @@ CIFSSMBQAllEAs(const int xid, struct cifs_tcon *tcon,
58375838
}
58385839

58395840
if (ea_name) {
5840-
if (strncmp(ea_name, temp_ptr, name_len) == 0) {
5841+
if (ea_name_len == name_len &&
5842+
strncmp(ea_name, temp_ptr, name_len) == 0) {
58415843
temp_ptr += name_len + 1;
58425844
rc = value_len;
58435845
if (buf_size == 0)

0 commit comments

Comments
 (0)