[patch #9694] Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch #9694] Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion

Simon Goldschmidt
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/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[patch #9694] Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion

Simon Goldschmidt
Update of patch #9694 (project lwip):

         Planned Release:                    None => 2.1.1                  


    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[patch #9694] Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion

Simon Goldschmidt
Follow-up Comment #1, patch #9694 (project lwip):

Hi Simon,
This looks like a fix for stable branch?

    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

[patch #9694] Update prev pointer when skipping entries in tcp_slowtmr to prevent hitting assertion

Simon Goldschmidt
Update of patch #9694 (project lwip):

                  Status:                    None => Done                  
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #2:

Applied, thanks for the patch!

It will be cherry-picked to 2.1.1 branch.

    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel