CVSROOT: /cvs Module name: src Changes by: bl...@cvs.openbsd.org 2015/05/18 13:10:35
Modified files: sys/kern : kern_sysctl.c Log message: For each file in sysctl(KERN_FILE_BYFILE), FILLIT() calls fill_file(), which calls VOP_GETATTR(). For NFS, that leads to nfs_getattr(). If the node's attributes are not in NFS's cache, nfs_getattr() will invoke nfs_request() and the latter will sleep, allowing the file pointer to disappear while we traverse the list. This results in kernel crashes while running netstat or pstat -f. Grab a reference to the file descriptor before calling FILLIT(), and release it afterwards. This way the file descriptor cannot disappear while we sleep in nfs_getattr(). Analysis and fix from Pedro Martelletto; input and OK guenther@ mpi@