Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1831886pxb; Wed, 9 Feb 2022 05:32:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeLzgONXd3wqXULWej7D/UzGaEtIBm50dM1MGOvwKI2QVcxLRsUeT/cqm939OOPFjpL3nU X-Received: by 2002:a17:90b:4b88:: with SMTP id lr8mr3429114pjb.166.1644413559181; Wed, 09 Feb 2022 05:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644413559; cv=none; d=google.com; s=arc-20160816; b=jQtKWrIN0o34bb+pZ9SlISEGxJQRANaj5jXXrmibWcm5OLjGXFkwfYV8G42MVMgqVN vm4JreD9t4MeGRaGmViL9xrf8UmAkWnhSIWDJZyYWdWVmo37dsdeUA6yw9Ra3kQ4m1oi 3hi3biH4iZ+LA8Vph1z/mFuTAOLcLWkr1dU6xvFF+g8vqSanKHmcT727QR03Xi9pcb23 ByhyrdU+/PElhVK7XOyVUMm9gKqqWGPA+InCbo4zNqOXdIk8UEHlG/MeDGRV29ipFm0q LtD7Kk/PyByrXc+Zsjtg3Im9aVHbehbxCK0YoNWaQ4SiOi3KlCP0Nj0pvu/ZYr4n3NgU 66lQ== 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=1rUahm+dFSIFy8WxO1NNUqezLWgN4LDU5UdihKExZp0=; b=X1n9XrBma6u9/q8Lu8vBgZrfSMLJzq3T8zQqHX0AQwvUddZkAzcv4qMqjY1k+QMfaQ ni8BWGwO9j0q3DEKLrudYzrwt7AkgDPXM4Ir3B0xOOnB0uwqvhItTHEjvs9YlYEdZS1S rBMXUTRPnJXEMADsAQX1N41MVj6Teqvzi/tELRM+48GiEs1uapLJ1a6Qrdcgb5nWxtBT Zwb2NePua+zdI4PAgLL/SuPZFN5iBmn/yUyz49/9FqZIj+qelNrBW+2xo/CtPg1TekVT dd47zeu0GEP22lSTHuy8vBoDbrCNUAlj/CLFjrQghuDHknMUjhGznwvPt7lDda5WU0bV yBxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WwzF9fXH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s3si8641219plg.526.2022.02.09.05.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:32:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WwzF9fXH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 64205E124143; Wed, 9 Feb 2022 02:16:45 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384020AbiBGLY2 (ORCPT + 99 others); Mon, 7 Feb 2022 06:24:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382312AbiBGLSt (ORCPT ); Mon, 7 Feb 2022 06:18:49 -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 04F76C03F938; Mon, 7 Feb 2022 03:18:35 -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 8D06DB81028; Mon, 7 Feb 2022 11:18:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD03C004E1; Mon, 7 Feb 2022 11:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644232713; bh=dAmIPYQVBvWgi3bxIbj5YMAmI6/YT3+3J/UdfZNiyYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwzF9fXHt9YIvvhM+9FPtkNqIsivO7K4bw7Ena6iFyTAQvdaqUwaWJ5CvKfSynLM7 WIk5c8SGkVq9DrthDektx1v3dWE9JbxisvzA55Bbs0t1pHuxqOwuvDnfTnikCbysxj fYN/k/m8A+PXpbtzGAUNsqu9oRObTcSuZuDo9Oek= 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.4 13/44] block: bio-integrity: Advance seed correctly for larger interval sizes Date: Mon, 7 Feb 2022 12:06:29 +0100 Message-Id: <20220207103753.586711165@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103753.155627314@linuxfoundation.org> References: <20220207103753.155627314@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 @@ -380,7 +380,7 @@ void bio_integrity_advance(struct bio *b struct blk_integrity *bi = blk_get_integrity(bio->bi_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); }