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 2F6A88481 for ; Fri, 10 Mar 2023 14:14:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5935C433EF; Fri, 10 Mar 2023 14:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678457674; bh=qb+KCG4feqfcL+4WEq3pRq76ehB7utZ3BMRoQoUz9R4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/lWKt7IecUd/LTA7M2vPOpbXhmlSkGv9wST0JNdifTBOL+4Oow5zrxRNIi0MAHdB CSBDuObwg+bFwvjLa1amZpV1hGG6/kgljiomei6W9GtD80uSACmmDJHzg9bnX0D3BO coiZdb6I0LDvYQH9D4mTjcnHkJL8tY00nqQ3UKfc= 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 4.19 019/252] block: bio-integrity: Copy flags when bio_integrity_payload is cloned Date: Fri, 10 Mar 2023 14:36:29 +0100 Message-Id: <20230310133719.407589198@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310133718.803482157@linuxfoundation.org> References: <20230310133718.803482157@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: 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 2e22a3f7466a8..469e30a6d3cde 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -444,6 +444,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