[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad2e9d94-2d95-4351-b800-627f20672209@samba.org>
Date: Wed, 6 Aug 2025 14:20:56 +0200
From: Stefan Metzmacher <metze@...ba.org>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Steve French <sfrench@...ba.org>, Paulo Alcantara <pc@...guebit.org>,
Ronnie Sahlberg <ronniesahlberg@...il.com>,
Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>,
Bharath SM <bharathsm@...rosoft.com>, linux-cifs@...r.kernel.org,
samba-technical@...ts.samba.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH next] smb: client: Fix use after free in send_done()
Hi Dan,
> The mempool_free() function frees "request". Don't free the request
> until after smbd_disconnect_rdma_connection() to avoid a use after free
> bug.
>
> Fixes: 5e65668c75c0 ("smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> fs/smb/client/smbdirect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
> index 58321e483a1a..162f8d1c548a 100644
> --- a/fs/smb/client/smbdirect.c
> +++ b/fs/smb/client/smbdirect.c
> @@ -286,8 +286,8 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
> if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_SEND) {
> log_rdma_send(ERR, "wc->status=%d wc->opcode=%d\n",
> wc->status, wc->opcode);
> - mempool_free(request, request->info->request_mempool);
> smbd_disconnect_rdma_connection(request->info);
> + mempool_free(request, request->info->request_mempool);
The correct fix is to use 'info' instead of 'request->info'
other than that the order needs to stay that way.
I already asked Steve to squash such a change into the
original commit (which is not yet upstream).
See:
https://lore.kernel.org/linux-cifs/cover.1754308712.git.metze@samba.org/T/#m98a8607d7b83a11fd78547306836a872a2a27192
What was the test that triggered the problem?
Or did you only noticed it by looking at the code?
Thanks!
metze
Powered by blists - more mailing lists