mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] smb: client: the key-dump ioctls read ses->auth_key while session setup replaces it
@ 2026-12-05 19:52 Piyus Kedia
  2026-12-05 19:52 ` [PATCH] smb: client: dump the session keys under session_mutex Piyus Kedia
  0 siblings, 1 reply; 2+ messages in thread
From: Piyus Kedia @ 2026-12-05 19:52 UTC (permalink / raw)
  To: Paulo Alcantara, Namjae Jeon, linux-cifs
  Cc: Ronnie Sahlberg, Shyam Prasad N, Tom Talpey, Bharath SM,
	samba-technical, linux-kernel, Kapil Vaswani

Hi,

CIFS_DUMP_FULL_KEY copies the session key out of ses->auth_key with no
lock against session setup, and for the AES-128 ciphers always 16 bytes
of it, whatever auth_key holds:

  fs/smb/client/ioctl.c:463 (cifs_dump_full_key)
      switch (ses->server->cipher_type) {
      case SMB2_ENCRYPTION_AES128_CCM:
      case SMB2_ENCRYPTION_AES128_GCM:
          out.session_key_length = CIFS_SESS_KEY_SIZE;
          ...
      case SMB2_ENCRYPTION_AES256_CCM:
      case SMB2_ENCRYPTION_AES256_GCM:
          out.session_key_length = ses->auth_key.len;
          ...
      if (copy_to_user(in, &out, sizeof(out))) {        /* :490 */
          ...
      end = in->data;
      if (copy_to_user(end, ses->auth_key.response,     /* :497 */
                       out.session_key_length)) {

and the older CIFS_DUMP_KEY does the same with memcpy() (ioctl.c:612).
Session setup, which every reconnect runs, replaces auth_key in steps
under ses->session_mutex:

  fs/smb/client/connect.c:4229 (cifs_setup_session)
      kfree_sensitive(ses->auth_key.response);
      ses->auth_key.response = NULL;
  fs/smb/client/sess.c:722 (decode_ntlmssp_challenge)
      ses->auth_key.response = kmemdup(bcc_ptr + tioffset, tilen,
                                       GFP_KERNEL);
  fs/smb/client/cifsencrypt.c:370 (set_auth_key_response)
      ses->auth_key.len = len;
  out:
      ses->auth_key.response = rsp;

So auth_key is first NULL, then the target info of the server's NTLMSSP
CHALLENGE - tilen bytes, as many as the server sent - then the NTLMv2
response, whose first 16 bytes become the session key; and a setup that
fails stays at the step it reached.  A dump during a reconnect, or after
one whose session setup failed, copies 16 bytes from NULL or from a
target info that can be shorter, and with AES-256 the length (line 471)
and the buffer (line 497) can belong to different setups, since the
copy_to_user() between them can sleep in a page fault.  The fuzzer hit
the short target info on 7.4.0-rc5:

  BUG: KASAN: slab-out-of-bounds in cifs_dump_full_key+0x65f/0x8a0 fs/smb/client/ioctl.c:497
  Read of size 16 at addr ffff88804302dfa0 by task syz-executor/9603
   copy_to_user include/linux/uaccess.h:241 [inline]
   cifs_dump_full_key+0x65f/0x8a0 fs/smb/client/ioctl.c:497
   cifs_ioctl+0xb47/0xf10 fs/smb/client/ioctl.c:643
   vfs_ioctl+0x5d/0xb0 fs/ioctl.c:52
   ...
  Allocated by task 1299:
   kmemdup_noprof+0x3e/0xa0 mm/util.c:138
   decode_ntlmssp_challenge+0x49a/0x690 fs/smb/client/sess.c:722
   SMB2_sess_auth_rawntlmssp_negotiate+0x454/0x600 fs/smb/client/smb2pdu.c:1918
   SMB2_sess_setup+0x200/0x3d0 fs/smb/client/smb2pdu.c:2087
   cifs_setup_session+0x6a5/0xaa0 fs/smb/client/connect.c:4240
   smb2_reconnect+0x851/0x1380 fs/smb/client/smb2pdu.c:411
   smb2_reconnect_server+0x53b/0x9d0 fs/smb/client/smb2pdu.c:4450
  The buggy address belongs to the object at ffff88804302dfa0
   which belongs to the cache kmalloc-8 of size 8
  The buggy address is located 0 bytes inside of
   allocated 4-byte region [ffff88804302dfa0, ffff88804302dfa4)

and also the other two, under their own titles: "KASAN: null-ptr-deref
Read in cifs_dump_full_key", a read of size 16 at address 0 at the same
line, auth_key.response being NULL between cifs_setup_session() and the
CHALLENGE; and, with AES-256, a read of size 200 of a 96-byte auth_key
allocated by set_auth_key_response().

How it is reached.  The reproducer is a minimal SMB 3.1.1 server on
loopback - NTLMv2 with a password it knows, AES-GCM, one share that
requires encryption (SHI1005_FLAGS_ENCRYPT_DATA, so that
smb3_encryption_required() holds) - and a mount of it; it makes the
client reconnect by closing the server's side of the connection, and
calls the ioctl on a file of the mount at the wrong moment:

  1. AES-256-GCM.  The mount's CHALLENGE carries 108 bytes of target
     info, so auth_key.len is 200.  CIFS_DUMP_FULL_KEY reads that
     length, then stops in copy_to_user() of its header on a page
     write-protected with userfaultfd; the client reconnects, the new
     CHALLENGE carries 4 bytes of target info and auth_key becomes a
     96-byte buffer; the write protection is lifted and the ioctl
     copies 200 bytes from that buffer:

       BUG: KASAN: slab-out-of-bounds in _copy_to_user+0xad/0xd0
       Read of size 200 at addr ffff88802476bd80 by task poc/9454
        _copy_to_user+0xad/0xd0 lib/usercopy.c:24
        cifs_dump_full_key fs/smb/client/ioctl.c:497 [inline]
        cifs_ioctl+0x1ec1/0x2660 fs/smb/client/ioctl.c:643
        __x64_sys_ioctl+0x121/0x170 fs/ioctl.c:598
       Allocated by task 3131:
        __kmalloc_noprof+0x357/0x810 mm/slub.c:5556
        set_auth_key_response fs/smb/client/cifsencrypt.c:354 [inline]
        setup_ntlmv2_rsp+0x546/0xb60 fs/smb/client/cifsencrypt.c:429
        build_ntlmssp_auth_blob+0x2a/0x780 fs/smb/client/sess.c:929
        SMB2_sess_auth_rawntlmssp_authenticate+0x293/0x460 fs/smb/client/smb2pdu.c:1969
        SMB2_sess_setup+0x1b4/0x470 fs/smb/client/smb2pdu.c:2087
        cifs_setup_session+0x49d/0xaf0 fs/smb/client/connect.c:4240
        smb2_reconnect.part.0+0x70e/0x18b0 fs/smb/client/smb2pdu.c:411
        smb2_reconnect_server+0x71a/0x1100 fs/smb/client/smb2pdu.c:4450
       The buggy address belongs to the object at ffff88802476bd80
        which belongs to the cache kmalloc-96 of size 96
       The buggy address is located 0 bytes inside of
        allocated 96-byte region [ffff88802476bd80, ffff88802476bde0)

     The ioctl returns 0 with session_key_length 200: bytes 16-95 of
     the key are the NTLMv2 response the server received in the
     reconnect, bytes 96-199 are what follows the buffer.

  2. AES-128-GCM.  The server refuses the reconnect's SESSION_SETUP
     (STATUS_ACCESS_DENIED), which leaves auth_key.response NULL until
     a session setup succeeds, and CIFS_DUMP_FULL_KEY copies 16 bytes
     from it:

       BUG: KASAN: null-ptr-deref in _copy_to_user+0xad/0xd0
       Read of size 16 at addr 0000000000000000 by task poc/9449
        _copy_to_user+0xad/0xd0 lib/usercopy.c:24
        cifs_dump_full_key fs/smb/client/ioctl.c:497 [inline]
        cifs_ioctl+0x1ec1/0x2660 fs/smb/client/ioctl.c:643

     after which the copy faults and the ioctl fails with EINVAL.
     CIFS_DUMP_KEY in the same state gives "null-ptr-deref in
     cifs_ioctl+0x1594/0x2660", from __asan_memcpy() at ioctl.c:612.

  3. AES-128-GCM, 4 bytes of target info in every CHALLENGE, the server
     dropping the connection a few requests after every session setup,
     one thread stat()ing so that the client reconnects and another
     looping CIFS_DUMP_FULL_KEY: the 7.4-rc5 report above, read of size
     16 of a 4-byte object allocated by decode_ntlmssp_challenge(),
     alongside null-ptr-deref reads as in 2.  This one is a race.

Impact - who can trigger it:

  - Only root issues the ioctls.  Both check capable(CAP_SYS_ADMIN)
    (ioctl.c:600 and 649), in the initial user namespace, and mounting
    cifs needs the same.  They are debugging interfaces, for decrypting
    captures of an encrypted share, and what they read goes to the
    caller's buffer.

  - The windows are opened by session setup, which every reconnect
    runs, so they are there whatever the server: a dump that lands in
    one reads from NULL, from the target info or from a buffer freed
    under it, and after a re-setup that failed before the CHALLENGE -
    refused, as here, or a sec=krb5 one, since SMB2_auth_kerberos()
    frees auth_key on any error (smb2pdu.c:1830; we did not test krb5)
    - auth_key.response stays NULL until a setup succeeds.  A malicious
    server controls how far the reads go: the length of its target
    info (MS-NLMP has a server put at least its NetBIOS computer and
    domain names there, so a short one is the server's choice; a 16-byte
    read runs 16 - tilen bytes past it), whether key exchange is
    negotiated (with it auth_key.len ends up 16, without it the length
    of the NTLMv2 response, which grows with the target info, so an
    AES-256 length of up to 255 - session_key_length is a u8 - can go
    stale), and when the client has to set the session up again.

  - What the reads do.  A stale AES-256 length copies past the end of
    the new auth_key into the caller's buffer: 104 bytes past a 96-byte
    object here, which in our runs held direct-map addresses, the
    address of module_ktype (this config has no KASLR) and pieces of
    strings: a sysfs device path, a udev rules file name.  An AES-128
    dump during the target-info window copies 16 - tilen bytes past
    it, 12 in the fuzzer's run.  From NULL, CIFS_DUMP_FULL_KEY's
    copy_to_user() faults and the ioctl fails with EINVAL;
    CIFS_DUMP_KEY's memcpy() reads address 0, which without KASAN
    should oops (we have not run such a kernel) - with KASAN the copy
    is skipped after the report and the ioctl returned 0 with 16 bytes
    of uninitialised stack as the session key.

  - There is also a use-after-free.  copy_to_user() can sleep in a
    fault on the user buffer half way through, and nothing keeps the
    buffer it copies from alive meanwhile.  With the second part of the
    user buffer on a page userfaultfd had not filled, the copy stopped
    64 bytes into a 200-byte AES-256 key, the reconnect (with the same
    target info, so the same length) freed auth_key.response, and the
    copy went on in the freed buffer: 116 of the remaining 136 bytes
    came back different from the key, every one of them zero, since
    kfree_sensitive() clears what it frees.  KASAN checks the source
    range before the copy and reported nothing.  Whether the freed
    buffer can be reallocated before the copy goes on we did not try.

Seen on 7.4.0-rc5 and REPRODUCED ON ksmbd-for-next (d70570cf8003,
2026-12-04), whose fs/smb/client is identical to mainline
(c3500c5ef648, 2026-12-04), with KASAN: the stale AES-256 length gave
the report in 1. in 4 of 4 boots; the refused re-setup gave the
null-ptr-deref read in 3 of 3 boots with each ioctl; the held copy read
the freed buffer in 3 of 3 (from the bytes; no KASAN report); and the
looped dumps gave the 7.4-rc5 report, 5 and 19 times, in 2 of the 3
boots we ran them in - the third, with an earlier version of the
program, set the session up only twice - besides null-ptr-deref reads
in all 3.  The code is the same in cifs-next (9b62aa64ed00,
2026-12-03).

CIFS_DUMP_KEY has copied 16 bytes from auth_key.response without a
lock since it was added in 7e7db86c7e10 ("smb3: allow decryption keys
to be dumped by admin for debugging"), v5.4, and CIFS_DUMP_FULL_KEY
since aa22ebc3826b ("smb3.1.1: allow dumping GCM256 keys to improve
debugging of encrypted shares"), v5.13; 1bb56810677f ("cifs: change
format of CIFS_FULL_KEY_DUMP ioctl"), also v5.13, gave it the
copy_to_user() above, and 5be7a0cef322 ("smb: client: Use
FullSessionKey for AES-256 encryption key derivation"), v7.1, made the
AES-256 length auth_key.len, which is where a stale length comes from.

A patch follows in reply to this mail.  It takes the keys under
session_mutex, which every caller of cifs_setup_session() holds, into a
buffer on the stack; refuses the dump with EAGAIN when
auth_key.response is NULL - whatever auth_key.len says, since a
channel-binding setup whose kmemdup() of the target info fails leaves
the old length beside a NULL pointer (sess.c:722-726) - or shorter than
the length to be reported; and copies the buffer to user space after
dropping the mutex.  A dump that comes during a session setup now waits
for it.  On ksmbd-for-next, same config and image, the patch the only
change between the two builds:

  without the patch   the reports above, and the held copy reading the
                      freed buffer
  with the patch      in each of 3 boots, which ran every case once:
                      the held dumps return the keys as the ioctl first
                      found them (all 200 bytes the mount's), both
                      ioctls fail with EAGAIN after the refused
                      re-setup, and the looped dumps all return a key,
                      over 529, 582 and 563 session setups; no KASAN
                      report and no lockdep report
  both                with the connection left alone, or the re-setup
                      accepted, the dumps return the session's current
                      keys; the 16-byte session keys equal the one the
                      server derived

This was found by AI-driven fuzzing built on top of syzkaller; its
analysis was then checked by hand against the code and every claim
above was reproduced.  The reproducer is fuzzer-generated, runs a
minimal SMB server and the mount in one program over loopback, and we
are happy to send it on request.

Kapil Vaswani
Piyus Kedia

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] smb: client: dump the session keys under session_mutex
  2026-12-05 19:52 [BUG] smb: client: the key-dump ioctls read ses->auth_key while session setup replaces it Piyus Kedia
@ 2026-12-05 19:52 ` Piyus Kedia
  0 siblings, 0 replies; 2+ messages in thread
From: Piyus Kedia @ 2026-12-05 19:52 UTC (permalink / raw)
  To: Paulo Alcantara, Namjae Jeon, linux-cifs
  Cc: Ronnie Sahlberg, Shyam Prasad N, Tom Talpey, Bharath SM,
	samba-technical, linux-kernel, Kapil Vaswani

CIFS_DUMP_FULL_KEY and CIFS_DUMP_KEY copy the session key out of
ses->auth_key.response, and the keys derived from it out of the session,
with no lock against session setup.  Session setup, which every
reconnect runs under ses->session_mutex, replaces auth_key in steps: it
frees it and leaves it NULL (cifs_setup_session()), points it at a copy
of the target info in the server's NTLMSSP CHALLENGE, whose length the
server chooses (decode_ntlmssp_challenge()), and then at the NTLMv2
response (setup_ntlmv2_rsp()); a setup that fails stays at the step it
reached.  For the AES-128 ciphers both ioctls copy 16 bytes whatever
auth_key holds, and for AES-256 cifs_dump_full_key() reads auth_key.len
and, after a copy_to_user() that can sleep, auth_key.response.  So a
dump during a reconnect, or after one whose session setup failed, reads
from NULL, past the end of a target info shorter than 16 bytes, or an
old length from a new, shorter buffer:

  BUG: KASAN: slab-out-of-bounds in _copy_to_user+0xad/0xd0
  Read of size 200 at addr ffff88802476bd80 by task poc/9454
   _copy_to_user+0xad/0xd0 lib/usercopy.c:24
   cifs_dump_full_key fs/smb/client/ioctl.c:497 [inline]
   cifs_ioctl+0x1ec1/0x2660 fs/smb/client/ioctl.c:643
  Allocated by task 3131:
   __kmalloc_noprof+0x357/0x810 mm/slub.c:5556
   set_auth_key_response fs/smb/client/cifsencrypt.c:354 [inline]
   setup_ntlmv2_rsp+0x546/0xb60 fs/smb/client/cifsencrypt.c:429
   build_ntlmssp_auth_blob+0x2a/0x780 fs/smb/client/sess.c:929
   SMB2_sess_auth_rawntlmssp_authenticate+0x293/0x460 fs/smb/client/smb2pdu.c:1969
   SMB2_sess_setup+0x1b4/0x470 fs/smb/client/smb2pdu.c:2087
   cifs_setup_session+0x49d/0xaf0 fs/smb/client/connect.c:4240
   smb2_reconnect.part.0+0x70e/0x18b0 fs/smb/client/smb2pdu.c:411
   smb2_reconnect_server+0x71a/0x1100 fs/smb/client/smb2pdu.c:4450
  The buggy address is located 0 bytes inside of
   allocated 96-byte region [ffff88802476bd80, ffff88802476bde0)

and, after a reconnect whose session setup the server refused:

  BUG: KASAN: null-ptr-deref in _copy_to_user+0xad/0xd0
  Read of size 16 at addr 0000000000000000 by task poc/9449

Take the keys under session_mutex into a buffer on the stack, refuse the
dump with -EAGAIN when auth_key holds no session key of the length to be
reported, and copy that buffer to user space after dropping the mutex:
copy_to_user() can sleep in a fault on the user buffer, which must not
hold up session setup, nor leave the copy reading an auth_key that
session setup has freed meanwhile.  A dump that comes during a session
setup now waits for it.

We found this with a syzkaller-based fuzzing harness driven by an AI tool.

Fixes: 7e7db86c7e10 ("smb3: allow decryption keys to be dumped by admin for debugging")
Fixes: aa22ebc3826b ("smb3.1.1: allow dumping GCM256 keys to improve debugging of encrypted shares")
Closes: https://lore.kernel.org/r/cifs-dump-key-auth-key.20261206@iiitd.ac.in/
Cc: stable@vger.kernel.org
Signed-off-by: Kapil Vaswani <kapil@presceralabs.ai>
Signed-off-by: Piyus Kedia <piyus@iiitd.ac.in>
---
Tested on ksmbd-for-next (d70570cf8003), whose fs/smb/client is the
same as mainline's, with KASAN and lockdep; this patch was the only
change between the two builds.  The reproducer is a minimal SMB 3.1.1
server on loopback whose share requires encryption, a mount of it, and
reconnects forced by closing the connection:

  before   AES-256, a dump held (userfaultfd) after reading auth_key.len
           while the reconnect shrinks auth_key: the report above, 4 of
           4 boots; a dump whose key copy is held half way while the
           reconnect frees auth_key: the rest of the key comes back as
           zeros from the freed buffer, 3 of 3 (no KASAN report); a
           refused re-setup, then either ioctl: null-ptr-deref, 3 of 3
           each; dumps looped across reconnects with 4 bytes of target
           info: slab-out-of-bounds reads of the target info in 2 of 3
           boots, null-ptr-deref reads in 3 of 3
  after    the held dumps return the keys as the ioctl first found
           them, both ioctls fail with -EAGAIN after the refused
           re-setup, the looped dumps all return a key; no KASAN and no
           lockdep report in 3 boots, each of which ran every case
  both     with the connection left alone, or the re-setup accepted,
           the dumps return the session's current keys

The patch applies to cifs-next (9b62aa64ed00) and mainline (c3500c5ef648).

 fs/smb/client/ioctl.c | 74 +++++++++++++++++++++++++++----------------
 1 file changed, 46 insertions(+), 28 deletions(-)

diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c
index bb8808289a46..985696c72df9 100644
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -408,10 +408,12 @@ static int cifs_shutdown(struct super_block *sb, unsigned long arg)
 static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug_info __user *in)
 {
 	struct smb3_full_key_debug_info out;
+	/* session_key_length is a u8; the server keys are 32 bytes at most */
+	u8 keys[U8_MAX + 2 * SMB3_GCM256_CRYPTKEY_SIZE];
+	unsigned int keys_len;
 	struct cifs_ses *ses;
 	int rc = 0;
 	bool found = false;
-	u8 __user *end;
 
 	if (!smb3_encryption_required(tcon)) {
 		rc = -EOPNOTSUPP;
@@ -460,6 +462,15 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
 		}
 	}
 
+	/*
+	 * Session setup frees and replaces ses->auth_key, and rewrites the keys
+	 * derived from it, under session_mutex.  One that is under way or has
+	 * failed can leave auth_key NULL or holding the target info of the
+	 * server's NTLMSSP challenge, which can be shorter than a session key.
+	 * Take the keys under the mutex, only if the session key is as long as
+	 * we report it, and copy them out after dropping it.
+	 */
+	mutex_lock(&ses->session_mutex);
 	switch (ses->server->cipher_type) {
 	case SMB2_ENCRYPTION_AES128_CCM:
 	case SMB2_ENCRYPTION_AES128_GCM:
@@ -473,45 +484,42 @@ static int cifs_dump_full_key(struct cifs_tcon *tcon, struct smb3_full_key_debug
 		break;
 	default:
 		rc = -EOPNOTSUPP;
-		goto out;
+		goto out_unlock;
+	}
+
+	if (!ses->auth_key.response ||
+	    ses->auth_key.len < out.session_key_length) {
+		rc = -EAGAIN;
+		goto out_unlock;
 	}
 
 	/* check if user buffer is big enough to store all the keys */
-	if (out.in_size < sizeof(out) + out.session_key_length + out.server_in_key_length
-	    + out.server_out_key_length) {
+	keys_len = out.session_key_length + out.server_in_key_length +
+		   out.server_out_key_length;
+	if (out.in_size < sizeof(out) + keys_len) {
 		rc = -ENOBUFS;
-		goto out;
+		goto out_unlock;
 	}
 
+	memcpy(keys, ses->auth_key.response, out.session_key_length);
+	memcpy(keys + out.session_key_length, ses->smb3encryptionkey,
+	       out.server_in_key_length);
+	memcpy(keys + out.session_key_length + out.server_in_key_length,
+	       ses->smb3decryptionkey, out.server_out_key_length);
 	out.session_id = ses->Suid;
 	out.cipher_type = le16_to_cpu(ses->server->cipher_type);
+	mutex_unlock(&ses->session_mutex);
 
-	/* overwrite user input with our output */
-	if (copy_to_user(in, &out, sizeof(out))) {
+	/* overwrite user input with our output, and append the keys to it */
+	if (copy_to_user(in, &out, sizeof(out)) ||
+	    copy_to_user(in->data, keys, keys_len))
 		rc = -EINVAL;
-		goto out;
-	}
-
-	/* append all the keys at the end of the user buffer */
-	end = in->data;
-	if (copy_to_user(end, ses->auth_key.response, out.session_key_length)) {
-		rc = -EINVAL;
-		goto out;
-	}
-	end += out.session_key_length;
-
-	if (copy_to_user(end, ses->smb3encryptionkey, out.server_in_key_length)) {
-		rc = -EINVAL;
-		goto out;
-	}
-	end += out.server_in_key_length;
-
-	if (copy_to_user(end, ses->smb3decryptionkey, out.server_out_key_length)) {
-		rc = -EINVAL;
-		goto out;
-	}
+	goto out;
 
+out_unlock:
+	mutex_unlock(&ses->session_mutex);
 out:
+	memzero_explicit(keys, sizeof(keys));
 	if (found)
 		cifs_put_smb_ses(ses);
 	return rc;
@@ -606,6 +614,15 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 				cifs_put_tlink(tlink);
 				break;
 			}
+			/* see cifs_dump_full_key() */
+			mutex_lock(&tcon->ses->session_mutex);
+			if (!tcon->ses->auth_key.response ||
+			    tcon->ses->auth_key.len < SMB2_NTLMV2_SESSKEY_SIZE) {
+				mutex_unlock(&tcon->ses->session_mutex);
+				rc = -EAGAIN;
+				cifs_put_tlink(tlink);
+				break;
+			}
 			pkey_inf.cipher_type =
 				le16_to_cpu(tcon->ses->server->cipher_type);
 			pkey_inf.Suid = tcon->ses->Suid;
@@ -615,6 +632,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
 			      tcon->ses->smb3decryptionkey, SMB3_SIGN_KEY_SIZE);
 			memcpy(pkey_inf.smb3encryptionkey,
 			      tcon->ses->smb3encryptionkey, SMB3_SIGN_KEY_SIZE);
+			mutex_unlock(&tcon->ses->session_mutex);
 			if (copy_to_user((void __user *)arg, &pkey_inf,
 					sizeof(struct smb3_key_debug_info)))
 				rc = -EFAULT;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-05 19:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 19:52 [BUG] smb: client: the key-dump ioctls read ses->auth_key while session setup replaces it Piyus Kedia
2026-12-05 19:52 ` [PATCH] smb: client: dump the session keys under session_mutex Piyus Kedia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®