]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/xe/userptr: properly setup pfn_flags_mask
authorMatthew Auld <matthew.auld@intel.com>
Wed, 26 Feb 2025 17:47:49 +0000 (17:47 +0000)
committerMatthew Auld <matthew.auld@intel.com>
Thu, 27 Feb 2025 08:18:01 +0000 (08:18 +0000)
commitdd8c01e42f4c5c1eaf02f003d7d588ba6706aa71
treec48183369ee98812aff7972c7ef17c890ae32174
parent18778b5fdd018baa6eb492166d04605b39030e1d
drm/xe/userptr: properly setup pfn_flags_mask

Currently we just leave it uninitialised, which at first looks harmless,
however we also don't zero out the pfn array, and with pfn_flags_mask
the idea is to be able set individual flags for a given range of pfn or
completely ignore them, outside of default_flags. So here we end up with
pfn[i] & pfn_flags_mask, and if both are uninitialised we might get back
an unexpected flags value, like asking for read only with default_flags,
but getting back write on top, leading to potentially bogus behaviour.

To fix this ensure we zero the pfn_flags_mask, such that hmm only
considers the default_flags and not also the initial pfn[i] value.

v2 (Thomas):
 - Prefer proper initializer.

Fixes: 81e058a3e7fd ("drm/xe: Introduce helper to populate userptr")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@intel.com>
Cc: <stable@vger.kernel.org> # v6.10+
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250226174748.294285-2-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_hmm.c