From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381411; b=E2VdU2tI/VtXWmTBlylphJZ0hgAI8xdlOKp5CVgXmPcGM45Cj49ryJHQLROjb4ht1fVl avghDDOERnthD/tDkMYCYLC2+8APUPSE2FBCc/abvbVMGcoT/pOYUyDPSZbyZHSb88Yb9 zNECQnH6hLFiGjY+hjF3xKoQMxYgHe3tgZfhgYPCxuUt6WgDPI4Ud6Pf7PlYjffOPzEPv w7Wb+xcD+iF+LUJVw/eKgupKqbLrdZ529Nxu/qdHF7CmBAntlcBmFHLTsZGXfFvfGx8Aa PT0iAc4z2yhi1AaMlJUBWtgL6kX8ssTmhInA74xko0uHBueNRhyXTkOVziwTWgJ+gLw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381411; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=U0YdjMv1NmYc517hf38V9I+Q7znTYNifd6C3RiLjK94=; b=c7rg5zTg4shlzoND8OVFMxJPcPTZyeRXdHXhl9m/ahnFM/prgKOafHFuf5MutFRszsj4 fRkiRBqdqJtJfwYCM6tObllwJtwGLrxOt25bfEj1La8svsJvY9HXZ0Z3scVFL1r0hxsiw L5iBJhEOKy62dY26E8CzEAzFdOMwlG5kGrZ3PD/7H+Fm0dc9iT6F/d9Om4XxAoXHvZMUk 4lUhneGlP2Zmo/BESBwf8CN4b5h1HvY+gy3C+M3rVwIlg9Ph4lUrOkcYfZ6+qDRpG4n5H U7d8qx+3n+a4QIU+8g4dkJgjODuEIyqQIv9kQzCt/5gAeJ5ImK2FOPt8VQEtg3tL32g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=EYiJkb69; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4024606A322; Fri, 4 Dec 2026 10:50:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=EYiJkb69 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59BAC1F00931; Fri, 4 Dec 2026 10:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381410; bh=U0YdjMv1NmYc517hf38V9I+Q7znTYNifd6C3RiLjK94=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EYiJkb69AS5MaNvB/kL0QsA4IPkMLc9rVXIOTczTgWFWkBt70GeR40wrhKcLQaFW9 e+PFHtQBjv9Qgpgs6rVu5l5ApK480Z5rUq1R6nN7t5dOsLHRwJFaNtL/AKz2zs56oO BSNmrUB+tz7RPSHkCMU69NCTzdL4EbK6ZkHKxHFU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dave Airlie Subject: [PATCH 7.3 691/742] i915/vma: use kfree_rcu to make sure vma are freed after a rcu grace period Date: Fri, 4 Dec 2026 19:09:15 +0900 Message-ID: <20261204100653.411739344@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Airlie commit 4cd3c5bdf16789fc8c8736ed1a1a645b8cecb3b6 upstream. There is a race in the vma lookup and the vma freeing that can race object close against object execbuffer vma lookups. execbuffer2 and close on two threads can be raced, so the radix tree lookup and tryget in eb_lookup_vma can be raced against a freed vma. The rcu protection in the eb lookup doesn't help because we don't use rcu around the free path. This patch adds rcu protection around the vma destruction path. We could also probably use SLAB_TYPESAFE_BY_RCU but there may be other submarined vma races in other code that this might not fix, so let's just force the rcu on free. Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_vma.c | 2 +- drivers/gpu/drm/i915/i915_vma_types.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/i915_vma.c +++ b/drivers/gpu/drm/i915/i915_vma.c @@ -67,7 +67,7 @@ static struct i915_vma *i915_vma_alloc(v static void i915_vma_free(struct i915_vma *vma) { - return kmem_cache_free(slab_vmas, vma); + kfree_rcu(vma, rcu); } #if IS_ENABLED(CONFIG_DRM_I915_ERRLOG_GEM) && IS_ENABLED(CONFIG_DRM_DEBUG_MM) --- a/drivers/gpu/drm/i915/i915_vma_types.h +++ b/drivers/gpu/drm/i915/i915_vma_types.h @@ -248,6 +248,9 @@ struct i915_vma { struct list_head closed_link; + /** rcu head for kfree_rcu */ + struct rcu_head rcu; + /** The async vma resource. Protected by the vm_mutex */ struct i915_vma_resource *resource; };