Received: by 10.192.165.148 with SMTP id m20csp4150372imm; Mon, 30 Apr 2018 12:42:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZowPrlzfLkHL17I5agLLvwKEhwHGR0FBRhM6QG1rgEi54DZ2Ep8qIhj4D25HFZagBEkPM9f X-Received: by 10.98.156.147 with SMTP id u19mr12204622pfk.74.1525117376318; Mon, 30 Apr 2018 12:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525117376; cv=none; d=google.com; s=arc-20160816; b=AYE+RCgVC4fUxBEeLBGVXJv8Eee7OdrU0zA3zCqc20NFRsK0y7H+WHlYWhn4mUQAiX jDf9FAeM6MoYUMvkRTa8j8SqOmwD/WGOy2eO4sWJTxIDIZMXZtaLp0rV/kNc5lcLsXUh UEuIhUCiyvVVfgrrzKd0TzLCTFiuTF4Wrs80G1YoSScA0cw5aIjTAlJmKrnlrav5ETvM MifEaEGwMjn1W7esNlraD9IXitLCro0IzKYM0vQrJEjdIBGVsPhrIBuZjvYi6PVHm8cA nNBHTOyMQgwungoAJhV0bHQadWH8Mv1a1dfBT5GLyiN29UHViM/H+NZBgXBUOcj1i327 782A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=wWi48bdUwbbtcqYPFZ+RmltX76lz51PDDzXUZ/JA0bI=; b=ebaDhk0zoJw0yLm8OcToyxrymFDHl7StMV5oMa+RBkQ3cLeQerJ5oB/1a+4VbnZXMG Vi1mtulSYEB0YUqIXCSQrkN/tPSy165sP0BY2nS7cv+EDEc6PDFhNdw5wyhQVngczWJ2 qb3XECh6dbulAiby8/gZpU+tyvxfAZwp5G2gS3sK8rDFhio54ctGvemq1Bq1/9ZK+RX/ w5F83Ul3HLiCJwqcD5Jcf7FvZuA/abb7pTqtQeeBhbm236DPy4DjPb6hgv940DPQZOMY H6hiK2QoqDQkqGccrSBjzv71vCWoZbCNkoAo0oKygsxoVAadKNJpgzV0Uuq0fjLMDwuR oNOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2-v6si6543381pgf.75.2018.04.30.12.42.42; Mon, 30 Apr 2018 12:42:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932313AbeD3Tme (ORCPT + 99 others); Mon, 30 Apr 2018 15:42:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:36236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756301AbeD3T23 (ORCPT ); Mon, 30 Apr 2018 15:28:29 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2AEE22DBF; Mon, 30 Apr 2018 19:28:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2AEE22DBF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dong Jia Shi , Halil Pasic , Pierre Morel , Cornelia Huck , Martin Schwidefsky Subject: [PATCH 4.16 066/113] vfio: ccw: process ssch with interrupts disabled Date: Mon, 30 Apr 2018 12:24:37 -0700 Message-Id: <20180430184018.006950047@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cornelia Huck commit 3368e547c52b96586f0edf9657ca12b94d8e61a7 upstream. When we call ssch, an interrupt might already be pending once we return from the START SUBCHANNEL instruction. Therefore we need to make sure interrupts are disabled while holding the subchannel lock until after we're done with our processing. Cc: stable@vger.kernel.org #v4.12+ Reviewed-by: Dong Jia Shi Acked-by: Halil Pasic Acked-by: Pierre Morel Signed-off-by: Cornelia Huck Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- drivers/s390/cio/vfio_ccw_fsm.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) --- a/drivers/s390/cio/vfio_ccw_fsm.c +++ b/drivers/s390/cio/vfio_ccw_fsm.c @@ -20,12 +20,12 @@ static int fsm_io_helper(struct vfio_ccw int ccode; __u8 lpm; unsigned long flags; + int ret; sch = private->sch; spin_lock_irqsave(sch->lock, flags); private->state = VFIO_CCW_STATE_BUSY; - spin_unlock_irqrestore(sch->lock, flags); orb = cp_get_orb(&private->cp, (u32)(addr_t)sch, sch->lpm); @@ -38,10 +38,12 @@ static int fsm_io_helper(struct vfio_ccw * Initialize device status information */ sch->schib.scsw.cmd.actl |= SCSW_ACTL_START_PEND; - return 0; + ret = 0; + break; case 1: /* Status pending */ case 2: /* Busy */ - return -EBUSY; + ret = -EBUSY; + break; case 3: /* Device/path not operational */ { lpm = orb->cmd.lpm; @@ -51,13 +53,16 @@ static int fsm_io_helper(struct vfio_ccw sch->lpm = 0; if (cio_update_schib(sch)) - return -ENODEV; - - return sch->lpm ? -EACCES : -ENODEV; + ret = -ENODEV; + else + ret = sch->lpm ? -EACCES : -ENODEV; + break; } default: - return ccode; + ret = ccode; } + spin_unlock_irqrestore(sch->lock, flags); + return ret; } static void fsm_notoper(struct vfio_ccw_private *private,