Skip to content

Commit 4e6f98b

Browse files
Jaehoon Kimgregkh
authored andcommitted
s390/dasd: enforce dma_alignment to ensure proper buffer validation
commit 130e6de 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 <sth@linux.ibm.com> Cc: stable@vger.kernel.org #6.11+ Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com> Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0a50182 commit 4e6f98b

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
@@ -334,6 +334,11 @@ static int dasd_state_basic_to_ready(struct dasd_device *device)
334334
lim.max_dev_sectors = device->discipline->max_sectors(block);
335335
lim.max_hw_sectors = lim.max_dev_sectors;
336336
lim.logical_block_size = block->bp_block;
337+
/*
338+
* Adjust dma_alignment to match block_size - 1
339+
* to ensure proper buffer alignment checks in the block layer.
340+
*/
341+
lim.dma_alignment = lim.logical_block_size - 1;
337342

338343
if (device->discipline->has_discard) {
339344
unsigned int max_bytes;

0 commit comments

Comments
 (0)