From 2900a982859da75d35e2a18a2e4f10b29a828226 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 12 Nov 2012 14:19:27 -0600 Subject: [PATCH] rebuild_wim(): Fix possible problem with fd closing Use list_for_each_entry_safe() instead of list_for_each_entry() when closing staging file descriptors, since a lookup table entry may be deleted when its last file descriptor is closed. --- src/mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mount.c b/src/mount.c index 6bc1fdff..54c7b099 100644 --- a/src/mount.c +++ b/src/mount.c @@ -876,7 +876,7 @@ static int rebuild_wim(struct wimfs_context *ctx, bool check_integrity) DEBUG("Closing all staging file descriptors."); - list_for_each_entry(lte, &ctx->staging_list, staging_list) { + list_for_each_entry_safe(lte, tmp, &ctx->staging_list, staging_list) { ret = inode_close_fds(lte->lte_inode); if (ret != 0) return ret; -- 2.43.0