Skip to contentSkip to conversation

Patch "IB/mlx5: Fix mlx5_ib_alloc_mr error flow" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Feb 28, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

IB/mlx5: Fix mlx5_ib_alloc_mr error flow

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Feb 28 16:23:28 CET 2018

From: Nitzan Carmi <[email protected]>
Date: Tue, 26 Dec 2017 11:20:20 +0200
Subject: IB/mlx5: Fix mlx5_ib_alloc_mr error flow

From: Nitzan Carmi <[email protected]>

[ Upstream commit 45e6ae7ef21b907dacb18da62d5787d74a31d860 ]

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 8a187ee52b04 ("IB/mlx5: Support the new memory registration API")
---
 drivers/infiniband/hw/mlx5/mr.c |    1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/mr.c +1 -0
@@ -1637,6 +1637,7 @@ struct ib_mr *mlx5_ib_alloc_mr(struct ib
 	MLX5_SET(mkc, mkc, access_mode, mr->access_mode);
 	MLX5_SET(mkc, mkc, umr_en, 1);
 
+	mr->ibmr.device = pd->device;
 	err = mlx5_core_create_mkey(dev->mdev, &mr->mmkey, in, inlen);
 	if (err)
 		goto err_destroy_psv;

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/ib-mlx5-fix-mlx5_ib_alloc_mr-error-flow.patch queue-4.14/ib-mlx4-fix-mlx4_ib_alloc_mr-error-flow.patch