]> git.baikalelectronics.ru Git - kernel.git/commit
IB/mlx4: Fix mlx4_ib_alloc_mr error flow
authorLeon Romanovsky <leonro@mellanox.com>
Sun, 31 Dec 2017 13:33:14 +0000 (15:33 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 2 Jan 2018 18:09:05 +0000 (11:09 -0700)
commitd7d49b4a1b8c56a224d50caaee50629c04c59515
tree40d750e107a235f45b95d631368fcc543bea78ce
parentf711ec60efe0612e6ccdf488613d5b50457bc7c3
IB/mlx4: Fix mlx4_ib_alloc_mr error flow

ibmr.device is being set only after ib_alloc_mr() is successfully complete.
Therefore, in case imlx4_mr_enable() returns with error, the error flow
unwinder calls to mlx4_free_priv_pages(), which uses ibmr.device.

Such usage causes to NULL dereference oops and to fix it, the IB device
should be set in the mr struct earlier stage (e.g. prior to calling
mlx4_free_priv_pages()).

Fixes: 68650c41cab6 ("IB/mlx4: Support the new memory registration API")
Signed-off-by: Nitzan Carmi <nitzanc@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx4/mr.c