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 1600BC678D5 for ; Tue, 7 Mar 2023 19:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233541AbjCGTBk (ORCPT ); Tue, 7 Mar 2023 14:01:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233535AbjCGTBM (ORCPT ); Tue, 7 Mar 2023 14:01:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9641CBC78B for ; Tue, 7 Mar 2023 10:47:46 -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 ams.source.kernel.org (Postfix) with ESMTPS id 13D18B819CA for ; Tue, 7 Mar 2023 18:47:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55FF3C433D2; Tue, 7 Mar 2023 18:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678214833; bh=tvCbtp1BxyWawUq4pJBW/I7MRX3mjCoyT3BAaEK48cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FcMtD2nu+m6Joc3yb/t/tHaC8F4bLLi6W4K+fHrm6XqkZ/zdGmc8juc07ovSWWsik vGVjXJaeJ3CVf40LFDgaS6VMb5oqW8EnGTBqpJFoXue1+e0HOWMNFwIJhcauhtv82B TNvQ/qBhX/Nh6+lF5EkpSinqW3D9WN6TV/3s93x0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Saurav Kashyap , "Martin K. Petersen" , Christoph Hellwig , Chaitanya Kulkarni , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 065/567] block: bio-integrity: Copy flags when bio_integrity_payload is cloned Date: Tue, 7 Mar 2023 17:56:41 +0100 Message-Id: <20230307165908.702173640@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307165905.838066027@linuxfoundation.org> References: <20230307165905.838066027@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: Martin K. Petersen [ Upstream commit b6a4bdcda430e3ca43bbb9cb1d4d4d34ebe15c40 ] Make sure to copy the flags when a bio_integrity_payload is cloned. Otherwise per-I/O properties such as IP checksum flag will not be passed down to the HBA driver. Since the integrity buffer is owned by the original bio, the BIP_BLOCK_INTEGRITY flag needs to be masked off to avoid a double free in the completion path. Fixes: aae7df50190a ("block: Integrity checksum flag") Fixes: b1f01388574c ("block: Relocate bio integrity flags") Reported-by: Saurav Kashyap Tested-by: Saurav Kashyap Signed-off-by: Martin K. Petersen Reviewed-by: Christoph Hellwig Reviewed-by: Chaitanya Kulkarni Link: https://lore.kernel.org/r/20230215171801.21062-1-martin.petersen@oracle.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/bio-integrity.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index 4a7c33ed9a661..4f34ac27c47dd 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -417,6 +417,7 @@ int bio_integrity_clone(struct bio *bio, struct bio *bio_src, bip->bip_vcnt = bip_src->bip_vcnt; bip->bip_iter = bip_src->bip_iter; + bip->bip_flags = bip_src->bip_flags & ~BIP_BLOCK_INTEGRITY; return 0; } -- 2.39.2