From owner-freebsd-current@FreeBSD.ORG Sun Apr 30 00:08:46 2006 Return-Path: X-Original-To: freebsd-current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8F5C16A402 for ; Sun, 30 Apr 2006 00:08:46 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [24.172.16.118]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4013A43D45 for ; Sun, 30 Apr 2006 00:08:46 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from shumai.marcuscom.com (shumai.marcuscom.com [192.168.1.4]) by creme-brulee.marcuscom.com (8.13.6/8.13.6) with ESMTP id k3U0ACHE009963; Sat, 29 Apr 2006 20:10:12 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: Scott Long In-Reply-To: <4453FB29.3040309@samsco.org> References: <1146346120.16564.12.camel@shumai.marcuscom.com> <4453FB29.3040309@samsco.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-8KAcoAn+HEAAR7LRJKV1" Organization: FreeBSD, Inc. Date: Sat, 29 Apr 2006 20:08:42 -0400 Message-Id: <1146355722.16564.20.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.4.2.1 FreeBSD GNOME Team Port Cc: freebsd-current@FreeBSD.org Subject: Re: File descriptor leak in libcam X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Apr 2006 00:08:47 -0000 --=-8KAcoAn+HEAAR7LRJKV1 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sat, 2006-04-29 at 17:47 -0600, Scott Long wrote: > Joe Marcus Clarke wrote: > > There is a leak in the cam_lookup_pass() if the ioctl call fails to fin= d > > the passthru device. Basically, the xpt file descriptor will not be > > closed. Can anyone give me permission to commit the following patch? > > Thanks. > >=20 > > http://www.marcuscom.com/downloads/camlib.c.diff > >=20 > > Joe > >=20 >=20 > Looks good to me. Style-wise, I'd have it close the fd before > testing the return of the ioctl, but that's minor. So you'd rather see something like: int rc; ... rc =3D ioctl(fd, CAMGETPASSTHRU, &ccb); close(fd); if (rc =3D=3D -1) { ... Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-8KAcoAn+HEAAR7LRJKV1 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQBEVAAKb2iPiv4Uz4cRAsOEAJ0RDYhxx/F9Av7Guch+fhukeH0sMQCfQzXX /ukbIuAA4bBiktaZE+66urQ= =iTGW -----END PGP SIGNATURE----- --=-8KAcoAn+HEAAR7LRJKV1--