Mercurial > flash_v2
changeset 1221:219ba4658ed2
Fix some malloc() issues - from Thomas Binder
| author | gthomas |
|---|---|
| date | Thu, 18 Sep 2003 19:41:20 +0000 |
| parents | c87d732b5f4a |
| children | f0bd64ec9405 |
| files | packages/net/bsd_tcpip/current/ChangeLog packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c |
| diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/net/bsd_tcpip/current/ChangeLog +++ b/packages/net/bsd_tcpip/current/ChangeLog @@ -1,3 +1,13 @@ +2003-09-17 Reinhard Jessich <Reinhard.Jessich@frequentis.com> + + * src/sys/kern/uipc_mbuf.c: Now using flags (how) argument in call to + cyg_net_mbuf_alloc, to avoid a (blocking) call to alloc method of mempool + during interrupts. This problem occurred under heavy IP traffic in case the + mempool became empty (alloc blocked). + * src/sys/net/if_ethersubr.c: Avoid dereferencing NULL pointer in case of + failing m_copy. Note that this problem was (at least sometimes) hidden + due to the bug in uipc_mbuf.c (described above). + 2003-09-08 Andrew Lunn <andrew.lunn@ascom.ch> * src/ecos/support.c (read_random): New function which is needed
--- a/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c +++ b/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c @@ -139,7 +139,7 @@ m_mballoc(nmb, how) int i; for (i = 0; i < nmb; i++) { - p = (struct mbuf *)cyg_net_mbuf_alloc(0, 0); + p = (struct mbuf *)cyg_net_mbuf_alloc(0, how); if (p != (struct mbuf *)0) { ((struct mbuf *)p)->m_next = mmbfree; mmbfree = (struct mbuf *)p;
--- a/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c +++ b/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c @@ -339,6 +339,11 @@ ether_output(ifp, m, dst, rt0) if ((ifp->if_flags & IFF_SIMPLEX) && (loop_copy != -1)) { if ((m->m_flags & M_BCAST) || (loop_copy > 0)) { struct mbuf *n = m_copy(m, 0, (int)M_COPYALL); + + if ( n == 0 ) { + error = 0; + goto bad; + } (void) if_simloop(ifp, n, dst->sa_family, hlen); } else if (bcmp(eh->ether_dhost,
