s390/cio: Harden pmcw/schib handling for dnv=0
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 3 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | s390/cio: Fix cio_update_schib() to not cache invalid schibdrivers/ | +7 | 0 replies | |
| 2/3 | s390/cio: Check pmcw.dnv before pmcw.ena in I/O entry pointsdrivers/ | +12 | 0 replies | |
| 3/3 | s390/cio: Guard PMCW field accesses with dnv checkdrivers/ drivers/ drivers/ +2 more | +21 | 0 replies |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Peter Oberparleiter |
|---|---|
| 1/3 | R-b |
| 2/3 | R-b |
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/3] s390/cio: Harden pmcw/schib handling for dnv=0
For I/O subchannels, pmcw.dnv must be validated before relying on any other PMCW or SCHIB fields.
Two issues exist today:
- Some I/O entry points check pmcw.ena without first verifying that pmcw.dnv is set.
- cio_update_schib() updates the cached SCHIB before validating pmcw.dnv, allowing an stsch result with dnv=0 to leave stale or undefined data in sch->schib.
This can trigger spurious, non-fatal error messages in the guest kernel log when a virtio device is being detached.
Fix this by validating pmcw.dnv before updating the cached SCHIB. Also clear the cached SCHIB when stsch succeeds but returns dnv=0, ensuring that stale state is not retained.
Additionally, add pmcw.dnv checks before pmcw.ena checks in I/O entry points and return -ENODEV when no device is present. Guard remaining direct accesses to cached PMCW fields, such as chpid[] and pam, to ensure they are only evaluated when the SCHIB contents are valid.
This was reported and discussed at:
Vineeth Vijayan (3):
s390/cio: Fix cio_update_schib() to not cache invalid schib s390/cio: Check pmcw.dnv before pmcw.ena in I/O entry points s390/cio: Guard PMCW field accesses with dnv check
drivers/s390/cio/chp.c | 3 +++ drivers/s390/cio/cio.c | 11 +++++++---- drivers/s390/cio/device.c | 9 +++++---- drivers/s390/cio/device_fsm.c | 3 +++ drivers/s390/cio/device_ops.c | 21 +++++++++++++++++++++ drivers/s390/cio/vfio_ccw_fsm.c | 2 +- 6 files changed, 40 insertions(+), 9 deletions(-)
Signature · 1 line
2.53.0