[PATCH OLK-6.6 0/1] drm: fix free illegal pointer when create drm_property_blob failed

we get (Unable to handle kernel NULL pointer dereference at virtual address 000000000000000c) when call drm_property_blob_put(). After analysis, we get the following process: alloc failed: drm_atomic_set_mode_for_crtc() drm_property_create_blob() // failed state->mode_blob = ERR_PTR(-ENOMEM) free illegal pointer: __drm_atomic_helper_crtc_destroy_state() drm_property_blob_put(state->mode_blob) drm_mode_object_put(&blob->base); // here blob is ERR_PTR(-ENOMEM) So do we have to determine if blob is an error code before calling drm_mode_object_put(). Fixes: 6bcacf51d050 (drm: Add reference counting to blob properties) drivers/gpu/drm/drm_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.33.0

euler inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8RJA9?from=project-issue CVE: NA --------------------------- we get (Unable to handle kernel NULL pointer dereference at virtual address 000000000000000c) when call drm_property_blob_put(). After analysis, we get the following process: alloc failed: drm_atomic_set_mode_for_crtc() drm_property_create_blob() // failed state->mode_blob = ERR_PTR(-ENOMEM) free illegal pointer: __drm_atomic_helper_crtc_destroy_state() drm_property_blob_put(state->mode_blob) drm_mode_object_put(&blob->base); // here blob is ERR_PTR(-ENOMEM) So do we have to determine if blob is an error code before calling drm_mode_object_put(). Fixes: 6bcacf51d050 (drm: Add reference counting to blob properties) Signed-off-by: zhangnaichuan <zhangnaichuan@huawei.com> Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> --- drivers/gpu/drm/drm_property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index dfec47983..4d1d04736 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -599,7 +599,7 @@ EXPORT_SYMBOL(drm_property_create_blob); */ void drm_property_blob_put(struct drm_property_blob *blob) { - if (!blob) + if (IS_ERR_OR_NULL(blob)) return; drm_mode_object_put(&blob->base); -- 2.33.0

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/3631 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/5... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/3631 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/5...
participants (2)
-
patchwork bot
-
zhangnaichuan