diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-03-03 19:54:21 +0100 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 11:41:28 +0200 |
commit | 182fe5abd8ebbb3a00c1be91f44e4783e139918c (patch) | |
tree | 7404993656166f2b7cb78e54e4275d44336ba27c /fs/gfs2/dir.c | |
parent | [GFS2] Need to ensure that sector_t is 64bits for GFS2 (diff) | |
download | linux-182fe5abd8ebbb3a00c1be91f44e4783e139918c.tar.xz linux-182fe5abd8ebbb3a00c1be91f44e4783e139918c.zip |
[GFS2] possible null pointer dereference fixup
gfs2_alloc_get may fail so we have to check it to prevent
NULL pointer dereference.
Signed-off-by: Cyrill Gorcunov <gorcunov@gamil.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r-- | fs/gfs2/dir.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index a3753c7989f7..94070ad8826b 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -1868,11 +1868,14 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len, if (!ht) return -ENOMEM; - gfs2_alloc_get(dip); + if (!gfs2_alloc_get(dip)) { + error = -ENOMEM; + goto out; + } error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); if (error) - goto out; + goto out_put; error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh); if (error) @@ -1946,8 +1949,9 @@ out_rlist: gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh); out_qs: gfs2_quota_unhold(dip); -out: +out_put: gfs2_alloc_put(dip); +out: kfree(ht); return error; } |