]> git.proxmox.com Git - mirror_ubuntu-focal-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)
commit5a371cf87e145b86efd32007e46146e78c1eff6d
tree40d750e107a235f45b95d631368fcc543bea78ce
parent45e6ae7ef21b907dacb18da62d5787d74a31d860
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: 1b2cd0fc673c ("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