home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / bsd / 8652 < prev    next >
Encoding:
Internet Message Format  |  1992-11-09  |  1.8 KB

  1. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!cs.utexas.edu!uwm.edu!ogicse!news.u.washington.edu!ns1.nodak.edu!plains.NoDak.edu!tinguely
  2. From: tinguely@plains.NoDak.edu (Mark Tinguely)
  3. Newsgroups: comp.unix.bsd
  4. Subject: Small buffer leak in kern__physio.c
  5. Message-ID: <BxGz47.9w8@ns1.nodak.edu>
  6. Date: 9 Nov 92 22:14:31 GMT
  7. Article-I.D.: ns1.BxGz47.9w8
  8. Sender: usenet@ns1.nodak.edu (News login)
  9. Organization: North Dakota State University
  10. Lines: 38
  11. Nntp-Posting-Host: plains.nodak.edu
  12.  
  13.  
  14.  There appears to be a small buffer leak in kern__physio.c. The function
  15.  physio() allocates a buf only for the lifetime of that function. If the
  16.  function exits on access error, the buf is not released.
  17.  
  18.  This error was found while looking for M_TEMP allocation (ie. may not be the
  19.  direct cause of a known problem). This is fix visible fix. physio() is
  20.  not called that often to cause a major memory loss.
  21.  
  22. *** kern__physio.c.orig    Mon Nov  9 15:49:10 1992
  23. --- kern__physio.c    Mon Nov  9 15:53:02 1992
  24. ***************
  25. *** 117,126 ****
  26.           bp->b_bcount = min (256*1024, amttodo);
  27.   
  28.           /* first, check if accessible */
  29. !         if (rw == B_READ && !useracc(base, bp->b_bcount, B_WRITE))
  30.               return (EFAULT);
  31. !         if (rw == B_WRITE && !useracc(base, bp->b_bcount, B_READ))
  32.               return (EFAULT);
  33.   
  34.           /* update referenced and dirty bits, handle copy objects */
  35.           if (rw == B_READ)
  36. --- 117,130 ----
  37.           bp->b_bcount = min (256*1024, amttodo);
  38.   
  39.           /* first, check if accessible */
  40. !         if (rw == B_READ && !useracc(base, bp->b_bcount, B_WRITE)) {
  41. !             free(bp, M_TEMP);
  42.               return (EFAULT);
  43. !         }
  44. !         if (rw == B_WRITE && !useracc(base, bp->b_bcount, B_READ)) {
  45. !             free(bp, M_TEMP);
  46.               return (EFAULT);
  47. +         }
  48.   
  49.           /* update referenced and dirty bits, handle copy objects */
  50.           if (rw == B_READ)
  51.