Commit 257a65d7 authored by Linus Torvalds's avatar Linus Torvalds

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: remove checks for ses->status == CifsExiting
  cifs: add check for kmalloc in parse_dacl
  cifs: don't send an echo request unless NegProt has been done
  cifs: enable signing flag in SMB header when server has it on
  cifs: Possible slab memory corruption while updating extended stats (repost)
  CIFS: Fix variable types in cifs_iovec_read/write (try #2)
  cifs: fix length vs. total_read confusion in cifs_demultiplex_thread
parents 8dbdea84 d402539b
...@@ -372,6 +372,10 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, ...@@ -372,6 +372,10 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
GFP_KERNEL); GFP_KERNEL);
if (!ppace) {
cERROR(1, "DACL memory allocation error");
return;
}
for (i = 0; i < num_aces; ++i) { for (i = 0; i < num_aces; ++i) {
ppace[i] = (struct cifs_ace *) (acl_base + acl_size); ppace[i] = (struct cifs_ace *) (acl_base + acl_size);
......
...@@ -136,9 +136,6 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command) ...@@ -136,9 +136,6 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command)
} }
} }
if (ses->status == CifsExiting)
return -EIO;
/* /*
* Give demultiplex thread up to 10 seconds to reconnect, should be * Give demultiplex thread up to 10 seconds to reconnect, should be
* greater than cifs socket timeout which is 7 seconds * greater than cifs socket timeout which is 7 seconds
...@@ -156,7 +153,7 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command) ...@@ -156,7 +153,7 @@ cifs_reconnect_tcon(struct cifsTconInfo *tcon, int smb_command)
* retrying until process is killed or server comes * retrying until process is killed or server comes
* back on-line * back on-line
*/ */
if (!tcon->retry || ses->status == CifsExiting) { if (!tcon->retry) {
cFYI(1, "gave up waiting on reconnect in smb_init"); cFYI(1, "gave up waiting on reconnect in smb_init");
return -EHOSTDOWN; return -EHOSTDOWN;
} }
......
...@@ -337,8 +337,12 @@ cifs_echo_request(struct work_struct *work) ...@@ -337,8 +337,12 @@ cifs_echo_request(struct work_struct *work)
struct TCP_Server_Info *server = container_of(work, struct TCP_Server_Info *server = container_of(work,
struct TCP_Server_Info, echo.work); struct TCP_Server_Info, echo.work);
/* no need to ping if we got a response recently */ /*
if (time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) * We cannot send an echo until the NEGOTIATE_PROTOCOL request is done.
* Also, no need to ping if we got a response recently
*/
if (server->tcpStatus != CifsGood ||
time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ))
goto requeue_echo; goto requeue_echo;
rc = CIFSSMBEcho(server); rc = CIFSSMBEcho(server);
...@@ -578,12 +582,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -578,12 +582,12 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
else if (reconnect == 1) else if (reconnect == 1)
continue; continue;
length += 4; /* account for rfc1002 hdr */ total_read += 4; /* account for rfc1002 hdr */
dump_smb(smb_buffer, total_read);
dump_smb(smb_buffer, length); if (checkSMB(smb_buffer, smb_buffer->Mid, total_read)) {
if (checkSMB(smb_buffer, smb_buffer->Mid, total_read+4)) { cifs_dump_mem("Bad SMB: ", smb_buffer,
cifs_dump_mem("Bad SMB: ", smb_buffer, 48); total_read < 48 ? total_read : 48);
continue; continue;
} }
...@@ -633,11 +637,11 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -633,11 +637,11 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
mid_entry->largeBuf = isLargeBuf; mid_entry->largeBuf = isLargeBuf;
multi_t2_fnd: multi_t2_fnd:
mid_entry->midState = MID_RESPONSE_RECEIVED; mid_entry->midState = MID_RESPONSE_RECEIVED;
list_del_init(&mid_entry->qhead);
mid_entry->callback(mid_entry);
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
mid_entry->when_received = jiffies; mid_entry->when_received = jiffies;
#endif #endif
list_del_init(&mid_entry->qhead);
mid_entry->callback(mid_entry);
break; break;
} }
mid_entry = NULL; mid_entry = NULL;
......
...@@ -1662,10 +1662,10 @@ static ssize_t ...@@ -1662,10 +1662,10 @@ static ssize_t
cifs_iovec_write(struct file *file, const struct iovec *iov, cifs_iovec_write(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *poffset) unsigned long nr_segs, loff_t *poffset)
{ {
size_t total_written = 0; unsigned int written;
unsigned int written = 0; unsigned long num_pages, npages, i;
unsigned long num_pages, npages; size_t copied, len, cur_len;
size_t copied, len, cur_len, i; ssize_t total_written = 0;
struct kvec *to_send; struct kvec *to_send;
struct page **pages; struct page **pages;
struct iov_iter it; struct iov_iter it;
...@@ -1821,7 +1821,8 @@ cifs_iovec_read(struct file *file, const struct iovec *iov, ...@@ -1821,7 +1821,8 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
{ {
int rc; int rc;
int xid; int xid;
unsigned int total_read, bytes_read = 0; ssize_t total_read;
unsigned int bytes_read = 0;
size_t len, cur_len; size_t len, cur_len;
int iov_offset = 0; int iov_offset = 0;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
......
...@@ -359,6 +359,10 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf, ...@@ -359,6 +359,10 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_hdr *in_buf,
if (rc) if (rc)
return rc; return rc;
/* enable signing if server requires it */
if (server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
in_buf->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
mutex_lock(&server->srv_mutex); mutex_lock(&server->srv_mutex);
mid = AllocMidQEntry(in_buf, server); mid = AllocMidQEntry(in_buf, server);
if (mid == NULL) { if (mid == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment