Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1779880pxb; Wed, 9 Feb 2022 04:27:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJydo4z8T7/4W6bBDC1DQ+r3jUV+FVvbK6lPewUTCMd3IFtro3/6mz9X3zO2rCudoIpYEfNP X-Received: by 2002:a05:6a00:1394:: with SMTP id t20mr2024724pfg.70.1644409637498; Wed, 09 Feb 2022 04:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644409637; cv=none; d=google.com; s=arc-20160816; b=VaK4kEUHAqYTnZUrg2IpIzAZ1W6uIoF6YqFjalxO8gqPqRp5ci95/WAran7VcRNezS 061OqbZXbmCEbCUaghToiJyVj2lq0bbJCiqN2Z825bliAHaPHf2MzPie3YYkBqsv8RYq AvfW7wtwYqhmuf+YYoJFZfNyjYKWl/ZJHrzUw7bFyFXkj09ReP6XQi3osoab9jApWCFT I+A4LJ6wSBeu2lpcfSnld+XDHnGoIZcadfmPIZBtgAAEhxqMOBbaxmovSESSA1eV3WIG WMez8ib1J3XrGhkZETjwcdTVOHw93P54tGiU6PoRi3IMzFPDefJUQFfVjoY2ZCN/LcjW hq/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zDoLMZzrudKIrpodgxhULTVgLL7j68Nn7gXmVdUXkZU=; b=wdFbBTQwaY3bSKqB55p6QBI7go9KCB0o2OxKxNhfkWAArspxbb71tbFzz5AdFmlX4s +8z4BPoK2JcWUZ3ftcenjeDepRo2bi7jhGN/UOdofSlfwmnU6BdHtIf25YnpWr8gtyGD /ktpaAnENleQQRhgbcE0ZtckkRUeLRa2Tfe/4ylBnWCx37taodK391skU6yIzFLp2vMC fvlMj/Z8+FwEed0IKOtgu7Dj3/kyMNs6t8LG8lGZ73PxTTHiajUUF19vR7tfn0+QIuyb tlmiVetN8V0ECpXhyTHPPd6fritJB6/uMXGURI9kwnHqM5vbZ0veGpxsEM9ZptzxFC+D JcBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ca9cA0aw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id r16si1117458pfl.337.2022.02.09.04.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 04:27:17 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ca9cA0aw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 59E22E0918EA; Wed, 9 Feb 2022 02:18:13 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387018AbiBGLij (ORCPT + 99 others); Mon, 7 Feb 2022 06:38:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352482AbiBGL0W (ORCPT ); Mon, 7 Feb 2022 06:26:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CA4DC03E910; Mon, 7 Feb 2022 03:25:43 -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 036C76077B; Mon, 7 Feb 2022 11:25:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E20CBC340EB; Mon, 7 Feb 2022 11:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233142; bh=BLyOJI36eHMt72Wa5DjaMq8TiYzOPzbxdmmTZTFuakE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ca9cA0awN41CwBd19+gW5kzRI+mTH/dOgvK/rxC614KQ8itc9epcUTy1Rc6zSDiJE JbU7fMkjIR5KCfvf7Ew35aIQyLIksG825exLF1j0HHSSm9wUyd6pYY9tpmP+qmDMWa UvuGJSQazIhXtdguo9/OWUbapDhSXCAFblwIpPWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Monakhov , Dmitry Ivanov , Alexey Lyashkov , "Martin K. Petersen" , Jens Axboe Subject: [PATCH 5.15 030/110] block: bio-integrity: Advance seed correctly for larger interval sizes Date: Mon, 7 Feb 2022 12:06:03 +0100 Message-Id: <20220207103803.263155646@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103802.280120990@linuxfoundation.org> References: <20220207103802.280120990@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin K. Petersen commit b13e0c71856817fca67159b11abac350e41289f5 upstream. Commit 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") added code to update the integrity seed value when advancing a bio. However, it failed to take into account that the integrity interval might be larger than the 512-byte block layer sector size. This broke bio splitting on PI devices with 4KB logical blocks. The seed value should be advanced by bio_integrity_intervals() and not the number of sectors. Cc: Dmitry Monakhov Cc: stable@vger.kernel.org Fixes: 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") Tested-by: Dmitry Ivanov Reported-by: Alexey Lyashkov Signed-off-by: Martin K. Petersen Link: https://lore.kernel.org/r/20220204034209.4193-1-martin.petersen@oracle.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/bio-integrity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -373,7 +373,7 @@ void bio_integrity_advance(struct bio *b struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9); - bip->bip_iter.bi_sector += bytes_done >> 9; + bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9); bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes); }