Skip to content

Commit

Permalink
[GFS2] Fix incorrect error path in prepare_write()
Browse files Browse the repository at this point in the history
The error path in prepare_write() was incorrect in the (very rare) event
that the transaction fails to start. The following prevents a NULL
pointer dereference,

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
swhiteho committed Aug 14, 2007
1 parent 6eefaf6 commit a867bb2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/gfs2/ops_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,

error = gfs2_trans_begin(sdp, rblocks, 0);
if (error)
goto out;
goto out_trans_fail;

if (gfs2_is_stuffed(ip)) {
if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
Expand All @@ -434,6 +434,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
out:
if (error) {
gfs2_trans_end(sdp);
out_trans_fail:
if (alloc_required) {
gfs2_inplace_release(ip);
out_qunlock:
Expand Down

0 comments on commit a867bb2

Please sign in to comment.