From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63EE6606A31A for ; Mon, 30 Nov 2026 22:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fDR0q6Ae Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 026C510F0C9; Mon, 30 Nov 2026 22:15:44 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94B0A10F0C9 for ; Mon, 30 Nov 2026 22:15:38 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 2D47341FBB; Mon, 30 Nov 2026 22:15:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F08941F00896; Mon, 30 Nov 2026 22:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796076938; bh=SQxj4GuFHV7C40MBrceQWZ89x7lLK4SDivopzM31Uy4=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=fDR0q6AeWy+R7fhCD1e9zVbta5USTDmSYNyeqQw+jheQeZkJU6S7evsuxs61UeE7w 1hs0aXe/Z9tgyo4GQokzD6PMHSaY8VNIGnCSRNKb5xiM+DgVeAvgKGJqOdmvtq1ge3 LQbv23Y7EAl4TBqQ+qEJxLNNSC/nXweFds9AgkVuZS0kR99bCwz/ymi86QO64rrs50 QkIkEbMtPpRqnr+YOyeHGI+wQm2LsMRECPvcgXcFIk4XPpAx8is5eN8e8+H61u573D 3iNCcSrIzPZykKrjJmxzP/t61O6fTTmmDw8AUL0ZRe8PvpdXNKMFXYxcZF7X742xbt 0x/rrnKIUYQ3w== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/2] drm/i915/pxp: access the component data under lock when sending IO messages To: "Daniele Ceraolo Spurio" , intel-gfx@lists.freedesktop.org In-Reply-To: <20261130220020.278579-5-daniele.ceraolospurio@intel.com> References: <20261130220020.278579-4-daniele.ceraolospurio@intel.com> <20261130220020.278579-5-daniele.ceraolospurio@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 22:15:37 +0000 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-gfx" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] drm/i915/pxp: unlocked pxp_component read before locking tee_mutex [1] -- commit 42cfbb60a511aa2cd5a38a2e1ac5e01feec04a77 Author: Daniele Ceraolo Spurio drm/i915/pxp: access the component data under lock when sending IO messages This commit moves the read of pxp->pxp_component inside pxp->tee_mutex in intel_pxp_tee_io_message() to avoid racing with component unbind. > diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c b/drivers/gpu/drm/i= 915/pxp/intel_pxp_tee.c > index 1784153f0cf85..a42b786b56126 100644 > --- a/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c > +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.c > @@ -61,11 +61,13 @@ static int intel_pxp_tee_io_message(struct intel_pxp = *pxp, > u32 *msg_out_rcv_size) > { > struct drm_i915_private *i915 =3D pxp->ctrl_gt->i915; > - struct i915_pxp_component *pxp_component =3D pxp->pxp_component; > + struct i915_pxp_component *pxp_component; > int ret =3D 0; > =20 > mutex_lock(&pxp->tee_mutex); > =20 > + pxp_component =3D pxp->pxp_component; > + > /* > * The binding of the component is asynchronous from i915 probe, so we > * can't be sure it has happened. [Severity: Critical] This problem wasn't introduced by this patch, but does intel_pxp_tee_stream_message() have the same unlocked pxp->pxp_component read [1] before acquiring pxp->tee_mutex? drivers/gpu/drm/i915/pxp/intel_pxp_tee.c:intel_pxp_tee_stream_message() { ... struct i915_pxp_component *pxp_component =3D pxp->pxp_component; unsigned int offset =3D 0; struct scatterlist *sg; int ret; if (msg_in_len > max_msg_size || msg_out_len > max_msg_size) return -ENOSPC; mutex_lock(&pxp->tee_mutex); if (unlikely(!pxp_component || !pxp_component->ops->gsc_command)) { ... } If mei_pxp_remove() unbinds the component and frees comp_master after pxp_component is read on entry to intel_pxp_tee_stream_message() but before pxp->tee_mutex is locked, intel_pxp_tee_stream_message() checks the stale local pointer and dereferences freed memory when calling pxp_component->ops->gsc_command(): CPU0 CPU1 intel_pxp_tee_stream_message() pxp_component =3D pxp->pxp_componen= t; mei_pxp_remove() component_master_del() i915_pxp_tee_component_unbind() mutex_lock(&pxp->tee_mutex); pxp->pxp_component =3D NULL; mutex_unlock(&pxp->tee_mutex); kfree(comp_master); mutex_lock(&pxp->tee_mutex); if (!pxp_component || ...) pxp_component->ops->gsc_command(...) <-- use-after-free [1] https://sashiko.dev/#/bug/linux-af0f5760-e7bb-43e3-9b35-d6b6f63dcfde --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130220020.2785= 79-4-daniele.ceraolospurio@intel.com?part=3D1