patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9694, Update prev pointer when skipping...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  Spencer <raptorswing>
Submitted:  Thu 27 Sep 2018 05:07:59 PM UTC
   
 
Category:  TCP Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Planned Release:  2.1.1

Thu 04 Oct 2018 03:39:32 PM UTC, comment #2: 

Applied, thanks for the patch!

It will be cherry-picked to 2.1.1 branch.

- <_101723>
Wed 03 Oct 2018 11:41:28 PM UTC, comment #1: 

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

Axel Lin <axellin>
Group Member
Thu 27 Sep 2018 05:07:59 PM UTC, original submission:  

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.

Spencer <raptorswing>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #45107:  0001-tcp_slowtmr-update-prev-ptr-when-skipping-entries.patch added by raptorswing (421B - text/x-patch - patch generated against current master branch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by _101723 (Posted a comment)
  • -email is unavailable- added by axellin (Posted a comment)
  • -email is unavailable- added by goldsimon (Updated the item)
  • -email is unavailable- added by raptorswing (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-04 _101723 StatusNone Done
        Open/ClosedOpen Closed
    2018-09-28 goldsimon Planned ReleaseNone 2.1.1
    2018-09-27 raptorswing Attached File- Added 0001-tcp_slowtmr-update-prev-ptr-when-skipping-entries.patch, #45107

    Back to the top

    Powered by Savane 3.15-e6e5.
    Corresponding source code