Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144595924
D45690.1775644514.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45690.1775644514.diff
View Options
diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1235,6 +1235,22 @@
#ifdef VIMAGE
finish_vnet_shutdown:
#endif
+ /*
+ * Objects associated with this ifnet have been deregistered from
+ * tables/lists here, but other threads may still reference the
+ * objects (e.g. nhop_objects). We need to clear ifp->if_afdata[]
+ * after the refereces are finished because other threads may access
+ * the contents of ifp->if_afdata[] in such references
+ * (in6_selecthlim() for example).
+ * Those references are (and should be) guarded by the net_epoch
+ * so we can wait for the end of the reference with
+ * epoch_wait_preempt() and NET_EPOCH_DRAIN_CALLBACKS().
+ * After these calls, objects assosiated with this ifnet are
+ * not kept referenced or will not be fetched because they are
+ * deregistered from tables/lists.
+ */
+ NET_EPOCH_WAIT();
+ NET_EPOCH_DRAIN_CALLBACKS();
/*
* We cannot hold the lock over dom_ifdetach calls as they might
* sleep, for example trying to drain a callout, thus open up the
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 10:35 AM (13 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28300627
Default Alt Text
D45690.1775644514.diff (1 KB)
Attached To
Mode
D45690: ifnet: fix a race in if_detach_internal on clearing if_afdata
Attached
Detach File
Event Timeline
Log In to Comment