From e8c4aa25c55c024354e73d03aa48144d0c57b0eb Mon Sep 17 00:00:00 2001 From: Rajeev Nandan Date: Thu, 9 May 2024 01:21:04 +0530 Subject: [PATCH] disp: msm: dsi: fix bl->raw_bd NULL pointer dereference In trusted vm, a stub function is used for the panel_ops.bl_register, hence the backlight_device bl->raw_bd used for WLED backlight type remains uninitialized. If the panel backlight is WLED, this can cause a NULL pointer dereference in TVM during dsi_panel_bl_handoff(). Add a check before dereferencing bl->raw_bd. Change-Id: Ieb40781263b4318313fd29b339122ae6c59b1590 Signed-off-by: Rajeev Nandan --- msm/dsi/dsi_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index ea91d02bdd..0dea3cdde5 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -670,7 +670,7 @@ static u32 dsi_panel_get_brightness(struct dsi_backlight_config *bl) switch (bl->type) { case DSI_BACKLIGHT_WLED: /* Try to query the backlight level from the backlight device */ - if (bd->ops && bd->ops->get_brightness) + if (bd && bd->ops && bd->ops->get_brightness) cur_bl_level = bd->ops->get_brightness(bd); break; case DSI_BACKLIGHT_DCS: