]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
smb: client: fix smbdirect_recv_io leak in smbd_negotiate() error path
authorStefan Metzmacher <metze@samba.org>
Thu, 18 Sep 2025 01:06:46 +0000 (03:06 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 18 Sep 2025 21:46:04 +0000 (16:46 -0500)
During tests of another unrelated patch I was able to trigger this
error: Objects remaining on __kmem_cache_shutdown()

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Fixes: f198186aa9bb ("CIFS: SMBD: Establish SMB Direct connection")
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smbdirect.c

index 1f3d64145863611804d98eeb6aeee23bfc732055..e0fce5033004c7265663d2f4a53dd0dadac76a40 100644 (file)
@@ -1108,8 +1108,10 @@ static int smbd_negotiate(struct smbd_connection *info)
        log_rdma_event(INFO, "smbd_post_recv rc=%d iov.addr=0x%llx iov.length=%u iov.lkey=0x%x\n",
                       rc, response->sge.addr,
                       response->sge.length, response->sge.lkey);
-       if (rc)
+       if (rc) {
+               put_receive_buffer(info, response);
                return rc;
+       }
 
        init_completion(&info->negotiate_completion);
        info->negotiate_done = false;