aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@linux.vnet.ibm.com>2007-01-09 09:57:34 -0500
committerDave Kleikamp <shaggy@linux.vnet.ibm.com>2007-01-09 09:57:34 -0500
commit17e6afc75ad0150d265a86a8f155b2871f9c07fe (patch)
tree2318ee640e6f6bda3cf19b5bcd3c7da4c9a377cb /fs
parentefa06708fe77190f31bed5c3cb5da49e211240f5 (diff)
JFS: Avoid BUG() on a damaged file system
On Mon, 2006-12-18 at 19:51 +0100, Eric Sesterhenn wrote: > hi, > > while playing around with fsfuzzer, i got the following oops with jfs: > > [ 851.804875] BUG at fs/jfs/jfs_xtree.c:760 > assert(!BT_STACK_FULL(btstack)) > [ 851.805179] ------------[ cut here ]------------ > [ 851.805238] kernel BUG at fs/jfs/jfs_xtree.c:760! JFS should mark the superblock dirty and return an error rather than calling BUG(). Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_xtree.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/jfs/jfs_xtree.c b/fs/jfs/jfs_xtree.c
index e98eb03e5310..acc97c46d8a4 100644
--- a/fs/jfs/jfs_xtree.c
+++ b/fs/jfs/jfs_xtree.c
@@ -757,6 +757,11 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp,
757 nsplit = 0; 757 nsplit = 0;
758 758
759 /* push (bn, index) of the parent page/entry */ 759 /* push (bn, index) of the parent page/entry */
760 if (BT_STACK_FULL(btstack)) {
761 jfs_error(ip->i_sb, "stack overrun in xtSearch!");
762 XT_PUTPAGE(mp);
763 return -EIO;
764 }
760 BT_PUSH(btstack, bn, index); 765 BT_PUSH(btstack, bn, index);
761 766
762 /* get the child page block number */ 767 /* get the child page block number */
@@ -3915,6 +3920,11 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
3915 */ 3920 */
3916 getChild: 3921 getChild:
3917 /* save current parent entry for the child page */ 3922 /* save current parent entry for the child page */
3923 if (BT_STACK_FULL(&btstack)) {
3924 jfs_error(ip->i_sb, "stack overrun in xtTruncate!");
3925 XT_PUTPAGE(mp);
3926 return -EIO;
3927 }
3918 BT_PUSH(&btstack, bn, index); 3928 BT_PUSH(&btstack, bn, index);
3919 3929
3920 /* get child page */ 3930 /* get child page */
@@ -4112,6 +4122,11 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
4112 */ 4122 */
4113 getChild: 4123 getChild:
4114 /* save current parent entry for the child page */ 4124 /* save current parent entry for the child page */
4125 if (BT_STACK_FULL(&btstack)) {
4126 jfs_error(ip->i_sb, "stack overrun in xtTruncate_pmap!");
4127 XT_PUTPAGE(mp);
4128 return -EIO;
4129 }
4115 BT_PUSH(&btstack, bn, index); 4130 BT_PUSH(&btstack, bn, index);
4116 4131
4117 /* get child page */ 4132 /* get child page */