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 C23D12417C3 for ; Sun, 21 Sep 2025 23:30:01 +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=1758497401; cv=none; b=gN0AuW1bim41USRQv6//+oPfACOD4Q+y/SqqP41Mrar1uITBcTFPU764Lm6Sp+rfHfONbrJpo8dq1AntXO1EgES399r39BSVDKo0STrn70v0chZfk+Cj5xYdZHtjcKjPyOZLFYxC2JMEdfJJsorZGfN5PGqz8IKmYSL9hXCE7j8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758497401; c=relaxed/simple; bh=YhaGovhPIdosN3MQ5iLJkoSuNO0QTXekjkbpJykj8C8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SPYUpwMYBkTXZV6jsZow7XEbMcm/PV6QXAdtUFECI5jS0RveRyDECpZNfWGwPWzUKfvxgj9koeQ9/OgNulo1IRIPXmLUNgr91M2q5viCEMVXBx5E6a/uXE3C1Ot1EU6RCEiwGQF2+D3IaLpK9wOoqlIpsiZ4Jp1aSY3B7QnRDGA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CFSJukxw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CFSJukxw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0F43C4CEF7; Sun, 21 Sep 2025 23:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758497401; bh=YhaGovhPIdosN3MQ5iLJkoSuNO0QTXekjkbpJykj8C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CFSJukxwedxSO9xDQMHmHnkLD0+PgpPPKKBZ+NOBXoAYL0GcOUb0diVPY1YWtMXwe i2alBa5C++9ElSF1XKL3cDuWfYwtWbR6dqj6Wnd+uUNRQWrmNYjbS50HxVrVGK7Zgc zGJIf7OlsPRI9VcnEzVRDxrGUXdsW4ghSlOJsoDMmhq0lwh4FplNtznnqfFAiB1TMk 570RiTINFJDS6tdaesma4Y7lg6smmnPWY0PjDX//uJrbwY1NutfIM/nZIaDzIsd0O0 r347O9aLZwVpXJC6Tn0K5xOJ1fRsnRUxW+nNFzt5LLo26hAbdSS2PmpNk/I50jJZuO gLPUnck/49VFg== From: Sasha Levin To: stable@vger.kernel.org Cc: Hans de Goede , Heikki Krogerus , Johannes Berg , Sasha Levin Subject: [PATCH 6.1.y 2/2] net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer Date: Sun, 21 Sep 2025 19:29:58 -0400 Message-ID: <20250921232958.3084822-2-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250921232958.3084822-1-sashal@kernel.org> References: <2025092155-evacuate-condition-525e@gregkh> <20250921232958.3084822-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Hans de Goede [ Upstream commit b6f56a44e4c1014b08859dcf04ed246500e310e5 ] Since commit 7d5e9737efda ("net: rfkill: gpio: get the name and type from device property") rfkill_find_type() gets called with the possibly uninitialized "const char *type_name;" local variable. On x86 systems when rfkill-gpio binds to a "BCM4752" or "LNV4752" acpi_device, the rfkill->type is set based on the ACPI acpi_device_id: rfkill->type = (unsigned)id->driver_data; and there is no "type" property so device_property_read_string() will fail and leave type_name uninitialized, leading to a potential crash. rfkill_find_type() does accept a NULL pointer, fix the potential crash by initializing type_name to NULL. Note likely sofar this has not been caught because: 1. Not many x86 machines actually have a "BCM4752"/"LNV4752" acpi_device 2. The stack happened to contain NULL where type_name is stored Fixes: 7d5e9737efda ("net: rfkill: gpio: get the name and type from device property") Cc: stable@vger.kernel.org Cc: Heikki Krogerus Signed-off-by: Hans de Goede Reviewed-by: Heikki Krogerus Link: https://patch.msgid.link/20250913113515.21698-1-hansg@kernel.org Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/rfkill/rfkill-gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index ecfb766c47d08..1a3560cdba3e9 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -78,10 +78,10 @@ static int rfkill_gpio_acpi_probe(struct device *dev, static int rfkill_gpio_probe(struct platform_device *pdev) { struct rfkill_gpio_data *rfkill; - struct gpio_desc *gpio; + const char *type_name = NULL; const char *name_property; const char *type_property; - const char *type_name; + struct gpio_desc *gpio; int ret; rfkill = devm_kzalloc(&pdev->dev, sizeof(*rfkill), GFP_KERNEL); -- 2.51.0