Skip to content

Commit b3a58f3

Browse files
Stefan Haberlandhcahca
authored andcommitted
s390/dasd: Fix invalid dereferencing of indirect CCW data pointer
Fix invalid dereferencing of indirect CCW data pointer in dasd_eckd_dump_sense() that leads to a kernel panic in error cases. When using indirect addressing for DASD CCWs (IDAW) the CCW CDA pointer does not contain the data address itself but a pointer to the IDAL. This needs to be translated from physical to virtual as well before using it. This dereferencing is also used for dasd_page_cache and also fixed although it is very unlikely that this code path ever gets used. Fixes: c0bd396 ("s390/dasd: use new address translation helpers") Cc: [email protected] Signed-off-by: Stefan Haberland <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
1 parent 2ae157e commit b3a58f3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/s390/block/dasd_eckd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4906,7 +4906,7 @@ dasd_eckd_free_cp(struct dasd_ccw_req *cqr, struct request *req)
49064906
ccw++;
49074907
if (dst) {
49084908
if (ccw->flags & CCW_FLAG_IDA)
4909-
cda = *((char **)dma32_to_virt(ccw->cda));
4909+
cda = dma64_to_virt(*((dma64_t *)dma32_to_virt(ccw->cda)));
49104910
else
49114911
cda = dma32_to_virt(ccw->cda);
49124912
if (dst != cda) {
@@ -5525,7 +5525,7 @@ dasd_eckd_dump_ccw_range(struct dasd_device *device, struct ccw1 *from,
55255525

55265526
/* get pointer to data (consider IDALs) */
55275527
if (from->flags & CCW_FLAG_IDA)
5528-
datap = (char *)*((addr_t *)dma32_to_virt(from->cda));
5528+
datap = dma64_to_virt(*((dma64_t *)dma32_to_virt(from->cda)));
55295529
else
55305530
datap = dma32_to_virt(from->cda);
55315531

drivers/s390/block/dasd_fba.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ dasd_fba_free_cp(struct dasd_ccw_req *cqr, struct request *req)
585585
ccw++;
586586
if (dst) {
587587
if (ccw->flags & CCW_FLAG_IDA)
588-
cda = *((char **)dma32_to_virt(ccw->cda));
588+
cda = dma64_to_virt(*((dma64_t *)dma32_to_virt(ccw->cda)));
589589
else
590590
cda = dma32_to_virt(ccw->cda);
591591
if (dst != cda) {

0 commit comments

Comments
 (0)