Message ID | 20231009071801.10210-8-guoqing.jiang@linux.dev (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Cleanup for siw | expand |
> -----Original Message----- > From: Guoqing Jiang <guoqing.jiang@linux.dev> > Sent: Monday, October 9, 2023 9:18 AM > To: Bernard Metzler <BMT@zurich.ibm.com>; jgg@ziepe.ca; leon@kernel.org > Cc: linux-rdma@vger.kernel.org > Subject: [EXTERNAL] [PATCH 07/19] RDMA/siw: Also goto out_sem_up if > pin_user_pages returns 0 > > Since it is legitimate for pin_user_pages returns 0, which > means it might be dead loop here. > > Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> > --- > drivers/infiniband/sw/siw/siw_mem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/infiniband/sw/siw/siw_mem.c > b/drivers/infiniband/sw/siw/siw_mem.c > index c5f7f1669d09..92c5776a9eed 100644 > --- a/drivers/infiniband/sw/siw/siw_mem.c > +++ b/drivers/infiniband/sw/siw/siw_mem.c > @@ -423,7 +423,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool > writable) > while (nents) { > rv = pin_user_pages(first_page_va, nents, foll_flags, > plist); > - if (rv < 0) > + if (rv <= 0) > goto out_sem_up; > > umem->num_pages += rv; > -- > 2.35.3 Okay, looks right. hw/qib/qib_user_pages.c and hw/usnic/usnic_uiom.c should be checked in that respect as well. Adding Dennis and Christian as maintainers of those. Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c index c5f7f1669d09..92c5776a9eed 100644 --- a/drivers/infiniband/sw/siw/siw_mem.c +++ b/drivers/infiniband/sw/siw/siw_mem.c @@ -423,7 +423,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable) while (nents) { rv = pin_user_pages(first_page_va, nents, foll_flags, plist); - if (rv < 0) + if (rv <= 0) goto out_sem_up; umem->num_pages += rv;
Since it is legitimate for pin_user_pages returns 0, which means it might be dead loop here. Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> --- drivers/infiniband/sw/siw/siw_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)