Received: by 10.223.185.116 with SMTP id b49csp1096784wrg; Fri, 23 Feb 2018 11:53:08 -0800 (PST) X-Google-Smtp-Source: AH8x227oJMVOugUBK+qgCz/F/ehlxz5nGNhzGKeDhRzIKx3rxl8i7HEXEEk9Ftq9BqNC2EcFstY0 X-Received: by 10.99.95.15 with SMTP id t15mr2221483pgb.183.1519415588352; Fri, 23 Feb 2018 11:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519415588; cv=none; d=google.com; s=arc-20160816; b=Vx3ngDMbuGMPFzN4EwvFauzEFRcdWIhqxGt0WSPgY/4b53em8MWwnfNsxIyNgISznT imHKwpC1gNtRCPHPDJWuxbRLvG958ji5Wj8y2oWHQFu0Z+r8CeXiMdwz8RePaKBz1Ky9 Tt1BOEvjDpO8MDW/3054R9Cps4iuvn+GtDyEAtLa6R0xg2ooRTTcwoPGjtPYDcmzgfuz epzSj9a9HTSgIyiVlyN+kVMBJvNKsP59mCmyFOeSvmymiXOKbNvY3McuCApCOckdIcfn vmnqHLBrcrjR/1M9NkAdGYO3EXJuzSiZLc8YbdkKtsrPy8snbLnScJFsXeg9dwga4bIf R0JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8A6l1YrtC8x6jzNDsaFQOasb43lMKWL9Y5beqUIvTaA=; b=SJGmGlxesI6T/Ddp+CcX2Q3nYhXff1p5wKSunVUXHYygIVsVIxSByc0rnzlk9/3zyM apwOz3SOWBMidBOiKuAbEtxF1a16gReHnU7M7R7DNbxRrWZXR8rdHQ8rIXHMgon00PMa IcL6PAfjJ1MNMHtAfVwo10U0vOas8b8fzj8RinxDRb7bsTtWXh3XGE6Ufw78N+pEPAcP ygHJLeqiYsl/kBZd2HbYsu/w8eRJLvV0YdyCv6uf9eo9MPLU/60s0GBt3SYVJGRBfvva 6tBWYBoxfHyHhRPDkypltWRMudDlXoJPtQCLHxUh/Jl7Z1oC2V9hVDUFEXnelbxWouW/ JFiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si1857012pgo.717.2018.02.23.11.52.53; Fri, 23 Feb 2018 11:53:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933882AbeBWSpr (ORCPT + 99 others); Fri, 23 Feb 2018 13:45:47 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:43434 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933869AbeBWSpo (ORCPT ); Fri, 23 Feb 2018 13:45:44 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CFE241244; Fri, 23 Feb 2018 18:45:43 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Sasha Levin Subject: [PATCH 4.9 078/145] drm/armada: fix leak of crtc structure Date: Fri, 23 Feb 2018 19:26:24 +0100 Message-Id: <20180223170734.813849392@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Russell King [ Upstream commit 33cd3c07a976e11c3c4cc6b0b3db6760ad1590c5 ] Fix the leak of the CRTC structure in the failure paths of armada_drm_crtc_create(). Signed-off-by: Russell King Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/armada/armada_crtc.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -1178,17 +1178,13 @@ static int armada_drm_crtc_create(struct ret = devm_request_irq(dev, irq, armada_drm_irq, 0, "armada_drm_crtc", dcrtc); - if (ret < 0) { - kfree(dcrtc); - return ret; - } + if (ret < 0) + goto err_crtc; if (dcrtc->variant->init) { ret = dcrtc->variant->init(dcrtc, dev); - if (ret) { - kfree(dcrtc); - return ret; - } + if (ret) + goto err_crtc; } /* Ensure AXI pipeline is enabled */ @@ -1199,13 +1195,15 @@ static int armada_drm_crtc_create(struct dcrtc->crtc.port = port; primary = kzalloc(sizeof(*primary), GFP_KERNEL); - if (!primary) - return -ENOMEM; + if (!primary) { + ret = -ENOMEM; + goto err_crtc; + } ret = armada_drm_plane_init(primary); if (ret) { kfree(primary); - return ret; + goto err_crtc; } ret = drm_universal_plane_init(drm, &primary->base, 0, @@ -1215,7 +1213,7 @@ static int armada_drm_crtc_create(struct DRM_PLANE_TYPE_PRIMARY, NULL); if (ret) { kfree(primary); - return ret; + goto err_crtc; } ret = drm_crtc_init_with_planes(drm, &dcrtc->crtc, &primary->base, NULL, @@ -1234,6 +1232,9 @@ static int armada_drm_crtc_create(struct err_crtc_init: primary->base.funcs->destroy(&primary->base); +err_crtc: + kfree(dcrtc); + return ret; }