Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Mar 2015 21:41:37 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279502 - head/sys/fs/nandfs
Message-ID:  <201503012141.t21Lfb3N093341@svn.freebsd.org>

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



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