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 EF936197A7D; Thu, 28 May 2026 20:37:10 +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=1780000631; cv=none; b=rIEWGW/0cCEhCw/FFoFjSj8OqKQQ72DFS6VcSwOJKTgKQAY3vs+SyKT1PiUnKRVv6gzlrF4wqudFEzVl1/+jpTQIcKo2UA+XFoXAYE14SygqjNEzbkjUPen83mybfLJbG1eH8frFFDAXRdKz/LMgYTC9o/AhSsXX0GnSqXuZIPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780000631; c=relaxed/simple; bh=Xg4yxkHYg3ASa/YAB29EpwlyC3p1RhgGYLIw1u+DHmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fwnSneWbtQWimn42Lnh0AsKb1mIQdxt+RmcxM31fMoM+HhnWAOKL9KB7dLa8xTocvh98d96OL2uiVOqT6CAvLQ9RaTodocY7Q0RpATCGXefu0KbNNPoCRz8Dbzu55AyIMhicLEjIikb2MNVp/F1JVFxpwRrfGAol+SQq8m5UwMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Gr2F1eme; 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="Gr2F1eme" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58FD61F000E9; Thu, 28 May 2026 20:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780000630; bh=2Djo6S0Z3sWywQljFse5wma0sG70RzhxOsAM8cK6RFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Gr2F1emePD7q0LpodFQzwnx4jIFaUDHS6BPNQf53ByXb30Fj02fJQn59PMsSyMJkd f5QOFjqXg8wZTjxdGRJb4+jBnaNcqSKmHCRl2HeCxCbW+NdOBZmxo/DjR7YqfusxCk KkDrUhrLvzYZqgtC1IUGa0p3k7A5LU7bFDd72sT4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Bartosz Golaszewski , "Rafael J. Wysocki (Intel)" , Andy Shevchenko , Sakari Ailus Subject: [PATCH 6.12 113/272] device property: set fwnode->secondary to NULL in fwnode_init() Date: Thu, 28 May 2026 21:48:07 +0200 Message-ID: <20260528194632.545014948@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194629.379955525@linuxfoundation.org> References: <20260528194629.379955525@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bartosz Golaszewski commit 215c90ee656114f5e8c32408228d97082f8e0eef upstream. 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 uninitalized 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. Cc: stable Fixes: 01bb86b380a3 ("driver core: Add fwnode_init()") Signed-off-by: Bartosz Golaszewski Reviewed-by: Rafael J. Wysocki (Intel) Reviewed-by: Andy Shevchenko Reviewed-by: Sakari Ailus Link: https://patch.msgid.link/20260506115701.23035-1-bartosz.golaszewski@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- include/linux/fwnode.h | 1 + 1 file changed, 1 insertion(+) --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -200,6 +200,7 @@ struct fwnode_operations { static inline void fwnode_init(struct fwnode_handle *fwnode, const struct fwnode_operations *ops) { + fwnode->secondary = NULL; fwnode->ops = ops; INIT_LIST_HEAD(&fwnode->consumers); INIT_LIST_HEAD(&fwnode->suppliers);