Received: by 10.192.165.148 with SMTP id m20csp4166910imm; Mon, 30 Apr 2018 13:03:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqUd11ZZCXUTUUiphGm4kn5qr/ThYazgqX326CdSNf0KbRWcxYCggB/E+GfSjPeps20HZW2 X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr13309090plp.136.1525118595164; Mon, 30 Apr 2018 13:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525118595; cv=none; d=google.com; s=arc-20160816; b=VHCk/PFPaHjcifOwKUHu7sMDGwE877FLrYFzeFMU8DO3KoImT63uqHwIJwF4oU+BUs R+lncgkbZizVfR+cnX8RpxKagcZHuCDDHlonXn8gHC/eheipR8PUq5JHMFTfNs/WyVpq r2Brc4eJE98FoTHRa5b933R1eVCl1XFpjDPr7qMq0H4f02kGPydU2/7Lw1U8W/UgLd60 KTcXTNkmTqgoqjO5KHKRveykgIgplBs4bidwkunY+1z5lnCmiyED/v9Qs6zu7pk80TeU msZMQwW/PyPCSGQ9PVwMj5h0lEak3ynXXu1W/thdHHk24CO+DEAOsFxMRrlCvnS3wozN e6GQ== 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=e9LblJuZ2SPRt75/ifzcJ3+6Z0Tn4LDhj/rqR9CWj6M=; b=bx8OPDWmE0n8rB1U85K1iZuV9WjwayYMSDc26C1vM4dB+kIUb8uPRGuqWqyPKefrDF PqHll4sKmIDqEG/3mNIA/6isIEEAtmg0bMcSxl4e5jBn5q9PMQ52KaIV6DURZ/loxZoc +5w1YmaEwBt3HxixiVLefiXwYrlYzX78bkVoC9fsey6qDJT0FPIfKRJqRGBmAwDYJa/5 fO0c8h8XwSUHZVfB4vewliBdRcdlz5kUJK+RzheYewBVcdJzr0BPEryBOEcNdNlFCfCf /uVSEtib8l8yZxbtlOn3mPfsvivtXb5+UZFR5yS4zCcLaQKED2lHlPELIKkm1lLVlyaP GVCg== 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 d9-v6si6686779pga.192.2018.04.30.13.03.01; Mon, 30 Apr 2018 13:03:15 -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 S1756006AbeD3T1g (ORCPT + 99 others); Mon, 30 Apr 2018 15:27:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755963AbeD3T11 (ORCPT ); Mon, 30 Apr 2018 15:27:27 -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 6E29722DAC; Mon, 30 Apr 2018 19:27:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E29722DAC 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.14 58/91] vfio: ccw: process ssch with interrupts disabled Date: Mon, 30 Apr 2018 12:24:40 -0700 Message-Id: <20180430184007.196458060@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184004.216234025@linuxfoundation.org> References: <20180430184004.216234025@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.14-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,