Codex points out that queue_metapath_scan and queue_fs_scan fail to free
the allocated items if they are not consumed by workqueue_add().
Cc: <linux-xfs@vger.kernel.org> # v6.9.0
Fixes: 8fb4b471322e65 ("xfs_scrub: use multiple threads to run in-kernel metadata scrubs that scan inodes")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
item->abortedp = abortedp;
ret = -workqueue_add(wq, fs_scan_worker, nr, item);
- if (ret)
+ if (ret) {
str_liberror(ctx, ret, _("queuing fs scan work"));
+ free(item);
+ }
return ret;
}
item->abortedp = abortedp;
ret = -workqueue_add(wq, fs_scan_worker, 0, item);
- if (ret)
+ if (ret) {
str_liberror(ctx, ret, _("queuing metapath scan work"));
+ free(item);
+ }
return ret;
}