]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
GFS2: Add calls to gfs2_holder_uninit in two error handlers
authorDaniel DeFreez <dcdefreez@ucdavis.edu>
Tue, 19 Apr 2016 23:57:45 +0000 (19:57 -0400)
committerBob Peterson <rpeterso@redhat.com>
Tue, 19 Apr 2016 23:59:11 +0000 (19:59 -0400)
This patch fixes two locations that do not call gfs2_holder_uninit
if gfs2_glock_nq returns an error.

Signed-off-by: Daniel DeFreez <dcdefreez@ucdavis.edu>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/aops.c
fs/gfs2/file.c

index aa016e4b8bec976d57b8a36cdbb3c12c7e8e39ff..58dd0061134bc5fcd31ed4bf15e35f7baae674b4 100644 (file)
@@ -1063,7 +1063,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
        gfs2_holder_init(ip->i_gl, LM_ST_DEFERRED, 0, &gh);
        rv = gfs2_glock_nq(&gh);
        if (rv)
-               return rv;
+               goto out_uninit;
        rv = gfs2_ok_for_dio(ip, offset);
        if (rv != 1)
                goto out; /* dio not valid, fall back to buffered i/o */
@@ -1102,6 +1102,7 @@ static ssize_t gfs2_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
                                  offset, gfs2_get_block_direct, NULL, NULL, 0);
 out:
        gfs2_glock_dq(&gh);
+out_uninit:
        gfs2_holder_uninit(&gh);
        return rv;
 }
index fd9a10e4518d00aaa98840583d4310a1b51901ab..f33fd92e5f49fc40917b4e9248d7b75aa476bf25 100644 (file)
@@ -160,7 +160,7 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
        gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
        error = gfs2_glock_nq(&gh);
        if (error)
-               return error;
+               goto out_uninit;
 
        fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_diskflags);
        if (!S_ISDIR(inode->i_mode) && ip->i_diskflags & GFS2_DIF_JDATA)
@@ -169,6 +169,7 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
                error = -EFAULT;
 
        gfs2_glock_dq(&gh);
+out_uninit:
        gfs2_holder_uninit(&gh);
        return error;
 }