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 171166FA0 for ; Mon, 16 Jan 2023 16:54:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B17DC433EF; Mon, 16 Jan 2023 16:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673888063; bh=L1KxcW33LNQv3HAtCHgeNVQ4jESZlz9Dnmw5PjeazPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CoKmBLB9KCax/fVY2++zmwlg3vY81IM3jKF04+Cn21y5z08FkAvu+QAYrc1UsbEaL cMn9djTtDPRNUyYTA9WTNRhpHxHhoUDY2fzJv2h0TUeDw684BR8QG66DGKmKEnw2Q+ leuBFOiQJd0tMvoSqccJHWqzrxBk/ZdE90DBkXjI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luo Meng , Mike Snitzer Subject: [PATCH 4.19 386/521] dm cache: Fix UAF in destroy() Date: Mon, 16 Jan 2023 16:50:48 +0100 Message-Id: <20230116154904.383724551@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154847.246743274@linuxfoundation.org> References: <20230116154847.246743274@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 @@ -1987,6 +1987,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);