]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-solaris-afs-nfsrdwr-avoid-reading-past-end-of-file-20060213
authorDerrick Brashear <shadow@dementia.org>
Mon, 13 Feb 2006 18:39:11 +0000 (18:39 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 13 Feb 2006 18:39:11 +0000 (18:39 +0000)
FIXES 25747

avoid a panic when we attempt a read past the end of the file

(cherry picked from commit 63031c0b8b1a00711a043431cb5d1c98834ab0cc)

src/afs/SOLARIS/osi_vnodeops.c

index 028148b49e4c705415e1d7a887c2d3b3c5c098e0..fae5817ba0f361d0ca4687df491521f01da1996f 100644 (file)
@@ -895,8 +895,9 @@ afs_nfsrdwr(avc, auio, arw, ioflag, acred)
         * call it with an offset based on blocks smaller than MAXBSIZE
         * (implying that it should be named BSIZE, since it is clearly both a
         * max and a min). */
-       size = auio->afsio_resid;       /* transfer size */
-       fileBase = auio->afsio_offset;  /* start file position for xfr */
+       size = auio->afsio_resid;       /* transfer size */     
+       fileBase = ((arw == UIO_READ) && (origLength < auio->uio_offset)) ? 
+           origLength : auio->afsio_offset;  /* start file position for xfr */
        pageBase = fileBase & ~(MAXBSIZE - 1);  /* file position of the page */
        pageOffset = fileBase & (MAXBSIZE - 1); /* xfr start's offset within page */
        tsize = MAXBSIZE - pageOffset;  /* how much more fits in this page */