From patchwork Fri Sep 23 07:35:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 12986258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 454B0C6FA82 for ; Fri, 23 Sep 2022 07:35:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2254310E476; Fri, 23 Sep 2022 07:35:28 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8060110E469 for ; Fri, 23 Sep 2022 07:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663918523; x=1695454523; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=gIle/YJE+un2mK2jXxsgYlKBsOBm0V1lumhDCUR5n4s=; b=V9igxS/JagkXmdQWEeCaBo/xJHJuaI1lYRA2TiElAUsvuRBifTqxeFjR cW6+OXCrhcNrZc16jbyuEU61rlGNkTIX5wti6hpomvNTA53fToIHAW/TF 7gp4UOLyHVzniOilY4ehUMHiVRZ6mWJ1WNnAjbZ2UxeYSyGcK82vKgqZB khTWyin26l4ZPU0eQb/I2aUfaHNwyxNXUG/wMlF0cGvNx9bcY64fBxEtQ y/MRGWhxcXEqceHcRZzmuge+7T3jNiB8I7+WdDYQ09LxUE1sJuVV2/XkS BNZ8fH+PjWjop5L8H+CpwxHM6Kh074UtnAsYNNmNPO8WCx+ze1U3mFjQ4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="280901047" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="280901047" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 00:35:22 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="795420082" Received: from nirmoyda-desk.igk.intel.com ([10.102.13.19]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 00:35:21 -0700 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Date: Fri, 23 Sep 2022 09:35:14 +0200 Message-Id: <20220923073515.23093-1-nirmoy.das@intel.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Organization: Intel Deutschland GmbH, Registered Address: Am Campeon 10, 85579 Neubiberg, Germany, Commercial Register: Amtsgericht Muenchen HRB 186928 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Fix a potential UAF at device unload X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chris.p.wilson@intel.com, matthew.auld@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" i915_gem_drain_freed_objects() might not be enough to free all the objects and RCU delayed work might get scheduled after the i915 device struct gets freed. Call i915_gem_drain_workqueue() to catch all RCU delayed work. Suggested-by: Chris Wilson Acked-by: Tvrtko Ursulin Signed-off-by: Nirmoy Das Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/i915/i915_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 88df9a35e0fe..7541028caebd 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1278,7 +1278,7 @@ void i915_gem_init_early(struct drm_i915_private *dev_priv) void i915_gem_cleanup_early(struct drm_i915_private *dev_priv) { - i915_gem_drain_freed_objects(dev_priv); + i915_gem_drain_workqueue(dev_priv); GEM_BUG_ON(!llist_empty(&dev_priv->mm.free_list)); GEM_BUG_ON(atomic_read(&dev_priv->mm.free_count)); drm_WARN_ON(&dev_priv->drm, dev_priv->mm.shrink_count);