Commit e54b000
committed
drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req()
While receiving an MST up request message from one thread in
drm_dp_mst_handle_up_req(), the MST topology could be removed from
another thread via drm_dp_mst_topology_mgr_set_mst(false), freeing
mst_primary and setting drm_dp_mst_topology_mgr::mst_primary to NULL.
This could lead to a NULL deref/use-after-free of mst_primary in
drm_dp_mst_handle_up_req().
Avoid the above by holding a reference for mst_primary in
drm_dp_mst_handle_up_req() while it's used.
v2: Fix kfreeing the request if getting an mst_primary reference fails.
Cc: Lyude Paul <lyude@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com> (v1)
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241204132007.3132494-1-imre.deak@intel.com1 parent 3f61185 commit e54b000
1 file changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4109 | 4109 | | |
4110 | 4110 | | |
4111 | 4111 | | |
| 4112 | + | |
4112 | 4113 | | |
4113 | 4114 | | |
4114 | | - | |
| 4115 | + | |
4115 | 4116 | | |
4116 | 4117 | | |
4117 | 4118 | | |
| |||
4129 | 4130 | | |
4130 | 4131 | | |
4131 | 4132 | | |
4132 | | - | |
| 4133 | + | |
| 4134 | + | |
| 4135 | + | |
| 4136 | + | |
| 4137 | + | |
| 4138 | + | |
| 4139 | + | |
| 4140 | + | |
| 4141 | + | |
4133 | 4142 | | |
| 4143 | + | |
4134 | 4144 | | |
4135 | | - | |
| 4145 | + | |
4136 | 4146 | | |
4137 | 4147 | | |
4138 | 4148 | | |
| |||
4149 | 4159 | | |
4150 | 4160 | | |
4151 | 4161 | | |
4152 | | - | |
| 4162 | + | |
4153 | 4163 | | |
4154 | 4164 | | |
4155 | 4165 | | |
4156 | 4166 | | |
4157 | 4167 | | |
4158 | | - | |
| 4168 | + | |
4159 | 4169 | | |
4160 | 4170 | | |
4161 | 4171 | | |
| |||
4172 | 4182 | | |
4173 | 4183 | | |
4174 | 4184 | | |
4175 | | - | |
| 4185 | + | |
| 4186 | + | |
| 4187 | + | |
4176 | 4188 | | |
4177 | 4189 | | |
4178 | 4190 | | |
| |||
0 commit comments