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/quota.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/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index a08dabd6ce90..636bccfd2bcf 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -617,8 +617,9 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
617 | int err = -EIO; | 617 | int err = -EIO; |
618 | 618 | ||
619 | if (gfs2_is_stuffed(ip)) { | 619 | if (gfs2_is_stuffed(ip)) { |
620 | struct gfs2_alloc *al = NULL; | 620 | struct gfs2_alloc *al = gfs2_alloc_get(ip); |
621 | al = gfs2_alloc_get(ip); | 621 | if (!al) |
622 | return -ENOMEM; | ||
622 | /* just request 1 blk */ | 623 | /* just request 1 blk */ |
623 | al->al_requested = 1; | 624 | al->al_requested = 1; |
624 | gfs2_inplace_reserve(ip); | 625 | gfs2_inplace_reserve(ip); |
@@ -729,6 +730,10 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) | |||
729 | 730 | ||
730 | if (nalloc) { | 731 | if (nalloc) { |
731 | al = gfs2_alloc_get(ip); | 732 | al = gfs2_alloc_get(ip); |
733 | if (!al) { | ||
734 | error = -ENOMEM; | ||
735 | goto out_gunlock; | ||
736 | } | ||
732 | 737 | ||
733 | al->al_requested = nalloc * (data_blocks + ind_blocks); | 738 | al->al_requested = nalloc * (data_blocks + ind_blocks); |
734 | 739 | ||