Commit 43b92fd2 authored by Israel Rukshin's avatar Israel Rukshin Committed by Jens Axboe
Browse files

nvmet-rdma: update queue list during ib_device removal

A NULL deref happens when nvmet_rdma_remove_one() is called more than once
(e.g. while connected via 2 ports).
The first call frees the queues related to the first ib_device but
doesn't remove them from the queue list.
While calling nvmet_rdma_remove_one() for the second ib_device it goes over
the full queue list again and we get the NULL deref.

Fixes: f1d4ef7d

 ("nvmet-rdma: register ib_client to not deadlock in device removal")
Signed-off-by: default avatarIsrael Rukshin <>
Reviewed-by: default avatarMax Gurtovoy <>
Reviewed-by: default avatarSagi Grimberg <>
Signed-off-by: default avatarChristoph Hellwig <>
Signed-off-by: default avatarJens Axboe <>
parent 6ddcf0a3
......@@ -1512,15 +1512,17 @@ static struct nvmet_fabrics_ops nvmet_rdma_ops = {
static void nvmet_rdma_remove_one(struct ib_device *ib_device, void *client_data)
struct nvmet_rdma_queue *queue;
struct nvmet_rdma_queue *queue, *tmp;
/* Device is being removed, delete all queues using this device */
list_for_each_entry(queue, &nvmet_rdma_queue_list, queue_list) {
list_for_each_entry_safe(queue, tmp, &nvmet_rdma_queue_list,
queue_list) {
if (queue->dev->device != ib_device)
pr_info("Removing queue %d\n", queue->idx);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment