drm/msm/dsi: add protection against NULL dsi device
PATCH 1/1 drm/msm/dsi: add protection against NULL dsi device
When panel probe happens after DSI probe, the DSI probe is deferred as per current design. In the probe defer path dsi device is destroyed. This NULL dsi device could be deferenced by the panel probe in the mipi_dsi_attach path.
Check for NULL dsi device before accessing it.
--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/dsi_manager.c +1 -1
@@ -769,7 +769,7 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)void msm_dsi_manager_attach_dsi_device (int id,u32 device_flags) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -struct drm_device *dev = msm_dsi->dev; +struct drm_device *dev = msm_dsi ? msm_dsi->dev :NULL ;struct msm_drm_private *priv;struct msm_kms *kms;struct drm_encoder *encoder;
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sean Paul
reviewerQuoted 6 lines · Abhinav Kumar
When panel probe happens after DSI probe, the DSI probe is deferred as per current design. In the probe defer path dsi device is destroyed. This NULL dsi device could be deferenced by the panel probe in the
mipi_dsi_attachpath.Check for NULL dsi device before accessing it.
It would be really nice to sort all of this out in a manner that's not sprinkling NULL checks around the driver. I spent 5 minutes looking around and couldn't really make sense of how all of these pieces interact, but this seems like it might be an architectural problem (perhaps since dpu was using its own panel stuff instead of drm_panel?).
Anyways, it'd be nice to fix that.
In the meantime, could you please add a big comment like the !dev check in this function explaining how this situation can come to pass? That way the knowledge isn't lost and whoever comes along to clean up all of these probe checks will have some clue as to what's going on.
Sean
Quoted 25 lines
Reported-by Jeffrey Hugo <[email protected]>Tested-by Jeffrey Hugo <[email protected]>Signed-off-by Abhinav Kumar <[email protected]>--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-1@@ -769,7 +769,7 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)void msm_dsi_manager_attach_dsi_device (int id,u32 device_flags) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -struct drm_device *dev = msm_dsi->dev; +struct drm_device *dev = msm_dsi ? msm_dsi->dev :NULL ;struct msm_drm_private *priv;struct msm_kms *kms;struct drm_encoder *encoder;Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 14 lines · Sean Paul
Quoted 6 lines · Abhinav Kumar
When panel probe happens after DSI probe, the DSI probe is deferred as per current design. In the probe defer path dsi device is destroyed. This NULL dsi device could be deferenced by the panel probe in the
mipi_dsi_attachpath.Check for NULL dsi device before accessing it.
It would be really nice to sort all of this out in a manner that's not sprinkling NULL checks around the driver. I spent 5 minutes looking around and couldn't really make sense of how all of these pieces interact, but this seems like it might be an architectural problem (perhaps since dpu was using its own panel stuff instead of
drm_panel?).
Quoted 8 lines
Anyways, it'd be nice to fix that.
In the meantime, could you please add a big comment like the !dev check in this function explaining how this situation can come to pass? That way the knowledge isn't lost and whoever comes along to clean up all of these probe checks will have some clue as to what's going on.
Sean
[Abhinav] Sure Sean, will add a detailed comment to explain the scenario
Quoted 19 lines
Quoted 19 lines
Reported-by Jeffrey Hugo <[email protected]>Tested-by Jeffrey Hugo <[email protected]>Signed-off-by Abhinav Kumar <[email protected]>--- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/dsi/dsi_manager.c +0
-1@@ -769,7 +769,7 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)void msm_dsi_manager_attach_dsi_device (int id,u32 device_flags) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -struct drm_device *dev = msm_dsi->dev;
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-0+struct drm_device *dev = msm_dsi ? msm_dsi->dev :NULL ;struct msm_drm_private *priv;struct msm_kms *kms;struct
drm_encoder*encoder;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 17 lines · Abhinav Kumar
Quoted 16 lines · Sean Paul
Quoted 6 lines · Abhinav Kumar
When panel probe happens after DSI probe, the DSI probe is deferred as per current design. In the probe defer path dsi device is destroyed. This NULL dsi device could be deferenced by the panel probe in the
mipi_dsi_attachpath.Check for NULL dsi device before accessing it.
It would be really nice to sort all of this out in a manner that's not sprinkling NULL checks around the driver. I spent 5 minutes looking around and couldn't really make sense of how all of these pieces interact, but this seems like it might be an architectural problem (perhaps since dpu was using its own panel stuff instead of
drm_panel?).Anyways, it'd be nice to fix that.
Quoted 7 lines
Quoted 6 lines
In the meantime, could you please add a big comment like the !dev check in this function explaining how this situation can come to pass? That way the knowledge isn't lost and whoever comes along to clean up all of these probe checks will have some clue as to what's going on.
Sean
[Abhinav] Sure Sean, will add a detailed comment to explain the scenario
Abhinav, it looks like this may have dropped off your radar. Do you know when you'll come back to it?
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Reported-by Jeffrey Hugo <[email protected]>Tested-by Jeffrey Hugo <[email protected]>Signed-off-by Abhinav Kumar <[email protected]>---
drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-1@@ -769,7 +769,7 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len) void msm_dsi_manager_attach_dsi_device(int id, u32 device_flags) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - struct drm_device *dev = msm_dsi->dev; + struct drm_device *dev = msm_dsi ? msm_dsi->dev : NULL; struct msm_drm_private *priv; struct msm_kms *kms;struct
drm_encoder*encoder;Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Signature · 8 lines
Jeffrey Hugo Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 23 lines · Jeffrey Hugo
Quoted 22 lines · Abhinav Kumar
Quoted 21 lines · Sean Paul
Quoted 6 lines · Abhinav Kumar
When panel probe happens after DSI probe, the DSI probe is deferred as per current design. In the probe defer path dsi device is destroyed. This NULL dsi device could be deferenced by the panel probe in the
mipi_dsi_attachpath.Check for NULL dsi device before accessing it.
It would be really nice to sort all of this out in a manner that's not sprinkling NULL checks around the driver. I spent 5 minutes looking around and couldn't really make sense of how all of these pieces interact, but this seems like it might be an architectural problem (perhaps since dpu was using its own panel stuff instead of
drm_panel?).Anyways, it'd be nice to fix that.
In the meantime, could you please add a big comment like the !dev check in this function explaining how this situation can come to pass? That way the knowledge isn't lost and whoever comes along to clean up all of these probe checks will have some clue as to what's going on.
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Sean
[Abhinav] Sure Sean, will add a detailed comment to explain the scenario
Abhinav, it looks like this may have dropped off your radar. Do you know when you'll come back to it?
Hi Jeff, Yes i will upload a v2 with a detailed comment as sean requested within this week.
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Reported-by Jeffrey Hugo <[email protected]>Tested-by Jeffrey Hugo <[email protected]>Signed-off-by Abhinav Kumar <[email protected]>---
drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/dsi/dsi_manager.c +0
-1@@ -769,7 +769,7 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len) void msm_dsi_manager_attach_dsi_device(int id, u32 device_flags) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - struct drm_device *dev = msm_dsi->dev;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/msm/dsi/dsi_manager.c +1
-0+ struct drm_device *dev = msm_dsi ? msm_dsi->dev : NULL; struct msm_drm_private *priv; struct msm_kms *kms;struct
drm_encoder*encoder;
-- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel