Commit 5ee0e962603ef7d41d8e6581963c8557501dfcad

Authored by Linus Torvalds

Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "Three small cifs fixes.  One fixes a hang under stress, and the other
  two are security related"

* 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: fix MUST SecurityFlags filtering
  Complete oplock break jobs before closing file handle
  cifs: use memzero_explicit to clear stack buffer

Showing 3 changed files Side-by-side Diff

fs/cifs/cifs_debug.c
... ... @@ -606,9 +606,11 @@
606 606 *flags = CIFSSEC_MUST_NTLMV2;
607 607 else if ((*flags & CIFSSEC_MUST_NTLM) == CIFSSEC_MUST_NTLM)
608 608 *flags = CIFSSEC_MUST_NTLM;
609   - else if ((*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN)
  609 + else if (CIFSSEC_MUST_LANMAN &&
  610 + (*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN)
610 611 *flags = CIFSSEC_MUST_LANMAN;
611   - else if ((*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT)
  612 + else if (CIFSSEC_MUST_PLNTXT &&
  613 + (*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT)
612 614 *flags = CIFSSEC_MUST_PLNTXT;
613 615  
614 616 *flags |= signflags;
... ... @@ -366,6 +366,7 @@
366 366 struct cifsLockInfo *li, *tmp;
367 367 struct cifs_fid fid;
368 368 struct cifs_pending_open open;
  369 + bool oplock_break_cancelled;
369 370  
370 371 spin_lock(&cifs_file_list_lock);
371 372 if (--cifs_file->count > 0) {
... ... @@ -397,7 +398,7 @@
397 398 }
398 399 spin_unlock(&cifs_file_list_lock);
399 400  
400   - cancel_work_sync(&cifs_file->oplock_break);
  401 + oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break);
401 402  
402 403 if (!tcon->need_reconnect && !cifs_file->invalidHandle) {
403 404 struct TCP_Server_Info *server = tcon->ses->server;
... ... @@ -408,6 +409,9 @@
408 409 server->ops->close(xid, tcon, &cifs_file->fid);
409 410 _free_xid(xid);
410 411 }
  412 +
  413 + if (oplock_break_cancelled)
  414 + cifs_done_oplock_break(cifsi);
411 415  
412 416 cifs_del_pending_open(&open);
413 417  
fs/cifs/smbencrypt.c
... ... @@ -221,7 +221,7 @@
221 221 }
222 222  
223 223 rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
224   - memset(wpwd, 0, 129 * sizeof(__le16));
  224 + memzero_explicit(wpwd, sizeof(wpwd));
225 225  
226 226 return rc;
227 227 }