FreeBSD Bugzilla – Attachment 183542 Details for
Bug 219701
crash in camperiphfree()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Proposed patch to cache the periph_driver pointer.
cam_periph_drv.20170616.1.txt (text/plain), 1.37 KB, created by
Kenneth D. Merry
on 2017-06-16 18:39:03 UTC
(
hide
)
Description:
Proposed patch to cache the periph_driver pointer.
Filename:
MIME Type:
Creator:
Kenneth D. Merry
Created:
2017-06-16 18:39:03 UTC
Size:
1.37 KB
patch
obsolete
>--- //depot/users/kenm/FreeBSD-test/sys/cam/cam_periph.c 2017-06-14 18:49:32.000000000 -0600 >+++ /usr/home/kenm/perforce4/kenm/FreeBSD-test/sys/cam/cam_periph.c 2017-06-14 18:49:32.000000000 -0600 >--- /tmp/tmp.6403.79 2017-06-16 12:36:41.000000000 -0600 >+++ /usr/home/kenm/perforce4/kenm/FreeBSD-test/sys/cam/cam_periph.c 2017-06-16 12:36:22.288576278 -0600 >@@ -661,6 +661,7 @@ > camperiphfree(struct cam_periph *periph) > { > struct periph_driver **p_drv; >+ struct periph_driver *drv; > > cam_periph_assert(periph, MA_OWNED); > KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating", >@@ -673,6 +674,15 @@ > printf("camperiphfree: attempt to free non-existant periph\n"); > return; > } >+ /* >+ * Cache a pointer to the periph_driver structure. If a >+ * periph_driver is added or removed from the array (see >+ * periphdriver_register()) while we drop the toplogy lock >+ * below, p_drv may change. This doesn't protect against this >+ * particular periph_driver going away. That will require full >+ * reference counting in the periph_driver infrastructure. >+ */ >+ drv = *p_drv; > > /* > * We need to set this flag before dropping the topology lock, to >@@ -708,8 +718,8 @@ > */ > xpt_lock_buses(); > >- TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); >- (*p_drv)->generation++; >+ TAILQ_REMOVE(&drv->units, periph, unit_links); >+ drv->generation++; > > xpt_remove_periph(periph); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 219701
: 183542