From nobody Wed Feb 11 08:59:40 2026 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 440DAC6FD1D for ; Thu, 16 Mar 2023 03:23:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbjCPDXc (ORCPT ); Wed, 15 Mar 2023 23:23:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjCPDXC (ORCPT ); Wed, 15 Mar 2023 23:23:02 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6CBA64B5 for ; Wed, 15 Mar 2023 20:20:58 -0700 (PDT) Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230316031940epoutp02ce393f504354795b3d2b1eda50b513d3~MyBs8ddUf0263402634epoutp02P for ; Thu, 16 Mar 2023 03:19:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230316031940epoutp02ce393f504354795b3d2b1eda50b513d3~MyBs8ddUf0263402634epoutp02P DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1678936780; bh=LkGb9gudNokFJQy+N1Um3lBkQSilGBO0QXo/O4ejpOE=; h=From:To:Cc:Subject:Date:References:From; b=oAK9wInLQaY4XeCBa0ZxvjGG07lSdd8ltStj4GswHm5sFaZxU2Vd6MrfTRurxUZxf TjGq1SCIPzsbsKuPWxoldXThEKuqgvDFE5NaZNEmWMHXqxqHxjkL0NIL1Xnv3iLJH+ E4jpDiT3uq1tl4+t9G2bFYYSW6tM7SOsUOhCuupk= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20230316031940epcas1p4caa8b32f085acd38d3d98e6baa0de599~MyBsl-9vU2301623016epcas1p47; Thu, 16 Mar 2023 03:19:40 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.38.241]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4PcXYl4G4Qz4x9Q5; Thu, 16 Mar 2023 03:19:39 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 97.98.54823.8CA82146; Thu, 16 Mar 2023 12:19:36 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230316031936epcas1p1ebd93477dcf3bf9ab1640306dd1da8ff~MyBpa58kf2332323323epcas1p1c; Thu, 16 Mar 2023 03:19:36 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230316031936epsmtrp1a883352cb7166f657325f6a3b10bbcaf~MyBpaMa_20887908879epsmtrp1z; Thu, 16 Mar 2023 03:19:36 +0000 (GMT) X-AuditID: b6c32a39-a97ff7000000d627-52-64128ac87ef3 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id AC.71.18071.8CA82146; Thu, 16 Mar 2023 12:19:36 +0900 (KST) Received: from localhost.localdomain (unknown [10.253.99.41]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230316031936epsmtip29bbf332b78a1d49bb5febf990943fc99~MyBpQ25921011610116epsmtip2L; Thu, 16 Mar 2023 03:19:36 +0000 (GMT) From: Yeongjin Gil To: agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com Cc: totte@google.com, linux-kernel@vger.kernel.org, Yeongjin Gil , Sungjong Seo Subject: [PATCH] dm verity: fix error handling for check_at_most_once Date: Thu, 16 Mar 2023 12:18:42 +0900 Message-Id: <20230316031842.17295-1-youngjin.gil@samsung.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrHJsWRmVeSWpSXmKPExsWy7bCmge6JLqEUg31HjS3WnzrGbLH33WxW i8u75rBZbPl3hNXixC1pi43PGC1m7H/K7sDusWBTqcemVZ1sHu/3XWXz6NuyitHj8ya5ANao BkabxKLkjMyyVIXUvOT8lMy8dFul0BA3XQslhYz84hJbpWhDQyM9QwNzPSMjIz1To1grI1Ml hbzE3FRbpQpdqF4lhaLkAqDa3MpioAE5qXpQcb3i1LwUh6z8UpDD9YoTc4tL89L1kvNzlRTK EnNKgUYo6Sd8Y8w4uv4iY8FS7op12z6zNDDu4Oxi5OSQEDCR+LnyA3MXIxeHkMAORonDy06z QzifGCWmPHvJCOF8Y5TYuvAsC0zLx+fvWCASexklVu+ZzQiSAGuZuc4TxGYT0JWY+vIpK4gt ImAt8aJpJlgDs0ALo8TaR2+YQRLCAq4Sn2edYAexWQRUJW7d7wEaxMHBK2Ar8eWwMogpISAv sfiBBEgFr4CgxMmZT8BuYAYKN2+dDXa2hMAldonH05uhjnOR2HJ4LTOELSzx6vgWdghbSuJl fxs7REM7o8SKh3MYIZwZjBJ/399nhaiyl2hubWYD2cwsoCmxfpc+RFhRYufvuYwQtqDE6Wvd zBBX8Em8+9rDCnEor0RHmxBEiZrElUm/oCbKSPQ9mAV1g4fExE8dTJCwipW4NH870wRGhVlI fpuF5LdZCEcsYGRexSiWWlCcm55abFhgihzJmxjBSVXLcgfj9Lcf9A4xMnEwHmKU4GBWEuEN ZxFIEeJNSaysSi3Kjy8qzUktPsSYDAzricxSosn5wLSeVxJvaGZmaWFpZGJobGZoSFjYxNLA xMzIxMLY0thMSZxX3PZkspBAemJJanZqakFqEcwWJg5OqQamRlunZ/4SV28yRnoyJBhfX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0TTuY/FtM8o7TU+s/v7 6hfPWBxchCrW+eutYo2YLcqy43zvO+4Ul1uuH99k8SmyTQ9iUa1h4zh1NXvJ5wneH+Qatv1j mjC79ftO3edOoe59Lff2z81QuaCQMH/1YrkXN689Znuu+iy+3++Rv+uHmx9X7+s7Vh6jXrnk YYzF/JYHrZxFn7ZuC29KU3o556sSS3FGoqEWc1FxIgCC9DHavQIAAA== X-CMS-MailID: 20230316031936epcas1p1ebd93477dcf3bf9ab1640306dd1da8ff X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE X-ArchiveUser: EV CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230316031936epcas1p1ebd93477dcf3bf9ab1640306dd1da8ff References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In verity_work(), the return value of verity_verify_io() is converted to blk_status and passed to verity_finish_io(). BTW, when a bit is set in v->validated_blocks, verity_verify_io() skips verification regardless of I/O error for the corresponding bio. In this case, the I/O error could not be returned properly, and as a result, there is a problem that abnormal data could be read for the corresponding block. To fix this problem, when an I/O error occurs, do not skip verification even if the bit related is set in v->validated_blocks. Fixes: 843f38d382b1 ("dm verity: add 'check_at_most_once' option to only va= lidate hashes once") Signed-off-by: Sungjong Seo Signed-off-by: Yeongjin Gil --- drivers/md/dm-verity-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c index ade83ef3b439..9316399b920e 100644 --- a/drivers/md/dm-verity-target.c +++ b/drivers/md/dm-verity-target.c @@ -523,7 +523,7 @@ static int verity_verify_io(struct dm_verity_io *io) sector_t cur_block =3D io->block + b; struct ahash_request *req =3D verity_io_hash_req(v, io); =20 - if (v->validated_blocks && + if (v->validated_blocks && bio->bi_status =3D=3D BLK_STS_OK && likely(test_bit(cur_block, v->validated_blocks))) { verity_bv_skip_block(v, io, iter); continue; --=20 2.39.2