* [PATCH 0/1] mm/gup: finish consolidating error handling
@ 2018-11-21 8:14 john.hubbard
2018-11-21 8:14 ` [PATCH] " john.hubbard
0 siblings, 1 reply; 4+ messages in thread
From: john.hubbard @ 2018-11-21 8:14 UTC (permalink / raw)
To: linux-mm, Andrew Morton; +Cc: LKML, John Hubbard
From: John Hubbard <jhubbard@nvidia.com>
Hi,
Keith Busch and Dan Williams noticed that this patch
(which was part of my RFC[1] for the get_user_pages + DMA
fix) also fixes a bug. Accordingly, I'm adjusting
the changelog and posting this as it's own patch.
[1] https://lkml.kernel.org/r/20181110085041.10071-1-jhubbard@nvidia.com
John Hubbard (1):
mm/gup: finish consolidating error handling
mm/gup.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--
2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mm/gup: finish consolidating error handling
2018-11-21 8:14 [PATCH 0/1] mm/gup: finish consolidating error handling john.hubbard
@ 2018-11-21 8:14 ` john.hubbard
2018-11-21 22:44 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: john.hubbard @ 2018-11-21 8:14 UTC (permalink / raw)
To: linux-mm, Andrew Morton
Cc: LKML, John Hubbard, Dan Williams, Kirill A . Shutemov, Dave Hansen
From: John Hubbard <jhubbard@nvidia.com>
Commit df06b37ffe5a4 ("mm/gup: cache dev_pagemap while pinning pages")
attempted to operate on each page that get_user_pages had retrieved. In
order to do that, it created a common exit point from the routine.
However, one case was missed, which this patch fixes up.
Also, there was still an unnecessary shadow declaration (with a
different type) of the "ret" variable, which this patch removes.
Fixes: df06b37ffe5a4 ("mm/gup: cache dev_pagemap while pinning pages")
Reviewed-by: Keith Busch <keith.busch@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
mm/gup.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index aa43620a3270..8cb68a50dbdf 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -702,12 +702,11 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
if (!vma || start >= vma->vm_end) {
vma = find_extend_vma(mm, start);
if (!vma && in_gate_area(mm, start)) {
- int ret;
ret = get_gate_page(mm, start & PAGE_MASK,
gup_flags, &vma,
pages ? &pages[i] : NULL);
if (ret)
- return i ? : ret;
+ goto out;
ctx.page_mask = 0;
goto next_page;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/gup: finish consolidating error handling
2018-11-21 8:14 ` [PATCH] " john.hubbard
@ 2018-11-21 22:44 ` Andrew Morton
2018-11-22 7:48 ` John Hubbard
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2018-11-21 22:44 UTC (permalink / raw)
To: john.hubbard
Cc: linux-mm, LKML, John Hubbard, Dan Williams, Kirill A . Shutemov,
Dave Hansen
On Wed, 21 Nov 2018 00:14:02 -0800 john.hubbard@gmail.com wrote:
> Commit df06b37ffe5a4 ("mm/gup: cache dev_pagemap while pinning pages")
> attempted to operate on each page that get_user_pages had retrieved. In
> order to do that, it created a common exit point from the routine.
> However, one case was missed, which this patch fixes up.
>
> Also, there was still an unnecessary shadow declaration (with a
> different type) of the "ret" variable, which this patch removes.
>
What is the bug which this supposedly fixes and what is that bug's
user-visible impact?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/gup: finish consolidating error handling
2018-11-21 22:44 ` Andrew Morton
@ 2018-11-22 7:48 ` John Hubbard
0 siblings, 0 replies; 4+ messages in thread
From: John Hubbard @ 2018-11-22 7:48 UTC (permalink / raw)
To: Andrew Morton, john.hubbard
Cc: linux-mm, LKML, Dan Williams, Kirill A . Shutemov, Dave Hansen
On 11/21/18 2:44 PM, Andrew Morton wrote:
> On Wed, 21 Nov 2018 00:14:02 -0800 john.hubbard@gmail.com wrote:
>
>> Commit df06b37ffe5a4 ("mm/gup: cache dev_pagemap while pinning pages")
>> attempted to operate on each page that get_user_pages had retrieved. In
>> order to do that, it created a common exit point from the routine.
>> However, one case was missed, which this patch fixes up.
>>
>> Also, there was still an unnecessary shadow declaration (with a
>> different type) of the "ret" variable, which this patch removes.
>>
>
> What is the bug which this supposedly fixes and what is that bug's
> user-visible impact?
>
Keith's description of the situation is:
This also fixes a potentially leaked dev_pagemap reference count if a
failure occurs when an iteration crosses a vma boundary. I don't think
it's normal to have different vma's on a users mapped zone device memory,
but good to fix anyway.
I actually thought that this code:
/* first iteration or cross vma bound */
if (!vma || start >= vma->vm_end) {
vma = find_extend_vma(mm, start);
if (!vma && in_gate_area(mm, start)) {
ret = get_gate_page(mm, start & PAGE_MASK,
gup_flags, &vma,
pages ? &pages[i] : NULL);
if (ret)
goto out;
...dealt with the "you're trying to pin the gate page, as part of this call",
rather than the generic case of crossing a vma boundary. (I think there's a fine
point that I must be overlooking.) But it's still a valid case, either way.
--
thanks,
John Hubbard
NVIDIA
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-22 7:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 8:14 [PATCH 0/1] mm/gup: finish consolidating error handling john.hubbard
2018-11-21 8:14 ` [PATCH] " john.hubbard
2018-11-21 22:44 ` Andrew Morton
2018-11-22 7:48 ` John Hubbard
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).