Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp82824pxb; Mon, 13 Sep 2021 13:33:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSe60SHQiCduRioCTnG/TV7gRp03OKXHjFRWcangfgEEoXJ6hy7OnUtchqFR3mEixoIf8V X-Received: by 2002:a92:cd0a:: with SMTP id z10mr6448261iln.207.1631565213217; Mon, 13 Sep 2021 13:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631565213; cv=none; d=google.com; s=arc-20160816; b=Z4Mw9RSzxzZuYyVVojElglovvuvKjg331MO09DcA62VoHdYoht9AhrhTEcpXAaZVKy PGv1qYKxEQp91ZkXzMquZBOFvm2aO0ReIdxDqNem1lDCBTfmqQx8TY1vVSx004lT60bu CA8V9ZknxC9dPP+VHoAK5nSWlSsYWv96w1neDhRwAasnW94J4E3YDdg1DyLXMG6h9LxR v28fsuaA3djWI9ocw4Xn+Y7l6QQO7ceHKL6Jvgf91MaeUUoUSrJvg/mbsPp5ROjfZfpS Qc7YMSj5JndS64H8Cg0SqQEooN3Wh+iTQLtumvKGHyhrGniuslo18RMOB93gOuq+obL8 2+Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CwYyU/SA/q94fIlU1Byk9J2pxnhHXTzAMgM75Yu1C5w=; b=JzHdayaTQUmDeiodQ8LDvwAKIfYMh9UjQsqKW2nniVcKwiBRHJ7oVBYZh7N6eInThA d/xyYWps5ZT83UgUoHtVFzQeU6pfWK6LFVZC+NEVeCYPGrXjEV4lEsC/dskUklsdsKr4 iYUNIh7nHFFD2tqcXBpZ3WmT15vIw0RIk0Co/WETV7wqBjUx4eLcEmfi20y2o4UnCKms ddmvP/aAUOHS2zsZLZnfFwFe7MLy7zj1p8vKVJFH33zEDx1W6830gc1FkSPzdaLKVFCE 7TPtO54rRT1FiQFNoCMXTLUapjd+p/yju5gMJe7S5I5cx9RmyhJ8W7MOBXg+XFWjssBU E4bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gU/7yhzs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l24si7206571jaf.107.2021.09.13.13.33.22; Mon, 13 Sep 2021 13:33:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="gU/7yhzs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242973AbhIMNip (ORCPT + 99 others); Mon, 13 Sep 2021 09:38:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:34448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242352AbhIMNdh (ORCPT ); Mon, 13 Sep 2021 09:33:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFCED6139F; Mon, 13 Sep 2021 13:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539578; bh=W/9OyMCIBDkFYitsxHS1MSsc19iKakqmMhUb9EfZU2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gU/7yhzsrome14+7UkNI9ljI2mpa2rDZRqe9KJ2sGCqmeG76TDxZ4GlZ22DNkTL1z St3oUrnT7xfPB1bOBhlD+9tLUq4g1cpbVXoVJiXD0YNAmor+PKuykuFhlsd2MRB7uO 0Kf6Hw9G9DaZoXm3Lp2w13JR8p7+p3yGT4yyMQF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Price , Laurent Pinchart , Sasha Levin Subject: [PATCH 5.10 079/236] drm/of: free the iterator object on failure Date: Mon, 13 Sep 2021 15:13:04 +0200 Message-Id: <20210913131103.044419599@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steven Price [ Upstream commit 6f9223a56fabc840836b49de27dc7b27642c6a32 ] When bailing out due to the sanity check the iterator value needs to be freed because the early return prevents for_each_child_of_node() from doing the dereference itself. Fixes: 6529007522de ("drm: of: Add drm_of_lvds_get_dual_link_pixel_order") Signed-off-by: Steven Price Reviewed-by: Laurent Pinchart Link: https://patchwork.freedesktop.org/patch/msgid/20210714143300.20632-1-steven.price@arm.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_of.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 197c57477344..997b8827fed2 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -331,8 +331,10 @@ static int drm_of_lvds_get_remote_pixels_type( * configurations by passing the endpoints explicitly to * drm_of_lvds_get_dual_link_pixel_order(). */ - if (!current_pt || pixels_type != current_pt) + if (!current_pt || pixels_type != current_pt) { + of_node_put(endpoint); return -EINVAL; + } } return pixels_type; -- 2.30.2