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 97AE2471414; Tue, 21 Jul 2026 20:11:33 +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=1784664696; cv=none; b=SGH297Dcy1li0ebggDrQecqLM7i2NmJiNNAgnIpedBO71/IqMvucU218xz1LanG3umVFz7AgRETqLskCeTEdEBnWDqz3OQXW/5T+GS0NIWZ1p4ZEHt2Z92a8L1Bgibg3I7/GXr1FS1dFC65rM6FbX+VSI4yeTCz0d16ExLO/t9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784664696; c=relaxed/simple; bh=Fs+m2fjy7kL9w/sdKJVWOYWU1kVggqii9R46lwNdJ1c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DmDmxeJA/XHAsmYcToxrE6tDfMLwdPEnyQs7/WBRjbuYHztxhpwont2Tk9dTYkXXOM8EPqzT50g+MjkVn4ENFp9H1H82cIBXhw8F5G8cdDCp9BmeNkzm2EB1GXNXpQaUDMSQis6Mip7u2J23MXNsftbs7b0Wq4vz1VNfRKvQjHw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Js8y7GVd; 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="Js8y7GVd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E58D71F000E9; Tue, 21 Jul 2026 20:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784664693; bh=Ulmxq7Gw75ppzmRWHCGP8zYyaRfo0+vs7M3A5Zkak54=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Js8y7GVdfwqifnz6HB7P8CdKzxSBaPGKROi36erhKwwpFOqSAWyY8xQFOrxpHFrSP BrcOSTHgz164mN1dj4SToG9gkOYe5I2IXovA9j5dE/D2Ue2EQvgBclej0OvZGqjDos fhLj26woZ+XApo3TlWNs5RgW+DgcdB3H5fyfYJxw= 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.6 0023/1266] device property: initialize the remaining fields of fwnode_handle in fwnode_init() Date: Tue, 21 Jul 2026 17:07:40 +0200 Message-ID: <20260721152442.309183046@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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.6-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 @@ -195,8 +195,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,