git: c01da939b099 - main - cardbus: Be sure to acquire Giant when calling into newbus

Warner Losh imp at FreeBSD.org
Sat Feb 27 08:23:17 UTC 2021


The branch main has been updated by imp:

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

commit c01da939b0998f8de068a23c9016c377e761255e
Author:     Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-02-27 07:00:52 +0000
Commit:     Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-02-27 08:23:09 +0000

    cardbus: Be sure to acquire Giant when calling into newbus
    
    Acquire Giant in cardbus_detach_card. This used to be done above us, but no
    more.
    
    Tested by: kargl@
    MFC After: 3 days
---
 sys/dev/cardbus/cardbus.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
index 391267944ec4..50a21dfc0b82 100644
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -256,10 +256,11 @@ cardbus_detach_card(device_t cbdev)
 {
 	int err = 0;
 
+	mtx_lock(&Giant);
 	err = bus_generic_detach(cbdev);
-	if (err)
-		return (err);
-	err = device_delete_children(cbdev);
+	if (err == 0)
+		err = device_delete_children(cbdev);
+	mtx_unlock(&Giant);
 	if (err)
 		return (err);
 


More information about the dev-commits-src-main mailing list