git: 955f213fa2f1 - main - graid3: Fix teardown in g_raid3_try_destroy()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sat, 20 Apr 2024 16:05:08 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=955f213fa2f14d5b5e9b655d8922e28315eb9fa3

commit 955f213fa2f14d5b5e9b655d8922e28315eb9fa3
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-20 16:02:06 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-04-20 16:04:57 +0000

    graid3: Fix teardown in g_raid3_try_destroy()
    
    Commit 33cb9b3c3a22 replaced a g_raid3_destroy_device() call with a
    g_raid3_free_device() call, which was incorrect and could lead to a
    panic if a RAID3 GEOM failed to start (e.g., due to missing disks).
    
    Reported by:    graid3 tests
    Fixes:          33cb9b3c3a22 ("graid3: Fix teardown races")
    MFC after:      3 days
    Sponsored by:   Klara, Inc.
---
 sys/geom/raid3/g_raid3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index 721610cefbec..c2d05b48d80d 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -2033,7 +2033,7 @@ g_raid3_try_destroy(struct g_raid3_softc *sc)
 		sc->sc_worker = NULL;
 	} else {
 		g_topology_unlock();
-		g_raid3_free_device(sc);
+		g_raid3_destroy_device(sc);
 	}
 	return (1);
 }