[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d20acea3-34fe-4c36-bfe2-323ece39db66@app.fastmail.com>
Date: Mon, 04 Dec 2023 14:35:55 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Philipp Stanner" <pstanner@...hat.com>,
"Bjorn Helgaas" <bhelgaas@...gle.com>,
"Hanjun Guo" <guohanjun@...wei.com>, "Neil Brown" <neilb@...e.de>,
"Kent Overstreet" <kent.overstreet@...il.com>,
"Jakub Kicinski" <kuba@...nel.org>,
"Niklas Schnelle" <schnelle@...ux.ibm.com>,
"Uladzislau Koshchanka" <koshchanka@...il.com>,
"John Sanpe" <sanpeqf@...il.com>,
"Dave Jiang" <dave.jiang@...el.com>,
"Masami Hiramatsu" <mhiramat@...nel.org>,
"Kees Cook" <keescook@...omium.org>,
"David Gow" <davidgow@...gle.com>,
"Herbert Xu" <herbert@...dor.apana.org.au>,
"Shuah Khan" <skhan@...uxfoundation.org>,
"wuqiang.matt" <wuqiang.matt@...edance.com>,
"Yury Norov" <yury.norov@...il.com>,
"Jason Baron" <jbaron@...mai.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Ben Dooks" <ben.dooks@...ethink.co.uk>,
"Danilo Krummrich" <dakr@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>, stable@...r.kernel.org,
"Arnd Bergmann" <arnd@...nel.org>
Subject: Re: [PATCH v3 1/5] lib/pci_iomap.c: fix cleanup bugs in pci_iounmap()
On Mon, Dec 4, 2023, at 13:38, Philipp Stanner wrote:
> pci_iounmap() in lib/pci_iomap.c is supposed to check whether an address
> is within ioport-range IF the config specifies that ioports exist. If
> so, the port should be unmapped with ioport_unmap(). If not, it's a
> generic MMIO address that has to be passed to iounmap().
>
> The bugs are:
> 1. ioport_unmap() is missing entirely, so this function will never
> actually unmap a port.
> 2. the #ifdef for the ioport-ranges accidentally also guards
> iounmap(), potentially compiling an empty function. This would
> cause the mapping to be leaked.
>
> Implement the missing call to ioport_unmap().
>
> Move the guard so that iounmap() will always be part of the function.
>
> CC: <stable@...r.kernel.org> # v5.15+
> Fixes: 316e8d79a095 ("pci_iounmap'2: Electric Boogaloo: try to make
> sense of it all")
> Reported-by: Danilo Krummrich <dakr@...hat.com>
> Suggested-by: Arnd Bergmann <arnd@...nel.org>
> Signed-off-by: Philipp Stanner <pstanner@...hat.com>
> ---
> In case someone wants to look into that and provide patches for kernels
> older than v5.15:
> Note that this patch only applies to v5.15+ – the leaks, however, are
> older. I went through the log briefly and it seems f5810e5c32923 already
> contains them in asm-generic/io.h.
Reviewed-by: Arnd Bergmann <arnd@...db.de>
Powered by blists - more mailing lists