On 6/24/26 7:09 PM, Keith Busch wrote:
From: Keith Busch <[email protected]>

The bio-based drivers don't necessarily check the alignment split, and
stacking block drivers don't always handle a misalignment detected after
submitting the bio. Validate user vectors against the device's
dma_alignment as the bio is built from the iov_iter, rejecting
misaligned early with -EINVAL.

Cc: [email protected]
Fixes: 5ff3f74e145a ("block: simplify direct io validity check")
Fixes: 7eac33186957 ("iomap: simplify direct io validity check")
Signed-off-by: Keith Busch <[email protected]>
---
  block/bio.c          | 56 +++++++++++++++++++++++++++++++++++++++++---
  block/blk-map.c      |  2 +-
  block/fops.c         |  2 +-
  fs/iomap/direct-io.c |  1 +
  include/linux/bio.h  |  2 +-
  include/linux/uio.h  | 10 +++++++-
  lib/iov_iter.c       |  9 ++++++-
  7 files changed, 74 insertions(+), 8 deletions(-)

Reviewed-by: Hannes Reinecke <[email protected]>

Cheers,

Hannes
--
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

Reply via email to