]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xprtrdma: Fix regbuf data not freed in rpcrdma_req_create()
authorZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Sun, 20 Nov 2022 07:34:29 +0000 (15:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:10 +0000 (11:41 +0100)
[ Upstream commit 9181f40fb2952fd59ecb75e7158620c9c669eee3 ]

If rdma receive buffer allocate failed, should call rpcrdma_regbuf_free()
to free the send buffer, otherwise, the buffer data will be leaked.

Fixes: 1e349d78e5b6 ("xprtrdma: Allocate req's regbufs at xprt create time")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/xprtrdma/verbs.c

index 0f4d39fdb48f2101fbee8227e528adb352b969af..e13115bbe7196dcf9e2cf241354321bc14e654a4 100644 (file)
@@ -1037,6 +1037,7 @@ out4:
        kfree(req->rl_sendbuf);
 out3:
        kfree(req->rl_rdmabuf);
+       rpcrdma_regbuf_free(req->rl_sendbuf);
 out2:
        kfree(req);
 out1: