Re: [PATCH] fs/proc/task_mmu: pin mm_users in do_pagemap_scan()
From: Lorenzo Stoakes (ARM)
Date: Mon Oct 26 2026 - 09:45:09 EST
On Sun, Oct 25, 2026 at 11:55:59AM +0100, David Hildenbrand (Arm) wrote:
> On 10/20/26 02:46, Andrew Morton wrote:
> > All looks good and checks out for me, thanks.
> >
> > Except...
> >
> >> --- a/fs/proc/task_mmu.c
> >> +++ b/fs/proc/task_mmu.c
> >> @@ -3231,15 +3231,18 @@ static long do_pagemap_scan(struct mm_struct *mm, unsigned long uarg)
> >> size_t n_ranges_out = 0;
> >> int ret;
> >>
> >> + if (!mm || !mmget_not_zero(mm))
> >> + return -ESRCH;
> >
> > Why the new test for !mm? The current call chain guarantees this is a
> > cant-happen and the current do_pagemap_scan will cheerfully oops if
> > mm==NULL.
>
> I'd just keep it for consistency with all the other checks in this file?
Agreed.
--
Cheers, Lorenzo