kern/87208: /dev/cuad[0/1] bad file descriptor error during mgetty read

Kostik Belousov kostikbel at gmail.com
Mon Dec 19 08:40:17 PST 2005


The following reply was made to PR kern/87208; it has been noted by GNATS.

From: Kostik Belousov <kostikbel at gmail.com>
To: bug-followup at FreeBSD.org, norbert at feu-nrmf.ph
Cc:  
Subject: Re: kern/87208: /dev/cuad[0/1] bad file descriptor error during mgetty read
Date: Mon, 19 Dec 2005 18:37:42 +0200

 --LQksG6bCIzRHxTLp
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Ok,
 it seems I have found the problem. Please, test the patch below:
 
 Index: sys/kern/kern_descrip.c
 ===================================================================
 RCS file: /usr/local/arch/ncvs/src/sys/kern/kern_descrip.c,v
 retrieving revision 1.289
 diff -u -r1.289 kern_descrip.c
 --- sys/kern/kern_descrip.c	30 Nov 2005 05:12:03 -0000	1.289
 +++ sys/kern/kern_descrip.c	19 Dec 2005 16:36:44 -0000
 @@ -1512,6 +1512,8 @@
  				newfdp->fd_freefile = i;
  		}
  	}
 +	if (newfdp->fd_freefile == -1)
 +		newfdp->fd_freefile = i;
  	FILEDESC_UNLOCK_FAST(fdp);
  	FILEDESC_LOCK(newfdp);
  	for (i = 0; i <= newfdp->fd_lastfile; ++i)
 @@ -1519,9 +1521,9 @@
  			fdused(newfdp, i);
  	FILEDESC_UNLOCK(newfdp);
  	FILEDESC_LOCK_FAST(fdp);
 -	if (newfdp->fd_freefile == -1)
 -		newfdp->fd_freefile = i;
  	newfdp->fd_cmask = fdp->fd_cmask;
 +	KASSERT(fd_first_free(newfdp, 0, newfdp->fd_nfiles) == newfdp->fd_freefile,
 +		("fd_first_free != fd_freefile fdp %p newfdp %p p %p", fdp, newfdp, curproc));
  	FILEDESC_UNLOCK_FAST(fdp);
  	return (newfdp);
  }
 
 --LQksG6bCIzRHxTLp
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2 (FreeBSD)
 
 iD8DBQFDpuHVC3+MBN1Mb4gRAsWYAJ47ZIwOzd0XXHS8p3h6Zz+VUQBCPACgjbHb
 xtwn+aOwayji2I07Zbr+dxw=
 =CMsY
 -----END PGP SIGNATURE-----
 
 --LQksG6bCIzRHxTLp--


More information about the freebsd-bugs mailing list