RDMA: Fix double-free in srq creation error flow
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Mon, 16 Sep 2019 07:11:54 +0000 (10:11 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 16 Sep 2019 17:37:38 +0000 (14:37 -0300)
commit3eca7fc2d8d1275d9cf0c709f0937becbfcf6d96
treeab1b452246f30cf2ad9a5252c0c2c3dddc37b38d
parenta3f4b8e31822650f815f4219a4abde2001fd2fd0
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: 68e326dea1db ("RDMA: Handle SRQ allocations by IB/core")
Link: https://lore.kernel.org/r/20190916071154.20383-5-leon@kernel.org
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/uverbs_cmd.c