From 634ee0b9f458f3530b9c0ea7e6951dd03db7d678 Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Mon, 17 Jul 2006 09:32:37 -0400 Subject: [GFS2] Fix use after free bug in dir.c Fix a use after free bug in dir.c spotted by Kevin Anderson. Cc: Kevin Anderson Signed-off-by: Steven Whitehouse --- fs/gfs2/dir.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'fs/gfs2/dir.c') diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index e96b5322c843..f62223b9e53d 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -1763,9 +1763,8 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) if (error) goto out; leaf = (struct gfs2_leaf *)bh->b_data; - brelse(bh); - len = 1 << (dip->i_di.di_depth - be16_to_cpu(leaf->lf_depth)); + brelse(bh); error = lc(dip, index, len, leaf_no, data); if (error) @@ -1781,7 +1780,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) error = -EIO; } - out: +out: kfree(lp); return error; -- cgit v1.2.3-55-g7522