From patchwork Mon Feb 19 12:50:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nirmoy Das X-Patchwork-Id: 13562661 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 52446C48BF8 for ; Mon, 19 Feb 2024 13:04:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3064310E39F; Mon, 19 Feb 2024 13:04:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="AUF0ansf"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id 020D910E20F; Mon, 19 Feb 2024 13:04: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=1708347864; x=1739883864; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eLx8SsGDcLIwXcAYcznhdvVOFyZUXADeQ6SsZ8dcwz4=; b=AUF0ansfqflvCJcGLOhOtgxeHeNwg48Jgjf54LN1Hmbb8Pv9pH/Glguj ILhq3avhuTamblMosN84yEKLFkOo7IgfV2hEPuK1VmOtDF+2qVmBX/u2K ZOp5RNXkvmm+pGYjWPKsub9Zl48FqV9ae7yiC0HDhElRhQZGb58D1waG1 yO3WXYybyNCicCeazsfkWBKuwXMYDBzMa5Pej8eoFsrdWZVwzzhkuEKJs oIJ1BdsuXVR5CsdFcrYpIdaPoFqldO9gl/YXjlOmVRNP0FkAfB/mHNANe /TO15izyN1eC3F6y1pWQ+FIp0pY155YEhB11D8IUOHTFpn13foMbm6xLU Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="27871574" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="27871574" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 05:04:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4850121" Received: from nirmoyda-desk.igk.intel.com ([10.102.138.190]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 05:04:21 -0800 From: Nirmoy Das To: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org, Nirmoy Das , Andi Shyti , Shawn Lee Subject: [PATCH] drm/i915: check before removing mm notifier Date: Mon, 19 Feb 2024 13:50:47 +0100 Message-ID: <20240219125047.28906-1-nirmoy.das@intel.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Organization: Intel Deutschland GmbH, Registered Address: Am Campeon 10, 85579 Neubiberg, Germany, Commercial Register: Amtsgericht Muenchen HRB 186928 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Error in mmu_interval_notifier_insert() can leave a NULL notifier.mm pointer. Catch that and return early. Cc: Andi Shyti Cc: Shawn Lee Signed-off-by: Nirmoy Das Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c index 0e21ce9d3e5a..61abfb505766 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c @@ -349,6 +349,9 @@ i915_gem_userptr_release(struct drm_i915_gem_object *obj) { GEM_WARN_ON(obj->userptr.page_ref); + if (!obj->userptr.notifier.mm) + return; + mmu_interval_notifier_remove(&obj->userptr.notifier); obj->userptr.notifier.mm = NULL; }