Patch "drm/i915: fix race condition UAF in i915_perf_add_config_ioctl" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/i915: fix race condition UAF in i915_perf_add_config_ioctl

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-i915-fix-race-condition-uaf-in-i915_perf_add_con.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d3952f0b04ad7e4f3ced5823fbe33d86e46ae2b8
Author: Min Li <lm0963hack@xxxxxxxxx>
Date:   Tue Mar 28 17:36:27 2023 +0800

    drm/i915: fix race condition UAF in i915_perf_add_config_ioctl
    
    [ Upstream commit dc30c011469165d57af9adac5baff7d767d20e5c ]
    
    Userspace can guess the id value and try to race oa_config object creation
    with config remove, resulting in a use-after-free if we dereference the
    object after unlocking the metrics_lock.  For that reason, unlocking the
    metrics_lock must be done after we are done dereferencing the object.
    
    Signed-off-by: Min Li <lm0963hack@xxxxxxxxx>
    Fixes: f89823c21224 ("drm/i915/perf: Implement I915_PERF_ADD/REMOVE_CONFIG interface")
    Cc: <stable@xxxxxxxxxxxxxxx> # v4.14+
    Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx>
    Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@xxxxxxxxx>
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230328093627.5067-1-lm0963hack@xxxxxxxxx
    [tursulin: Manually added stable tag.]
    (cherry picked from commit 49f6f6483b652108bcb73accd0204a464b922395)
    Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 4b57cc10bd68e..774d45142091b 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -4220,13 +4220,13 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
 		err = oa_config->id;
 		goto sysfs_err;
 	}
-
-	mutex_unlock(&perf->metrics_lock);
+	id = oa_config->id;
 
 	drm_dbg(&perf->i915->drm,
 		"Added config %s id=%i\n", oa_config->uuid, oa_config->id);
+	mutex_unlock(&perf->metrics_lock);
 
-	return oa_config->id;
+	return id;
 
 sysfs_err:
 	mutex_unlock(&perf->metrics_lock);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux