RDMA/srp: Fix a recently introduced memory leak
authorBart Van Assche <bvanassche@acm.org>
Mon, 24 May 2021 04:12:10 +0000 (21:12 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:56:17 +0000 (16:56 +0200)
commit067b6631315ded7c34817403ca35732888d749a1
tree35f3a8157a67b4ea6bf19bec1284cc05d846a900
parent116d5cdfacff50a9a8bfcc2dfd16b4bbb270f261
RDMA/srp: Fix a recently introduced memory leak

[ Upstream commit 7ec2e27a3afff64c96bfe7a77685c33619db84be ]

Only allocate a memory registration list if it will be used and if it will
be freed.

Link: https://lore.kernel.org/r/20210524041211.9480-5-bvanassche@acm.org
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Fixes: f273ad4f8d90 ("RDMA/srp: Remove support for FMR memory registration")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/ulp/srp/ib_srp.c