In in6_pcbpurgeif0() called, e.g., from if_clone_destroy(),

once we have a lock, make sure the inp is not marked freed.
This can happen since the list traversal and locking was
converted to epoch(9).  If the inp is marked "freed", skip it.

This prevents a NULL pointer deref panic later on.

Reported by:	slavash (Mellanox)
Tested by:	slavash (Mellanox)
Reviewed by:	markj (no formal review but caught my unlock mistake)
Approved by:	re (kib)
This commit is contained in:
Bjoern A. Zeeb 2018-09-27 15:32:37 +00:00
parent 3d95cc51bb
commit e15e0e3e4d

View File

@ -809,6 +809,10 @@ in6_pcbpurgeif0(struct inpcbinfo *pcbinfo, struct ifnet *ifp)
INP_INFO_WLOCK(pcbinfo);
CK_LIST_FOREACH(in6p, pcbinfo->ipi_listhead, inp_list) {
INP_WLOCK(in6p);
if (__predict_false(in6p->inp_flags2 & INP_FREED)) {
INP_WUNLOCK(in6p);
continue;
}
im6o = in6p->in6p_moptions;
if ((in6p->inp_vflag & INP_IPV6) && im6o != NULL) {
/*