From: Barry Naujok Date: Thu, 30 Nov 2006 14:46:37 +0000 (+0000) Subject: Fix libxfs SEGV when attempting to mount a non-XFS filesystem. X-Git-Tag: v2.9.0~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32244196e094a2426e5efa8b772e5ca887056fdf;p=thirdparty%2Fxfsprogs-dev.git Fix libxfs SEGV when attempting to mount a non-XFS filesystem. Merge of master-melb:xfs-cmds:27588a by kenmcd. Updated change history --- diff --git a/doc/CHANGES b/doc/CHANGES index cf8986f8e..f9b5e700c 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,13 +1,18 @@ +xfsprogs-2.8.x + - Fix up libxfs initialisation with bad filesystem. + Thanks to Utako Kuzaka for this. + xfsprogs-2.8.16 (30 October 2006) - Fix up an endian problem for nlink setting in phase 7 for xfs_repair. xfsprogs-2.8.15 (19 October 2006) - Fix up nlink checks and repairs in phase 7 for xfs_repair. - Remove a bogus LEAFN warning for a single leaf node v2 dir. + Thanks to Roger Willcocks for this. xfsprogs-2.8.14 (6 October 2006) - Fix up the ring command in xfs_db, - thanks to Utako Kusaka + Thanks to Utako Kuzaka for this. - Set the blocksize on the device to the given sector size which is _not_ necessarily 512 bytes; idea suggested by Shailendra Tripathi. diff --git a/libxfs/init.c b/libxfs/init.c index 38a51007d..6fe78a6d5 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -595,8 +595,8 @@ libxfs_mount( fprintf(stderr, _("%s: data size check failed\n"), progname); if (!(flags & LIBXFS_MOUNT_DEBUGGER)) return NULL; - } - libxfs_putbuf(bp); + } else + libxfs_putbuf(bp); if (mp->m_logdev && mp->m_logdev != mp->m_dev) { d = (xfs_daddr_t) XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); @@ -610,7 +610,8 @@ libxfs_mount( if (!(flags & LIBXFS_MOUNT_DEBUGGER)) return NULL; } - libxfs_putbuf(bp); + if (bp) + libxfs_putbuf(bp); } /* Initialize realtime fields in the mount structure */