From patchwork Tue Aug 30 21:50:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Haixia Shi X-Patchwork-Id: 9306121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A006607F0 for ; Tue, 30 Aug 2016 21:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DF01288F6 for ; Tue, 30 Aug 2016 21:50:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02A9F28D8D; Tue, 30 Aug 2016 21:50:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 918B4288F6 for ; Tue, 30 Aug 2016 21:50:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A32A36E04B; Tue, 30 Aug 2016 21:50:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) by gabe.freedesktop.org (Postfix) with ESMTPS id D0DBE6E04B for ; Tue, 30 Aug 2016 21:50:24 +0000 (UTC) Received: by mail-pf0-x230.google.com with SMTP id x72so11807937pfd.2 for ; Tue, 30 Aug 2016 14:50:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fKuj2pkdo83LY9SZzR4n4k8kM46TqSby/oiBL3P1R+s=; b=hj/UQ5scM6tFy+z1YUdmQk+VQGmLAcF7Ld21waGZtAw310yE5x16A/PIo3S8/xdBnd Js+DUTwrn7JGM+Iz+tva67+uIal1pQjDUwJXMEJyqlVw3RsQsxGuXwyq+wWMcQReE9kn psTeX3zU/1d6nrCY1odsQ9qCEkFe5pFX5A+QE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fKuj2pkdo83LY9SZzR4n4k8kM46TqSby/oiBL3P1R+s=; b=T5BPCTAn2RvmLWFbZLBbHqIeElHn0R42YaHXHW1H5d4nEF1w260H1QgGLhSxp5TQBM nw45QtWxdGyttRwYdSGwmEv7+t2U1hxb7jjuVViujxoSXuI5mLMrZiKsjkQevJqbVYKF HkWhWC+VmWbLnl8S5mBh8yYD6YuiN0+aBYezOtGdMG+8ShOdHyIbF2Iux+bsFIssxoc2 1U5ByC4eB8aiCUU1AvSEiVUeIFADxM2n7ODVOMKKuc7fq9Z/79AQkxOJIZbBeHHx5qDd 7xnT3ErMJVZR92yzARRlZwxHpsENczzm216z2IumRO5GS9GmA9B9n540rc4no32Brvy2 jPkg== X-Gm-Message-State: AE9vXwMEGMFtclssnnQtywNTShOjh9tapR6XiDjEU2Y8SVhDGJBJFE2HiK80wnL/o1DI1+AS X-Received: by 10.98.47.132 with SMTP id v126mr10580242pfv.152.1472593824448; Tue, 30 Aug 2016 14:50:24 -0700 (PDT) Received: from haixia-z620.mtv.corp.google.com ([172.22.117.235]) by smtp.gmail.com with ESMTPSA id c7sm59485064pfj.25.2016.08.30.14.50.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Aug 2016 14:50:23 -0700 (PDT) From: Haixia Shi To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/udl: fix a NULL pointer reference in udl_gem_free_object(). Date: Tue, 30 Aug 2016 14:50:20 -0700 Message-Id: <1472593821-38429-1-git-send-email-hshi@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 MIME-Version: 1.0 Cc: Haixia Shi X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Previously this function had a NULL pointer check for gem->map_list.map, but that line was refactored after commit 0de23977cfeb5b357ec884ba15417ae118ff9e9bb ("drm/gem: convert to new unified vma manager"). After the refactor it is still necessasry to check that the vma manager is not NULL because udl_gem_free_object() may come in after the vma manager is destroyed. Signed-off-by: Haixia Shi Reviewed-by: Stéphane Marchesin --- drivers/gpu/drm/udl/udl_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 818e707..72e1bd4 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c @@ -204,7 +204,8 @@ void udl_gem_free_object(struct drm_gem_object *gem_obj) if (obj->pages) udl_gem_put_pages(obj); - drm_gem_free_mmap_offset(gem_obj); + if (gem_obj->dev->vma_offset_manager) + drm_gem_free_mmap_offset(gem_obj); } /* the dumb interface doesn't work with the GEM straight MMAP