From patchwork Tue Apr 12 15:57:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 8812321 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F0D919F54F for ; Tue, 12 Apr 2016 15:58:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36DDC2021F for ; Tue, 12 Apr 2016 15:58:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5907D201B9 for ; Tue, 12 Apr 2016 15:58:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 585A46E714; Tue, 12 Apr 2016 15:58:15 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D5C66E715 for ; Tue, 12 Apr 2016 15:58:06 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 12 Apr 2016 08:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,474,1455004800"; d="scan'208";a="953408797" Received: from unknown (HELO localhost.isw.intel.com) ([10.237.224.82]) by orsmga002.jf.intel.com with ESMTP; 12 Apr 2016 08:58:04 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Tue, 12 Apr 2016 16:57:41 +0100 Message-Id: <1460476663-24890-3-git-send-email-matthew.auld@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1460476663-24890-1-git-send-email-matthew.auld@intel.com> References: <1460476663-24890-1-git-send-email-matthew.auld@intel.com> Subject: [Intel-gfx] [PATCH 3/5] drm/i915: bail in alloc_pdp when !FULL_48BIT_PPGTT X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we are not in FULL_48BIT_PPGTT mode then we really shouldn't continue on with our allocations, given that the call to free_dpd would bail early without freeing everything, thus leaking memory. Cc: Chris Wilson Cc: Joonas Lahtinen Signed-off-by: Matthew Auld --- drivers/gpu/drm/i915/i915_gem_gtt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index fa583d5..6601b11 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -569,7 +569,8 @@ i915_page_directory_pointer *alloc_pdp(struct drm_device *dev) struct i915_page_directory_pointer *pdp; int ret = -ENOMEM; - WARN_ON(!USES_FULL_48BIT_PPGTT(dev)); + if (WARN_ON(!USES_FULL_48BIT_PPGTT(dev))) + return ERR_PTR(-EINVAL); pdp = kzalloc(sizeof(*pdp), GFP_KERNEL); if (!pdp)