diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-10-08 11:43:10 +0200 |
---|---|---|
committer | Gedare Bloom <gedare@rtems.org> | 2014-11-22 09:32:12 -0500 |
commit | 797e9a8c7a52cd8f25c79328a35d5f364eda4838 (patch) | |
tree | bfedfaa621251ca6cfd27cf7db8ffb6c0eccd304 | |
parent | capture: back-port conversion from task_name to task_id (closes #1361) (diff) | |
download | rtems-797e9a8c7a52cd8f25c79328a35d5f364eda4838.tar.bz2 |
ppp: PR1943: Avoid NULL pointer access
Waiting for mbufs at this level is a bad solution. It would be better
to try to allocate a new mbuf chain before we hand over the current mbuf
chain to the upper layer. In case the allocation fails we should drop
the current packet and use its mbuf chain for a new packet.
-rw-r--r-- | cpukit/libnetworking/net/ppp_tty.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/cpukit/libnetworking/net/ppp_tty.c b/cpukit/libnetworking/net/ppp_tty.c index 94d0a69552..0aa2c279ae 100644 --- a/cpukit/libnetworking/net/ppp_tty.c +++ b/cpukit/libnetworking/net/ppp_tty.c @@ -704,14 +704,8 @@ pppallocmbuf(struct ppp_softc *sc, struct mbuf **mp) m = *mp; if ( m == NULL ) { /* get mbuf header */ - MGETHDR(m, M_DONTWAIT, MT_DATA); - if ( m == NULL ) { - /* error - set condition to break out */ - printf("pppallocmbuf: MGETHDR failed\n"); - break; - } - MCLGET(m, M_DONTWAIT); - m->m_next = NULL; + MGETHDR(m, M_WAIT, MT_DATA); + MCLGET(m, M_WAIT); *mp = m; } |