yasuoka@ privately pointed I was wrong about KASSERT(). I fixed my
diff. These checks are useless and I guess they make understanding
harder so I removed panic() from pppx_if_destoy() too.
Index: sys/net/if_pppx.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppx.c,v
retrieving revision 1.88
diff -u -p -r1.88 if_pppx.c
--- sys/net/if_pppx.c 18 Jun 2020 14:20:12 -0000 1.88
+++ sys/net/if_pppx.c 20 Jun 2020 11:32:58 -0000
@@ -696,14 +696,10 @@ pppx_add_session(struct pppx_dev *pxd, s
pxi->pxi_key.pxik_protocol = req->pr_protocol;
pxi->pxi_dev = pxd;
- /* this is safe without splnet since we're not modifying it */
- if (RBT_FIND(pppx_ifs, &pppx_ifs, pxi) != NULL) {
+ if (RBT_INSERT(pppx_ifs, &pppx_ifs, pxi) != NULL) {
error = EADDRINUSE;
goto out;
}
-
- if (RBT_INSERT(pppx_ifs, &pppx_ifs, pxi) != NULL)
- panic("%s: pppx_ifs modified while lock was held", __func__);
LIST_INSERT_HEAD(&pxd->pxd_pxis, pxi, pxi_list);
snprintf(ifp->if_xname, sizeof(ifp->if_xname), "%s%d", "pppx", unit);
@@ -776,8 +772,7 @@ pppx_add_session(struct pppx_dev *pxd, s
return (error);
remove:
- if (RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi) == NULL)
- panic("%s: pppx_ifs modified while lock was held", __func__);
+ RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi);
LIST_REMOVE(pxi, pxi_list);
out:
pool_put(pppx_if_pl, pxi);
@@ -870,8 +865,7 @@ pppx_if_destroy(struct pppx_dev *pxd, st
NET_LOCK();
pipex_rele_session(session);
- if (RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi) == NULL)
- panic("%s: pppx_ifs modified while lock was held", __func__);
+ RBT_REMOVE(pppx_ifs, &pppx_ifs, pxi);
LIST_REMOVE(pxi, pxi_list);
pool_put(pppx_if_pl, pxi);