lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <deb756fc-dc58-4689-ac0e-632944830871@linux.dev>
Date: Fri, 26 Dec 2025 17:05:09 -0800
From: Zhu Yanjun <yanjun.zhu@...ux.dev>
To: Li Zhijian <lizhijian@...itsu.com>, linux-rdma@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, zyjzyj2000@...il.com, jgg@...pe.ca,
 leon@...nel.org, Daisuke Matsuda <dskmtsd@...il.com>
Subject: Re: [PATCH] IB/rxe: ODP: Fix missing umem_odp->umem_mutex unlock


在 2025/12/26 1:41, Li Zhijian 写道:
> rxe_odp_map_range_and_lock() should unlock umem_odp->umem_mutex on error.
>
> Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
> ---
>   drivers/infiniband/sw/rxe/rxe_odp.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_odp.c b/drivers/infiniband/sw/rxe/rxe_odp.c
> index 8b6a8b064d3c..d22b08da2713 100644
> --- a/drivers/infiniband/sw/rxe/rxe_odp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_odp.c
> @@ -178,8 +178,10 @@ static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u
>   			return err;
>   
160 static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, 
int length, u32 flags)
161 {
162     struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
163     bool need_fault;
164     int err;
165
166     if (unlikely(length < 1))
167         return -EINVAL;
168
169     mutex_lock(&umem_odp->umem_mutex);
170
171     need_fault = rxe_check_pagefault(umem_odp, iova, length);
172     if (need_fault) {
173         mutex_unlock(&umem_odp->umem_mutex);
174
175         /* umem_mutex is locked on success. */
176         err = rxe_odp_do_pagefault_and_lock(mr, iova, length,
177                             flags);
178         if (err < 0)

179             return err;

If the function rxe_odp_do_pagefault_and_lock() succeeds and run here, 
the mutex lock umem_mutex should be held.

Thus, if rxe_check_pagefault fails, the mutex lock umem_mutex should be 
released.

as such, I am fine with this.

But IMO, the commit log is too simple. The above explanations should be 
added into the commit logs.

Reviewed-by: Zhu Yanjun <yanjun.zhu@...ux.dev>

Zhu Yanjun

180
181         need_fault = rxe_check_pagefault(umem_odp, iova, length);
182         if (need_fault)
183             return -EFAULT;
184     }
185
186     return 0;
187 }

>   		need_fault = rxe_check_pagefault(umem_odp, iova, length);
> -		if (need_fault)
> +		if (need_fault) {
> +			mutex_unlock(&umem_odp->umem_mutex);
>   			return -EFAULT;
> +		}
>   	}
>   
>   	return 0;

-- 
Best Regards,
Yanjun.Zhu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ