History

Merge tag '6.7-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French: - multichannel fixes (including a lock ordering fix and an important refcounting fix) - spnego fix * tag '6.7-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: fix lock ordering while disabling multichannel cifs: fix leak of iface for primary channel cifs: fix check of rc in function generate_smb3signingkey cifs: spnego: add ';' in HOST_KEY_LEN

Linus Torvalds committed 2 years ago

Commit 33b63f12 parents 05aa69b 5eef12c4 files · +23 −14Browse files

Unified · Split

4 files
  1. fs/smb/client/cifs_spnego.c +2 −2
  2. fs/smb/client/connect.c +6 −0
  3. fs/smb/client/sess.c +13 −9
  4. fs/smb/client/smb2transport.c +2 −3
fs/smb/client/cifs_spnego.c+2−2
@@ -64,8 +64,8 @@ struct key_type cifs_spnego_key_type = { · 63 unmodified lines
64 * strlen(";sec=ntlmsspi") */64 * strlen(";sec=ntlmsspi") */
65#define MAX_MECH_STR_LEN 1365#define MAX_MECH_STR_LEN 13
66 66
67/* strlen of "host=" */67/* strlen of ";host=" */
68#define HOST_KEY_LEN 568#define HOST_KEY_LEN 6
69 69
70/* strlen of ";ip4=" or ";ip6=" */70/* strlen of ";ip4=" or ";ip6=" */
71#define IP_KEY_LEN 571#define IP_KEY_LEN 5
fs/smb/client/connect.c+6−0
@@ -2065,6 +2065,12 @@ void __cifs_put_smb_ses(struct cifs_ses *ses) · 2064 unmodified lines
2065 ses->chans[i].server = NULL;2065 ses->chans[i].server = NULL;
2066 }2066 }
2067 2067
2068 /* we now account for primary channel in iface->refcount */
2069 if (ses->chans[0].iface) {
2070 kref_put(&ses->chans[0].iface->refcount, release_iface);
2071 ses->chans[0].server = NULL;
2072 }
2073
2068 sesInfoFree(ses);2074 sesInfoFree(ses);
2069 cifs_put_tcp_session(server, 0);2075 cifs_put_tcp_session(server, 0);
2070}2076}
fs/smb/client/sess.c+13−9
@@ -322,28 +322,32 @@ cifs_disable_secondary_channels(struct cifs_ses *ses) · 321 unmodified lines
322 iface = ses->chans[i].iface;322 iface = ses->chans[i].iface;
323 server = ses->chans[i].server;323 server = ses->chans[i].server;
324 324
325 /*
326 * remove these references first, since we need to unlock
327 * the chan_lock here, since iface_lock is a higher lock
328 */
329 ses->chans[i].iface = NULL;
330 ses->chans[i].server = NULL;
331 spin_unlock(&ses->chan_lock);
332
325 if (iface) {333 if (iface) {
326 spin_lock(&ses->iface_lock);334 spin_lock(&ses->iface_lock);
327 kref_put(&iface->refcount, release_iface);335 kref_put(&iface->refcount, release_iface);
328 ses->chans[i].iface = NULL;
329 iface->num_channels--;336 iface->num_channels--;
330 if (iface->weight_fulfilled)337 if (iface->weight_fulfilled)
331 iface->weight_fulfilled--;338 iface->weight_fulfilled--;
332 spin_unlock(&ses->iface_lock);339 spin_unlock(&ses->iface_lock);
333 }340 }
334 341
335 spin_unlock(&ses->chan_lock);
336 if (server && !server->terminate) {
337 server->terminate = true;
338 cifs_signal_cifsd_for_reconnect(server, false);
339 }
340 spin_lock(&ses->chan_lock);
341
342 if (server) {342 if (server) {
343 ses->chans[i].server = NULL;343 if (!server->terminate) {
344 server->terminate = true;
345 cifs_signal_cifsd_for_reconnect(server, false);
346 }
344 cifs_put_tcp_session(server, false);347 cifs_put_tcp_session(server, false);
345 }348 }
346 349
350 spin_lock(&ses->chan_lock);
347 }351 }
348 352
349done:353done:
fs/smb/client/smb2transport.c+2−3
@@ -458,6 +458,8 @@ generate_smb3signingkey(struct cifs_ses *ses, · 457 unmodified lines
458 ptriplet->encryption.context,458 ptriplet->encryption.context,
459 ses->smb3encryptionkey,459 ses->smb3encryptionkey,
460 SMB3_ENC_DEC_KEY_SIZE);460 SMB3_ENC_DEC_KEY_SIZE);
461 if (rc)
462 return rc;
461 rc = generate_key(ses, ptriplet->decryption.label,463 rc = generate_key(ses, ptriplet->decryption.label,
462 ptriplet->decryption.context,464 ptriplet->decryption.context,
463 ses->smb3decryptionkey,465 ses->smb3decryptionkey,
@@ -466,9 +468,6 @@ generate_smb3signingkey(struct cifs_ses *ses, · 2 unmodified lines
466 return rc;468 return rc;
467 }469 }
468 470
469 if (rc)
470 return rc;
471
472#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS471#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
473 cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);472 cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);
474 /*473 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t