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 89EA2C54EBD for ; Wed, 4 Jan 2023 16:17:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239592AbjADQRN (ORCPT ); Wed, 4 Jan 2023 11:17:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239834AbjADQQp (ORCPT ); Wed, 4 Jan 2023 11:16:45 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C8993C388 for ; Wed, 4 Jan 2023 08:16:44 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id 813F9CE1849 for ; Wed, 4 Jan 2023 16:16:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F6A0C433EF; Wed, 4 Jan 2023 16:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672849000; bh=4JAiU6RFn3VqAt5LoRnZv/NfsZu7QEvmtueIVX2WfII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DwLJ9tNfeTAK/aa0ZUMHhmMBA5PHojdB/hIR+62iPwzrbsJukblxe34/fgqGs1cC5 dMCCxB4VlWpAmYET/feH3gvX3f8aHVbeBYHpquzKmxgZyVzo4BaEe42e2Ag9JIAz44 FnTUcAZ9+HkV997L9zCpVXzTtf18Aog7nx6AzzjI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Luo Meng , Mike Snitzer Subject: [PATCH 6.0 049/177] dm integrity: Fix UAF in dm_integrity_dtr() Date: Wed, 4 Jan 2023 17:05:40 +0100 Message-Id: <20230104160509.134044386@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230104160507.635888536@linuxfoundation.org> References: <20230104160507.635888536@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Luo Meng commit f50cb2cbabd6c4a60add93d72451728f86e4791c upstream. Dm_integrity also has the same UAF problem when dm_resume() and dm_destroy() are concurrent. Therefore, cancelling timer again in dm_integrity_dtr(). Cc: stable@vger.kernel.org Fixes: 7eada909bfd7a ("dm: add integrity target") Signed-off-by: Luo Meng Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-integrity.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -4558,6 +4558,8 @@ static void dm_integrity_dtr(struct dm_t BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress)); BUG_ON(!list_empty(&ic->wait_list)); + if (ic->mode == 'B') + cancel_delayed_work_sync(&ic->bitmap_flush_work); if (ic->metadata_wq) destroy_workqueue(ic->metadata_wq); if (ic->wait_wq)