]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
comedi: Flush partial mappings in error case
authorJann Horn <jannh@google.com>
Thu, 17 Oct 2024 19:07:45 +0000 (21:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:54:11 +0000 (13:54 +0100)
commitc6963a06ce5c61d3238751ada04ee1569663a828
tree86bc27323a55bb3a2c7c0c0a16475e609b643020
parent45a8f8232a495221ed058191629f5c628f21601a
comedi: Flush partial mappings in error case

commit ce8f9fb651fac95dd41f69afe54d935420b945bd upstream.

If some remap_pfn_range() calls succeeded before one failed, we still have
buffer pages mapped into the userspace page tables when we drop the buffer
reference with comedi_buf_map_put(bm). The userspace mappings are only
cleaned up later in the mmap error path.

Fix it by explicitly flushing all mappings in our VMA on the error path.

See commit 79a61cc3fc04 ("mm: avoid leaving partial pfn mappings around in
error case").

Cc: stable@vger.kernel.org
Fixes: ed9eccbe8970 ("Staging: add comedi core")
Signed-off-by: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/r/20241017-comedi-tlb-v3-1-16b82f9372ce@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/comedi/comedi_fops.c