Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp755425ybl; Fri, 6 Dec 2019 05:49:53 -0800 (PST) X-Google-Smtp-Source: APXvYqw5Q8QpcGvDqW261b6AQKOcLY3WgQKG7sO9lFIgC2/IwJkp3JW/tCAiiBJZkHlvoV7cHncy X-Received: by 2002:a9d:6315:: with SMTP id q21mr10360692otk.15.1575640193791; Fri, 06 Dec 2019 05:49:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575640193; cv=none; d=google.com; s=arc-20160816; b=CE6s6YmDUU64zTC/qYl7CmxzKSFY6FsbMGod8IojRoTPDOBAtgoA0gYfsI+vAG6T5A q7QSpe8hPBlqzLlriT6HZ8fKuEfLB0hTu43tXRuOk9h45BnKiNKfoc4y3H4JTjpNIQC3 ShbwAskhTWy6tjEkO08dMVmoTvk5xHTEqrK40PqdmF1ZLWl1201JqBfUvaXj9Shk4PK/ y6IUa/nUbJieuBPItTDfagEXHXGCaFh3wHv79eUY3pRIbYLIWKdijmXDy2ovQod6bHJC U8JJ0BJ3iSRhmdhyzwKzwlCciXM+dxeDiYn1ybooooUxPYqHDd2F3jPkMKh0EWbbdXcE Vxcg== 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:cc:to:from:ironport-sdr:dkim-signature; bh=yg/H4rYLdpjMh9EeUO9p3gNSwplJDxuqHR+8symDg3A=; b=ZYTT8PNoegctGQxScsx2aW/wzxiGGs7MAgbNv+NcEIoQ0CwYUqvCwiFnFt+ZIrdbbI lDIIcuXDsTbwgoYckuHsxWn7d69pYFZmbpCUyAWRrbHMnbILkzcYovmXCWt8PqyyNBZF HB1+6AtGn3hTe5WGtDs9qJkDbSOgSU1HGR2Lqb2Fm47+xMuZtoQEe+z9AYxyo06DeSwz Cj6x9UgxrJw1TBc5BWvUZuVXCNFpWohikN5+EQ1VkgzVdkM1ti+mBIZ5O4wS+L4Jjdaa uyGPYPoAs3nLbxY6fI7drRyRrj1BxAlH0Ppqh/lUL76IvsFemqo7wG5r2ENiZ31S9NK5 U0pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=LTEJgQ5t; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v67si6610077oia.26.2019.12.06.05.49.40; Fri, 06 Dec 2019 05:49:53 -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=@amazon.com header.s=amazon201209 header.b=LTEJgQ5t; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726278AbfLFNtJ (ORCPT + 99 others); Fri, 6 Dec 2019 08:49:09 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:65230 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726201AbfLFNtJ (ORCPT ); Fri, 6 Dec 2019 08:49:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1575640149; x=1607176149; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yg/H4rYLdpjMh9EeUO9p3gNSwplJDxuqHR+8symDg3A=; b=LTEJgQ5tm4ht+lT8CsKEFqzJS0qYquI4zxI/w20qqP3SpfM3NV5wRvbh P/A1iDAI6KS00Jsa+VlZP6jQHfehrb1VBeKUKjh+Y+C8Tj3yHcvcxiY1o xsgUI9A+U41WJuh0f2QA6wzD8htECy+JNlj5NGq8zsyMyTEtYII4ET3a8 c=; IronPort-SDR: FjhXB9JqAJI6AnLIvtS0fINmoBUIYUcB+9FSmhw7O7H4zkwx4pPwr7ol9WV7YDYF8GNVE7iwSL 9QljUSXCPItg== X-IronPort-AV: E=Sophos;i="5.69,284,1571702400"; d="scan'208";a="13388569" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-c300ac87.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 06 Dec 2019 13:48:57 +0000 Received: from EX13MTAUEA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2b-c300ac87.us-west-2.amazon.com (Postfix) with ESMTPS id 6334EA2BE3; Fri, 6 Dec 2019 13:48:56 +0000 (UTC) Received: from EX13D07EUB004.ant.amazon.com (10.43.166.234) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 6 Dec 2019 13:48:55 +0000 Received: from u86a60e9fba0b55.ant.amazon.com (10.43.162.16) by EX13D07EUB004.ant.amazon.com (10.43.166.234) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 6 Dec 2019 13:48:51 +0000 From: Stefan Nuernberger To: CC: Boris Ostrovsky , Juergen Gross , Ross Lagerwall , Uwe Dannowski , Conny Seidel , Stefan Nuernberger , , Subject: [PATCH] xen/pciback: Prevent NULL pointer dereference in quirks_show Date: Fri, 6 Dec 2019 14:48:04 +0100 Message-ID: <20191206134804.4537-1-snu@amazon.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.43.162.16] X-ClientProxiedBy: EX13D04UWB004.ant.amazon.com (10.43.161.103) To EX13D07EUB004.ant.amazon.com (10.43.166.234) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Dannowski Reading /sys/bus/pci/drivers/pciback/quirks while unbinding can result in dereferencing a NULL pointer. Instead, skip printing information about the dangling quirk. Reported-by: Conny Seidel Signed-off-by: Uwe Dannowski Signed-off-by: Stefan Nuernberger Cc: xen-devel@lists.xenproject.org Cc: stable@vger.kernel.org --- drivers/xen/xen-pciback/pci_stub.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 097410a7cdb7..da725e474294 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c @@ -1346,6 +1346,8 @@ static ssize_t quirks_show(struct device_driver *drv, char *buf) quirk->devid.subdevice); dev_data = pci_get_drvdata(quirk->pdev); + if (!dev_data) + continue; list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { field = cfg_entry->field; -- 2.23.0 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879