From 04fec95922740f87f0883a3d18dffcc85a3189cd Mon Sep 17 00:00:00 2001 From: jmcneill Date: Mon, 6 Oct 2008 02:21:50 +0000 Subject: [PATCH] ehci_free_itd: use LIST_INSERT_HEAD rather than LIST_INSERT_AFTER(LIST_FIRST(..), ..) when returning itds to the freelist to prevent a crash when the freelist is empty. Reviewed by Jeremy Morse. --- sys/dev/usb/ehci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index 684da26952f3..99dff6f418d1 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.149 2008/10/05 21:31:39 jmcneill Exp $ */ +/* $NetBSD: ehci.c,v 1.150 2008/10/06 02:21:50 jmcneill Exp $ */ /* * Copyright (c) 2004-2008 The NetBSD Foundation, Inc. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.149 2008/10/05 21:31:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.150 2008/10/06 02:21:50 jmcneill Exp $"); #include "ohci.h" #include "uhci.h" @@ -2828,7 +2828,7 @@ ehci_free_itd(ehci_softc_t *sc, ehci_soft_itd_t *itd) int s; s = splusb(); - LIST_INSERT_AFTER(LIST_FIRST(&sc->sc_freeitds), itd, u.free_list); + LIST_INSERT_HEAD(&sc->sc_freeitds, itd, u.free_list); splx(s); }