From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 BB6D423395D; Thu, 16 Jul 2026 14:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210440; cv=none; b=DV92sGZaZQ9niG/uXfgNj1acBncTCJoQtci5Z30Z76ugrPyk9wWQ7xXqRlS2Ox6XYPp6vCrLokct1VULuKF3haOIgTpnH628Mm/XK/RNw77xaELs42Nvk1BvWSt+7FC07ByoJ5h3h7F94VN/nHFIXNf5ZwTx3Bf7c1+yunUKy6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784210440; c=relaxed/simple; bh=D3tsBsVQzWK26pMr7U19HtRic39BnVpfxZKRTJamyAE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P7s0R76KA5S9W6YOyWqc1uMz6JRycHrg3Hyx0TMWVZXgYefF0O4PaYG3F3qij87Wg0CXaIpJp86a2bI/m6MlQF3/H3bGG1gvBpHooC50ASr2lnscK3VwS0FXC1/KCB8Cm0t/x8wumkYVbU8unHvfReWq4qELP8wH5f9TmIpkl5E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=o+5Xt0ed; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="o+5Xt0ed" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30D501F00A3A; Thu, 16 Jul 2026 14:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784210439; bh=VfholR15uUgtVPrN8Ch2FlJwa9kuSO/Nl1v0CBaMXzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=o+5Xt0edbQJJsaLxFSgAfIevoFN+yaw8GODcnGFaiuxAjBMXd8t4xYulvs+gNdiil 7JUN/dO1NglXE256qBvrKmVWXMj0d8NUfI8feLih41XU9tZ8wOgzmUL6idZuftHTFP FxEAmiBxOtmvHiI3Q0QdmJhCKcy2yg5U4DrByG6U= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sakari Ailus , "Rafael J. Wysocki (Intel)" , Andy Shevchenko , Bartosz Golaszewski , Danilo Krummrich , Sasha Levin Subject: [PATCH 6.18 008/480] device property: initialize the remaining fields of fwnode_handle in fwnode_init() Date: Thu, 16 Jul 2026 15:25:55 +0200 Message-ID: <20260716133044.864774724@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133044.672218725@linuxfoundation.org> References: <20260716133044.672218725@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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bartosz Golaszewski [ Upstream commit 7eba000621fff223dd7bab484d48918c7c77a307 ] If a firmware node is allocated on the stack (for instance: temporary software node whose life-time we control) or on the heap - but using a non-zeroing allocation function - and initialized using fwnode_init(), its secondary pointer will contain uninitialized memory which likely will be neither NULL nor IS_ERR() and so may end up being dereferenced (for example: in dev_to_swnode()). Set fwnode->secondary to NULL on initialization. While at it: initialize the remaining fields of struct fwnode_handle too just to be sure. Cc: stable@vger.kernel.org Fixes: 01bb86b380a3 ("driver core: Add fwnode_init()") Reviewed-by: Sakari Ailus Reviewed-by: Rafael J. Wysocki (Intel) Reviewed-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Link: https://patch.msgid.link/20260511074927.9473-1-bartosz.golaszewski@oss.qualcomm.com [ Fix typo in commit message. - Danilo ] Signed-off-by: Danilo Krummrich Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- include/linux/fwnode.h | 2 ++ 1 file changed, 2 insertions(+) --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -210,8 +210,10 @@ static inline void fwnode_init(struct fw { fwnode->secondary = NULL; fwnode->ops = ops; + fwnode->dev = NULL; INIT_LIST_HEAD(&fwnode->consumers); INIT_LIST_HEAD(&fwnode->suppliers); + fwnode->flags = 0; } static inline void fwnode_set_flag(struct fwnode_handle *fwnode,