[GFS2] Fix incorrect error path in prepare_write()
authorSteven Whitehouse <swhiteho@redhat.com>
Tue, 17 Jul 2007 09:29:02 +0000 (10:29 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Tue, 14 Aug 2007 09:33:44 +0000 (10:33 +0100)
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>
fs/gfs2/ops_address.c

index ce90032c010ec7176d8f31505a5c859833dc3650..42a5f58f6fca4adf5ad1faae9edec36939b05d2c 100644 (file)
@@ -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)) {
@@ -434,6 +434,7 @@ prepare_write:
 out:
        if (error) {
                gfs2_trans_end(sdp);
+out_trans_fail:
                if (alloc_required) {
                        gfs2_inplace_release(ip);
 out_qunlock: