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/bmap.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/bmap.c')
-rw-r--r-- | fs/gfs2/bmap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index c1ee6355ced1..f7093aa69aae 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -900,6 +900,8 @@ static int do_grow(struct gfs2_inode *ip, u64 size) | |||
900 | int error; | 900 | int error; |
901 | 901 | ||
902 | al = gfs2_alloc_get(ip); | 902 | al = gfs2_alloc_get(ip); |
903 | if (!al) | ||
904 | return -ENOMEM; | ||
903 | 905 | ||
904 | error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 906 | error = gfs2_quota_lock(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); |
905 | if (error) | 907 | if (error) |
@@ -1081,7 +1083,8 @@ static int trunc_dealloc(struct gfs2_inode *ip, u64 size) | |||
1081 | lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift; | 1083 | lblock = (size - 1) >> sdp->sd_sb.sb_bsize_shift; |
1082 | 1084 | ||
1083 | find_metapath(sdp, lblock, &mp, ip->i_height); | 1085 | find_metapath(sdp, lblock, &mp, ip->i_height); |
1084 | gfs2_alloc_get(ip); | 1086 | if (!gfs2_alloc_get(ip)) |
1087 | return -ENOMEM; | ||
1085 | 1088 | ||
1086 | error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); | 1089 | error = gfs2_quota_hold(ip, NO_QUOTA_CHANGE, NO_QUOTA_CHANGE); |
1087 | if (error) | 1090 | if (error) |