RDMA/uverbs: Make the event_queue fds return POLLERR when disassociated
authorJason Gunthorpe <jgg@mellanox.com>
Tue, 7 Apr 2020 00:44:26 +0000 (21:44 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jun 2020 14:40:22 +0000 (16:40 +0200)
commitf23be4d1555d0dadcd744251dc6d88ac9d6007f0
treea7b6e3af64915722d51cdb66541f9ecf62880621
parent3f14df580a3d52fa127b03043d372dfe5c784c5b
RDMA/uverbs: Make the event_queue fds return POLLERR when disassociated

[ Upstream commit eb356e6dc15a30af604f052cd0e170450193c254 ]

If is_closed is set, and the event list is empty, then read() will return
-EIO without blocking. After setting is_closed in
ib_uverbs_free_event_queue(), we do trigger a wake_up on the poll_wait,
but the fops->poll() function does not check it, so poll will continue to
sleep on an empty list.

Fixes: 14e23bd6d221 ("RDMA/core: Fix locking in ib_uverbs_event_read")
Link: https://lore.kernel.org/r/0-v1-ace813388969+48859-uverbs_poll_fix%25jgg@mellanox.com
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/uverbs_main.c