linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/pciback: Prevent NULL pointer dereference in quirks_show
@ 2019-12-06 13:48 Stefan Nuernberger
  2019-12-06 15:11 ` Boris Ostrovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Nuernberger @ 2019-12-06 13:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Boris Ostrovsky, Juergen Gross, Ross Lagerwall, Uwe Dannowski,
	Conny Seidel, Stefan Nuernberger, xen-devel, stable

From: Uwe Dannowski <uwed@amazon.de>

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 <consei@amazon.de>
Signed-off-by: Uwe Dannowski <uwed@amazon.de>
Signed-off-by: Stefan Nuernberger <snu@amazon.com>

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




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-09 21:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-06 13:48 [PATCH] xen/pciback: Prevent NULL pointer dereference in quirks_show Stefan Nuernberger
2019-12-06 15:11 ` Boris Ostrovsky
2019-12-06 18:09   ` Nuernberger, Stefan
2019-12-06 20:15     ` Boris Ostrovsky
2019-12-09 18:16       ` Nuernberger, Stefan
2019-12-09 21:21         ` Boris Ostrovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).