gfs2: Fix error handling in init_statfs
authorAndreas Gruenbacher <agruenba@redhat.com>
Mon, 28 Jun 2021 11:14:50 +0000 (19:14 +0800)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 28 Jun 2021 12:30:00 +0000 (14:30 +0200)
On an error path, init_statfs calls iput(pn) after pn has already been put.
Fix that by setting pn to NULL after the initial iput.

Fixes: 97fd734ba17e ("gfs2: lookup local statfs inodes prior to journal recovery")
Cc: stable@vger.kernel.org # v5.10+
Reported-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/ops_fstype.c

index 826f77d9cff5d9630fdfaa2a3d41a73815655bac..5f4504dd0875ab80a7eb41b68fbdf93f1900fca1 100644 (file)
@@ -687,6 +687,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
        }
 
        iput(pn);
+       pn = NULL;
        ip = GFS2_I(sdp->sd_sc_inode);
        error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0,
                                   &sdp->sd_sc_gh);