cvs commit: src/sys/fs/pseudofs pseudofs_vnops.c

Dag-Erling Smorgrav des at FreeBSD.org
Mon Mar 14 08:21:33 PST 2005


des         2005-03-14 16:21:32 UTC

  FreeBSD src repository

  Modified files:
    sys/fs/pseudofs      pseudofs_vnops.c 
  Log:
  Fix two long-standing bugs in pfs_readdir():
  
  Since we used an sbuf of size resid to accumulate dirents, we would end
  up returning one byte short when we had enough dirents to fill or exceed
  the size of the sbuf (the last byte being lost to bogus NUL termination)
  causing the next call to return EINVAL due to an unaligned offset.  This
  went undetected for a long time because I did most of my testing in
  single-user mode, where there are rarely enough processes to fill the
  4096-byte buffer ls(1) uses.  The most common symptom of this bug is that
  tab completion of /proc or /compat/linux/proc does not work properly when
  many processes are running.
  
  Also, a check near the top would return EINVAL if resid was smaller than
  PFS_DELEN, even if it was 0, which is frequently the case and perfectly
  allowable.  Change the test so that it returns 0 if resid is 0.
  
  MFC after:      2 weeks
  
  Revision  Changes    Path
  1.52      +13 -11    src/sys/fs/pseudofs/pseudofs_vnops.c


More information about the cvs-all mailing list