git: 2d7b5953dd90 - stable/13 - geom_linux_lvm: Avoid removing from vg_list before inserting

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 24 Oct 2023 13:38:04 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=2d7b5953dd90430c065014b748ac0e6217bff9d7

commit 2d7b5953dd90430c065014b748ac0e6217bff9d7
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-10-17 14:25:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-10-24 13:18:07 +0000

    geom_linux_lvm: Avoid removing from vg_list before inserting
    
    PR:             266693
    Reported by:    Robert Morris <rtm@lcs.mit.edu>
    MFC after:      1 week
    
    (cherry picked from commit 56279238b03a0ccef245b22fff7679fe35cffccc)
---
 sys/geom/linux_lvm/g_linux_lvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/geom/linux_lvm/g_linux_lvm.c b/sys/geom/linux_lvm/g_linux_lvm.c
index dddc3ae9184e..c63318fed729 100644
--- a/sys/geom/linux_lvm/g_linux_lvm.c
+++ b/sys/geom/linux_lvm/g_linux_lvm.c
@@ -512,7 +512,6 @@ g_llvm_free_vg(struct g_llvm_vg *vg)
 		LIST_REMOVE(lv, lv_next);
 		free(lv, M_GLLVM);
 	}
-	LIST_REMOVE(vg, vg_next);
 	free(vg, M_GLLVM);
 }
 
@@ -596,7 +595,8 @@ g_llvm_destroy(struct g_llvm_vg *vg, int force)
 		}
 	}
 
-	g_llvm_free_vg(gp->softc);
+	LIST_REMOVE(vg, vg_next);
+	g_llvm_free_vg(vg);
 	gp->softc = NULL;
 	g_wither_geom(gp, ENXIO);
 	return (0);