svn commit: r279502 - head/sys/fs/nandfs

Warner Losh imp at FreeBSD.org
Sun Mar 1 21:41:38 UTC 2015


Author: imp
Date: Sun Mar  1 21:41:37 2015
New Revision: 279502
URL: https://svnweb.freebsd.org/changeset/base/279502

Log:
  nandfs_meta_bread() calls bread() which can set bp to NULL in some
  error cases. Calling brelse() with a NULL pointer is not allowed,
  so only call brelse() when the bp is non-NULL.
  
  Reported by: Maxime Villard (reported as uninitialized variable)

Modified:
  head/sys/fs/nandfs/bmap.c

Modified: head/sys/fs/nandfs/bmap.c
==============================================================================
--- head/sys/fs/nandfs/bmap.c	Sun Mar  1 21:41:35 2015	(r279501)
+++ head/sys/fs/nandfs/bmap.c	Sun Mar  1 21:41:37 2015	(r279502)
@@ -317,7 +317,8 @@ bmap_truncate_indirect(struct nandfs_nod
 
 	error = nandfs_bread_meta(node, lbn, NOCRED, 0, &bp);
 	if (error) {
-		brelse(bp);
+		if (bp != NULL)
+			brelse(bp);
 		return (error);
 	}
 


More information about the svn-src-all mailing list