Skip to content
Commit 1eb9364c authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

IB/uverbs: Fix ordering of ucontext check in ib_uverbs_write



During disassociation the ucontext will become NULL, however due to how
the SRCU locking works the ucontext must only be examined after looking
at the ib_dev, which governs the RCU control flow.

With the wrong ordering userspace will see EINVAL instead of EIO for a
disassociated uverbs FD, which breaks rdma-core.

Cc: stable@vger.kernel.org
Fixes: 491d5c6a ("RDMA/uverbs: Move uncontext check before SRCU read lock")
Reported-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent 3dc7c7ba
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