Skip to content

Commit

Permalink
JFS: Avoid BUG() on a damaged file system
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Dave Kleikamp committed Jan 9, 2007
1 parent efa0670 commit 17e6afc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fs/jfs/jfs_xtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ static int xtSearch(struct inode *ip, s64 xoff, s64 *nextp,
nsplit = 0;

/* push (bn, index) of the parent page/entry */
if (BT_STACK_FULL(btstack)) {
jfs_error(ip->i_sb, "stack overrun in xtSearch!");
XT_PUTPAGE(mp);
return -EIO;
}
BT_PUSH(btstack, bn, index);

/* get the child page block number */
Expand Down Expand Up @@ -3915,6 +3920,11 @@ s64 xtTruncate(tid_t tid, struct inode *ip, s64 newsize, int flag)
*/
getChild:
/* save current parent entry for the child page */
if (BT_STACK_FULL(&btstack)) {
jfs_error(ip->i_sb, "stack overrun in xtTruncate!");
XT_PUTPAGE(mp);
return -EIO;
}
BT_PUSH(&btstack, bn, index);

/* get child page */
Expand Down Expand Up @@ -4112,6 +4122,11 @@ s64 xtTruncate_pmap(tid_t tid, struct inode *ip, s64 committed_size)
*/
getChild:
/* save current parent entry for the child page */
if (BT_STACK_FULL(&btstack)) {
jfs_error(ip->i_sb, "stack overrun in xtTruncate_pmap!");
XT_PUTPAGE(mp);
return -EIO;
}
BT_PUSH(&btstack, bn, index);

/* get child page */
Expand Down

0 comments on commit 17e6afc

Please sign in to comment.