From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2EFC82F2366; Tue, 17 Jun 2025 15:44:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750175072; cv=none; b=sqkGrGx0H57eOO/4Cv8aT87IgiEqYjGSbnYY2jy7snPqrxCvJ8mJNcZxBINyYGYGa9VQD2AfLmeNB4Gm1rhdaLjSULyRy/Ki9H+N9r35ctjSYk+tYa2kSX1tPjpJB4HYrIYV7PNmduMjjBF3wzd13tpo/TTcZ6p4L5Tym89L52g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750175072; c=relaxed/simple; bh=NDhQI3uA1WMxgZF4xBl/ybhsR5OYsiVmNaZCWjVfnYM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C3jQl37VK8/VAbhcJTZ5AO/WPq4x34+FM1A4Krdc/T4mmcJwEzQCEcfZrA7FjCM8OeZ+fkq+rSLk8WlS4TpN/cOOLhtd9t0BFKGfmpXKPSDPc4+Z2Oa+jigB6EbdfSm5KVtn6pAplsdn5upBrR3NjB1Q26AvJUP/K7qTwwbtYMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nJhbbvJy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nJhbbvJy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C56EC4CEE3; Tue, 17 Jun 2025 15:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750175072; bh=NDhQI3uA1WMxgZF4xBl/ybhsR5OYsiVmNaZCWjVfnYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJhbbvJyJV+T6ILu77BUosCRuG0U3gXAcNY1JKgQaUR44zy82IcptZijbWWo8+pDH uFqA7Mo3/xGE0v+xX3qh9sBGzGONNzll44YZRc0Y2AcdjFbfeUXZYz8POUJ2RYPcTC 8tnur0yjgLqBgYKBLz8t9AUffRPUX+PZfcze8K4g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Biju Das , Laurent Pinchart , Tomi Valkeinen , Sasha Levin Subject: [PATCH 6.12 089/512] drm: rcar-du: Fix memory leak in rcar_du_vsps_init() Date: Tue, 17 Jun 2025 17:20:55 +0200 Message-ID: <20250617152423.188386014@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152419.512865572@linuxfoundation.org> References: <20250617152419.512865572@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Biju Das [ Upstream commit 91e3bf09a90bb4340c0c3c51396e7531555efda4 ] The rcar_du_vsps_init() doesn't free the np allocated by of_parse_phandle_with_fixed_args() for the non-error case. Fix memory leak for the non-error case. While at it, replace the label 'error'->'done' as it applies to non-error case as well and update the error check condition for rcar_du_vsp_init() to avoid breakage in future, if it returns positive value. Fixes: 3e81374e2014 ("drm: rcar-du: Support multiple sources from the same VSP") Signed-off-by: Biju Das Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/20231116122424.80136-1-biju.das.jz@bp.renesas.com Signed-off-by: Tomi Valkeinen Signed-off-by: Sasha Levin --- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c index 70d8ad065bfa1..4c8fe83dd6101 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c @@ -705,7 +705,7 @@ static int rcar_du_vsps_init(struct rcar_du_device *rcdu) ret = of_parse_phandle_with_fixed_args(np, vsps_prop_name, cells, i, &args); if (ret < 0) - goto error; + goto done; /* * Add the VSP to the list or update the corresponding existing @@ -743,13 +743,11 @@ static int rcar_du_vsps_init(struct rcar_du_device *rcdu) vsp->dev = rcdu; ret = rcar_du_vsp_init(vsp, vsps[i].np, vsps[i].crtcs_mask); - if (ret < 0) - goto error; + if (ret) + goto done; } - return 0; - -error: +done: for (i = 0; i < ARRAY_SIZE(vsps); ++i) of_node_put(vsps[i].np); -- 2.39.5