From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 4F25D439F88 for ; Tue, 11 Aug 2026 14:38:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786459097; cv=none; b=jPu5UaePlvYNNS0Hw6QLUnZF/OzAkZ/q2PahEoYVvGI5s6lhiQrg93fIOfJfNbNUbtKPxRl1Gb6WBK23kw22HYhu/zssZ+9VCVEx8vIlCtwEkkxvDTdlQPbZG1PDTyA8sSD9HmHU8XrZhLqUm+E2rjRDGJjG/bzsRGXkNNy82kY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786459097; c=relaxed/simple; bh=TtNY68wUyMQSioI9LXH30Zx+n7O9AHV5anstD/i31s4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=b8Y9H1yGHmqby74feIsRh0fkzC6Gr2Vlk/XReHJBbp1e+z3lOVgV4CsgDPN1nVejLSc1SBTnwf/W99KypjSexhTuzSnnvN1hDvtoWGOwsa2jtGfo6h2Cphg2/35BhnPt7BFM0slypSQxgqm9tL/9DV0I/vCO/PYW8JTKWTKfMYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=T6gB4WlC; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="T6gB4WlC" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 649371A1563; Tue, 11 Aug 2026 14:38:13 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 362E56033C; Tue, 11 Aug 2026 14:38:13 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6171411C48D76; Tue, 11 Aug 2026 16:38:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786459088; h=from:subject:date:message-id:to:cc:mime-version:content-type: in-reply-to:references; bh=TtNY68wUyMQSioI9LXH30Zx+n7O9AHV5anstD/i31s4=; b=T6gB4WlCUpO9J8OChDCYcanrpe2r0YYg9nCFuZwmdEhcbfYW/HgXXA7Lk3GH9i/CNSVj9m /fQ6AD4mTCrROQ+ZdZnOrWlvCCh+z6NWi9o2h0BSX/t1+BAoUFSmKkUUYDu26h6gsCSpE1 Nd3125flkpfd0gwptult0rrKPjn1omNR4Klofn2G3wwBFHuXrL6x9+yc63tiqwLOTkwG9z 2YRzVYp7xn5x3aTXvQ86+vQOwOmXsShgCXByyc1rLHkbZst2WijdTRN4ERyrP+FbtSEWNW QG0LEo8cPwVy7v5ceUsNgOsXPnnJ5N68yGm0eR94ETsS1Z95IyvjNGeQZZdwfg== From: Miquel Raynal To: Leo Cheng Cc: Srinivas Kandagatla , Michael Walle , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] nvmem: layouts: sl28vpd: fix device_node reference leak in error path In-Reply-To: (Leo Cheng's message of "Tue, 11 Aug 2026 20:55:48 +0800") References: User-Agent: mu4e 1.12.12; emacs 30.2 Date: Tue, 11 Aug 2026 16:38:05 +0200 Message-ID: <87ecg4oh82.fsf@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Last-TLS-Session-Version: TLSv1.3 On 11/08/2026 at 20:55:48 +08, Leo Cheng wrote: > 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: Miquel Raynal