]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/xe/ct: prevent UAF in send_recv()
authorMatthew Auld <matthew.auld@intel.com>
Tue, 1 Oct 2024 08:43:47 +0000 (09:43 +0100)
committerLucas De Marchi <lucas.demarchi@intel.com>
Tue, 8 Oct 2024 23:06:05 +0000 (18:06 -0500)
commitdb7f92af626178ba59dbbcdd5dee9ec24a987a88
treeca8241d8b424462be8100233396c4da8501645c9
parent8cf0b93919e13d1e8d4466eb4080a4c4d9d66d7b
drm/xe/ct: prevent UAF in send_recv()

Ensure we serialize with completion side to prevent UAF with fence going
out of scope on the stack, since we have no clue if it will fire after
the timeout before we can erase from the xa. Also we have some dependent
loads and stores for which we need the correct ordering, and we lack the
needed barriers. Fix this by grabbing the ct->lock after the wait, which
is also held by the completion side.

v2 (Badal):
 - Also print done after acquiring the lock and seeing timeout.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241001084346.98516-5-matthew.auld@intel.com
(cherry picked from commit 52789ce35c55ccd30c4b67b9cc5b2af55e0122ea)
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_guc_ct.c