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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251230092751.GA27868@unreal>
Date: Tue, 30 Dec 2025 11:27:51 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Zhu Yanjun <yanjun.zhu@...ux.dev>
Cc: Li Zhijian <lizhijian@...itsu.com>, linux-rdma@...r.kernel.org,
	linux-kernel@...r.kernel.org, zyjzyj2000@...il.com, jgg@...pe.ca,
	Daisuke Matsuda <dskmtsd@...il.com>
Subject: Re: [PATCH] IB/rxe: ODP: Fix missing umem_odp->umem_mutex unlock

On Fri, Dec 26, 2025 at 05:05:09PM -0800, Zhu Yanjun wrote:
> 
> 在 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>

I made a few adjustments to the commit message, added a Fixes tag, included  
your Reviewed-by, and applied the patch.

Thanks

> 
> 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