]>
Commit | Line | Data |
---|---|---|
bbecac5b GKH |
1 | From 2fb4f4eadd180a50112618dd9c5fef7fc50d4f08 Mon Sep 17 00:00:00 2001 |
2 | From: Parav Pandit <parav@mellanox.com> | |
3 | Date: Sun, 25 Feb 2018 13:39:56 +0200 | |
4 | Subject: IB/core: Fix missing RDMA cgroups release in case of failure to register device | |
5 | ||
6 | From: Parav Pandit <parav@mellanox.com> | |
7 | ||
8 | commit 2fb4f4eadd180a50112618dd9c5fef7fc50d4f08 upstream. | |
9 | ||
10 | During IB device registration process, if query_device() fails or if | |
11 | ib_core fails to registers sysfs entries, rdma cgroup cleanup is | |
12 | skipped. | |
13 | ||
14 | Cc: <stable@vger.kernel.org> # v4.2+ | |
15 | Fixes: 4be3a4fa51f4 ("IB/core: Fix kernel crash during fail to initialize device") | |
16 | Reviewed-by: Daniel Jurgens <danielj@mellanox.com> | |
17 | Signed-off-by: Parav Pandit <parav@mellanox.com> | |
18 | Signed-off-by: Leon Romanovsky <leon@kernel.org> | |
19 | Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> | |
20 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
21 | ||
22 | --- | |
23 | drivers/infiniband/core/device.c | 6 ++++-- | |
24 | 1 file changed, 4 insertions(+), 2 deletions(-) | |
25 | ||
26 | --- a/drivers/infiniband/core/device.c | |
27 | +++ b/drivers/infiniband/core/device.c | |
28 | @@ -534,14 +534,14 @@ int ib_register_device(struct ib_device | |
29 | ret = device->query_device(device, &device->attrs, &uhw); | |
30 | if (ret) { | |
31 | pr_warn("Couldn't query the device attributes\n"); | |
32 | - goto cache_cleanup; | |
33 | + goto cg_cleanup; | |
34 | } | |
35 | ||
36 | ret = ib_device_register_sysfs(device, port_callback); | |
37 | if (ret) { | |
38 | pr_warn("Couldn't register device %s with driver model\n", | |
39 | device->name); | |
40 | - goto cache_cleanup; | |
41 | + goto cg_cleanup; | |
42 | } | |
43 | ||
44 | device->reg_state = IB_DEV_REGISTERED; | |
45 | @@ -557,6 +557,8 @@ int ib_register_device(struct ib_device | |
46 | mutex_unlock(&device_mutex); | |
47 | return 0; | |
48 | ||
49 | +cg_cleanup: | |
50 | + ib_device_unregister_rdmacg(device); | |
51 | cache_cleanup: | |
52 | ib_cache_cleanup_one(device); | |
53 | ib_cache_release_one(device); |