buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51595, ip4_reass: ip_reass_pbufcount may...

 
 

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

bug #51595: ip4_reass: ip_reass_pbufcount may be updated incorectly

Submitter:  Ambroz Bizjak <abizjak>
Submitted:  Thu 27 Jul 2017 10:14:02 PM UTC
   
 
Category:  IPv4 Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Tue 09 Jan 2018 07:22:13 AM UTC, comment #2: 

This just got another fix.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 28 Jul 2017 07:47:34 AM UTC, comment #1: 

Fixed, thanks for reporting.

Simon Goldschmidt <goldsimon>
Group administrator
Thu 27 Jul 2017 10:14:02 PM UTC, original submission:  

In ip4_frag.c, ip4_reass(), see this code:

  /* Track the current number of pbufs current 'in-flight', in order to limit
     the number of fragments that may be enqueued at any one time
     (overflow checked by testing against IP_REASS_MAX_PBUFS) */
  ip_reass_pbufcount = (u16_t)(ip_reass_pbufcount + clen);

  /* At this point, we have either created a new entry or pointing
   to an existing one /

  /* check for 'no more fragments', and update queue entry*/
  if ((IPH_OFFSET(fraghdr) & PP_NTOHS(IP_MF)) == 0) {
    u16_t datagram_len = (u16_t)(offset + len);
    if ((datagram_len < offset) || (datagram_len > (0xFFFF - IP_HLEN))) {
      /* u16_t overflow, cannot handle this */
      goto nullreturn;

In this case of "goto nullreturn", ip_reass_pbufcount has been increased but the pbuf has not been queued to the reassembly chains.

After this, ip_reass_chain_frag_into_datagram_and_validate seems to take responsibility for decrementing back in case the pbuf was not queued which is fine. Solution should be to move the increment below the if block  /* check for 'no more fragments', and update queue entry*/.

Ambroz Bizjak <abizjak>

 

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

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by abizjak (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-07-28 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code