Skip to content

Commit 204c8f7

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: don't leak a locked dquot when xfs_dquot_attach_buf fails
xfs_qm_quotacheck_dqadjust acquired the dquot through xfs_qm_dqget, which means it owns a reference and holds q_qlock. Both need to be dropped on an error exit. Cc: <stable@vger.kernel.org> # v6.13 Fixes: ca37818 ("xfs: convert quotacheck to attach dquot buffers") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 0ec73eb commit 204c8f7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/xfs/xfs_qm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ xfs_qm_quotacheck_dqadjust(
13181318

13191319
error = xfs_dquot_attach_buf(NULL, dqp);
13201320
if (error)
1321-
return error;
1321+
goto out_unlock;
13221322

13231323
trace_xfs_dqadjust(dqp);
13241324

@@ -1348,8 +1348,9 @@ xfs_qm_quotacheck_dqadjust(
13481348
}
13491349

13501350
dqp->q_flags |= XFS_DQFLAG_DIRTY;
1351+
out_unlock:
13511352
xfs_qm_dqput(dqp);
1352-
return 0;
1353+
return error;
13531354
}
13541355

13551356
/*

0 commit comments

Comments
 (0)