s390/cmf: Fix virtual vs physical address confusion
Subsystems (2)
Peter Oberparleiter
maintainerPATCH 1/1 s390/cmf: Fix virtual vs physical address confusion
The measurement block address is an absolute address; therefore add a missing virt_to_phys() translation.
Without this fix, a wrong address will be used by firmware when storing extended format channel measurement data on kernels built with CONFIG_RANDOMIZE_IDENTITY_BASE=y.
--- drivers/s390/cio/cmf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/cio/cmf.c +1 -1
@@ -183,7 +183,7 @@ static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc, sch->config.mbfc = mbfc;/* address can be either a block address or a block index */ if (mbfc) - sch->config.mba = address; + sch->config.mba = address ?virt_to_phys ((void *)address) :0 ;else sch->config.mbi = address;
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
The measurement block address is an absolute address; therefore add a missing
virt_to_phys()translation.Without this fix, a wrong address will be used by firmware when storing extended format channel measurement data on kernels built with
CONFIG_RANDOMIZE_IDENTITY_BASE=y.Signed-off-by Peter Oberparleiter <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Heiko Carstens
maintainerQuoted 17 lines · Peter Oberparleiter
The measurement block address is an absolute address; therefore add a missing
virt_to_phys()translation.Without this fix, a wrong address will be used by firmware when storing extended format channel measurement data on kernels built with
CONFIG_RANDOMIZE_IDENTITY_BASE=y.Signed-off-by Peter Oberparleiter <[email protected]>--- drivers/s390/cio/cmf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/s390/cio/cmf.c +0
-0
drivers/s390/cio/cmf.c static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc, · line 186
Quoted 5 lines
drivers/s390/cio/cmf.c +1
-1@@ -183,7 +183,7 @@ static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc, sch->config.mbfc = mbfc;/* address can be either a block address or a block index */ if (mbfc) - sch->config.mba = address; + sch->config.mba = address ?virt_to_phys ((void *)address) :0 ;
Would it make sense to change the type of the mba member in struct schib_config and struct schib to dma64_t, and use virt_to_dma64() instead of virt_to_phys() here?
That would add sparse type checking and would catch similar future bugs.
Peter Oberparleiter
maintainerQuoted 28 lines · Heiko Carstens
Quoted 17 lines · Peter Oberparleiter
The measurement block address is an absolute address; therefore add a missing
virt_to_phys()translation.Without this fix, a wrong address will be used by firmware when storing extended format channel measurement data on kernels built with
CONFIG_RANDOMIZE_IDENTITY_BASE=y.Signed-off-by Peter Oberparleiter <[email protected]>--- drivers/s390/cio/cmf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/s390/cio/cmf.c +0
-0drivers/s390/cio/cmf.c static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc, · line 186
Quoted 5 lines
drivers/s390/cio/cmf.c +1
-1@@ -183,7 +183,7 @@ static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc, sch->config.mbfc = mbfc;/* address can be either a block address or a block index */ if (mbfc) - sch->config.mba = address; + sch->config.mba = address ?virt_to_phys ((void *)address) :0 ;Would it make sense to change the type of the mba member in struct
schib_configand struct schib todma64_t, and usevirt_to_dma64()instead ofvirt_to_phys()here?
Quoted 1 line
That would add sparse type checking and would catch similar future bugs.
Sounds good - I'll prepare a v2.
Signature · 2 lines
Peter Oberparleiter Linux on IBM Z Development - IBM Germany R&D