mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
xprtrdma: Fix use-after-free in rpcrdma_post_recvs
[ Upstream commit2d0abe36cf] Dereference wr->next /before/ the memory backing wr has been released. This issue was found by code inspection. It is not expected to be a significant problem because it is in an error path that is almost never executed. Fixes:7c8d9e7c88("xprtrdma: Move Receive posting to ... ") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
499cc1428e
commit
e793ac763c
@@ -1558,10 +1558,11 @@ rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
|
||||
rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr,
|
||||
(const struct ib_recv_wr **)&bad_wr);
|
||||
if (rc) {
|
||||
for (wr = bad_wr; wr; wr = wr->next) {
|
||||
for (wr = bad_wr; wr;) {
|
||||
struct rpcrdma_rep *rep;
|
||||
|
||||
rep = container_of(wr, struct rpcrdma_rep, rr_recv_wr);
|
||||
wr = wr->next;
|
||||
rpcrdma_recv_buffer_put(rep);
|
||||
--count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user