Commit 4f6ac47b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

xfs: fix a use after free in xfs_defer_finish_recovery

dfp will be freed by ->recover_work and thus the tracepoint in case
of an error can lead to a use after free.

Store the defer ops in a local variable to avoid that.

Fixes: 7f2f7531 ("xfs: store an ops pointer in struct xfs_defer_pending")
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent 378b6aef
......@@ -915,12 +915,14 @@ xfs_defer_finish_recovery(
struct xfs_defer_pending *dfp,
struct list_head *capture_list)
{
const struct xfs_defer_op_type *ops = dfp->dfp_ops;
int error;
error = dfp->dfp_ops->recover_work(dfp, capture_list);
/* dfp is freed by recover_work and must not be accessed afterwards */
error = ops->recover_work(dfp, capture_list);
if (error)
trace_xlog_intent_recovery_failed(mp, error,
dfp->dfp_ops->recover_work);
ops->recover_work);
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment