* [ECOS] Bugs in FreeBSD stack fixed ...
@ 2003-09-17 16:20 Thomas BINDER
2003-09-18 19:42 ` Gary Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Thomas BINDER @ 2003-09-17 16:20 UTC (permalink / raw)
To: ecos-patches; +Cc: ecos-discuss
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
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
--
[-- Attachment #2: bsd_tcpip.txt --]
[-- Type: text/plain, Size: 2782 bytes --]
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);
[-- Attachment #3: Type: text/plain, Size: 146 bytes --]
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ECOS] Bugs in FreeBSD stack fixed ...
2003-09-17 16:20 [ECOS] Bugs in FreeBSD stack fixed Thomas BINDER
@ 2003-09-18 19:42 ` Gary Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Gary Thomas @ 2003-09-18 19:42 UTC (permalink / raw)
To: Thomas BINDER; +Cc: eCos patches, eCos Discussion
On Wed, 2003-09-17 at 10:19, Thomas BINDER wrote:
> 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).
>
Looks reasonable, I've applied these changes.
--
Gary Thomas <gary@mlbassoc.com>
MLB Associates
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-09-18 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-17 16:20 [ECOS] Bugs in FreeBSD stack fixed Thomas BINDER
2003-09-18 19:42 ` Gary Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).