From f967933e8b951d4a9d37de15983fde016d5a1f11 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Thu, 26 Mar 2015 23:30:18 +0100 Subject: [PATCH] PPP, PPPoS, protect open flag in connect() and listen() Protect open flag in connect() and listen(), this is a bitfield, it might not be set atomically on some targets. --- src/netif/ppp/pppos.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 094582bd..9ceab721 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -339,6 +339,7 @@ static err_t pppos_connect(ppp_pcb *ppp, void *ctx) { pppos_pcb *pppos = (pppos_pcb *)ctx; + PPPOS_DECL_PROTECT(lev); #if PPP_INPROC_IRQ_SAFE /* input pbuf left over from last session? */ @@ -359,7 +360,9 @@ pppos_connect(ppp_pcb *ppp, void *ctx) */ pppos->in_accm[15] = 0x60; /* no need to protect since RX is not running */ pppos->out_accm[15] = 0x60; + PPPOS_PROTECT(lev); pppos->open = 1; + PPPOS_UNPROTECT(lev); /* * Start the connection and handle incoming events (packet or timeout). @@ -378,6 +381,7 @@ pppos_listen(ppp_pcb *ppp, void *ctx, struct ppp_addrs *addrs) ipcp_options *ipcp_wo; #endif /* PPP_IPV4_SUPPORT */ lcp_options *lcp_wo; + PPPOS_DECL_PROTECT(lev); #if PPP_INPROC_IRQ_SAFE /* input pbuf left over from last session? */ @@ -421,7 +425,9 @@ pppos_listen(ppp_pcb *ppp, void *ctx, struct ppp_addrs *addrs) */ pppos->in_accm[15] = 0x60; /* no need to protect since RX is not running */ pppos->out_accm[15] = 0x60; + PPPOS_PROTECT(lev); pppos->open = 1; + PPPOS_UNPROTECT(lev); /* * Wait for something to happen.