linux_dsm_epyc7002/drivers/infiniband/hw/mlx5
Jason Gunthorpe 22fa27fbc6 IB/uverbs: Fix locking around struct ib_uverbs_file ucontext
We have a parallel unlocked reader and writer with ib_uverbs_get_context()
vs everything else, and nothing guarantees this works properly.

Audit and fix all of the places that access ucontext to use one of the
following locking schemes:
- Call ib_uverbs_get_ucontext() under SRCU and check for failure
- Access the ucontext through an struct ib_uobject context member
  while holding a READ or WRITE lock on the uobject.
  This value cannot be NULL and has no race.
- Hold the ucontext_lock and check for ufile->ucontext !NULL

This also re-implements ib_uverbs_get_ucontext() in a way that is safe
against concurrent ib_uverbs_get_context() and disassociation.

As a side effect, every access to ucontext in the commands is via
ib_uverbs_get_context() with an error check, or via the uobject, so there
is no longer any need for the core code to check ucontext on every command
call. These checks are also removed.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2018-07-25 14:21:46 -06:00
..
ah.c RDMA: Convert drivers to use sgid_attr instead of sgid_index 2018-06-18 11:11:26 -06:00
cmd.c Merge branch 'mlx5-dump-fill-mkey' into rdma.git for-next 2018-07-04 13:23:46 -06:00
cmd.h Merge branch 'mlx5-dump-fill-mkey' into rdma.git for-next 2018-07-04 13:23:46 -06:00
cong.c IB/mlx5: fix uaccess beyond "count" in debugfs read/write handlers 2018-07-09 13:15:12 -06:00
cq.c Merge branch 'mini_cqe' into git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma for-next 2018-05-29 15:23:18 -06:00
devx.c IB/uverbs: Fix locking around struct ib_uverbs_file ucontext 2018-07-25 14:21:46 -06:00
doorbell.c IB/mlx5: Fix Mellanox copyright note 2015-04-02 16:33:42 -04:00
flow.c IB/mlx5: Enable driver uapi commands for flow steering 2018-07-24 14:33:52 -06:00
gsi.c IB/mlx5: Fix iteration overrun in GSI qps 2016-08-02 14:32:51 -04:00
ib_rep.c RDMA/mlx5: Update SPDX tags to show proper license 2018-06-05 14:04:20 -06:00
ib_rep.h RDMA/mlx5: Update SPDX tags to show proper license 2018-06-05 14:04:20 -06:00
ib_virt.c IB/mlx5: Restore IB guid/policy for virtual functions 2017-07-24 10:34:28 -04:00
Kconfig net/mlx5: Fix tristate and description for MLX5 module 2018-07-18 14:33:25 -07:00
mad.c IB/mlx5: Route MADs for dual port RoCE 2018-01-08 11:42:23 -07:00
main.c IB/mlx5: Enable driver uapi commands for flow steering 2018-07-24 14:33:52 -06:00
Makefile IB/mlx5: Introduce flow steering matcher uapi object 2018-07-24 13:34:37 -06:00
mem.c IB/mlx5: Simplify mlx5_ib_cont_pages 2017-09-25 11:47:24 -04:00
mlx5_ib.h IB/mlx5: Enable driver uapi commands for flow steering 2018-07-24 14:33:52 -06:00
mr.c IB/mlx5: fix uaccess beyond "count" in debugfs read/write handlers 2018-07-09 13:15:12 -06:00
odp.c IB/mlx5: Move locks initialization to the corresponding stage 2018-01-03 17:26:59 -07:00
qp.c RDMA/mlx5: Check that supplied blue flame index doesn't overflow 2018-07-13 11:54:50 -06:00
srq.c treewide: kvzalloc() -> kvcalloc() 2018-06-12 16:19:22 -07:00