Commit 634ee0b9 authored by Steven Whitehouse's avatar Steven Whitehouse

[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 <kanderso@redhat.com>
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 4bf311dd
...@@ -1763,9 +1763,8 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) ...@@ -1763,9 +1763,8 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
if (error) if (error)
goto out; goto out;
leaf = (struct gfs2_leaf *)bh->b_data; leaf = (struct gfs2_leaf *)bh->b_data;
brelse(bh);
len = 1 << (dip->i_di.di_depth - be16_to_cpu(leaf->lf_depth)); len = 1 << (dip->i_di.di_depth - be16_to_cpu(leaf->lf_depth));
brelse(bh);
error = lc(dip, index, len, leaf_no, data); error = lc(dip, index, len, leaf_no, data);
if (error) if (error)
...@@ -1781,7 +1780,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) ...@@ -1781,7 +1780,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
error = -EIO; error = -EIO;
} }
out: out:
kfree(lp); kfree(lp);
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment