Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2865983pxb; Mon, 18 Apr 2022 09:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDhRVKrQ6+J3Yg26TOlRvstxVAFps8qneR3eSvCVbf6md8QAeVW1fQ9u9VakRR0qaGXr35 X-Received: by 2002:a17:907:6e1e:b0:6ef:5a59:2bd4 with SMTP id sd30-20020a1709076e1e00b006ef5a592bd4mr10120206ejc.143.1650300761100; Mon, 18 Apr 2022 09:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650300761; cv=none; d=google.com; s=arc-20160816; b=f8Dd2MOrsRtTLozY2Y18JxJCZuZmd/oR3FzWA24npHRMynT5DmaCTD2PxxtQ2FYi9h SN3q/0PhOItUmigrCGOE4lQSQnAcYJX5JTLyh4qTTIWIScBLpiS8QDafw5x/XYyQqUfy 1xjipPV3z1L0aVyq6KQc5us6TN0Ti5rkogOSzyKhElH0q0EMd1uSQIkHevCKfFUlHZED tJGXCaFj0gwEwjFhMNlFu9HXsvFxh2rt53VT14EGciDUfOaFb6czKgMaoRxxR6/U4MeJ wtfXHtRjMxkL+CbUdbEvII9Ffh8xW+xmzfiPBkbqCxQNw9j7VSvjgZ/7g0I3Mm/MbE3k F/Eg== 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=of6vJevwBdLJQCV2norpGdaYgYyV05Yfa4DDR33oDX8=; b=dzZaGUAVV9bzQFfXD3YZPS0EJB1xM504LedJXlkjXt9Tu6uaXCLoVmJFA3ZxeW+18/ VNATRukZqJnTGt0X8fHlV1/PRhhf7x34kGiNdgI+Y9NTErWnSe84ZHIw/w98TH0AotW5 WdyaNMGqZKPuQO4lc+JJ1X1rbOau5wix4ZCHhHPyEB5IzgAK1/NpjpEU7SZTBwWjIjSa JeQ+TzWk8K8Qw7T9/9BLGVZHJCU7ONM5jTCks7anapHur3pZ7y96er1eCkv7LwqPEuEs wNAGHXpjH+WAhD9NhxoAqXJ4k2E5N9Mx1Ri8ER52yNO6UxLI0cx4/e4MKuX5l3ReUzbp 8qeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LV5rc88M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fi11-20020a170906da0b00b006e858b7d765si6338371ejb.880.2022.04.18.09.52.16; Mon, 18 Apr 2022 09:52:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LV5rc88M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S245320AbiDROCc (ORCPT + 99 others); Mon, 18 Apr 2022 10:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244190AbiDRNnd (ORCPT ); Mon, 18 Apr 2022 09:43:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D56231504; Mon, 18 Apr 2022 05:59:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE319B80D9C; Mon, 18 Apr 2022 12:59:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A259C385A7; Mon, 18 Apr 2022 12:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286780; bh=Cie9xTbHTERLmiPE7EPVmZETpno/5UZwrKY6N28oaNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LV5rc88M0hwh+DBOm/hVJN6Cj+jgfJaXEuuNk1OqZcXHIpfiuMcDN8nku0Vjr1SMI bpc8ic1pWp68RT+7EAfv7iyctZUAgDMReBXzHUUDXhiCM9q9fEkFnv0V0PS2sJs64b kU5yMmBah1Zm5kss9yqXbcPRtLldBX5ccK53pdvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Philipp Zabel , Sasha Levin Subject: [PATCH 4.14 242/284] drm/imx: Fix memory leak in imx_pd_connector_get_modes Date: Mon, 18 Apr 2022 14:13:43 +0200 Message-Id: <20220418121218.900232250@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: José Expósito [ Upstream commit bce81feb03a20fca7bbdd1c4af16b4e9d5c0e1d3 ] Avoid leaking the display mode variable if of_get_drm_display_mode fails. Fixes: 76ecd9c9fb24 ("drm/imx: parallel-display: check return code from of_get_drm_display_mode()") Addresses-Coverity-ID: 1443943 ("Resource leak") Signed-off-by: José Expósito Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/20220108165230.44610-1-jose.exposito89@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/imx/parallel-display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c index 8def97d75030..6420dec6cc00 100644 --- a/drivers/gpu/drm/imx/parallel-display.c +++ b/drivers/gpu/drm/imx/parallel-display.c @@ -77,8 +77,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) ret = of_get_drm_display_mode(np, &imxpd->mode, &imxpd->bus_flags, OF_USE_NATIVE_MODE); - if (ret) + if (ret) { + drm_mode_destroy(connector->dev, mode); return ret; + } drm_mode_copy(mode, &imxpd->mode); mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, -- 2.35.1