linux-stable/drivers/infiniband
Nitzan Carmi 1fd2d40b46 IB/mlx5: Fix mlx5_ib_alloc_mr error flow
[ Upstream commit 45e6ae7ef2 ]

ibmr.device is being set only after ib_alloc_mr() is
(successfully) complete. Therefore, in case mlx5_core_create_mkey()
return with error, the error flow calls mlx5_free_priv_descs()
which uses ibmr.device (which doesn't exist yet), causing
a NULL dereference oops.

To fix this, the IB device should be set in the mr struct earlier
stage (e.g. prior to calling mlx5_core_create_mkey()).

Fixes: 8a187ee52b ("IB/mlx5: Support the new memory registration API")
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Nitzan Carmi <nitzanc@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-03 10:24:31 +01:00
..
core RDMA/uverbs: Sanitize user entered port numbers prior to access it 2018-02-28 10:19:40 +01:00
hw IB/mlx5: Fix mlx5_ib_alloc_mr error flow 2018-03-03 10:24:31 +01:00
sw RDMA/rxe: Fix rxe_qp_cleanup() 2018-02-22 15:42:15 +01:00
ulp iser-target: Fix possible use-after-free in connection establishment error 2018-01-23 19:58:12 +01:00
Kconfig IB/core: Expose ioctl interface through experimental Kconfig 2017-08-31 08:35:14 -04:00
Makefile IB/rdmavt: Create module framework and handle driver registration 2016-03-10 20:37:04 -05:00