s390/vfio_ccw: Fix out of bounds check on CCW array
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 0a19e61e6d4c6192077ead760ba0a2d350987d4c · < 4c2e1d359d7a2b82cdf3254e4e480af9417f99fb| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
s390/vfio_ccw: Fix out of bounds check on CCW array
The routine ccwchain_calc_length() counts the number of channel command words (CCWs) that are chained together in a single channel program, and rejects anything larger than CCWCHAIN_LEN_MAX (256) CCWs.
The loop itself is "do..while (count < 257)", and while the logic in is_cpa_within_range() correctly adjusts between the 0-index array of CCWs and the count of CCWs starting at 1, this means it would look at a possible 257th CCW before ending the loop and (correctly) returning an error.
Fix this by restructuring the loop to break as soon as 256 CCWs (thus indexes 0-255) are examined, without looking at memory outside the range.
From the CVE record · Linux
The Linux kernel’s s390/vfio_ccw code can examine a 257th channel command word after reaching its 256-word limit, reading outside the CCW array. The input does not specify how an attacker could trigger this condition or whether access or user interaction is required.
Engineers running the Linux kernel with s390/vfio_ccw should check their versions; affected versions are not specified.