From nobody Thu Apr 2 12:17:52 2026 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 323A1391E76 for ; Mon, 30 Mar 2026 02:27:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774837680; cv=none; b=WRj/+1rXcjlTTnDZynxpLLpGGrbGCQycftsjO4ViwTR7eWq4EDsLSxp8X+cbVJt7Khxbhnk/WK3NGMPDsfouI7TrKiYMTYQ3itoel3bxi6Qgno9rgzSoLnr+ryAhUNu5VbpmG0MnPn4/LWPfQNUa1bMgyO3q9aV+0nl+G8d4Lm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774837680; c=relaxed/simple; bh=QDf16Y7vyxJr6CaPRWRkq0hvjTb2t+Mwk/4kS11e5G8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=swiY7vkNd6Th30mf62n2d1eM1qt/qUaS4/yH73x6W1NqZOgEwDPv+glwUBnQBdXSTvmPV8UgyrZ80Sij3VyqnBr6jB0dc60HTDInbUZYG8dij4kNrhC06PzGSCOpBHl6JVcipFBVnbXqaz7Wd3D90ISRGuo6yGUo50oiB16FLnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M24Nnnng; arc=none smtp.client-ip=74.125.82.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M24Nnnng" Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-2c66eafc1easo554302eec.1 for ; Sun, 29 Mar 2026 19:27:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774837678; x=1775442478; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Gq4MIC18tzOF8Y9yYjqLKcBworY2R0LEwLR/J/vdJqc=; b=M24NnnngCdbbWFRJIAXGs9rOMgU9vpwJHy6eKIx7wetLpAmVu97WfCeBGQSj0oiOwa VRlu2L8M/6hZRgOyWxjhFPdH3LLfi5wNZjUSJU1v7mCckHdUv+cuQyg16u8ebFKavgyv 4zFRKIlsTE/BdWm3XtfnrtwyUo+KCj+00hAstxj6+OjrqOYUCw8cAudl3YNmqY2OgL14 UscTACGTOijvzFvKpPkQyVbXa8PP0COB1V1Rzi9JzloLlA1EpAw5qLxNNGtTe5b5xbEj 1ngpbViPsQRal7NbA+dJub6KUFsDN5SPM8AKCXLsEa+2gLtH4Q44In8Gm4DLh+TaXsJC eN0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774837678; x=1775442478; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Gq4MIC18tzOF8Y9yYjqLKcBworY2R0LEwLR/J/vdJqc=; b=PAlHnGUKt/gUI/xyYiVa/On4JjWEd2/PQs5v7w0VvXDzRCj8kTNL/GoFPZ/PNbMgrd gqpEFO3bJhIZbV3+cWVmgR8/9NRc/g/NB5fEDVxfBjlaNVSbJnTjER6l7R7QnZdSSARt dUbfBqva0IpUAL58sgWJxerI14eWJt5RjubcuvqP64JYPfIsKnO876AF58LTigF9bTuz HhjxyiXVhTxwb8GOLN31rb6+sYH2/JvNhg4ypHi6sbvFOxkT/kNHpUCv3hmKvAPgZk2O zpaw/Xh6wQ2A35hrGDpZwzExrksIw1edGM65NSYoU3eVPnqPe1nfOLzdS0g7lJKPtU3R YoKA== X-Gm-Message-State: AOJu0Yxa9cb1dK58cUTUkypTGFtufhB9yUAUaKrSEK/VgZlmzjSvCZVS RnHbgBsJQBBIU98TrEyXUZ4+JEFXDbZ4Fx5oDqs2EJILSgvqwKv+1O38jYq9gw== X-Gm-Gg: ATEYQzy6XF/6deSWANX5au1XGdSwZLG2rnKORpilZdaqOyzgeHyDjQpfeX1dcCUqKEE OFFEbTB9dw6h30n7cXMRcybAHumXC3c874SVux/9cZVDMOCghXtH5EM6lwVj7evrJK1eNQ+aleJ vn02mdSxZUaMKRchn4pjzDajA85DMrf/zSsVvqakiz8ozN9wsfxz9JS7xvYuRrYzXRtMnxmhcgf eNq7F51YxPJo9DICAhYTXY0IJP1fLLK5NFIMnHR+tor+0WYcDq21MKZy6uw9kEcrhcc3mHRf3eR XF+jAKf8CvAHBUBDi2zUUCMFjXD8sprF81IW0EueBy1Smcv/ss3tr1H2vXEnngabpLUY/WEV9dt 1KM73jQPtC6Ad30TDSEZHqJ3rDNkYVrBiY7CFEdOFaOEgn9bKPOvrD6gccfrWi1JXdP0c+F+gYP L7FSmVasQi8BlVjh1ErWp9gisno25V9suiOUSHV0mZRKSCgwtoDokOsziKckrlI43BO9evbr1xb kDfH5AmXrVfSqM= X-Received: by 2002:a05:7300:3b1a:b0:2c5:b23e:48a6 with SMTP id 5a478bee46e88-2c5b23e4f48mr1555198eec.23.1774837677943; Sun, 29 Mar 2026 19:27:57 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:7265:773a:8e51:c62f]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2c3c7971d97sm6250673eec.30.2026.03.29.19.27.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2026 19:27:57 -0700 (PDT) From: Dmitry Torokhov Date: Sun, 29 Mar 2026 19:27:48 -0700 Subject: [PATCH v2 1/4] x86/geode: fix on-stack property data usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260329-property-gpio-fix-v2-1-3cca5ba136d8@gmail.com> References: <20260329-property-gpio-fix-v2-0-3cca5ba136d8@gmail.com> In-Reply-To: <20260329-property-gpio-fix-v2-0-3cca5ba136d8@gmail.com> To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Hans de Goede , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, driver-core@lists.linux.dev, stable@vger.kernel.org X-Mailer: b4 0.15-dev-a6826 The PROPERTY_ENTRY_GPIO macro (and by extension PROPERTY_ENTRY_REF) creates a temporary software_node_ref_args structure on the stack when used in a runtime assignment. This results in the property pointing to data that is invalid once the function returns. Fix this by ensuring the GPIO reference data is not stored on stack and using PROPERTY_ENTRY_REF_ARRAY_LEN() to point directly to the persistent reference data. Fixes: 298c9babadb8 ("x86/platform/geode: switch GPIO buttons and LEDs to s= oftware properties") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov --- arch/x86/platform/geode/geode-common.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/geode/geode-common.c b/arch/x86/platform/geo= de/geode-common.c index 05189c5f7d2a..1843ae385e2d 100644 --- a/arch/x86/platform/geode/geode-common.c +++ b/arch/x86/platform/geode/geode-common.c @@ -28,8 +28,10 @@ static const struct software_node geode_gpio_keys_node = =3D { .properties =3D geode_gpio_keys_props, }; =20 -static struct property_entry geode_restart_key_props[] =3D { - { /* Placeholder for GPIO property */ }, +static struct software_node_ref_args geode_restart_gpio_ref; + +static const struct property_entry geode_restart_key_props[] =3D { + PROPERTY_ENTRY_REF_ARRAY_LEN("gpios", &geode_restart_gpio_ref, 1), PROPERTY_ENTRY_U32("linux,code", KEY_RESTART), PROPERTY_ENTRY_STRING("label", "Reset button"), PROPERTY_ENTRY_U32("debounce-interval", 100), @@ -64,8 +66,7 @@ int __init geode_create_restart_key(unsigned int pin) struct platform_device *pd; int err; =20 - geode_restart_key_props[0] =3D PROPERTY_ENTRY_GPIO("gpios", - &geode_gpiochip_node, + geode_restart_gpio_ref =3D SOFTWARE_NODE_REFERENCE(&geode_gpiochip_node, pin, GPIO_ACTIVE_LOW); =20 err =3D software_node_register_node_group(geode_gpio_keys_swnodes); @@ -99,6 +100,7 @@ int __init geode_create_leds(const char *label, const st= ruct geode_led *leds, const struct software_node *group[MAX_LEDS + 2] =3D { 0 }; struct software_node *swnodes; struct property_entry *props; + struct software_node_ref_args *gpio_refs; struct platform_device_info led_info =3D { .name =3D "leds-gpio", .id =3D PLATFORM_DEVID_NONE, @@ -127,6 +129,12 @@ int __init geode_create_leds(const char *label, const = struct geode_led *leds, goto err_free_swnodes; } =20 + gpio_refs =3D kzalloc_objs(*gpio_refs, n_leds); + if (!gpio_refs) { + err =3D -ENOMEM; + goto err_free_props; + } + group[0] =3D &geode_gpio_leds_node; for (i =3D 0; i < n_leds; i++) { node_name =3D kasprintf(GFP_KERNEL, "%s:%d", label, i); @@ -135,9 +143,11 @@ int __init geode_create_leds(const char *label, const = struct geode_led *leds, goto err_free_names; } =20 + gpio_refs[i] =3D SOFTWARE_NODE_REFERENCE(&geode_gpiochip_node, + leds[i].pin, + GPIO_ACTIVE_LOW); props[i * 3 + 0] =3D - PROPERTY_ENTRY_GPIO("gpios", &geode_gpiochip_node, - leds[i].pin, GPIO_ACTIVE_LOW); + PROPERTY_ENTRY_REF_ARRAY_LEN("gpios", &gpio_refs[i], 1); props[i * 3 + 1] =3D PROPERTY_ENTRY_STRING("linux,default-trigger", leds[i].default_on ? @@ -171,6 +181,8 @@ int __init geode_create_leds(const char *label, const s= truct geode_led *leds, err_free_names: while (--i >=3D 0) kfree(swnodes[i].name); + kfree(gpio_refs); +err_free_props: kfree(props); err_free_swnodes: kfree(swnodes); --=20 2.53.0.1018.g2bb0e51243-goog