Date: Sun, 21 Dec 2014 16:15:30 +0000 (UTC) From: Steven Hartland <smh@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276013 - head/sys/dev/ahci Message-ID: <201412211615.sBLGFU1E010093@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412211615.sBLGFU1E010093>