lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #9694] Update prev pointer when skipping entries in


From: Spencer
Subject: [lwip-devel] [patch #9694] Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion
Date: Thu, 27 Sep 2018 13:08:01 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0

URL:
  <https://savannah.nongnu.org/patch/?9694>

                 Summary: Update prev pointer when skipping entries in
tcp_slowtmr to prevent hitting assertion
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: raptorswing
            Submitted on: Thu 27 Sep 2018 05:07:59 PM UTC
                Category: TCP
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

In my application I was sporadically hitting the assertion


LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_active_pcbs", tcp_active_pcbs ==
pcb);


on line 1395 of tcp.c.

I realized that it is possible for already-processed entries in the list to be
skipped without updating the prev pointer in this block starting on line
1220:


if (pcb->last_timer == tcp_timer_ctr) {
  /* skip this pcb, we have already processed it */
  pcb = pcb->next;
  continue;
}


Then later, when removing a pcb from the list at line 1389, the code compares
prev with null to decide whether the pcb is the head of the list or not. If a
pcb was skipped, prev could still be null and the code takes the else branch
assuming that the current pcb is the head of the list. Then the assertion
fails.

The attached patch just modifies the block starting at 1220 to update the prev
pointer when skipping pcbs. I haven't hit the assertion in my application
since I applied this fix.

I hope this is helpful. Thanks.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 27 Sep 2018 05:08:00 PM UTC  Name:
0001-tcp_slowtmr-update-prev-ptr-when-skipping-entries.patch  Size: 421B   By:
raptorswing
patch generated against current master branch
<http://savannah.nongnu.org/patch/download.php?file_id=45107>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9694>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

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