From nobody@FreeBSD.ORG  Wed Oct  4 07:03:39 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 13AF637B66C; Wed,  4 Oct 2000 07:03:39 -0700 (PDT)
Message-Id: <20001004140339.13AF637B66C@hub.freebsd.org>
Date: Wed,  4 Oct 2000 07:03:39 -0700 (PDT)
From: dockes@musicmaker.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: libcam's cam_real_open_device() may lose fds on error condition
X-Send-Pr-Version: www-1.0

>Number:         21751
>Category:       kern
>Synopsis:       [libcam] [patch] libcam's cam_real_open_device() may lose fds on error condition
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 04 07:10:01 PDT 2000
>Closed-Date:    Sun Feb 17 19:29:39 UTC 2008
>Last-Modified:  Sun Feb 17 19:29:39 UTC 2008
>Originator:     Jean-Francois Dockes
>Release:        4.1.1-RELEASE
>Organization:
musicmaker.com
>Environment:
FreeBSD hautmedoc 4.1.1-RELEASE FreeBSD 4.1.1-RELEASE #1: Tue Oct  3 17:15:13 MEST 2000     dockes@hautmedoc:/u/src/sys/compile/HAUTMEDOC  i386

>Description:
In libcam's camlib.c, if one of the 2 last ioctl calls in 
cam_real_open_device() fails (probably a very unlikely condition, but 
the fix is simple enough),the routine will return an error without 
closing an open descriptor.

>How-To-Repeat:

>Fix:
*** camlib.c.org        Tue Oct  3 16:29:40 2000
--- camlib.c    Wed Oct  4 15:51:51 2000
***************
*** 555,559 ****
        char *func_name = "cam_real_open_device";
        union ccb ccb;
!       int fd, malloced_device = 0;
  
        /*
--- 555,559 ----
        char *func_name = "cam_real_open_device";
        union ccb ccb;
!       int fd = -1, malloced_device = 0;
  
        /*
***************
*** 692,695 ****
--- 692,697 ----
  crod_bailout:
http://perso.wanadoo.fr/dockes/camlib-fd.patch


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ken 
Responsible-Changed-By: ken 
Responsible-Changed-When: Wed Oct 4 09:32:51 PDT 2000 
Responsible-Changed-Why:  
My code. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21751 
Responsible-Changed-From-To: ken->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Aug 2 00:39:02 UTC 2007 
Responsible-Changed-Why:  
With permission, reassign away from inactive committer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21751 
State-Changed-From-To: open->closed 
State-Changed-By: antoine 
State-Changed-When: Sun Feb 17 19:28:14 UTC 2008 
State-Changed-Why:  
Close: fixed in revision 1.9 of lib/libcam/camlib.c more than 6 years ago. 
Thanks for the submission. 

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