svn commit: r297401 - head/sys/fs/cd9660

Konstantin Belousov kib at FreeBSD.org
Tue Mar 29 19:59:46 UTC 2016


Author: kib
Date: Tue Mar 29 19:59:44 2016
New Revision: 297401
URL: https://svnweb.freebsd.org/changeset/base/297401

Log:
  Do not access buffer if bread(9) or cluster_read(9) failed.  On error,
  the functions free the buffer and set the pointer to NULL.  Also
  remove useless call to brelse(9) on the error path.
  
  PR:	208275
  Submitted by:	Fabian Keil <fk at fabiankeil.de>
  MFC after:	2 weeks

Modified:
  head/sys/fs/cd9660/cd9660_vnops.c

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==============================================================================
--- head/sys/fs/cd9660/cd9660_vnops.c	Tue Mar 29 19:57:11 2016	(r297400)
+++ head/sys/fs/cd9660/cd9660_vnops.c	Tue Mar 29 19:59:44 2016	(r297401)
@@ -341,11 +341,9 @@ cd9660_read(ap)
 			} else
 				error = bread(vp, lbn, size, NOCRED, &bp);
 		}
-		n = MIN(n, size - bp->b_resid);
-		if (error) {
-			brelse(bp);
+		if (error != 0)
 			return (error);
-		}
+		n = MIN(n, size - bp->b_resid);
 
 		error = uiomove(bp->b_data + on, (int)n, uio);
 		brelse(bp);


More information about the svn-src-head mailing list