Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

kernel/natapci - Fix a NULL pointer dereference.

- ata_devclass is NULL when no unit 0/1 is available or no
  legacy support has been detected.
- device_add_child() populates ata_devclass via make_device()
  so do not try to get information out of it when NULL.

Submitted-by: @dillon
  • Loading branch information...
commit 40fa28485e51267b667cffb3cc801ee93a20bc48 1 parent 1a7bbca
@tuxillo tuxillo authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 sys/dev/disk/nata/ata-pci.c
View
8 sys/dev/disk/nata/ata-pci.c
@@ -246,9 +246,11 @@ ata_pci_attach(device_t dev)
continue;
}
/* XXX TGEN devclass_find_free_unit() implementation */
- while (freeunit < devclass_get_maxunit(ata_devclass) &&
- devclass_get_device(ata_devclass, freeunit) != NULL)
- freeunit++;
+ if (ata_devclass) {
+ while (freeunit < devclass_get_maxunit(ata_devclass) &&
+ devclass_get_device(ata_devclass, freeunit) != NULL)
+ freeunit++;
+ }
device_add_child(dev, "ata", freeunit);
}
bus_generic_attach(dev);
Please sign in to comment.
Something went wrong with that request. Please try again.