Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1827903imm; Mon, 3 Sep 2018 10:28:25 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYpOYX+Lw9fyTVXhJsri5/8l2xLkbEUIIdlJ0oBQK1NXRfy04PrsPhoFzCy2tsGpBnYrNo4 X-Received: by 2002:a62:6690:: with SMTP id s16-v6mr30611566pfj.152.1535995704903; Mon, 03 Sep 2018 10:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995704; cv=none; d=google.com; s=arc-20160816; b=Z3mYlv699nlYILp2D4F8lLt/3N1Y1JxW9GYBOiXZedEazcET1n0weC5PEJpLPKxc53 npf1qjcZ/kbcg+K6K2q/TOYYXMWMhHevWGatWKLmp5ztAkTx3g4KR47+ketecXS7rnC6 BF7cgV1hHLJHW/NzCwaslLpHJ3FpjQf36ZswI6pL7UUE5cjzGQ0JvMnjhlNERZs/zcNA ciZzdvlPbFw5ZLS7TgAYfhZ8oC4Ixxbs2Fd3RR+DTJgobholum+ibU8eQsItC5H9xLCR C4pC9EtCY/HGJxRC9RwxwMiNbgNeNZBJfAkcbEtf7yBHnIN/YeAnYH/23JGh2vM2j927 zwhg== 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 :arc-authentication-results; bh=cp3rIwBkVhMLTKww5Ing+J5GZJ7IHNp4d0TWCoVGoyc=; b=Y7qU9xM1yRRcIadNq2WRuCMIw2/w3qBepqnqhmsTn89IpF6rPYJRIX6Vt+CKss9uBO C2LNBWpFeuGP6BaAxQ5XzTN4SNSYRmMNL7pV28DBjKJjdlP5+zQm7L/P+kiBj32hmukS yve3nWnQ4Ul6/Ia9El4rtbOygvpB80QDW9u+/oA4RAkq7BPEGi3Scao3TRc9LwT5azem P2P9rKyIvZudfve+OzQTXFhUs8Jwj0hwVqVpj9aU/KWBuWjuTxNrLFWTcLktl88lKlei EQ8Pxbdwsg0O/MUOoEVQqGunI8rhz2zjRkjNpnHI+RuA1DdPsCPJIBDJ97rGKPi3Ytcb ZDNA== 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 k18-v6si18588755pgm.102.2018.09.03.10.28.09; Mon, 03 Sep 2018 10:28:24 -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 S1730915AbeICVsQ (ORCPT + 99 others); Mon, 3 Sep 2018 17:48:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45984 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728731AbeICVsP (ORCPT ); Mon, 3 Sep 2018 17:48:15 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 97DBAD24; Mon, 3 Sep 2018 17:27:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Ott , Heiko Carstens Subject: [PATCH 4.14 146/165] s390/pci: fix out of bounds access during irq setup Date: Mon, 3 Sep 2018 18:57:12 +0200 Message-Id: <20180903165704.009950486@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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: Sebastian Ott commit 866f3576a72b2233a76dffb80290f8086dc49e17 upstream. During interrupt setup we allocate interrupt vectors, walk the list of msi descriptors, and fill in the message data. Requesting more interrupts than supported on s390 can lead to an out of bounds access. When we restrict the number of interrupts we should also stop walking the msi list after all supported interrupts are handled. Cc: stable@vger.kernel.org Signed-off-by: Sebastian Ott Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/pci/pci.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -420,6 +420,8 @@ int arch_setup_msi_irqs(struct pci_dev * hwirq = 0; for_each_pci_msi_entry(msi, pdev) { rc = -EIO; + if (hwirq >= msi_vecs) + break; irq = irq_alloc_desc(0); /* Alloc irq on node 0 */ if (irq < 0) return -ENOMEM;