Skip to content

Commit

Permalink
GFS2: Fix an unchecked error from gfs2_rs_alloc
Browse files Browse the repository at this point in the history
Check the return value of gfs2_rs_alloc(ip) and avoid a possible null
pointer dereference.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Andrew Price authored and Steven Whitehouse committed Nov 7, 2012
1 parent ddffeb8 commit aaaf68c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/gfs2/quota.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,11 @@ int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid)
struct gfs2_quota_data **qd;
int error;

if (ip->i_res == NULL)
gfs2_rs_alloc(ip);
if (ip->i_res == NULL) {
error = gfs2_rs_alloc(ip);
if (error)
return error;
}

qd = ip->i_res->rs_qa_qd;

Expand Down

0 comments on commit aaaf68c

Please sign in to comment.