Skip to content

Commit a0767da

Browse files
mikijoyjgunthorpe
authored andcommitted
RDMA/core: Add missing list deletion on freeing event queue
When the uobject file scheme was revised to allow device disassociation from the file it became possible for read() to still happen the driver destroys the uobject. The old clode code was not tolerant to concurrent read, and when it was moved to the driver destroy it creates a bug. Ensure the event_list is empty after driver destroy by adding the missing list_del(). Otherwise read() can trigger a use after free and double kfree. Fixes: f7c8416 ("RDMA/core: Simplify destruction of FD uobjects") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael Guralnik <[email protected]> Reviewed-by: Yishai Hadas <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 663218a commit a0767da

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/infiniband/core/uverbs_std_types.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ void ib_uverbs_free_event_queue(struct ib_uverbs_event_queue *event_queue)
220220
list_for_each_entry_safe(entry, tmp, &event_queue->event_list, list) {
221221
if (entry->counter)
222222
list_del(&entry->obj_list);
223+
list_del(&entry->list);
223224
kfree(entry);
224225
}
225226
spin_unlock_irq(&event_queue->lock);

0 commit comments

Comments
 (0)