Re: [GIT PULL v1 01/23] s390/vfio_ccw: Free all memory if cp_init() fails
[email protected] Mon, 03 Aug 2026 16:28:26 +0000
| Newsgroups | org.kernel.vger.linux-s390,org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: Pre-existing issues: - [High] A malicious guest can trigger unbounded kernel stack recursion and= host panic by providing a long chain of non-looping Transfer in Channel (T= IC) CCWs. -- --- Patch [1]: [GIT PULL v1 01/23] s390/vfio_ccw: Free all memory if cp_ini= t() fails --- commit 2ed68383152f2b2060167f3fc63cdb973d979950 Author: Eric Farman <[email protected]> s390/vfio_ccw: Free all memory if cp_init() fails This commit moves the ccwchain cleanup out of the recursive ccwchain_handle_ccw() and ccwchain_loop_tic() logic into a new wrapper function ccwchain_build_ccws(). This ensures that all segments allocated for a channel program are freed if initialization fails. > diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_c= p.c > index 7561aa7d3e017..086d1b54bdb05 100644 > --- a/drivers/s390/cio/vfio_ccw_cp.c > +++ b/drivers/s390/cio/vfio_ccw_cp.c [ ... ] > @@ -455,9 +455,6 @@ static int ccwchain_handle_ccw(dma32_t cda, struct ch= annel_program *cp) > /* Loop for tics on this new chain. */ > ret =3D ccwchain_loop_tic(chain, cp); > =20 [Severity: High] This is a pre-existing issue, but can this recursive call chain lead to unbounded kernel stack consumption? Looking at ccwchain_handle_ccw() and ccwchain_loop_tic(), they recursively call each other: ccwchain_handle_ccw() ccwchain_loop_tic() ccwchain_handle_ccw() If a guest constructs a channel program with a long sequence of Transfer in Channel (TIC) CCWs, where each points to a distinct guest physical address, tic_target_chain_exists() will return false. Does this allow an unprivileged guest to trigger unbounded recursion and overflow the host kernel stack, resulting in a host panic? > - if (ret) > - ccwchain_free(chain); > - > return ret; > } --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260803160924.2368= [email protected]?part=3D1