[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y14xpf9r.fsf@nvdebian.thelocal>
Date: Fri, 16 Aug 2024 08:55:02 +1000
From: Alistair Popple <apopple@...dia.com>
To: Max Ramanouski <max8rr8@...il.com>
Cc: x86@...nel.org, dave.hansen@...ux.intel.com, luto@...nel.org,
peterz@...radead.org, linux-kernel@...r.kernel.org, jniethe@...dia.com,
jhubbard@...dia.com, linux-mm@...ck.org, tglx@...utronix.de,
hch@...radead.org, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v3] x86/ioremap: Use is_ioremap_addr() in iounmap()
Max Ramanouski <max8rr8@...il.com> writes:
> Restrict iounmap() to memory allocated in ioremap region, by using
> is_ioremap_addr(). Similarly to the generic iounmap() implementation.
>
> Additionally, add warning in case there is an attempt to iounmap()
> invalid memory, instead of silently exiting, thus helping to
> avoid incorrect usage of iounmap().
Looks good, thanks. Feel free to add:
Reviewed-by: Alistair Popple <apopple@...dia.com>
> Reviewed-by: Christoph Hellwig <hch@....de>
> Signed-off-by: Max Ramanouski <max8rr8@...il.com>
> ---
> arch/x86/mm/ioremap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index aa7d279321ea..70b02fc61d93 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -11,6 +11,7 @@
> #include <linux/init.h>
> #include <linux/io.h>
> #include <linux/ioport.h>
> +#include <linux/ioremap.h>
> #include <linux/slab.h>
> #include <linux/vmalloc.h>
> #include <linux/mmiotrace.h>
> @@ -457,7 +458,7 @@ void iounmap(volatile void __iomem *addr)
> {
> struct vm_struct *p, *o;
>
> - if ((void __force *)addr <= high_memory)
> + if (WARN_ON_ONCE(!is_ioremap_addr((void __force *)addr)))
> return;
>
> /*
Powered by blists - more mailing lists