mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
IB/core: Fix missing RDMA cgroups release in case of failure to register device
commit2fb4f4eadd
upstream. During IB device registration process, if query_device() fails or if ib_core fails to registers sysfs entries, rdma cgroup cleanup is skipped. Cc: <stable@vger.kernel.org> # v4.2+ Fixes:4be3a4fa51
("IB/core: Fix kernel crash during fail to initialize device") Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c1badd7b65
commit
e3a8c7b5d7
1 changed files with 4 additions and 2 deletions
|
@ -534,14 +534,14 @@ int ib_register_device(struct ib_device *device,
|
||||||
ret = device->query_device(device, &device->attrs, &uhw);
|
ret = device->query_device(device, &device->attrs, &uhw);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_warn("Couldn't query the device attributes\n");
|
pr_warn("Couldn't query the device attributes\n");
|
||||||
goto cache_cleanup;
|
goto cg_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ib_device_register_sysfs(device, port_callback);
|
ret = ib_device_register_sysfs(device, port_callback);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_warn("Couldn't register device %s with driver model\n",
|
pr_warn("Couldn't register device %s with driver model\n",
|
||||||
device->name);
|
device->name);
|
||||||
goto cache_cleanup;
|
goto cg_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
device->reg_state = IB_DEV_REGISTERED;
|
device->reg_state = IB_DEV_REGISTERED;
|
||||||
|
@ -557,6 +557,8 @@ int ib_register_device(struct ib_device *device,
|
||||||
mutex_unlock(&device_mutex);
|
mutex_unlock(&device_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
cg_cleanup:
|
||||||
|
ib_device_unregister_rdmacg(device);
|
||||||
cache_cleanup:
|
cache_cleanup:
|
||||||
ib_cache_cleanup_one(device);
|
ib_cache_cleanup_one(device);
|
||||||
ib_cache_release_one(device);
|
ib_cache_release_one(device);
|
||||||
|
|
Loading…
Reference in a new issue