Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Nov 2016 13:24:57 +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: r308995 - head/sys/fs/udf
Message-ID:  <201611221324.uAMDOvJn052736@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Nov 22 13:24:57 2016
New Revision: 308995
URL: https://svnweb.freebsd.org/changeset/base/308995

Log:
  On error, bread(9) zeroes buffer pointer, do not dereference it.
  See r294954 for the bread(9) change and r297401 for similar cd9660 fix.
  
  Reported and tested by:	Joshua Kinard <kumba@gentoo.org>
  PR:	214705
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/fs/udf/udf_vnops.c

Modified: head/sys/fs/udf/udf_vnops.c
==============================================================================
--- head/sys/fs/udf/udf_vnops.c	Tue Nov 22 12:29:24 2016	(r308994)
+++ head/sys/fs/udf/udf_vnops.c	Tue Nov 22 13:24:57 2016	(r308995)
@@ -487,11 +487,11 @@ udf_read(struct vop_read_args *ap)
 		} else {
 			error = bread(vp, lbn, size, NOCRED, &bp);
 		}
-		n = min(n, size - bp->b_resid);
-		if (error) {
+		if (error != 0) {
 			brelse(bp);
 			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?201611221324.uAMDOvJn052736>