svn commit: r276013 - head/sys/dev/ahci

Steven Hartland smh at FreeBSD.org
Sun Dec 21 16:15:30 UTC 2014


Author: smh
Date: Sun Dec 21 16:15:29 2014
New Revision: 276013
URL: https://svnweb.freebsd.org/changeset/base/276013

Log:
  Clamp ahci max irq's to AHCI_MAX_IRQS
  
  This prevents the possiblity of any overruns on the statically allocated
  struct irqs field.
  
  Differential Revision:	D838
  MFC after:	2 weeks
  X-MFC-With:	r276012
  Sponsored by:	Multiplay

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Sun Dec 21 16:07:46 2014	(r276012)
+++ head/sys/dev/ahci/ahci.c	Sun Dec 21 16:15:29 2014	(r276013)
@@ -356,6 +356,14 @@ ahci_setup_interrupt(device_t dev)
 		device_printf(dev, "Falling back to one MSI\n");
 		ctlr->numirqs = 1;
 	}
+
+	/* Ensure we don't overrun irqs. */
+	if (ctlr->numirqs > AHCI_MAX_IRQS) {
+		device_printf(dev, "Too many irqs %d > %d (clamping)\n",
+		    ctlr->numirqs, AHCI_MAX_IRQS);
+		ctlr->numirqs = AHCI_MAX_IRQS;
+	}
+
 	/* Allocate all IRQs. */
 	for (i = 0; i < ctlr->numirqs; i++) {
 		ctlr->irqs[i].ctlr = ctlr;


More information about the svn-src-head mailing list