diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-07-17 05:29:02 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-08-14 05:33:44 -0400 |
commit | a867bb28c1cb49ae86d034d8bd8fe6dbcbb19566 (patch) | |
tree | 0ab8fbdfa681ebb47979cc5ae645f7b8855581d5 | |
parent | 6eefaf61f664053c1dd6534a994cab3f8bb07263 (diff) |
[GFS2] Fix incorrect error path in prepare_write()
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>
-rw-r--r-- | fs/gfs2/ops_address.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index ce90032c010e..42a5f58f6fca 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -416,7 +416,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page, | |||
416 | 416 | ||
417 | error = gfs2_trans_begin(sdp, rblocks, 0); | 417 | error = gfs2_trans_begin(sdp, rblocks, 0); |
418 | if (error) | 418 | if (error) |
419 | goto out; | 419 | goto out_trans_fail; |
420 | 420 | ||
421 | if (gfs2_is_stuffed(ip)) { | 421 | if (gfs2_is_stuffed(ip)) { |
422 | if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) { | 422 | if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) { |
@@ -434,6 +434,7 @@ prepare_write: | |||
434 | out: | 434 | out: |
435 | if (error) { | 435 | if (error) { |
436 | gfs2_trans_end(sdp); | 436 | gfs2_trans_end(sdp); |
437 | out_trans_fail: | ||
437 | if (alloc_required) { | 438 | if (alloc_required) { |
438 | gfs2_inplace_release(ip); | 439 | gfs2_inplace_release(ip); |
439 | out_qunlock: | 440 | out_qunlock: |