Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3eca7fc2 authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Jason Gunthorpe
Browse files

RDMA: Fix double-free in srq creation error flow

The cited commit introduced a double-free of the srq buffer in the error
flow of procedure __uverbs_create_xsrq().

The problem is that ib_destroy_srq_user() called in the error flow also
frees the srq buffer.

Thus, if uverbs_response() fails in __uverbs_create_srq(), the srq buffer
will be freed twice.

Cc: <stable@vger.kernel.org>
Fixes: 68e326de ("RDMA: Handle SRQ allocations by IB/core")
Link: https://lore.kernel.org/r/20190916071154.20383-5-leon@kernel.org


Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Reviewed-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent a3f4b8e3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3482,7 +3482,8 @@ static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,

err_copy:
	ib_destroy_srq_user(srq, uverbs_get_cleared_udata(attrs));

	/* It was released in ib_destroy_srq_user */
	srq = NULL;
err_free:
	kfree(srq);
err_put: