public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Carlos Llamas <cmllamas@google.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: kernel-team@android.com, linux-kernel@vger.kernel.org,
	 Carlos Llamas <cmllamas@google.com>,
	Eric Biggers <ebiggers@kernel.org>,
	 Christoph Hellwig <hch@lst.de>,
	"open list:BLOCK LAYER" <linux-block@vger.kernel.org>
Subject: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors
Date: Thu, 30 Oct 2025 04:39:18 +0000	[thread overview]
Message-ID: <20251030043919.2787231-1-cmllamas@google.com> (raw)

Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
fail the data unit alignment check.

This was flagged by an LTP test that expects EINVAL when performing an
O_DIRECT read with a misaligned buffer [1].

Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/all/aP-c5gPjrpsn0vJA@google.com/ [1]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
---
 block/blk-crypto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-crypto.c b/block/blk-crypto.c
index 4b1ad84d1b5a..3e7bf1974cbd 100644
--- a/block/blk-crypto.c
+++ b/block/blk-crypto.c
@@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
 	}
 
 	if (!bio_crypt_check_alignment(bio)) {
-		bio->bi_status = BLK_STS_IOERR;
+		bio->bi_status = BLK_STS_INVAL;
 		goto fail;
 	}
 
-- 
2.51.1.851.g4ebd6896fd-goog


             reply	other threads:[~2025-10-30  4:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30  4:39 Carlos Llamas [this message]
2025-10-30  4:50 ` [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors Eric Biggers
2025-10-30  6:03 ` Christoph Hellwig
2025-10-30 17:17   ` Eric Biggers
2025-10-31  9:10     ` Christoph Hellwig
2025-10-30 14:53 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251030043919.2787231-1-cmllamas@google.com \
    --to=cmllamas@google.com \
    --cc=axboe@kernel.dk \
    --cc=ebiggers@kernel.org \
    --cc=hch@lst.de \
    --cc=kernel-team@android.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox