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
6464 * strlen(";sec=ntlmsspi") */
6565 #define MAX_MECH_STR_LEN 13
6666
67−/* strlen of "host=" */
68−#define HOST_KEY_LEN 5
67+/* strlen of ";host=" */
68+#define HOST_KEY_LEN 6
6969
7070 /* strlen of ";ip4=" or ";ip6=" */
7171 #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
20652065 ses->chans[i].server = NULL;
20662066 }
20672067
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+
20682074 sesInfoFree(ses);
20692075 cifs_put_tcp_session(server, 0);
20702076 }
fs/smb/client/sess.c+13−9
@@ -322,28 +322,32 @@ cifs_disable_secondary_channels(struct cifs_ses *ses) · 321 unmodified lines
322322 iface = ses->chans[i].iface;
323323 server = ses->chans[i].server;
324324
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+
325333 if (iface) {
326334 spin_lock(&ses->iface_lock);
327335 kref_put(&iface->refcount, release_iface);
328− ses->chans[i].iface = NULL;
329336 iface->num_channels--;
330337 if (iface->weight_fulfilled)
331338 iface->weight_fulfilled--;
332339 spin_unlock(&ses->iface_lock);
333340 }
334341
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−
342342 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+ }
344347 cifs_put_tcp_session(server, false);
345348 }
346349
350+ spin_lock(&ses->chan_lock);
347351 }
348352
349353 done:
fs/smb/client/smb2transport.c+2−3
@@ -458,6 +458,8 @@ generate_smb3signingkey(struct cifs_ses *ses, · 457 unmodified lines
458458 ptriplet->encryption.context,
459459 ses->smb3encryptionkey,
460460 SMB3_ENC_DEC_KEY_SIZE);
461+ if (rc)
462+ return rc;
461463 rc = generate_key(ses, ptriplet->decryption.label,
462464 ptriplet->decryption.context,
463465 ses->smb3decryptionkey,
@@ -466,9 +468,6 @@ generate_smb3signingkey(struct cifs_ses *ses, · 2 unmodified lines
466468 return rc;
467469 }
468470
469− if (rc)
470− return rc;
471−
472471 #ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
473472 cifs_dbg(VFS, "%s: dumping generated AES session keys\n", __func__);
474473 /*

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