Skip to content

Commit fa45f1e

Browse files
Jaehoon Kimjfvogel
authored andcommitted
s390/dasd: enforce dma_alignment to ensure proper buffer validation
commit 130e6de62107116eba124647116276266be0f84c upstream. The block layer validates buffer alignment using the device's dma_alignment value. If dma_alignment is smaller than logical_block_size(bp_block) -1, misaligned buffer incorrectly pass validation and propagate to the lower-level driver. This patch adjusts dma_alignment to be at least logical_block_size -1, ensuring that misalignment buffers are properly rejected at the block layer and do not reach the DASD driver unnecessarily. Fixes: 2a07bb6 ("s390/dasd: Remove DMA alignment") Reviewed-by: Stefan Haberland <[email protected]> Cc: [email protected] #6.11+ Signed-off-by: Jaehoon Kim <[email protected]> Signed-off-by: Stefan Haberland <[email protected]> Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 9582756d97460f441e5d77eb3ce382cf6aa1e3f3) Signed-off-by: Jack Vogel <[email protected]>
1 parent 7eef451 commit fa45f1e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/s390/block/dasd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ static int dasd_state_basic_to_ready(struct dasd_device *device)
332332
lim.max_dev_sectors = device->discipline->max_sectors(block);
333333
lim.max_hw_sectors = lim.max_dev_sectors;
334334
lim.logical_block_size = block->bp_block;
335+
/*
336+
* Adjust dma_alignment to match block_size - 1
337+
* to ensure proper buffer alignment checks in the block layer.
338+
*/
339+
lim.dma_alignment = lim.logical_block_size - 1;
335340

336341
if (device->discipline->has_discard) {
337342
unsigned int max_bytes;

0 commit comments

Comments
 (0)