* [PATCH] RDMA/umem: updated bug fix in error handling path
@ 2019-03-06 2:00 john.hubbard
2019-03-06 18:45 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: john.hubbard @ 2019-03-06 2:00 UTC (permalink / raw)
To: linux-mm
Cc: Andrew Morton, LKML, John Hubbard, Artemy Kovalyov,
Leon Romanovsky, Ira Weiny, Jason Gunthorpe, Doug Ledford,
linux-rdma
From: John Hubbard <jhubbard@nvidia.com>
The previous attempted bug fix overlooked the fact that
ib_umem_odp_map_dma_single_page() was doing a put_page()
upon hitting an error. So there was not really a bug there.
Therefore, this reverts the off-by-one change, but
keeps the change to use release_pages() in the error path.
Fixes: commit xxxxxxxxxxxx ("RDMA/umem: minor bug fix in error handling path")
Suggested-by: Artemy Kovalyov <artemyko@mellanox.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Doug Ledford <dledford@redhat.com>
Cc: linux-rdma@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
drivers/infiniband/core/umem_odp.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index d45735b02e07..c9cafaa080e7 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -686,10 +686,13 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp, u64 user_virt,
if (ret < 0) {
/*
- * Release pages, starting at the the first page
- * that experienced an error.
+ * Release pages, remembering that the first page
+ * to hit an error was already released by
+ * ib_umem_odp_map_dma_single_page().
*/
- release_pages(&local_page_list[j], npages - j);
+ if (npages - (j + 1) > 0)
+ release_pages(&local_page_list[j+1],
+ npages - (j + 1));
break;
}
}
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/umem: updated bug fix in error handling path
2019-03-06 2:00 [PATCH] RDMA/umem: updated bug fix in error handling path john.hubbard
@ 2019-03-06 18:45 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2019-03-06 18:45 UTC (permalink / raw)
To: john.hubbard
Cc: linux-mm, Andrew Morton, LKML, John Hubbard, Artemy Kovalyov,
Leon Romanovsky, Ira Weiny, Doug Ledford, linux-rdma
On Tue, Mar 05, 2019 at 06:00:22PM -0800, john.hubbard@gmail.com wrote:
> From: John Hubbard <jhubbard@nvidia.com>
>
> The previous attempted bug fix overlooked the fact that
> ib_umem_odp_map_dma_single_page() was doing a put_page()
> upon hitting an error. So there was not really a bug there.
>
> Therefore, this reverts the off-by-one change, but
> keeps the change to use release_pages() in the error path.
>
> Fixes: commit xxxxxxxxxxxx ("RDMA/umem: minor bug fix in error handling path")
> Suggested-by: Artemy Kovalyov <artemyko@mellanox.com>
>
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: linux-rdma@vger.kernel.org
> Cc: linux-mm@kvack.org
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
> drivers/infiniband/core/umem_odp.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
Applied to for-next, thanks
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-06 18:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 2:00 [PATCH] RDMA/umem: updated bug fix in error handling path john.hubbard
2019-03-06 18:45 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).