[lvc-project] [PATCH] drm/gma500: Fix null dereference in hdmi teardown

Zabelin Nikita n.zabelin at mt-integration.ru
Thu Sep 18 18:06:59 MSK 2025


pci_set_drvdata sets the value of pdev->driver_data to NULL,
after which the driver_data obtained from the same dev is 
dereferenced in oaktrail_hdmi_i2c_exit, and the i2c_dev is 
extracted from it. To prevent this, swap these calls.

Fixes: 1b082cc ("gma500: Add Oaktrail support")

Found by Linux Verification Center (linuxtesting.org) with Svacer.

Signed-off-by: Zabelin Nikita <n.zabelin at mt-integration.ru>
---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 95b7cb099e63..9c7d9584aac7 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -724,8 +724,8 @@ void oaktrail_hdmi_teardown(struct drm_device *dev)
 
 	if (hdmi_dev) {
 		pdev = hdmi_dev->dev;
-		pci_set_drvdata(pdev, NULL);
 		oaktrail_hdmi_i2c_exit(pdev);
+		pci_set_drvdata(pdev, NULL);
 		iounmap(hdmi_dev->regs);
 		kfree(hdmi_dev);
 		pci_dev_put(pdev);
-- 
2.43.0




More information about the lvc-project mailing list