Date: Sat, 1 Apr 2000 17:42:05 -0800 (PST) From: Jin Guojun (FTG staff) <jin@george.lbl.gov> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/16767 open("/dev/ppi0") will crash machine in 4.0 Message-ID: <200004020142.RAA01122@george.lbl.gov>
next in thread | raw e-mail | index | archive | help
ppi->intr_resource = bus_alloc_resource(...) failed for ppi_attach() somehow, and it is hard to trace MACROs . If the maintainer cannot find why bus_alloc_resource() failed either, please check the ppi->intr_resource value and return failure in ppi_attach(), so users will not crash the machine when trying to open /dev/ppi0. Thanks, -Jin # dmesg ... ppi_attach: parent 0xc0e63080 irq 0x7 ppi_attach: ppi 0xc0e69c00 intr_res 0x0 ... ppi_attach(device_t dev) { uintptr_t irq; int zero = 0; struct ppi_data *ppi = DEVTOSOFTC(dev); /* retrive the irq */ BUS_READ_IVAR(device_get_parent(dev), dev, PPBUS_IVAR_IRQ, &irq); printf("ppi_attach: parent 0x%x irq 0x%x\n", device_get_parent(dev), irq ); /* declare our interrupt handler */ ppi->intr_resource = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1, RF_ACTIVE); printf("ppi_attach: ppi 0x%x intr_res 0x%x\n", ppi, ppi->intr_resource); make_dev(&ppi_cdevsw, device_get_unit(dev), /* XXX cleanup */ UID_ROOT, GID_WHEEL, 0600, "ppi%d", device_get_unit(dev)); return (0); } struct resource * bus_alloc_resource(device_t dev, int type, int *rid, u_long start, u_long end, u_long count, u_int flags) { if (dev->parent == 0) return (0); return (BUS_ALLOC_RESOURCE(dev->parent, dev, type, rid, start, end, count, flags)); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004020142.RAA01122>