Received: by 10.223.185.116 with SMTP id b49csp1047485wrg; Fri, 23 Feb 2018 10:58:27 -0800 (PST) X-Google-Smtp-Source: AH8x227uJCLzxtyApeExoNP3S9VyqI4Y+rXuuNpKLxJTNHFXZuaKxopJSvXtJW44+LIjbCxO1FrW X-Received: by 2002:a17:902:6c4d:: with SMTP id h13-v6mr2579685pln.273.1519412307186; Fri, 23 Feb 2018 10:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519412307; cv=none; d=google.com; s=arc-20160816; b=fs+dQRwSSdwcskowsDclDttZQ/wbk5GVoxZWuCJWs2bPp6cTsQQv62r1OlFVSxasGO t4m9Of+JmQh+dJAbjaLfbFPBPGD8Tcuae3oNEHid9t6/kcJ5QvEXmhA1Mqks6AMZFlt1 6VSxLkBWF5DTeT9L3mTVxynFMBcSNrRy5b9ViLTDKiihikcgBAra54wOoDkQ7AONX1VF JX00GwVdEWJdYfwbKReiS9vjU94Ra4TYiuwyJxiZ9XUwVQ4q5WrgN/hQWhC8HBqhwQwP 4Fwq5/CRmzswI9vicKrhNgBciUCmWANpJR4k6kIY8nY79QMShHILtWhKpA+LSaX8KyId CJVg== 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=xAmQZFeNclo3z1pbtokjrHq67BGiqZQSVVqVZkNBm8Q=; b=cWzZITcWylKQZcYmSwa+Qh0ObevN/aNVpPUOQ+9qwR/2aGESozFcGFzvZwEKNucmxh se5IA6YmnlKv4VJfVez0N7JUag/hN3eb3qJ2fnetZU+RN4qOgm72Togx6RcyKQ7yLja+ tW5xzUC2Q/kwFaLJrQIfVsvIWuLKsiJ9BUUngRCf8ri5j1mV4VFj9sciyJx4kVGoYOVc AZy8qFZGSclVmQq1qkXpltn/Skwp2TntNe8P3BNiYr985AxSa5LQlCVJ7ehrxw+tyP0h cSRUfyz97ImDl1sUutvXb8/y/2mhPqlhxoB/L1FVxRPx4TFLLI5Pd6Ef9CwkGjZJ8HE5 4T1A== 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 q5si2193306pff.398.2018.02.23.10.58.13; Fri, 23 Feb 2018 10:58:27 -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 S965184AbeBWSzs (ORCPT + 99 others); Fri, 23 Feb 2018 13:55:48 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48366 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935543AbeBWSzq (ORCPT ); Fri, 23 Feb 2018 13:55:46 -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 E9B051225; Fri, 23 Feb 2018 18:55:45 +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.14 141/159] drm/armada: fix leak of crtc structure Date: Fri, 23 Feb 2018 19:27:29 +0100 Message-Id: <20180223170800.090983929@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@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.14-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 @@ -1225,17 +1225,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 */ @@ -1246,13 +1242,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, @@ -1263,7 +1261,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, @@ -1282,6 +1280,9 @@ static int armada_drm_crtc_create(struct err_crtc_init: primary->base.funcs->destroy(&primary->base); +err_crtc: + kfree(dcrtc); + return ret; }