aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-10-17 13:19:27 +0300
committerDoug Ledford <dledford@redhat.com>2018-10-17 11:43:07 -0400
commit67fecaf8e9cc28812042f61194ac0e0a9737f897 (patch)
tree9f4e9830c345376f95e4d5aa0514ad9f4f5549ae /drivers/infiniband/core
parentib_srp: Remove WARN_ON in srp_terminate_io() (diff)
downloadlinux-dev-67fecaf8e9cc28812042f61194ac0e0a9737f897.tar.xz
linux-dev-67fecaf8e9cc28812042f61194ac0e0a9737f897.zip
RDMA/core: Fix unwinding flow in case of error to register device
If port pkey list initialization fails, free the port_immutable memory during cleanup path. Currently it is missed out. If cache setup fails, free the pkey list during cleanup path. Fixes: d291f1a65 ("IB/core: Enforce PKey security on QPs") Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 5e70f5e1cfd9..d175b94ae952 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -545,14 +545,14 @@ int ib_register_device(struct ib_device *device, const char *name,
ret = setup_port_pkey_list(device);
if (ret) {
dev_warn(&device->dev, "Couldn't create per port_pkey_list\n");
- goto out;
+ goto port_cleanup;
}
ret = ib_cache_setup_one(device);
if (ret) {
dev_warn(&device->dev,
"Couldn't set up InfiniBand P_Key/GID cache\n");
- goto port_cleanup;
+ goto pkey_cleanup;
}
device->index = __dev_new_index();
@@ -596,6 +596,8 @@ cg_cleanup:
cache_cleanup:
ib_cache_cleanup_one(device);
ib_cache_release_one(device);
+pkey_cleanup:
+ kfree(device->port_pkey_list);
port_cleanup:
kfree(device->port_immutable);
out: