s390/pci: do not read data after failed load
If a pci load instruction fails the content of the register where the
data is stored is possibly unchanged. Fix the inline assembly wrapper
__pcilg to not return stale data. Additionally fix the callers of this
function who access uninitialized variables.
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
diff --git a/arch/s390/include/asm/pci_io.h b/arch/s390/include/asm/pci_io.h
index 0e0bec9..83a9caa 100644
--- a/arch/s390/include/asm/pci_io.h
+++ b/arch/s390/include/asm/pci_io.h
@@ -92,6 +92,9 @@
int cc;
cc = s390pci_load(&data, req, offset);
+ if (cc)
+ goto out;
+
switch (len) {
case 1:
*((u8 *) dst) = (u8) data;
@@ -106,6 +109,7 @@
*((u64 *) dst) = (u64) data;
break;
}
+out:
return cc;
}