]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
RDMA/hfi1: Fix use-after-free bug for mm struct
authorDouglas Miller <doug.miller@cornelisnetworks.com>
Fri, 8 Apr 2022 13:35:23 +0000 (09:35 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:59:47 +0000 (11:59 +0200)
commit149c6bb5b0c87631eb93940b19ec703c0e0fff22
treebd2ee1cfdfd9c709f8b21b071a2c9ec47cdff7bb
parent9f5e4e313ab1162309d85022c92499fe45e74de6
RDMA/hfi1: Fix use-after-free bug for mm struct

BugLink: https://bugs.launchpad.net/bugs/1969107
commit 2bbac98d0930e8161b1957dc0ec99de39ade1b3c upstream.

Under certain conditions, such as MPI_Abort, the hfi1 cleanup code may
represent the last reference held on the task mm.
hfi1_mmu_rb_unregister() then drops the last reference and the mm is freed
before the final use in hfi1_release_user_pages().  A new task may
allocate the mm structure while it is still being used, resulting in
problems. One manifestation is corruption of the mmap_sem counter leading
to a hang in down_write().  Another is corruption of an mm struct that is
in use by another task.

Fixes: 3d2a9d642512 ("IB/hfi1: Ensure correct mm is used at all times")
Link: https://lore.kernel.org/r/20220408133523.122165.72975.stgit@awfm-01.cornelisnetworks.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Douglas Miller <doug.miller@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9ca11bd8222a612de0d2f54d050bfcf61ae2883f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/infiniband/hw/hfi1/mmu_rb.c