diff options
author | Dan Carpenter <error27@gmail.com> | 2023-02-06 17:40:35 +0300 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2023-02-07 12:27:49 +0200 |
commit | 8e6e49ccf1a0f2b3257394dc8610bb6d48859d3f (patch) | |
tree | c62fc411dd96f4c4cf3f218dc2561a420098f9f5 /drivers/infiniband | |
parent | 68e416255b29c25cbf20018d55849bcb8505c858 (diff) | |
download | lwn-8e6e49ccf1a0f2b3257394dc8610bb6d48859d3f.tar.gz lwn-8e6e49ccf1a0f2b3257394dc8610bb6d48859d3f.zip |
RDMA/mlx5: Check reg_create() create for errors
The reg_create() can fail. Check for errors before dereferencing it.
Fixes: dd1b913fb0d0 ("RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y+ERYy4wN0LsKsm+@kili
Reviewed-by: Devesh Sharma <devesh.s.sharma@oracle.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index bef4a50e3739..67356f515261 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1166,6 +1166,8 @@ static struct mlx5_ib_mr *alloc_cacheable_mr(struct ib_pd *pd, mutex_lock(&dev->slow_path_mutex); mr = reg_create(pd, umem, iova, access_flags, page_size, false); mutex_unlock(&dev->slow_path_mutex); + if (IS_ERR(mr)) + return mr; mr->mmkey.rb_key = rb_key; return mr; } |