From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (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 A559C312805 for ; Tue, 3 Feb 2026 09:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770112677; cv=none; b=uJnMHNW5KjIokMEE0qonXyQ2IPEOwuscNNSOJaevVBWKeu3h/0FzmbvFkDc7N0CtRJ0MpJiV/Se5Fba7OmYjVEz/K+YH0jDudCRbY88L5qtLxr6xKvIOKMS8EyiHeMu0gSLZZe1d8M+vJcVSKNJCZzQbW91r4fo8c/kHKAJa/cs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770112677; c=relaxed/simple; bh=L13EJ42XxP4rPbwJTgUR66rvHI0MKA//neD+wIRlpf0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oX658U59+mW5x4DWDtnnq3uChjqtYQT3sPYw3SSInTn35rWiI5UDeIYyhLjHays9mNJAdcSN6yp84xoo+DwbQv2ENJErrYhHWnMxMTFITRLWYDIRlgp+q464u63+feqv4yctXX+AXGNy82caNiKxKwJZ0W7w2KvdOuXRUYIVzvM= 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=mU9qdHWW; arc=none smtp.client-ip=185.246.85.4 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="mU9qdHWW" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id CE4EE4E423E2; Tue, 3 Feb 2026 09:57:52 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 97E0B60728; Tue, 3 Feb 2026 09:57:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E4F65119A8891; Tue, 3 Feb 2026 10:57:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1770112671; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=vpUZYtj8lQcFWACxWodePAoJiEPpPqkbSTyFbqsxono=; b=mU9qdHWWKE+eo0Zsi7eZAjrpFGRvpHW5k0lhFn9bVc0nqSZ8njV6uj3nTuTpi5dvdxiV20 OSHOGnG14jpx/JPFMD7lFOAnxeKCIXYn90v385S9FDFibD51IQt7KwmdSXaFktkaiNi4MR caEqk+uuoPgTzEztRKmEMqnvIbq1HjfKNnlITTybI2DYUge0egxqkLQLD3gFzo0Xfec5Ts gRPyXSD57I/Ao6PPpyHGUz2Z9BMjnwNa9gxyXtwFhCpL9LLR7XSYg1O7+E02DAnE0AmaTV 4u12fcr16fsEGuEOE2tjLTuCH8fmcjvuaFb8ohTUyCgSoL0t0XPiUPtwLnLCJw== Date: Tue, 3 Feb 2026 10:57:47 +0100 From: Kory Maincent To: Felix Gu Cc: Paul Kocialkowski , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Paul Kocialkowski , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/logicvc: Fix device node reference leak in logicvc_drm_config_parse() Message-ID: <20260203105747.71b71dfa@kmaincent-XPS-13-7390> In-Reply-To: <20260130-logicvc_drm-v1-1-04366463750c@gmail.com> References: <20260130-logicvc_drm-v1-1-04366463750c@gmail.com> Organization: bootlin X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 On Fri, 30 Jan 2026 00:21:19 +0800 Felix Gu wrote: > The logicvc_drm_config_parse() function calls of_get_child_by_name() to > find the "layers" node but fails to release the reference, leading to a > device node reference leak. >=20 > Fix this by using the __free(device_node) cleanup attribute to automatic > release the reference when the variable goes out of scope. >=20 > Fixes: efeeaefe9be5 ("drm: Add support for the LogiCVC display controller= ") > Signed-off-by: Felix Gu > --- > drivers/gpu/drm/logicvc/logicvc_drm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/gpu/drm/logicvc/logicvc_drm.c > b/drivers/gpu/drm/logicvc/logicvc_drm.c index 204b0fee55d0..bbebf4fc7f51 > 100644 --- a/drivers/gpu/drm/logicvc/logicvc_drm.c > +++ b/drivers/gpu/drm/logicvc/logicvc_drm.c > @@ -92,7 +92,6 @@ static int logicvc_drm_config_parse(struct logicvc_drm > *logicvc) struct device *dev =3D drm_dev->dev; > struct device_node *of_node =3D dev->of_node; > struct logicvc_drm_config *config =3D &logicvc->config; > - struct device_node *layers_node; > int ret; > =20 > logicvc_of_property_parse_bool(of_node, > LOGICVC_OF_PROPERTY_DITHERING, @@ -128,7 +127,8 @@ static int > logicvc_drm_config_parse(struct logicvc_drm *logicvc) if (ret) > return ret; > =20 > - layers_node =3D of_get_child_by_name(of_node, "layers"); > + struct device_node *layers_node __free(device_node) =3D > + of_get_child_by_name(of_node, "layers"); We usualy don't declare variable in the middle of a function. You should rather simply change the declaration line at the top like this: struct device_node *layers_node __free(device_node) =3D NULL; Regards, --=20 K=C3=B6ry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com