diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-03-03 13:54:21 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2008-03-31 05:41:28 -0400 |
commit | 182fe5abd8ebbb3a00c1be91f44e4783e139918c (patch) | |
tree | 7404993656166f2b7cb78e54e4275d44336ba27c /fs/gfs2/dir.c | |
parent | 105284970ba7d0d0ff4b97e57728eac7adf6a42a (diff) |
[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, | |||
1868 | if (!ht) | 1868 | if (!ht) |
1869 | return -ENOMEM; | 1869 | return -ENOMEM; |
1870 | 1870 | ||
1871 | gfs2_alloc_get(dip); | 1871 | if (!gfs2_alloc_get(dip)) { |
1872 | error = -ENOMEM; | ||
1873 | goto out; | ||
1874 | } | ||
1872 | 1875 | ||
1873 | error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 1876 | error = gfs2_quota_hold(dip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); |
1874 | if (error) | 1877 | if (error) |
1875 | goto out; | 1878 | goto out_put; |
1876 | 1879 | ||
1877 | error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh); | 1880 | error = gfs2_rindex_hold(sdp, &dip->i_alloc->al_ri_gh); |
1878 | if (error) | 1881 | if (error) |
@@ -1946,8 +1949,9 @@ out_rlist: | |||
1946 | gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh); | 1949 | gfs2_glock_dq_uninit(&dip->i_alloc->al_ri_gh); |
1947 | out_qs: | 1950 | out_qs: |
1948 | gfs2_quota_unhold(dip); | 1951 | gfs2_quota_unhold(dip); |
1949 | out: | 1952 | out_put: |
1950 | gfs2_alloc_put(dip); | 1953 | gfs2_alloc_put(dip); |
1954 | out: | ||
1951 | kfree(ht); | 1955 | kfree(ht); |
1952 | return error; | 1956 | return error; |
1953 | } | 1957 | } |