NetBSD Problem Report #38242

From martin@duskware.de  Sat Mar 15 21:55:24 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id A0D2D63B863
	for <gnats-bugs@gnats.netbsd.org>; Sat, 15 Mar 2008 21:55:24 +0000 (UTC)
Message-Id: <20080315213312.F105563B863@narn.NetBSD.org>
Date: Sat, 15 Mar 2008 21:33:12 +0000 (UTC)
From: o.vd.linden@quicknet.nl
Reply-To: o.vd.linden@quicknet.nl
To: netbsd-bugs-owner@NetBSD.org
Subject: unitialized struct device referencing in opl driver
X-Send-Pr-Version: www-1.0

>Number:         38242
>Category:       kern
>Synopsis:       unitialized struct device referencing in opl driver
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    cube
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 15 22:00:00 +0000 2008
>Closed-Date:    Tue Mar 18 21:56:23 +0000 2008
>Last-Modified:  Tue Mar 18 21:56:23 +0000 2008
>Originator:     Onno van der Linden
>Release:        4.9.55
>Organization:
>Environment:
NetBSD sheep 4.99.55 NetBSD 4.99.55 (SHEEP.acpi) #4: Sat Mar 15 20:20:36 MET 2008  root@sheep:/usr/src/sys/arch/i386/compile/SHEEP.acpi i386

>Description:
Booting a kernel that has the opl driver in it will fail with a uvm_fault because it references an unitialized part of its softc structure in
opl_attach(). The unitialized part is sc->mididev.dev.


>How-To-Repeat:
Compile a kernel that uses opl(4) and boot it.
>Fix:
$ diff -c `pwd`/midisyn.c.orig `pwd`/midisyn.c
*** /sys/dev/midisyn.c.orig     Sat Mar 15 22:16:46 2008
--- /sys/dev/midisyn.c  Sat Mar 15 22:17:58 2008
***************
*** 249,255 ****
                .cookie = ms,
                .notify = midisyn_notify
        };
! 
        sc->hw_if = &midisyn_hw_if;
        sc->hw_hdl = ms;
        DPRINTF(("midisyn_attach: ms=%p\n", sc->hw_hdl));
--- 249,255 ----
                .cookie = ms,
                .notify = midisyn_notify
        };
!       sc->dev = (struct device *) sc;
        sc->hw_if = &midisyn_hw_if;
        sc->hw_hdl = ms;
        DPRINTF(("midisyn_attach: ms=%p\n", sc->hw_hdl));

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->cube
Responsible-Changed-By: cube@NetBSD.org
Responsible-Changed-When: Sat, 15 Mar 2008 22:29:23 +0000
Responsible-Changed-Why:
My bad.


State-Changed-From-To: open->analyzed
State-Changed-By: cube@NetBSD.org
State-Changed-When: Sat, 15 Mar 2008 22:29:23 +0000
State-Changed-Why:
opl_softc embeds a midi_softc.


From: Quentin Garnier <cube@cubidou.net>
To: gnats-bugs@NetBSD.org
Cc: o.vd.linden@quicknet.nl
Subject: Re: kern/38242: unitialized struct device referencing in opl driver
Date: Sat, 15 Mar 2008 23:30:40 +0100

 --c3TuL/F1HcnI7CtP
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Sat, Mar 15, 2008 at 10:00:00PM +0000, o.vd.linden@quicknet.nl wrote:
 > >Number:         38242
 > >Category:       kern
 > >Synopsis:       unitialized struct device referencing in opl driver

 Sorry about that, I'll fix it shortly.

 Nice try, but the patch is wrong, though :)

 --=20
 Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
 "See the look on my face from staying too long in one place
 [...] every time the morning breaks I know I'm closer to falling"
 KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

 --c3TuL/F1HcnI7CtP
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (NetBSD)

 iQEVAwUBR9xOENgoQloHrPnoAQK2EAgAu50Rq3h0R3iT8KcsACb1sBDQ5VZ+m1/S
 i5ycKpXhNlLyWCmKTzveQ42//ZMT9XVRAyHrotc2r8J7rt+qYoC3SfTNQcMerl5o
 H7wSyed0Midv0eylRjcXkpWashTe1D0/Cf4DVqlgoAIw599tZ5eFTSKj9OFHNWVB
 Tsyx8Xs6efdklBQqeRDMHLOHN4waVAMIYJ7OrZ8Fc1sB1/4E3jjQSXQ/tvzuXojF
 WGfEP7zWo6OJ4ZkhZgFyUaV5AUW/GBTugwdw+AE6GkokLgAQ8u9wlI1rVuNp6oEw
 66sisMATtNbVh/2VE5OHdhPdcFeaX7sst0vKlY3QO/C6ARTGxCoGAA==
 =BKvE
 -----END PGP SIGNATURE-----

 --c3TuL/F1HcnI7CtP--

From: Quentin Garnier <cube@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38242 CVS commit: src/sys/dev
Date: Sat, 15 Mar 2008 23:14:38 +0000 (UTC)

 Module Name:	src
 Committed By:	cube
 Date:		Sat Mar 15 23:14:38 UTC 2008

 Modified Files:
 	src/sys/dev/ic: oplvar.h
 	src/sys/dev/isa: cms.c opl_ess.c opl_isa.c opl_sb.c opl_wss.c opl_ym.c
 	src/sys/dev/pci: opl_cmpci.c opl_eso.c opl_fms.c opl_sv.c opl_yds.c
 	src/sys/dev/pcmcia: opl_esl.c

 Log Message:
 Split device_t and softc for opl(4).  That should have been done along with
 midi(4), because opl_softc embed a midi_softc.
 Fixes PR#38242 by Onno van der Linden.


 To generate a diff of this commit:
 cvs rdiff -r1.13 -r1.14 src/sys/dev/ic/oplvar.h
 cvs rdiff -r1.15 -r1.16 src/sys/dev/isa/cms.c
 cvs rdiff -r1.14 -r1.15 src/sys/dev/isa/opl_ess.c src/sys/dev/isa/opl_ym.c
 cvs rdiff -r1.17 -r1.18 src/sys/dev/isa/opl_isa.c
 cvs rdiff -r1.16 -r1.17 src/sys/dev/isa/opl_sb.c
 cvs rdiff -r1.11 -r1.12 src/sys/dev/isa/opl_wss.c
 cvs rdiff -r1.13 -r1.14 src/sys/dev/pci/opl_cmpci.c src/sys/dev/pci/opl_fms.c \
     src/sys/dev/pci/opl_yds.c
 cvs rdiff -r1.14 -r1.15 src/sys/dev/pci/opl_eso.c
 cvs rdiff -r1.12 -r1.13 src/sys/dev/pci/opl_sv.c
 cvs rdiff -r1.15 -r1.16 src/sys/dev/pcmcia/opl_esl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->feedback
State-Changed-By: cube@NetBSD.org
State-Changed-When: Sat, 15 Mar 2008 23:25:26 +0000
State-Changed-Why:
A fix has been committed.


From: Quentin Garnier <cube@cubidou.net>
To: gnats-bugs@NetBSD.org
Cc: o.vd.linden@quicknet.nl
Subject: Re: kern/38242: unitialized struct device referencing in opl driver
Date: Sun, 16 Mar 2008 00:26:09 +0100

 --yi6uow/Yu/470I/Z
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Sat, Mar 15, 2008 at 10:00:00PM +0000, o.vd.linden@quicknet.nl wrote:
 > >Number:         38242
 > >Category:       kern
 > >Synopsis:       unitialized struct device referencing in opl driver
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       high
 > >Responsible:    kern-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Sat Mar 15 22:00:00 +0000 2008
 > >Originator:     Onno van der Linden
 > >Release:        4.9.55
 > >Organization:
 > >Environment:
 > NetBSD sheep 4.99.55 NetBSD 4.99.55 (SHEEP.acpi) #4: Sat Mar 15 20:20:36 =
 MET 2008  root@sheep:/usr/src/sys/arch/i386/compile/SHEEP.acpi i386
 >=20
 > >Description:
 > Booting a kernel that has the opl driver in it will fail with a uvm_fault=
  because it references an unitialized part of its softc structure in
 > opl_attach(). The unitialized part is sc->mididev.dev.

 Is it fixed now?

 --=20
 Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
 "See the look on my face from staying too long in one place
 [...] every time the morning breaks I know I'm closer to falling"
 KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

 --yi6uow/Yu/470I/Z
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (NetBSD)

 iQEVAwUBR9xbENgoQloHrPnoAQIkyAf/dfZWv3BzQs3DpMi5kLHF8StKQZmGYO0x
 4FhLj4cphnVTRFa4D6sWXEcxZFN8KV9+4f1I7TCaKf/yaZln8KnwZtOkX3xi+tXo
 y9hAoTkEqWFEtVN44xi6fdDwzao9McCQY8l/MM6k2M7PdKds6A1DaBqzgYqnBOa1
 QPgcu80OnOfTSwrhwn0j5aWKfHWsVnedTnkNhEg1YGSrp1haLOxz26Rp7ifJct7T
 USZe0/sNaAHQdhfhw1pWB6OSbpcJ4A5EbVHQ9AANPtTTylBWB2DXoq3+6wK77rQu
 J5HiLvuaCnL6nbpbsO6tDxx1/iY7u2DBfacuJTBzjHFN6B57jnQXXw==
 =0cQb
 -----END PGP SIGNATURE-----

 --yi6uow/Yu/470I/Z--

State-Changed-From-To: feedback->closed
State-Changed-By: cube@NetBSD.org
State-Changed-When: Tue, 18 Mar 2008 21:56:23 +0000
State-Changed-Why:
Problem is fixed now.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.