[rtems commit] ppp: PR1943: Avoid NULL pointer access
Gedare Bloom
gedare at rtems.org
Sat Nov 22 14:34:43 UTC 2014
Module: rtems
Branch: 4.10
Commit: d1d31a5f6114ff73b11cf67bb6a09b3df0d8748c
Changeset: http://git.rtems.org/rtems/commit/?id=d1d31a5f6114ff73b11cf67bb6a09b3df0d8748c
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Oct 8 11:43:10 2014 +0200
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.
---
cpukit/libnetworking/net/ppp_tty.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/cpukit/libnetworking/net/ppp_tty.c b/cpukit/libnetworking/net/ppp_tty.c
index 1d91266..9b2ca26 100644
--- a/cpukit/libnetworking/net/ppp_tty.c
+++ b/cpukit/libnetworking/net/ppp_tty.c
@@ -708,14 +708,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;
}
More information about the vc
mailing list