Received: by 10.223.185.116 with SMTP id b49csp1136466wrg; Fri, 23 Feb 2018 12:34:39 -0800 (PST) X-Google-Smtp-Source: AH8x2270IMWvkiTbxk6jm+ldYSS2lI442QmvoAlQUmNQUFo8n9fabVVp+XZhD6yqtzkxvkmazYIm X-Received: by 10.99.99.132 with SMTP id x126mr2306456pgb.86.1519418079129; Fri, 23 Feb 2018 12:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519418079; cv=none; d=google.com; s=arc-20160816; b=eJuzkn6yZH9o8XfAGIHIPhjXqFZADIv5E8/R54YxmLSX2uF6yAaGR956pwmG9vo6N8 /r8ZG3RJTl+jSw13BPwCLYBZfPWLTngeylaIf5ApzrIgpkAhzr2nTnFbHjxeDXgnSq00 myKpSL//pvjzmWoSAUgxiIczCWttUd2oGgJlEDBigHKVW81hSl72XUeU03KUG0wkeRGq sd7sUcKRNUdbeefoycauCSsWXuEhzRyVgaFn6RW9ljqnXYtd8eMGMXWXdmGrbrLf+EMS oJtZmHWvY0wPIDPtkagRXNhGi1/GXtQ28ZvPOIAbYcMtMmXLfLF0BBL/xuCOjIjFtXhX CXRQ== 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=KGZV8gR9jGpasnwv81KDIxil6/49UlOmVIBZ9P5853o=; b=YaMoSmjyzgll5Qzc5EAz7Win1Cgl5RpJ2cVk9wgAOY35n6t4Ak9h2r3v2210dW4Bi4 jbTH1cZLDAv4R+ZEZb8qMDrknbz6cdA41DjudkxUlLw5JArcRmNYc779r42hzfbZJHyW qomcH4J5yHDhifXDL+91IkFStoKml2tgtOfXwF7E369kHqsdg605+M2CY/f/+4VFtzDS PNcCEYYcyFWHR88GP2UzG+4cUfGLS1XSz+yMb6gURDCClQ7JsOPxLGMcX/2sUsqP9Af0 jwU1l9Mf0C5oxP11wjBlDt768jB7tzaxQgjothpiX1yXtE8Ia6dzj+MtkqcYdXujrfOO uzAA== 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 1-v6si2276591ply.476.2018.02.23.12.34.24; Fri, 23 Feb 2018 12:34:39 -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 S1753783AbeBWSfR (ORCPT + 99 others); Fri, 23 Feb 2018 13:35:17 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37198 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753765AbeBWSfN (ORCPT ); Fri, 23 Feb 2018 13:35:13 -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 837BC124C; Fri, 23 Feb 2018 18:35:12 +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.4 056/193] drm/armada: fix leak of crtc structure Date: Fri, 23 Feb 2018 19:24:49 +0100 Message-Id: <20180223170334.767274930@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@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.4-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 @@ -1182,17 +1182,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 */ @@ -1203,13 +1199,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, @@ -1219,7 +1217,7 @@ static int armada_drm_crtc_create(struct DRM_PLANE_TYPE_PRIMARY); if (ret) { kfree(primary); - return ret; + goto err_crtc; } ret = drm_crtc_init_with_planes(drm, &dcrtc->crtc, &primary->base, NULL, @@ -1238,6 +1236,9 @@ static int armada_drm_crtc_create(struct err_crtc_init: primary->base.funcs->destroy(&primary->base); +err_crtc: + kfree(dcrtc); + return ret; }