From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A26CC43381 for ; Fri, 29 Mar 2019 16:43:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17C5921871 for ; Fri, 29 Mar 2019 16:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553877809; bh=8zEagwTwUIm1Dem/xNPt5dEW4Xeo+wXtoQwhUMyo3Tg=; h=Subject:To:Cc:From:Date:List-ID:From; b=mOmeWBrJP+U8F2rk+YnukBbbzxsPRLUtdSeLYprR7vGWOR5vtwPBo0BGkR4Uj7asv ER4v/I1oYFS3n0wFc0b30kPPkGAG1aJR5hmGLiHuwITDgQyhmojjhA/WATss3Cd/qz 8q6u6DO49LM4hL5krqOCJo2lXSV0+LdZQalN0l+s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729480AbfC2Qn2 (ORCPT ); Fri, 29 Mar 2019 12:43:28 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45521 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729334AbfC2Qn2 (ORCPT ); Fri, 29 Mar 2019 12:43:28 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 666E021F0C; Fri, 29 Mar 2019 12:43:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 29 Mar 2019 12:43:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=E2r+9L ghvGy6uBJys5THvqXUxuiShR/arrAx/SZqWnE=; b=YLoUN7fxqo6GnYHYG9mWVZ hHJFomSbitssYxRpD1j5IFOihEL/1dkrw/EtLcdKKTqZLbP1tmiqKKXn3FwuHBxh 7qoyoqaQ4qBHBu04gvWgiGhhNToZCvd64UHC8xkc9QXZ2kNPe5+XP7OPuTwPDMoL JfOqDYj9L403bXypXBXgagLgs2c6oagfY2L1VnOFcGgwjWvrvo+upy15CNOKhcAk lOG0j94XOzTWTFDT7X4a67xw4jCcqYGBS3d5FcJV2xbn3LGSV7tQRHjQrcGie1he tu2CCADx8tcYROp1vhMlnkE7UopM97b4xyLssyaKe+nV1wJRyNi6hU46wvcSPQMg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrkeejgdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedu X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D307E4666; Fri, 29 Mar 2019 12:43:26 -0400 (EDT) Subject: FAILED: patch "[PATCH] vfio: ccw: only free cp on final interrupt" failed to apply to 4.14-stable tree To: cohuck@redhat.com, farman@linux.ibm.com Cc: From: Date: Fri, 29 Mar 2019 17:43:24 +0100 Message-ID: <155387780427137@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 50b7f1b7236bab08ebbbecf90521e84b068d7a17 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Mon, 11 Mar 2019 10:59:53 +0100 Subject: [PATCH] vfio: ccw: only free cp on final interrupt 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 Signed-off-by: Cornelia Huck diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index a10cec0e86eb..0b3b9de45c60 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -72,20 +72,24 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) { struct vfio_ccw_private *private; struct irb *irb; + bool is_final; private = container_of(work, struct vfio_ccw_private, io_work); irb = &private->irb; + 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; }