]> 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)
commit7b374343329e87bbc621303525f5d12911aa3ba9
tree40d750e107a235f45b95d631368fcc543bea78ce
parent01c659c2c0ae56d177107b3d57e2fbc80de85092
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: 99f25d98bdf4 ("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