Subject: Re: kern/29651
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Rui Paulo <rpaulo@netbsd-pt.org>
List: netbsd-bugs
Date: 03/10/2005 17:54:01
The following reply was made to PR kern/29651; it has been noted by GNATS.

From: Rui Paulo <rpaulo@netbsd-pt.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/29651
Date: Thu, 10 Mar 2005 17:54:20 +0000

 The following patch addresses this problem. I've tested it with success
 on NetBSD/i386 2.9.16.
 
 Is it clean ? 
 
 Index: vfs_bio.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/vfs_bio.c,v
 retrieving revision 1.142
 diff -u -r1.142 vfs_bio.c
 --- vfs_bio.c   26 Feb 2005 21:34:56 -0000      1.142
 +++ vfs_bio.c   10 Mar 2005 17:39:47 -0000
 @@ -1620,11 +1620,13 @@
                 bufcache = t;
                 buf_setwm();
         } else if (rnode->sysctl_data == &bufmem_lowater) {
 -               if (bufmem_hiwater - bufmem_lowater < 16)
 +               if (t < 0 || t >= bufmem_hiwater 
 +                   || bufmem_hiwater - bufmem_lowater < 16)
                         return (EINVAL);
                 bufmem_lowater = t;
         } else if (rnode->sysctl_data == &bufmem_hiwater) {
 -               if (bufmem_hiwater - bufmem_lowater < 16)
 +               if (t < 0 || t <= bufmem_lowater
 +                   || bufmem_hiwater - bufmem_lowater < 16)
                         return (EINVAL);
                 bufmem_hiwater = t;
         } else
 
 -- 
  Rui Paulo <rpaulo@netbsd-pt.org>        http://www.netbsd-pt.org/users/rpaulo/