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 55D5D1DF25E; Wed, 19 Feb 2025 09:20:00 +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=1739956800; cv=none; b=ZcsZ7lBz1Up2jkDiy/2dLMJidT15W6+gmsX0I1+mTSe3roYOVtvPVi9f+xdopGEKtbClC5TJBxdHfe2uR99KkJA/g7jcUzR3qvVndrevl0MKQ1zwwnv//E8BEZbJg8sg1NX/uQk/rSguUoCk+zkM9xT7LxIXw6gUEUyNCLQ7p1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739956800; c=relaxed/simple; bh=ioTScVTQyJbInDqynY2WE85SUrSf1qPJ8z7ZyvJhfNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Vw3JwHRcHrsoBI1xbkh5AEfi3Uiykl8xIbqp/X7S0MmOoUbAR7+NiM+t6JxlnqdoZdT8AQiz7GE/vOwxFgUN/ABh+hZsAJDJkHSK7ExfXCIwgMW9RJ41PZ1DjyE8Zl+iiK74gbJJ6ujSlI68oAIVW5CnXRWMg4PFnrfIHAlXKhU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=b3k/tpTM; 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="b3k/tpTM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0758C4CEE7; Wed, 19 Feb 2025 09:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739956800; bh=ioTScVTQyJbInDqynY2WE85SUrSf1qPJ8z7ZyvJhfNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3k/tpTMS8QUmjdkxnI/Ds93yfaSwjyvRkeqJa0asSdWkCcErh3mPRPO3uQh1cFfw rNp/zfclpuyYfm/Yy8ZNsoob0qAoggwTEY3lBBjQYAxgN/XQgHyE3Lz5dNC4bO0QxB zhyU+Mf+G540ADEVIqS97Wf2sGOgdPX7OaICzzCo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 6.1 304/578] platform/x86: int3472: Check for adev == NULL Date: Wed, 19 Feb 2025 09:25:08 +0100 Message-ID: <20250219082704.975669878@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250219082652.891560343@linuxfoundation.org> References: <20250219082652.891560343@linuxfoundation.org> User-Agent: quilt/0.68 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede [ Upstream commit cd2fd6eab480dfc247b737cf7a3d6b009c4d0f1c ] Not all devices have an ACPI companion fwnode, so adev might be NULL. This can e.g. (theoretically) happen when a user manually binds one of the int3472 drivers to another i2c/platform device through sysfs. Add a check for adev not being set and return -ENODEV in that case to avoid a possible NULL pointer deref in skl_int3472_get_acpi_buffer(). Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20241209220522.25288-1-hdegoede@redhat.com Reviewed-by: Ilpo Järvinen Signed-off-by: Ilpo Järvinen Signed-off-by: Sasha Levin --- drivers/platform/x86/intel/int3472/discrete.c | 3 +++ drivers/platform/x86/intel/int3472/tps68470.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index c42c3faa2c32d..0f16436e5804b 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -359,6 +359,9 @@ static int skl_int3472_discrete_probe(struct platform_device *pdev) struct int3472_cldb cldb; int ret; + if (!adev) + return -ENODEV; + ret = skl_int3472_fill_cldb(adev, &cldb); if (ret) { dev_err(&pdev->dev, "Couldn't fill CLDB structure\n"); diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 5b8d1a9620a5d..82fb2fbc1000f 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -152,6 +152,9 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) int ret; int i; + if (!adev) + return -ENODEV; + n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata); if (n_consumers < 0) return n_consumers; -- 2.39.5