diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-17 09:32:37 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-17 09:32:37 -0400 |
commit | 634ee0b9f458f3530b9c0ea7e6951dd03db7d678 (patch) | |
tree | 5d4ce77d3f7104957a220c39bdc99d4d07ce8082 | |
parent | 4bf311ddfbffe12d41ad1a3c311ab727db6f72cb (diff) |
[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: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/dir.c | 5 |
1 files changed, 2 insertions, 3 deletions
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) | |||
1763 | if (error) | 1763 | if (error) |
1764 | goto out; | 1764 | goto out; |
1765 | leaf = (struct gfs2_leaf *)bh->b_data; | 1765 | leaf = (struct gfs2_leaf *)bh->b_data; |
1766 | brelse(bh); | ||
1767 | |||
1768 | len = 1 << (dip->i_di.di_depth - be16_to_cpu(leaf->lf_depth)); | 1766 | len = 1 << (dip->i_di.di_depth - be16_to_cpu(leaf->lf_depth)); |
1767 | brelse(bh); | ||
1769 | 1768 | ||
1770 | error = lc(dip, index, len, leaf_no, data); | 1769 | error = lc(dip, index, len, leaf_no, data); |
1771 | if (error) | 1770 | if (error) |
@@ -1781,7 +1780,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) | |||
1781 | error = -EIO; | 1780 | error = -EIO; |
1782 | } | 1781 | } |
1783 | 1782 | ||
1784 | out: | 1783 | out: |
1785 | kfree(lp); | 1784 | kfree(lp); |
1786 | 1785 | ||
1787 | return error; | 1786 | return error; |