Deny to create pipex_session which is already exist. Newly created
session will be placed to list head so the caller of
pipex_*_lookup_session() will receive wrong session.
Index: sys/net/if_pppx.c
===================================================================
RCS file: /cvs/src/sys/net/if_pppx.c,v
retrieving revision 1.79
diff -u -p -r1.79 if_pppx.c
--- sys/net/if_pppx.c 6 Apr 2020 12:31:30 -0000 1.79
+++ sys/net/if_pppx.c 6 Apr 2020 13:47:26 -0000
@@ -719,6 +719,11 @@ pppx_add_session(struct pppx_dev *pxd, s
return (EPROTONOSUPPORT);
}
+ session = pipex_lookup_by_session_id(req->pr_protocol,
+ req->pr_session_id);
+ if (session)
+ return (EEXIST);
+
pxi = pool_get(pppx_if_pl, PR_WAITOK | PR_ZERO);
if (pxi == NULL)
return (ENOMEM);
Index: sys/net/pipex.c
===================================================================
RCS file: /cvs/src/sys/net/pipex.c,v
retrieving revision 1.112
diff -u -p -r1.112 pipex.c
--- sys/net/pipex.c 6 Apr 2020 13:14:04 -0000 1.112
+++ sys/net/pipex.c 6 Apr 2020 13:47:33 -0000
@@ -312,6 +312,11 @@ pipex_add_session(struct pipex_session_r
return (EPROTONOSUPPORT);
}
+ session = pipex_lookup_by_session_id(req->pr_protocol,
+ req->pr_session_id);
+ if (session)
+ return (EEXIST);
+
/* prepare a new session */
session = pool_get(&pipex_session_pool, PR_WAITOK | PR_ZERO);
session->state = PIPEX_STATE_OPENED;