]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/gma500: Fix null dereference in hdmi teardown
authorZabelin Nikita <n.zabelin@mt-integration.ru>
Thu, 18 Sep 2025 15:06:59 +0000 (18:06 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 Oct 2025 11:35:46 +0000 (13:35 +0200)
[ Upstream commit 352e66900cde63f3dadb142364d3c35170bbaaff ]

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.

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

Fixes: 1b082ccf5901 ("gma500: Add Oaktrail support")
Signed-off-by: Zabelin Nikita <n.zabelin@mt-integration.ru>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://lore.kernel.org/r/20250918150703.2562604-1-n.zabelin@mt-integration.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/gma500/oaktrail_hdmi.c

index a097a59a9eaec1929487f7661f7d4843b2f06d21..08e83b7513197778346cd7c30fbfa35a04fa328e 100644 (file)
@@ -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);