Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:05 -0000
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r345793 - stable/11/sys/kern
Message-ID:  <201904020843.x328hJ66027598@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mw
Date: Tue Apr  2 08:43:19 2019
New Revision: 345793
URL: https://svnweb.freebsd.org/changeset/base/345793

Log:
  MFC r344676: Prevent detaching driver if the attach is not finished
  
  Submitted by: Rafal Kozik <rk@semihalf.com>
  Obtained from: Semihalf
  Sponsored by: Amazon, Inc.

Modified:
  stable/11/sys/kern/subr_bus.c

Modified: stable/11/sys/kern/subr_bus.c
==============================================================================
--- stable/11/sys/kern/subr_bus.c	Tue Apr  2 08:35:24 2019	(r345792)
+++ stable/11/sys/kern/subr_bus.c	Tue Apr  2 08:43:19 2019	(r345793)
@@ -2964,6 +2964,10 @@ device_detach(device_t dev)
 	PDEBUG(("%s", DEVICENAME(dev)));
 	if (dev->state == DS_BUSY)
 		return (EBUSY);
+	if (dev->state == DS_ATTACHING) {
+		device_printf(dev, "device in attaching state! Deferring detach.\n");
+		return (EBUSY);
+	}
 	if (dev->state != DS_ATTACHED)
 		return (0);
 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904020843.x328hJ66027598>