From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23DC129827E; Tue, 30 Sep 2025 15:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759245525; cv=none; b=J2U3CbZYIUv5VH3XYU5Qm6gqg8nfm0czsULMt+YhA6NTzYxRcYzRboL4YwfWS5kOi+B0tyEC+502338+cLd6Dpl7Ckz/U1sYM57gHe/UUuRzs8F5v7kilg8zsk39PyH5GbeuHu0EHYg6yB0/IFt1gOrSTxhBph0TMxYMQIoorsI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759245525; c=relaxed/simple; bh=cbKe0aW4diWOXRj4nRKZhfustMY1uIz9+iFCEkOEg6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lQqwC9rrdflWPqgROjxkvLx0uU1fcpbFxXOQLumAT7OapgEAdbe2d/4Z+BkxgA1esgNLaVfGtMbqLmbSGLwTgqrYtqKC+gtGdOV81RI46AD6daJhsR4amCA11wKI0ZsTD0VszbZks0SMNg2GicxdGwdjQw8frI8oGQCNNggFq+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2aczaLcD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2aczaLcD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 566A1C4CEF0; Tue, 30 Sep 2025 15:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759245524; bh=cbKe0aW4diWOXRj4nRKZhfustMY1uIz9+iFCEkOEg6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2aczaLcDT60/xz9OLzyfugSDIaclFITGayCVVFCBQKLoo9KuM/Oh4Us8aqlePR9LJ Qzbqse45NnXquBWLeePS2Lr42HCvw1qPLtQZayr8ennN79BL8w/rWdlPLbfkgmUKHX WCGFs/4C8NkdKpWm/CgXVOgwREdvB3EIn+OgHH/k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zabelin Nikita , Patrik Jakobsson , Sasha Levin Subject: [PATCH 6.1 44/73] drm/gma500: Fix null dereference in hdmi teardown Date: Tue, 30 Sep 2025 16:47:48 +0200 Message-ID: <20250930143822.431915598@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143820.537407601@linuxfoundation.org> References: <20250930143820.537407601@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zabelin Nikita [ 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 Signed-off-by: Patrik Jakobsson Link: https://lore.kernel.org/r/20250918150703.2562604-1-n.zabelin@mt-integration.ru Signed-off-by: Sasha Levin --- 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 95b7cb099e638..9c7d9584aac7f 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.51.0