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 4C6E1146588; Thu, 13 Feb 2025 15:23:38 +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=1739460218; cv=none; b=acLsm7lf50GplRBQGTx+9QlDmxo0z+kgjlqedcg59Z6cvdDB7WUKoYj+IFanmd7YgvCeedK9SBq9DGxi3ZyqW9W86QC0gU/8ZSa9se1Ngm2ERoW6aGUU+ZicD8Ahl5ExYpxDrM0lHOpGKXb+1v+stCN9nWuEw85iMRDwN5XD+b8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739460218; c=relaxed/simple; bh=Lv3tkUTPZ3LH4IMmSX/R2LkI1xkwBYjeOkTdHLi+vc4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G8xruMCZ+PlF5T2IJT6qz+BFsf8S1BCT2xhRNQZ00/+fHkVQUAo2b4sVd2pa2N4nM80LyQXPSenwGwN1oHC4udcNm0XSGX6IhhrowfYE/ZB4deccOwArUT5i7WRQnBKyUJrppMQJ8uZ/uYFUh9E2BKtySFWR+U47JFPN2iF7TjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ttA0WZj4; 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="ttA0WZj4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D956C4CED1; Thu, 13 Feb 2025 15:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739460218; bh=Lv3tkUTPZ3LH4IMmSX/R2LkI1xkwBYjeOkTdHLi+vc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttA0WZj4RwhEn6JFLHO+y2BkWAFFQd7zinZJRC2EQ6A50GVCPHqfxfjY+vAqn3JZJ huWYwfpmj+9/HBiWUu7Si0O1OO9UCkjRvrLxap326zj1NEYpeNHzJWx9PZ/HNbrvY7 s0ULc084kQ6xRe11Pziqjh0EMRj0sUk7Frpmed68= 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.6 049/273] platform/x86: int3472: Check for adev == NULL Date: Thu, 13 Feb 2025 15:27:01 +0100 Message-ID: <20250213142409.290628048@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213142407.354217048@linuxfoundation.org> References: <20250213142407.354217048@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.6-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 e33c2d75975cf..d56f79043f5e2 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -284,6 +284,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 1e107fd49f828..81ac4c6919630 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