From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7405EC19F2A for ; Thu, 11 Aug 2022 16:24:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237989AbiHKQYB (ORCPT ); Thu, 11 Aug 2022 12:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237855AbiHKQXc (ORCPT ); Thu, 11 Aug 2022 12:23:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF33BA220A; Thu, 11 Aug 2022 09:04:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CDA761387; Thu, 11 Aug 2022 16:04:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 785DFC4347C; Thu, 11 Aug 2022 16:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660233873; bh=Vj7PwdQ49BJnUhlC3XmBabmhq+7w685PYhqGwl6Rkgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IexsCHPtF9n+uySimnaNJnlaoUIb49pEPHs5WmoahdfJbi8cK+O/VuXQDLcVquNI3 4pqR6gQrxSSfYmxwSOYK6mqRqZqvBGp42gTdRgYQCCLfhFGVplok1qD5WXFYtwwiGn 3TrT7SXQWCfC8JwJEusDp0Eh8fj3Gw7ZrfUoZB+fXlIiz74/YxjgZOk0b79X5pzDTP SocSFQfND+D5/xqNwRz1+65mu2gJZ46HDgofbBPbC4J/KC0JJcbqKjlGkLZgIzxeJc jEUK0qFAPz03+DJ0NR1qvln2cF2OW1di0e5ASSMH6sd5E2jwqyJxgsv/5sE8cWoG2c 5b+Jxd8Q2JXBw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mark Menzynski , Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, Sasha Levin Subject: [PATCH AUTOSEL 5.10 04/46] drm/nouveau: clear output poll workers before nouveau_fbcon_destroy() Date: Thu, 11 Aug 2022 12:03:28 -0400 Message-Id: <20220811160421.1539956-4-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220811160421.1539956-1-sashal@kernel.org> References: <20220811160421.1539956-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mark Menzynski [ Upstream commit 6b03816f869529393b37d03e5d75b68f7365a7a4 ] Resources needed for output poll workers are destroyed in nouveau_fbcon_fini() before output poll workers are cleared in nouveau_display_fini(). This means there is a time between fbcon_fini() and display_fini(), where if output poll happens, it crashes. This patch introduces another output poll clearing before fbcon resources are destroyed. BUG: KASAN: use-after-free in __drm_fb_helper_initial_config_and_unlock.cold+0x1f3/0x291 [drm_kms_helper] Cc: Ben Skeggs Cc: Karol Herbst Cc: Lyude Paul Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Mark Menzynski Reviewed-by: Lyude Paul Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220523113541.10562-1-mmenzyns@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 24ec5339efb4..502f960517fe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -39,6 +39,7 @@ #include #include +#include #include #include #include @@ -603,6 +604,7 @@ nouveau_fbcon_fini(struct drm_device *dev) if (!drm->fbcon) return; + drm_kms_helper_poll_fini(dev); nouveau_fbcon_accel_fini(dev); nouveau_fbcon_destroy(dev, drm->fbcon); kfree(drm->fbcon); -- 2.35.1