From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90A653E1CE8 for ; Thu, 25 Jun 2026 12:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782391235; cv=none; b=Bs8QC1BDl0DG6SVc3/WPhXy24eVJAgovkR+5q9eZgrLWhAdc6ks8Ck+G8vj/Tw5QKaWWp5/AJIvGB3GGWahdlqD6KFyRT5cSzgeL7hjW8KFhKaulVsjGef8xODWuxA9+3B0I4Aa5mZEiN9k4oBBwWe4OL2v17HOlgl92tl5JzSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782391235; c=relaxed/simple; bh=svc/sSg0MQErtiJsmeWhPL35iTOYisGGDBfUUJZ83XI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b2W726NXQDZcKsZqSoUQa9tCvuPklrTNLRL7i4+E3gZpKV9ekX9bc0hM95LacjZPYCWMIqASdPJzvozaDCmM9fbnzNW5zYxHU7KX1JbZdAPQYjZ6Uyljt31rzemUsrSGK4obqwnebnnp119iJhC2etIiZp9+JY8yzGXtCBxvM/4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=IVqE8aEn; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="IVqE8aEn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1782391232; bh=svc/sSg0MQErtiJsmeWhPL35iTOYisGGDBfUUJZ83XI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=IVqE8aEnvO5m1Bwqc64rcbJJfj/CSMbzSrd/dYGFdVpQvMR+aUXRV6lby/XXK4cXa gUVDmTlcbjx/U0GAvy4MezLxNvfC/49zrKwmzMvsND3rSsFYcU3D6VlqEjlVUNfzG6 fhJSnYWXEltLYlQk2g6PvtXOS+6EQHtVE2HKRpxpxPeVdufq7zFlTHk/3wnhZQpP+5 vbAFzsjCYYstq+wWOBy0ljG2tjxj0J0PO50YFxwwsMYOSn2gkdG9uLLzwEemkU6HvD WXDfwHMwLJIq0hG6VpDgXbOPHQAGKfMDhLf+ZJhxL4g4JMyOQlMNMkxzYam6WrFlOS t/rZojiNv979g== Received: from fedora-2.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 928DB17E0E48; Thu, 25 Jun 2026 14:40:31 +0200 (CEST) From: Boris Brezillon Date: Thu, 25 Jun 2026 14:40:29 +0200 Subject: [PATCH 03/11] drm/panthor: Fix UAF on works queued to panthor_cleanup_wq Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260625-panthor-misc-fixes-v1-3-b67ed973fea6@collabora.com> References: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> In-Reply-To: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> To: Steven Price , Liviu Dudau Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Nicolas Frattaroli , Chia-I Wu , Karunika Choo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Boris Brezillon , sashiko-bot@kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1782391229; l=1347; i=boris.brezillon@collabora.com; s=20260429; h=from:subject:message-id; bh=svc/sSg0MQErtiJsmeWhPL35iTOYisGGDBfUUJZ83XI=; b=8jhS++k+3i31gOxoKbPAUjOPEhesK5G4rJdspiVQSsqao8JCu99Tl0JAgUKAmb5mAJJfH3i9J //9rPfZxYK6BRRO+8rbg30OaMkcz4j4kZTAJjvTXoQibPS6y1Ra8ruD X-Developer-Key: i=boris.brezillon@collabora.com; a=ed25519; pk=eN+ORdOgQY7d5U+0kA8h5bf67XdD8bhKbjD/TCHexSY= If we don't drain the panthor_cleanup_wq before unregistering/destroying the panthor_device, we might end up with cleanup works that are executed after the device is gone. Add a drain_workqueue() call in panthor_device_unplug() to prevent that. Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block") Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block") Reported-by: sashiko-bot@kernel.org Closes: https://sashiko.dev/#/patchset/20260625-panthor-signal-from-irq-v5-0-8836a74e0ef9@collabora.com?part=2 Signed-off-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_device.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c index 0b25abebb803..a0774e28aa94 100644 --- a/drivers/gpu/drm/panthor/panthor_device.c +++ b/drivers/gpu/drm/panthor/panthor_device.c @@ -101,6 +101,11 @@ void panthor_device_unplug(struct panthor_device *ptdev) panthor_gpu_unplug(ptdev); panthor_pwr_unplug(ptdev); + /* Make sure works queued to panthor_cleanup_wq are executed + * before the device is destroyed. + */ + drain_workqueue(panthor_cleanup_wq); + pm_runtime_dont_use_autosuspend(ptdev->base.dev); pm_runtime_put_sync_suspend(ptdev->base.dev); -- 2.54.0