lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #50276] tcp: fix accept event on closed listening PCBs


From: David van Moolenbroek
Subject: [lwip-devel] [bug #50276] tcp: fix accept event on closed listening PCBs
Date: Fri, 10 Feb 2017 12:48:24 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0

URL:
  <http://savannah.nongnu.org/bugs/?50276>

                 Summary: tcp: fix accept event on closed listening PCBs
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: dcvmoole
            Submitted on: Fri 10 Feb 2017 05:48:22 PM UTC
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head

    _______________________________________________________

Details:

I just got a rare crash I cannot reproduce, but all the debug information
points to my side of things trying to process a TCP accept event for a new PCB
for which the listening PCB was already gone.

Within lwIP, listener tracking is in place if either LWIP_CALLBACK_API or
TCP_LISTEN_BACKLOG is defined, except that there is exactly one place where
the listener is checked only if LWIP_CALLBACK_API is defined, and not if
TCP_LISTEN_BACKLOG is defined. And that place prevents closed listening PCBs
from triggering accept events. And indeed, my config defines
TCP_LISTEN_BACKLOG but not LWIP_CALLBACK_API.

Attached patch should fix this problem.

===

If LWIP_CALLBACK_API is not defined, but TCP_LISTEN_BACKLOG is, then the
LWIP_EVENT_ACCEPT TCP event may be triggered for closed listening sockets.
This case is just as disastrous for the event API as it is for the callback
API, as there is no way for the event hook to tell whether the listening PCB
is still around. Add the same protection against this case for
TCP_LISTEN_BACKLOG as was already in place for LWIP_CALLBACK_API.

Also remove one NULL check for LWIP_CALLBACK_API that had already become
redundant for all callers, making the TCP_EVENT_ACCEPT code for that callback
wrapper more in line with the rest of the wrappers.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 10 Feb 2017 05:48:22 PM UTC  Name:
0001-tcp-fix-accept-event-on-closed-listening-PCBs.patch  Size: 3kB   By:
dcvmoole

<http://savannah.nongnu.org/bugs/download.php?file_id=39722>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?50276>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]