aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/dir.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2008-03-03 21:54:21 +0300
committerSteven Whitehouse <swhiteho@redhat.com>2008-03-31 10:41:28 +0100
commit182fe5abd8ebbb3a00c1be91f44e4783e139918c (patch)
tree7404993656166f2b7cb78e54e4275d44336ba27c /fs/gfs2/dir.c
parent105284970ba7d0d0ff4b97e57728eac7adf6a42a (diff)
downloadkernel_samsung_smdk4412-182fe5abd8ebbb3a00c1be91f44e4783e139918c.zip
kernel_samsung_smdk4412-182fe5abd8ebbb3a00c1be91f44e4783e139918c.tar.gz
kernel_samsung_smdk4412-182fe5abd8ebbb3a00c1be91f44e4783e139918c.tar.bz2
[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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index a3753c7..94070ad 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;
}