Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/hdaudio call kmem_free with the right address in...



details:   https://anonhg.NetBSD.org/src/rev/af57c703d555
branches:  trunk
changeset: 777993:af57c703d555
user:      para <para%NetBSD.org@localhost>
date:      Sun Mar 11 19:39:36 2012 +0000

description:
call kmem_free with the right address in hdafg_detach for sc_widgets
the former code let to memory corruption

diffstat:

 sys/dev/pci/hdaudio/hdafg.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r ee62a24a0fcf -r af57c703d555 sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c       Sun Mar 11 19:33:17 2012 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c       Sun Mar 11 19:39:36 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.16 2012/03/11 19:39:36 para Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3733,7 +3733,7 @@
 hdafg_detach(device_t self, int flags)
 {
        struct hdafg_softc *sc = device_private(self);
-       struct hdaudio_widget *w = sc->sc_widgets;
+       struct hdaudio_widget *wl, *w = sc->sc_widgets;
        struct hdaudio_assoc *as = sc->sc_assocs;
        struct hdaudio_control *ctl = sc->sc_ctls;
        struct hdaudio_mixer *mx = sc->sc_mixers;
@@ -3755,10 +3755,10 @@
 
        /* restore bios pin widget configuration */
        for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) {
-               w = hdafg_widget_lookup(sc, nid);               
-               if (w == NULL || w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
+               wl = hdafg_widget_lookup(sc, nid);              
+               if (wl == NULL || wl->w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
                        continue;
-               hdafg_widget_setconfig(w, w->w_pin.biosconfig);
+               hdafg_widget_setconfig(wl, wl->w_pin.biosconfig);
        }
 
        if (w)



Home | Main Index | Thread Index | Old Index