On Wed, Apr 20, 2011 at 01:15:22AM +0000, Rick Macklem wrote:
> Author: rmacklem
> Date: Wed Apr 20 01:15:22 2011
> New Revision: 220877
> URL: http://svn.freebsd.org/changeset/base/220877
> 
> Log:
>   Modify the offset + size checks for read and write in the
>   experimental NFS client to take care of overflows for the calls
>   above the buffer cache layer in a manner similar to r220876.
>   Thanks go to dillon at apollo.backplane.com for providing the
>   snippet of code that does this.
[...]
> +     tmp_off = uio->uio_offset + uio->uio_resid;
> +     mtx_lock(&nmp->nm_mtx);
> +     if (tmp_off > nmp->nm_maxfilesize || tmp_off < uio->uio_offset) {
> +             mtx_unlock(&nmp->nm_mtx);
>               return (EFBIG);
> +     }
> +     mtx_unlock(&nmp->nm_mtx);

I don't think you need the lock to protect nm_maxfilesize. Can it change
from under us? My guess is that it is set on mount time and is not
modified afterwards.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://yomoli.com

Attachment: pgppFrhLwoiAo.pgp
Description: PGP signature

Reply via email to