From nobody@FreeBSD.org  Tue Jul 11 01:32:13 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7524C16A4DE
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Jul 2006 01:32:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0424743D76
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Jul 2006 01:32:13 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k6B1WCZf043809
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 11 Jul 2006 01:32:12 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k6B1WChj043808;
	Tue, 11 Jul 2006 01:32:12 GMT
	(envelope-from nobody)
Message-Id: <200607110132.k6B1WChj043808@www.freebsd.org>
Date: Tue, 11 Jul 2006 01:32:12 GMT
From: Beyond Luo <fedora@ercist.iscas.ac.cn>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] mutex lock errors in drivers
X-Send-Pr-Version: www-2.3

>Number:         100046
>Category:       kern
>Synopsis:       [patch] mutex lock errors in drivers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 11 01:40:14 GMT 2006
>Closed-Date:    Wed Jul 26 07:51:51 GMT 2006
>Last-Modified:  Wed Jul 26 07:51:51 GMT 2006
>Originator:     Beyond Luo
>Release:        6.0
>Organization:
Institute of Software, Chinese Academy of Science
>Environment:
FreeBSD Earth.Earth 6.0-RELEASE FreeBSD 6.0-RELEASE #2: Tue Feb 28 02:32:45 UTC 2006     root@guhao.fsd.iscas:/usr/obj/usr/src/sys/CAS-EARTH  i386
(We are doing some work on FreeBSD6.0)
>Description:
The following three files do not do mtx_unlock before return:
  /usr/src/sys/cam/scsi/scsi_cd.c (#line 594)
  /usr/src/sys/cam/scsi/scsi_da.c (#line 1004)
  /usr/src/sys/dev/aac/aac_cam.c (#line 417)

(Detected by a bug-check tool we are developing.)


>How-To-Repeat:

>Fix:
  following mtx_unlock should be added respectively:
  mtx_unlock(&Giant);
  mtx_unlock(&Giant);
  mtx_unlock(&sc->aac_io_lock);
>Release-Note:
>Audit-Trail:

From: Craig Rodrigues <rodrigc@crodrigues.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/100046: [patch] mutex lock errors in drivers
Date: Wed, 12 Jul 2006 01:09:18 -0400

 Here is the actual patch missing from the PR.
 
 
 Index: aac_cam.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/dev/aac/aac_cam.c,v
 retrieving revision 1.22
 diff -u -u -r1.22 aac_cam.c
 --- aac_cam.c	8 Oct 2005 15:55:09 -0000	1.22
 +++ aac_cam.c	12 Jul 2006 05:06:23 -0000
 @@ -414,6 +414,7 @@
  		} else {
  			ccb->ccb_h.status = CAM_REQ_CMP;
  			xpt_done(ccb);
 +			mtx_unlock(&sc->aac_io_lock);
  			return;
  		}
  	default:
 Index: scsi_cd.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/cam/scsi/scsi_cd.c,v
 retrieving revision 1.95
 diff -u -u -r1.95 scsi_cd.c
 --- scsi_cd.c	17 Apr 2006 09:12:53 -0000	1.95
 +++ scsi_cd.c	12 Jul 2006 05:07:23 -0000
 @@ -591,6 +591,7 @@
  
  	if (softc->sysctl_tree == NULL) {
  		printf("cdsysctlinit: unable to allocate sysctl tree\n");
 +		mtx_unlock(&Giant);
  		return;
  	}
  
 Index: scsi_da.c
 ===================================================================
 RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v
 retrieving revision 1.190
 diff -u -u -r1.190 scsi_da.c
 --- scsi_da.c	18 Apr 2006 22:01:59 -0000	1.190
 +++ scsi_da.c	12 Jul 2006 05:07:23 -0000
 @@ -1001,6 +1001,7 @@
  		CTLFLAG_RD, 0, tmpstr);
  	if (softc->sysctl_tree == NULL) {
  		printf("dasysctlinit: unable to allocate sysctl tree\n");
 +		mtx_unlock(&Giant);
  		return;
  	}
 
 
 
  
State-Changed-From-To: open->patched 
State-Changed-By: delphij 
State-Changed-When: Fri Jul 14 13:59:04 UTC 2006 
State-Changed-Why:  
Patch applied against -HEAD.  MFC Reminder (2 weeks) 


Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Fri Jul 14 13:59:04 UTC 2006 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100046 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Wed Jul 26 07:51:22 UTC 2006 
State-Changed-Why:  
Patch applied to both RELENG_6 and RELENG_5.  Thanks for your 
submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100046 
>Unformatted:
