From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) (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 B8C4835CB81 for ; Wed, 12 Aug 2026 06:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.201.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786515776; cv=none; b=NOylSWx+qRCVY0pa/TOdO29BpN/f/5S8Rn3cX+DbJ5TmpR32nFWVLrNH8dsvxtfNfOgYFXWt/cQJKBvW8AVYrqyQN05L58xYIWq+hwWjB/pst9Fk6eZ7WCHZvp52QwTainXyVxOkTg9ZQATFYwIsNEXFIvzi7Y0e4DZDEnAwZdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786515776; c=relaxed/simple; bh=w0gvtsdgp+ldq1q+7R994LzsKEuGVG1ZXaqSNC4RQH4=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:From:To: References:In-Reply-To; b=aVh1A5K0B83k3tSGfiyLPN0gp1wbwGowh/nkvlEIs1yAiv4WWFtlOR6ijBcVZ885SZ/79JMoSxxo4SLCjjsUZp3/XgDkseLNzxFIYLAglTe4r+lkWkjoB4L/8mASjPs9+SXAj9eKYUxQo54XwRsrAYLiTS1/nT35HLMa321G+oE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=walle.cc; arc=none smtp.client-ip=159.69.201.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=walle.cc Received: from localhost (unknown [IPv6:2a02:810b:4320:1000:4685:ff:fe12:5967]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 8204C141; Wed, 12 Aug 2026 08:22:52 +0200 (CEST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 12 Aug 2026 08:22:52 +0200 Message-Id: Subject: Re: [PATCH 2/2] nvmem: layouts: onie-tlv: fix device_node reference leak in error path Cc: From: "Michael Walle" To: "Leo Cheng" , "Srinivas Kandagatla" , "Miquel Raynal" X-Mailer: aerc 0.20.0 References: In-Reply-To: On Tue Aug 11, 2026 at 2:55 PM CEST, Leo Cheng wrote: > onie_tlv_add_cells() takes a reference on the child node via > of_get_child_by_name() for each parsed TLV and passes it to > nvmem_add_one_cell() as cell.np. On success the created cell entry > adopts that reference and releases it later via of_node_put(); on > failure nvmem_add_one_cell() does not consume it, so the caller still > owns it, but the error path only puts layout before returning, leaking > the child node reference. > > Put cell.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: d3c0d12f6474 ("nvmem: layouts: onie-tlv: Add new layout driver") > Signed-off-by: Leo Cheng Reviewed-by: Michael Walle