From patchwork Thu Sep 17 14:21:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Melissa Wen X-Patchwork-Id: 11782633 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 86BC8746 for ; Thu, 17 Sep 2020 14:21:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 529A722227 for ; Thu, 17 Sep 2020 14:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Gf2VHjDf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 529A722227 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1CD7E6E2B0; Thu, 17 Sep 2020 14:21:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EEFE6E2B0 for ; Thu, 17 Sep 2020 14:21:54 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id l15so4557506wmh.1 for ; Thu, 17 Sep 2020 07:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=5FnmYtdXAn2GfXn0e/JA4kujHMKHfd/DBUE2dQvYwgc=; b=Gf2VHjDfGmm9jrDvmYL4jz5y45xySJnjysTrqANbMzxQPRjuOMt72KfrKD71HetTlL GKhqe6MfA46drBGR0zd8zud/Pa7hEGUl1JdkL8LikUjqK/mpJhKqQeJEO6ahRwOcLkd1 MRHJejKac8RXl42/N9CklbXNdsbH5Rn5R96UvSkhRbQ9Z32n5qVCRog4xjPJwsB7bdu7 drXNTEyy/gq7khARyXSpioNWh/1l0NWmpIMa3I2K81Ca5GrcvgFpfHIw7nMKGI04WPDb Ln984b+6/EO0xisuNQvf3weBsEWIKa96jGoeAP44rZdEytQCTT+EUjA16G0V3PODIwpu KIcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=5FnmYtdXAn2GfXn0e/JA4kujHMKHfd/DBUE2dQvYwgc=; b=RhHoQ0bX60DwqHXFMseQAfTyZAbMQY9GFatap2eY9I+o1G9nnndC+DidnfRA5uhDQh dy+NJw2848YloVavPIA2Z18QyX1mIT1mp1QbAiWjZw50QjshFyn/BdwodW5YDGHG66TZ /EycxEysdcnvBMG/Gsm40Hf8WbIcFdvb6x1MDN3SbyDBTAQbPyQSpEM4Wff472hq7jvT n0Ho8TH+6N5YXU/6pJz58qm2Cw32d4oX/7KI15p7LJsyzQHeewXYo479iaZ5vcoRxq8p 6wRBiVx4yVQV/vRfmZ4uPZ88HNj2e6RAXD/OyRsqyT3ABQVqVAc6Y8czoNkKkMK+7i1h W4ww== X-Gm-Message-State: AOAM533wHx7SSJUR8v4/L71P4fsarBRD2B9ef9WxwkPcChXJWVl+g5lT xbrtPVuCqSfUYJCQiOD48WUQ7pW+hzDb0w== X-Google-Smtp-Source: ABdhPJycYUiauYLP6RHWxZ07Hqg0M6H3AS73hlY+BtUCrt3NweQ9aMj6lSlkhiWeCUDRIlwak8XZ+w== X-Received: by 2002:a1c:bcd6:: with SMTP id m205mr8037634wmf.68.1600352513274; Thu, 17 Sep 2020 07:21:53 -0700 (PDT) Received: from smtp.gmail.com (a95-92-181-29.cpe.netcabo.pt. [95.92.181.29]) by smtp.gmail.com with ESMTPSA id w14sm42327866wrk.95.2020.09.17.07.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 07:21:52 -0700 (PDT) Date: Thu, 17 Sep 2020 11:21:45 -0300 From: Melissa Wen To: Daniel Vetter , David Airlie Subject: [PATCH] drm/vgem: validate vgem_device before exit operations Message-ID: <20200917142145.ipcxb2zo4up357t2@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch adds a check for the vgem_device before handling it. Signed-off-by: Melissa Wen --- drivers/gpu/drm/vgem/vgem_drv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index cb884c890065..119ca887cb8a 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -472,7 +472,14 @@ static int __init vgem_init(void) static void __exit vgem_exit(void) { - struct platform_device *pdev = vgem_device->platform; + struct platform_device *pdev; + + if (!vgem_device) { + DRM_INFO("vgem_device is NULL\n"); + return; + } + + pdev = vgem_device->platform; drm_dev_unregister(&vgem_device->drm); devres_release_group(&pdev->dev, NULL);