Re: [PATCH v3 3/3] mm/vma: eliminate mmap_action->error_hook, introduce error_override

From: Oscar Salvador (SUSE)

Date: Thu Jun 11 2026 - 04:02:06 EST


On Tue, Jun 02, 2026 at 12:06:27PM +0100, Lorenzo Stoakes wrote:
> Rather than providing a hook, simplify things by providing the ability to
> override mmap action errors. This allows us to more carefully validate the
> value provided and thus ensure only a valid error code is specified, and
> simplifies the interface.
>
> This way, we eliminate all hooks but mmap_prepare and allow only mmap
> actions to be specified (which core mm controls).
>
> This significantly improves robustness and eliminates any unnecessary code
> duplication in driver mmap hooks.
>
> We also update the /dev/mem logic (the only user) to use
> mmap_action->error_override instead.
>
> Signed-off-by: Lorenzo Stoakes <ljs@xxxxxxxxxx>

Reviewed-by: Oscar Salvador (SUSE) <osalvador@xxxxxxxxxx>



--
Oscar Salvador
SUSE Labs