Re: [PATCH RFC 05/12] mm/gup: Fix follow_devmap_p[mu]d() to return even if NULL

From: Christoph Hellwig
Date: Thu Nov 23 2023 - 02:25:38 EST


On Wed, Nov 15, 2023 at 08:29:01PM -0500, Peter Xu wrote:
> This seems to be a bug not by any report but by code observations.
>
> When GUP sees a devpmd or devpud, it should return whatever value returned
> from follow_devmap_p[mu]d(). If page==NULL returned, it means a fault is
> probably required. Skipping return the NULL should allow the code to fall
> through, which can cause unexpected behavior.
>
> It was there at least before the follow page rework (080dbb618b) in 2017,
> so 6 years. Not yet digging for a Fixes, assuming it can hardly trigger
> even if the logical bug does exist.
>
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>

I'd still add a fixes tag and send if off to Linux for 6.7-rc instead
of letting it linger.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>