diff options
| author | Lorenzo Stoakes <ljs@kernel.org> | 2026-05-22 17:00:11 +0100 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-05-28 21:31:22 -0700 |
| commit | 7bf8b6eee04cd282aa84e81e3328a88593bbcad2 (patch) | |
| tree | cd0798ac7255754bd6746e31a61a83bc9c5345de /tools | |
| parent | f9c8525ca8fe76a4659da57b0dc43fa2f7f3f7b0 (diff) | |
| download | linux-next-history-7bf8b6eee04cd282aa84e81e3328a88593bbcad2.tar.gz | |
mm/vma: eliminate mmap_action->error_hook, introduce error_filter
Rather than providing a hook, simplify things by providing the ability to
filter 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_filter instead.
Link: https://lore.kernel.org/e770b28427937057fa953ac380a134b24acd8bb4.1779462249.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes <ljs@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David Hildenbrand <david@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jann Horn <jannh@google.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/vma/include/dup.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h index fddfd1b57c090..bcd569a720879 100644 --- a/tools/testing/vma/include/dup.h +++ b/tools/testing/vma/include/dup.h @@ -483,13 +483,10 @@ struct mmap_action { enum mmap_action_type type; /* - * If specified, this hook is invoked when an error occurred when - * attempting the selection action. - * - * The hook can return an error code in order to filter the error, but - * it is not valid to clear the error here. + * If non-zero, filter errors that arise from mmap actions such that we + * return error_filter instead. Only valid error codes may be specified. */ - int (*error_hook)(int err); + int error_filter; /* * This should be set in rare instances where the operation required |
