# Re: f0ae4afe3d35 ("RDMA/mlx5: Fix releasing unallocated memory in dereg MR flow")

- From: Chuck Lever III \<hidden\>
- Date: 2021-12-19 18:19:16 
- List: linux-rdma
- Page: https://ratatoskr.run/linux-rdma/2021/12/15465775
- Thread: https://ratatoskr.run/linux-rdma/2021/12/15465770/t.md

```text
Hello Maor-

> On Dec 19, 2021, at 4:51 AM, Maor Gottlieb [ref] wrote:
> 
> 
> On 12/18/2021 11:25 PM, Chuck Lever III wrote:
>> NFS/RDMA with an NFS client using mlx5-based hardware triggers a
>> system deadlock (no error messages) on the client. I bisected to
>> f0ae4afe3d35 ("RDMA/mlx5: Fix releasing unallocated memory in
>> dereg MR flow").
>> 
>> --
>> Chuck Lever
> 
> Hi Chuck,
> 
> I found some bug in the cited commit. Can you please test if the below patch fixes this deadlock ?
> 
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 157d862fb864..3cb4e34fe199 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1978,7 +1978,7 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
>                         return rc;
>         }
> 
> -   if (mr->umem) {
> + if (udata && mr->umem) {
>                 bool is_odp = is_odp_mr(mr);
> 
>                 if (!is_odp)

After applying this one-liner, I am not able to reproduce the
NFS client system deadlock.

Tested-by: Chuck Lever <redacted>

--
Chuck Lever



```
