buglwIP - A Lightweight TCP/IP stack - Bugs: bug #36561, Some netifapi functions handle...

 
 

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

bug #36561: Some netifapi functions handle pointers to stale objects

Submitted by:  Mason <mason>
Submitted on:  Wed 30 May 2012 01:43:28 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Invalid
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.4.0

Wed 30 May 2012 02:16:46 PM UTC, comment #1:

That's no bug, because:

- TCPIP_NETIFAPI() (as called by netifapi_netif_add()) waits for tcpip_callback() to return, so when netif_add() is called, the address is still valid.

- both netif_add() and netif_set_addr() copy the address into ip_addr_t members of struct netif, so the original pointers are not referenced after the function returns.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 30 May 2012 01:43:28 PM UTC, original submission:

I think there's a bug in
netifapi_netif_add
netifapi_netif_set_addr

These functions receive pointers to ip_addr_t objects
(ipaddr, netmask, gw) which likely "live" on the stack.
The pointers are copied to a message, which is posted
to the tcpip_thread.

When the tcpip_thread receives the message, the thread
that requested the operation has likely moved on, and
the ip_addr_t objects no longer exist. The pointers to
these objects are thus invalid.

Proposed solution (untested): in struct netifapi_msg_msg,
we could store the actual ip_addr_t objects, instead of
pointers to these objects.

Mason <mason>

 

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 mason (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
    Wed 30 May 2012 02:16:46 PM UTCgoldsimonStatusNone=>Invalid
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1