Received: by 10.223.185.116 with SMTP id b49csp397172wrg; Tue, 20 Feb 2018 00:59:36 -0800 (PST) X-Google-Smtp-Source: AH8x227gMFV0Gd/HDMN0xrwSjSUTmIb4qyrEsfGZ9Le/pKfPSBbw2Xy4UOWZ+w+q9G4P8F4Ffgy6 X-Received: by 10.99.130.72 with SMTP id w69mr14382049pgd.368.1519117176645; Tue, 20 Feb 2018 00:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519117176; cv=none; d=google.com; s=arc-20160816; b=VIb4IgeQ2uQSIpevEXpVG/63/6Ol3lIJvId+v0WvlSeCdFsN0g3dkS8kG8D0d2cfAm 3wVEri9giQbGraGhFo1sz6ZTyyjYFOKCgirso9eAC5Z6MatQmlc0ng0E2o7DynWhNblo iKJaVYxzIDQUNuR9bEpmjjwIPTbk3ibZhaBeB4N/HAzLrhmK3vjvA9I+yqW4l+eVqA0r wJy9UGh6GG6ViVNL7rKBVmL6IhZU5HCItwmJX1CaN7c8y5xMVvvN1LN6d2REFM4bO2di GMA3PcAKp5IOpXk4XMT4+69Y+IZBx9ocvt+jXzvT/V9dzKh38FWNNB7FtJaG5R7pTJup qvgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature :arc-authentication-results; bh=/fJX4OwqnIgf0Qvel0KqduSSUB/v4QMAgwoHeAo3HBI=; b=RXs2x3HqoMOjDf1kEUKa0uky4t27Ro62G9YYcFJ+c0NYfz1PKQzlBo6Ji06izTgmUi qnTWZgPPQ6u+Rn6f9H4+dbnma5But9PPd+7lZVQzgdASyL5UbQUVcvln9Efq2MCc1xB1 kTgHlXLS9YGMqolc28KA9jAQePSFt9GMzVrkmrmbMppFZV085eJuqPNgohgSf2VIYaVV zfw7oBeG5URHlbnUekbZMMIJwHJXR/MxpKhW6FUYYlYnVoKBDGR3/yj8TQMUBIWTK89R 4zzWWb810VBpxfIZepjo1QNcN/gcYGRk5un4/Ha2KzAebeo7ACWbi3gmAEyW6hhEK5tT aiLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pi38tTGl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o184si647343pga.245.2018.02.20.00.59.20; Tue, 20 Feb 2018 00:59:36 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Pi38tTGl; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751180AbeBTI6R (ORCPT + 99 others); Tue, 20 Feb 2018 03:58:17 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36290 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750733AbeBTI6Q (ORCPT ); Tue, 20 Feb 2018 03:58:16 -0500 Received: by mail-wr0-f195.google.com with SMTP id u15so12218279wrg.3; Tue, 20 Feb 2018 00:58:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=/fJX4OwqnIgf0Qvel0KqduSSUB/v4QMAgwoHeAo3HBI=; b=Pi38tTGloDcXYYG5rPk5LpqAdeBhDe0RB9uP6ax5GWxnfsKvpWVHOpI41ztNKk5Wmu w4yfC+maYP6pMk1v9h6w8EckdVKULdyBRtSLuT0JX8dcYiRHKuLovKf3/yAvMQES+lmV Ofvc7pqM2+ODB1ulbXqhy5xsSO8DlvcxBy1PuLjeJdZ50r4ZX3WTyCXE85pFOQlGHkiH nNrNQirRsRLywep5X1duIaI53XbD57JygWQ5hIxjEpF9sox4FFWoh5gE9cLiB7B9uj7A GxywuPxBLhiADYQYOP1t5pSTdVXb5Nz6ZnTg2sezTrfT/oGXmj/lY2MgUru7xYxn5wJR vffw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=/fJX4OwqnIgf0Qvel0KqduSSUB/v4QMAgwoHeAo3HBI=; b=KW1z6eLpQvioTpLGbTaJHdCyAExsoG8oqTXdygu54GG2CpYnK+TLy5jgpz2LKvjsqL 2ZAOJVdK+n1xc79elFr/Y86y4zZdWfZBMBi8ZCtOO8LUknRhTBJvnvpZqQTIwJIdyJwQ +WMlOoi8ugqbwkJwhpahIAVFREscePl+1iiEMBJ34cZUZ+KHUMn4F4Fo3z+cg9HJGdV5 upYOZiqe30ShkZOottfwHB/2rAqdsgqEtvFT7jmoX+i4rG+q5j24oaDs0W2w2it4HJ4m sQ+0ADSexkwuW6kL6STvnzQ1qdyx8I4Iy/VCO6AWGbZ+YE7qnFjG33yN9NUoh1s1uPbw ol0w== X-Gm-Message-State: APf1xPCwL7PuRgevf/uNs9whTqrhx6D3b21gVhmlql0YqxY+FQ0xJ9po B8aOJ8zC1Mc7q6PYt+S+ba+Wpg== X-Received: by 10.223.163.157 with SMTP id l29mr11233558wrb.239.1519117094824; Tue, 20 Feb 2018 00:58:14 -0800 (PST) Received: from baker.fritz.box ([2a02:908:1251:8fc0:7008:2819:5c1a:982d]) by smtp.gmail.com with ESMTPSA id x194sm4779844wmd.4.2018.02.20.00.58.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Feb 2018 00:58:14 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: bhelgaas@google.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH] PCI: stop crashing in pci_release_resource Date: Tue, 20 Feb 2018 09:58:13 +0100 Message-Id: <20180220085813.1897-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Is it entirely possible that the BIOS wasn't able to assign resources to a device. In this case don't crash in pci_release_resource() when we try to resize the resource. Signed-off-by: Christian König CC: stable@vger.kernel.org --- drivers/pci/setup-res.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index e815111f3f81..fd72c87a9b72 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -401,6 +401,9 @@ void pci_release_resource(struct pci_dev *dev, int resno) { struct resource *res = dev->resource + resno; + if (!res->parent) + return; + dev_info(&dev->dev, "BAR %d: releasing %pR\n", resno, res); release_resource(res); res->end = resource_size(res) - 1; -- 2.14.1