vfio: ccw: only free cp on final interrupt
authorCornelia Huck <cohuck@redhat.com>
Mon, 11 Mar 2019 09:59:53 +0000 (10:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:26:21 +0000 (06:26 +0200)
commit0f273f0c3064dab95c82d6046b0f5ea2ababd304
tree533af2322153b5a666711d33f28fd811b7c82544
parent92d4ee2e82767998f1300e6ac4fc9f95bf860b7c
vfio: ccw: only free cp on final interrupt

commit 50b7f1b7236bab08ebbbecf90521e84b068d7a17 upstream.

When we get an interrupt for a channel program, it is not
necessarily the final interrupt; for example, the issuing
guest may request an intermediate interrupt by specifying
the program-controlled-interrupt flag on a ccw.

We must not switch the state to idle if the interrupt is not
yet final; even more importantly, we must not free the translated
channel program if the interrupt is not yet final, or the host
can crash during cp rewind.

Fixes: e5f84dbaea59 ("vfio: ccw: return I/O results asynchronously")
Cc: stable@vger.kernel.org # v4.12+
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/cio/vfio_ccw_drv.c