From owner-svn-src-head@FreeBSD.ORG Sun Apr 8 13:44:56 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8EC121065680; Sun, 8 Apr 2012 13:44:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 799FE8FC0A; Sun, 8 Apr 2012 13:44:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q38DiuHQ014198; Sun, 8 Apr 2012 13:44:56 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q38DiuHx014196; Sun, 8 Apr 2012 13:44:56 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201204081344.q38DiuHx014196@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 8 Apr 2012 13:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234036 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Apr 2012 13:44:56 -0000 Author: trasz Date: Sun Apr 8 13:44:55 2012 New Revision: 234036 URL: http://svn.freebsd.org/changeset/base/234036 Log: Fix panic in ffs_reload(), which may happen when read-only filesystem gets resized and then reloaded. Reviewed by: kib, mckusick (earlier version) Sponsored by: The FreeBSD Foundation Modified: head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Sun Apr 8 11:09:08 2012 (r234035) +++ head/sys/ufs/ffs/ffs_vfsops.c Sun Apr 8 13:44:55 2012 (r234036) @@ -675,8 +675,14 @@ ffs_reload(struct mount *mp, struct thre /* * Step 3: re-read summary information from disk. */ - blks = howmany(fs->fs_cssize, fs->fs_fsize); - space = fs->fs_csp; + size = fs->fs_cssize; + blks = howmany(size, fs->fs_fsize); + if (fs->fs_contigsumsize > 0) + size += fs->fs_ncg * sizeof(int32_t); + size += fs->fs_ncg * sizeof(u_int8_t); + free(fs->fs_csp, M_UFSMNT); + space = malloc((u_long)size, M_UFSMNT, M_WAITOK); + fs->fs_csp = space; for (i = 0; i < blks; i += fs->fs_frag) { size = fs->fs_bsize; if (i + fs->fs_frag > blks)