From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1E3BD46B7 for ; Mon, 16 Jan 2023 16:30:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98806C433D2; Mon, 16 Jan 2023 16:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673886613; bh=Z4aUZFRaqv3Zaeo+67xERNk2fgPY6+eFUSWx4qw0qQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9CaFSgj65QnsDEbPOXxEwYQrj5FUdDOOnTIBiNGnDfJ9D0F2Qgxhn7dHc9yYZkts dLypQe4cUSmllv+h37Cqs92ooA1vnyFR0igmJYj/23dr/R28iI9NH/DlVXTsEZpctS vpd06i2ZSnu628c5cdHM28gGwK567QeCO3HCrA0o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luo Meng , Mike Snitzer Subject: [PATCH 5.4 497/658] dm cache: Fix UAF in destroy() Date: Mon, 16 Jan 2023 16:49:45 +0100 Message-Id: <20230116154932.233603372@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154909.645460653@linuxfoundation.org> References: <20230116154909.645460653@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Luo Meng commit 6a459d8edbdbe7b24db42a5a9f21e6aa9e00c2aa upstream. Dm_cache also has the same UAF problem when dm_resume() and dm_destroy() are concurrent. Therefore, cancelling timer again in destroy(). Cc: stable@vger.kernel.org Fixes: c6b4fcbad044e ("dm: add cache target") Signed-off-by: Luo Meng Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-cache-target.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -1992,6 +1992,7 @@ static void destroy(struct cache *cache) if (cache->prison) dm_bio_prison_destroy_v2(cache->prison); + cancel_delayed_work_sync(&cache->waker); if (cache->wq) destroy_workqueue(cache->wq);