lkml.org 
[lkml]   [2019]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.3 063/135] nvme-rdma: fix a segmentation fault during module unload
    Date
    From: Max Gurtovoy <maxg@mellanox.com>

    [ Upstream commit 9ad9e8d6ca29c1446d81c6518ae634a2141dfd22 ]

    In case there are controllers that are not associated with any RDMA
    device (e.g. during unsuccessful reconnection) and the user will unload
    the module, these controllers will not be freed and will access already
    freed memory. The same logic appears in other fabric drivers as well.

    Fixes: 87fd125344d6 ("nvme-rdma: remove redundant reference between ib_device and tagset")
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
    Signed-off-by: Keith Busch <kbusch@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/nvme/host/rdma.c | 8 ++++++++
    1 file changed, 8 insertions(+)

    diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
    index 842ef876724f7..439e66769f250 100644
    --- a/drivers/nvme/host/rdma.c
    +++ b/drivers/nvme/host/rdma.c
    @@ -2118,8 +2118,16 @@ err_unreg_client:

    static void __exit nvme_rdma_cleanup_module(void)
    {
    + struct nvme_rdma_ctrl *ctrl;
    +
    nvmf_unregister_transport(&nvme_rdma_transport);
    ib_unregister_client(&nvme_rdma_ib_client);
    +
    + mutex_lock(&nvme_rdma_ctrl_mutex);
    + list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list)
    + nvme_delete_ctrl(&ctrl->ctrl);
    + mutex_unlock(&nvme_rdma_ctrl_mutex);
    + flush_workqueue(nvme_delete_wq);
    }

    module_init(nvme_rdma_init_module);
    --
    2.20.1


    \
     
     \ /
      Last update: 2019-12-03 23:42    [W:3.300 / U:0.468 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site