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 733F4199939; Tue, 30 Sep 2025 14:58:03 +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=1759244283; cv=none; b=EJZpa380NUtgDpoR7f3YGN/2LVyPGzLarNKZallsbsJBCW7AwrNjSu6jJwKSVZqdVIwdba0JdHrGkCkIXd7/+WHTTeXIVQQdXlofYkECX3ETcO5R3kxp3TGh7NGUWeV/UZFRHWbhUJyhvxncKway/dqrIDxMng5KQuVOZzpa0+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759244283; c=relaxed/simple; bh=wfPgoISDa/ppZkz83P+8lSO8zkvtu8+u+uEfcZ+PX0s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o8emBxfy0NP5WzyP0HVDWFMvtem2c6Lns1ChBpb9et0kzPfUGSGN/nnzvSPJlVpMgTYKz0QB1ItqAw0lvvqDGCTaTwep2tw85CJYL3fhArEkmTv9J8ilcrp9Xs6k+OrLr0e0K5tTALtRyJ8cU6P3I2ng28B+7PUUhYHS5am3irc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FrxAjvYi; 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="FrxAjvYi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDBC2C4CEF0; Tue, 30 Sep 2025 14:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759244283; bh=wfPgoISDa/ppZkz83P+8lSO8zkvtu8+u+uEfcZ+PX0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FrxAjvYiqAQ984kFhDLy8otXAt905v+UAcSDhMnc1OGRNoBtl5+s/fhoqYEmJNeec wSNYAfxMzuHCThcb9hISpZ2f280mNx9CStQEPXenFRaB/CBe9JWcOjhISbQkySP021 tZ/o9akWj8YXH1xxZ4d5/YxqrEATLSUQuDU5Pd4g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Heikki Krogerus , Hans de Goede , Johannes Berg , Sasha Levin Subject: [PATCH 5.10 081/122] net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer Date: Tue, 30 Sep 2025 16:46:52 +0200 Message-ID: <20250930143826.315748572@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250930143822.939301999@linuxfoundation.org> References: <20250930143822.939301999@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- net/rfkill/rfkill-gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c @@ -78,10 +78,10 @@ static int rfkill_gpio_acpi_probe(struct 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);