This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Bugs in FreeBSD stack fixed ...
- From: Thomas BINDER <Thomas dot Binder at frequentis dot com>
- To: ecos-patches at sources dot redhat dot com
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Wed, 17 Sep 2003 18:19:47 +0200
- Subject: [ECOS] Bugs in FreeBSD stack fixed ...
- Organization: Frequentis
Hi!
The attached patch fixes 2 bugs in the FreeBSD stack.
The first problem is that the alloc method of the fixed mempool is called from an interrupt, the second is a NULL pointer dereferenciation in case m_copy failed. The NULL pointer problem was also discussed on the FreeBSD list (April 2003).
best regards,
Tom
--
diff --exclude CVS -NauU5 -r /home_vie1/tbinder/ecos-anonymous/ecos/packages/net/bsd_tcpip/current/ChangeLog ./net/bsd_tcpip/current/ChangeLog
--- /home_vie1/tbinder/ecos-anonymous/ecos/packages/net/bsd_tcpip/current/ChangeLog Sun Sep 14 00:00:37 2003
+++ ./net/bsd_tcpip/current/ChangeLog Wed Sep 17 18:09:06 2003
@@ -1,5 +1,15 @@
+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
when CYGSEM_NET_RANDOMID is enabled.
* include/sys/param.h: Prototype for new function.
diff --exclude CVS -NauU5 -r /home_vie1/tbinder/ecos-anonymous/ecos/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c ./net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c
--- /home_vie1/tbinder/ecos-anonymous/ecos/packages/net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c Wed Sep 17 17:54:06 2003
+++ ./net/bsd_tcpip/current/src/sys/kern/uipc_mbuf.c Wed Sep 17 17:35:41 2003
@@ -137,11 +137,11 @@
{
struct mbuf *p;
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;
mbstat.m_mbufs++;
mbtypes[MT_FREE]++;
diff --exclude CVS -NauU5 -r /home_vie1/tbinder/ecos-anonymous/ecos/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c ./net/bsd_tcpip/current/src/sys/net/if_ethersubr.c
--- /home_vie1/tbinder/ecos-anonymous/ecos/packages/net/bsd_tcpip/current/src/sys/net/if_ethersubr.c Wed Sep 17 17:54:07 2003
+++ ./net/bsd_tcpip/current/src/sys/net/if_ethersubr.c Wed Sep 17 17:51:33 2003
@@ -337,10 +337,15 @@
* reasons and compatibility with the original behavior.
*/
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,
eh->ether_shost, ETHER_ADDR_LEN) == 0) {
(void) if_simloop(ifp, m, dst->sa_family, hlen);
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss