Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795019352; b=XOOSB2o4g0LRkxZLW0QvHEm5QG6Cd155t/uPVRzxOMdGQISyaHzPlyLlEh57/JxygjRJ muy0CsxA4ElxjlxMYah4jc9+agoPXCfMu/zVityTr2rR1zBkRojtnxer6zQ9XLr6pjjgl wFE2WK3NHBxCLVRlRp29Q68sc2MEsJRfk6IGczcJyuNwpM7zn/HOXXGs+DNahor0s7fFd ALhEWWtHxnIqIrBAaOcD+BO/W7DBY81uOSD9NHOMEccXuztcd9cRx0nTwUSaRBL5LHcKV 8O7t/ueBzagFDClL8JVNVK4qXkQaTm9LG3uNHCT81HfUiN7SbeW5eA2BWn/zlLFMHEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795019352; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=4ZxeGdkLXa5oIoROKr84l016XqSCm3pb/28WOanYpEI=; b=yTjuDhJU6dZr05YvSBgHeqZrPHCBvg4TaGBXtqVIpq5WgY7V5UVn/zUxDYLARp8Lt4Dr Y8mibvhIpDDyYZ2OQqvUptoNFJl1/y1BhjvV7kO40kdJm93yV5hpd/8KztuChtK948yD0 gR6mhewnwtUWLX6xZJTNeYwvpjh9HQjHOsqlPE/ay6IvqFjwx/8n1G8o9l2X+pRS7kAkO CkaBucPDkdOJvhLfPkzp/JrPfjxttUgKRge6z+eQCA0SuB0TyN57j5n6DOF/8+IsEz1ue ftzBotN1QYBbtST8+xUYJlojY4Crzi6lLeOYe4LHV2g37pZGTSeo0d+rb5Inlw7S6BA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RNmuRy7R; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3872460A2609; Wed, 18 Nov 2026 16:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=RNmuRy7R Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E4951F000C4; Wed, 18 Nov 2026 16:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795019352; bh=4ZxeGdkLXa5oIoROKr84l016XqSCm3pb/28WOanYpEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RNmuRy7RJ84BDfGRXa2GS3G7KYOO+/WBLKxZO2EE+WaoOYz+DQR608hddL8x2uNzI a7GE9FxqtEIZpt+JXac+suqYkuZdzre8eonqyzvnXvZpH9wlzKurpZWycfYYW0yMzI pgyxSf6qSv8Q2YvTndvJzR1/yqALqOiq+SqLIWBM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Leo Cheng , Michael Walle , Miquel Raynal , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 7.3 1564/2651] nvmem: layouts: sl28vpd: fix device_node reference leak in error path Date: Wed, 18 Nov 2026 15:46:44 +0100 Message-ID: <20261118150344.253891560@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150247.972732815@linuxfoundation.org> References: <20261118150247.972732815@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leo Cheng [ Upstream commit 73bd84aa58ad1fd775d6af2e8445a9456659c445 ] sl28vpd_add_cells() takes a reference on the child node via of_get_child_by_name() for each entry and passes it to nvmem_add_one_cell() as info.np. On success the created cell entry adopts that reference and releases it later via of_node_put() when the entry is torn down; nvmem_add_one_cell() does not take its own reference. On failure it does not consume the reference either, so the caller still owns it, but the error path only puts layout_np before returning, leaking the child node reference. Put info.np on the error path as well. of_node_put(NULL) is a no-op, so this is safe even when of_get_child_by_name() returned NULL. Fixes: d9fae023fe86 ("nvmem: layouts: sl28vpd: Add new layout driver") Signed-off-by: Leo Cheng Reviewed-by: Michael Walle Reviewed-by: Miquel Raynal Signed-off-by: Srinivas Kandagatla Link: https://patch.msgid.link/20261002101329.1084348-3-srini@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/nvmem/layouts/sl28vpd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vpd.c index e93b020b08369..79de1e6947d09 100644 --- a/drivers/nvmem/layouts/sl28vpd.c +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -126,6 +126,7 @@ static int sl28vpd_add_cells(struct nvmem_layout *layout) ret = nvmem_add_one_cell(nvmem, &info); if (ret) { + of_node_put(info.np); of_node_put(layout_np); return ret; } -- 2.53.0