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 B99D8C54EBE for ; Mon, 16 Jan 2023 16:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233662AbjAPQmb (ORCPT ); Mon, 16 Jan 2023 11:42:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233707AbjAPQmB (ORCPT ); Mon, 16 Jan 2023 11:42:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E4C136FEB for ; Mon, 16 Jan 2023 08:30:08 -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 dfw.source.kernel.org (Postfix) with ESMTPS id CD64F61089 for ; Mon, 16 Jan 2023 16:30:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E414EC433D2; Mon, 16 Jan 2023 16:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673886607; bh=QvaXAWXgfQTSenmbtOn8yzNUpE0eB8fevIM2V49tfI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rVdJyZWDabHBOYm346Cy9331M/ok5ofEr5DnCo7ADnGsXRX1yChYKrqPbltIMPV1K ufFQXw2GtvNq+VXqHZ8d/jfQ6qSNY6eIoqtdpHSjJTz9jNFTSLtvrbClP92myQeLvk sge+m/kwlNeVAE/c3TyGOiraCoAu5uPwWhMBpRRU= 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 495/658] dm integrity: Fix UAF in dm_integrity_dtr() Date: Mon, 16 Jan 2023 16:49:43 +0100 Message-Id: <20230116154932.154220052@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 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 @@ -4195,6 +4195,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)