Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Mar 2016 19:59:45 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297401 - head/sys/fs/cd9660
Message-ID:  <201603291959.u2TJxjD2037122@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603291959.u2TJxjD2037122>