Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2019-06-24 09:36:42 +0200
committerPetr Tesarik <ptesarik@suse.cz>2019-06-24 09:36:59 +0200
commitc46f194618c1dfc349c24c96386161d4946c2410 (patch)
treeb8ee5f3ebff940dc85f18f96b186d60c284e671f
parentab4947f0e224bebf192f6b20bc333b1cf382710c (diff)
vfio: ccw: only free cp on final interrupt (bsc#1051510).
-rw-r--r--patches.fixes/vfio-ccw-only-free-cp-on-final-interrupt56
-rw-r--r--series.conf1
2 files changed, 57 insertions, 0 deletions
diff --git a/patches.fixes/vfio-ccw-only-free-cp-on-final-interrupt b/patches.fixes/vfio-ccw-only-free-cp-on-final-interrupt
new file mode 100644
index 0000000000..8c109ab987
--- /dev/null
+++ b/patches.fixes/vfio-ccw-only-free-cp-on-final-interrupt
@@ -0,0 +1,56 @@
+From: Cornelia Huck <cohuck@redhat.com>
+Date: Mon, 11 Mar 2019 10:59:53 +0100
+Subject: vfio: ccw: only free cp on final interrupt
+Git-commit: 50b7f1b7236bab08ebbbecf90521e84b068d7a17
+Patch-mainline: v5.1-rc3
+References: bsc#1051510
+
+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>
+Acked-by: Petr Tesarik <ptesarik@suse.com>
+---
+ drivers/s390/cio/vfio_ccw_drv.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/s390/cio/vfio_ccw_drv.c
++++ b/drivers/s390/cio/vfio_ccw_drv.c
+@@ -71,21 +71,25 @@ static void vfio_ccw_sch_io_todo(struct
+ struct vfio_ccw_private *private;
+ struct subchannel *sch;
+ struct irb *irb;
++ bool is_final;
+
+ private = container_of(work, struct vfio_ccw_private, io_work);
+ irb = &private->irb;
+ sch = private->sch;
+
++ is_final = !(scsw_actl(&irb->scsw) &
++ (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT));
+ if (scsw_is_solicited(&irb->scsw)) {
+ cp_update_scsw(&private->cp, &irb->scsw);
+- cp_free(&private->cp);
++ if (is_final)
++ cp_free(&private->cp);
+ }
+ memcpy(private->io_region.irb_area, irb, sizeof(*irb));
+
+ if (private->io_trigger)
+ eventfd_signal(private->io_trigger, 1);
+
+- if (private->mdev)
++ if (private->mdev && is_final)
+ private->state = VFIO_CCW_STATE_IDLE;
+ }
+
diff --git a/series.conf b/series.conf
index 8f3169f226..5931a6a2dc 100644
--- a/series.conf
+++ b/series.conf
@@ -21907,6 +21907,7 @@
patches.fixes/rhashtable-Still-do-rehash-when-we-get-EEXIST.patch
patches.fixes/bpf-do-not-restore-dst_reg-when-cur_state-is-freed.patch
patches.arch/ARM-imx6q-cpuidle-fix-bug-that-CPU-might-not-wake-up.patch
+ patches.fixes/vfio-ccw-only-free-cp-on-final-interrupt
patches.drm/0001-drm-rockchip-vop-reset-scale-mode-when-win-is-disabl.patch
patches.drm/drm-meson-Fix-invalid-pointer-in-meson_drv_unbind.patch
patches.drm/drm-meson-Uninstall-IRQ-handler.patch