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

Submitted by:  Ambroz Bizjak <abizjak>
Submitted on:  Thu 27 Jul 2017 10:14:02 PM UTC  
 
Category: IPv4Severity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: git head

Fri 28 Jul 2017 07:47:34 AM UTC, comment #1:

Fixed, thanks for reporting.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by abizjak (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 28 Jul 2017 07:47:34 AM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1