drm/client: fix null pointer dereference in drm_client_modeset_probe
Subsystems (3)
PATCH RESEND v2 1/1 drm/client: fix null pointer dereference in drm_client_modeset_probe
In drm_client_modeset_probe(), the return value of drm_mode_duplicate() is assigned to modeset->mode, which will lead to a possible NULL pointer dereference on failure of drm_mode_duplicate(). Add a check to avoid npd.
---
Changes in v2:
- added the recipient's email address, due to the prolonged absence of a response from the recipients.
- added Cc stable.
--- drivers/gpu/drm/drm_client_modeset.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_client_modeset.c +3 -0
@@ -880,6 +880,9 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,kfree (modeset->mode); modeset->mode =drm_mode_duplicate (dev, mode); +if (!modeset->mode) +continue ; +drm_connector_get (connector); modeset->connectors[modeset->num_connectors++] = connector; modeset->x = offset->x;
Signature · 1 line
2.25.1
Quoted 21 lines · Ma Ke
In
drm_client_modeset_probe(), the return value ofdrm_mode_duplicate()is assigned tomodeset->mode, which will lead to a possible NULL pointer dereference on failure ofdrm_mode_duplicate(). Add a check to avoid npd.Fixes cf13909aee05 ("drm/fb-helper: Move out modeset config code")Signed-off-by Ma Ke <[email protected]>---
Changes in v2:
- added the recipient's email address, due to the prolonged absence of a response from the recipients.
- added Cc stable.--- drivers/gpu/drm/drm_client_modeset.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/drm_client_modeset.c +0
-0
drivers/gpu/drm/drm_client_modeset.c int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, · line 885
Quoted 6 lines
drivers/gpu/drm/drm_client_modeset.c +3
-0@@ -880,6 +880,9 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,kfree (modeset->mode); modeset->mode =drm_mode_duplicate (dev, mode); +if (!modeset->mode) +continue ; +
Why would you continue in this case?
BR,
Jani.
Quoted 3 lines
drivers/gpu/drm/drm_client_modeset.c +0
-0drm_connector_get (connector); modeset->connectors[modeset->num_connectors++] = connector; modeset->x = offset->x;
Signature · 1 line
Jani Nikula, Intel