OSDN Git Service

RDMA/core: Fix locking in ib_uverbs_event_read
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 8 Jan 2020 17:22:03 +0000 (19:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:33:23 +0000 (16:33 -0500)
commit14d37518a97843eae6951e77f0d4510f30d4d90c
tree6ae2685412a777f3726092f6a918bca1da561ab1
parentab40fc36d6b39d65e0f5fdb950f2155e1250c8f1
RDMA/core: Fix locking in ib_uverbs_event_read

commit 14e23bd6d22123f6f3b2747701fa6cd4c6d05873 upstream.

This should not be using ib_dev to test for disassociation, during
disassociation is_closed is set under lock and the waitq is triggered.

Instead check is_closed and be sure to re-obtain the lock to test the
value after the wait_event returns.

Fixes: 036b10635739 ("IB/uverbs: Enable device removal when there are active user space applications")
Link: https://lore.kernel.org/r/1578504126-9400-12-git-send-email-yishaih@mellanox.com
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/uverbs_main.c