Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Apr 2019 08:35:24 +0000 (UTC)
From:      Marcin Wojtas <mw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r345792 - stable/12/sys/kern
Message-ID:  <201904020835.x328ZOwP022656@repo.freebsd.org>

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

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/12/sys/kern/subr_bus.c

Modified: stable/12/sys/kern/subr_bus.c
==============================================================================
--- stable/12/sys/kern/subr_bus.c	Tue Apr  2 04:12:06 2019	(r345791)
+++ stable/12/sys/kern/subr_bus.c	Tue Apr  2 08:35:24 2019	(r345792)
@@ -2994,6 +2994,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?201904020835.x328ZOwP022656>