buglwIP - A Lightweight TCP/IP stack - Bugs: bug #63458, Sockopt hook cause socket leak.

 
 

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

bug #63458: Sockopt hook cause socket leak.

Submitter:  Masakazu <kneko715>
Submitted:  Fri 02 Dec 2022 10:39:40 AM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  2.2.1
lwIP version:  2.1.2

Wed 11 Oct 2023 07:24:04 PM UTC, comment #1: 

Fixed, thanks for reporting!

Simon Goldschmidt <goldsimon>
Group administrator
Fri 02 Dec 2022 10:39:40 AM UTC, original submission:  

After hooking lwip_setsockopt_impl or lwip_getsockopt_impl by using LWIP_HOOK_SOCKETS_SETSOCKOPT or LWIP_HOOK_SOCKETS_GETSOCKOPT, done_socket(sock) is not called so leak sock.


sockets.c : http://git.savannah.gnu.org/cgit/lwip.git/tree/src/api/sockets.c#n2937

> static int
> lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *optlen)
> {
>   int err = 0;
>   struct lwip_sock *sock = tryget_socket(s);
>   if (!sock) {
>     return EBADF;
>   }
>
> #ifdef LWIP_HOOK_SOCKETS_GETSOCKOPT
>   if (LWIP_HOOK_SOCKETS_GETSOCKOPT(s, sock, level, optname, optval, optlen, &err)) {
>     !!CALL done_socket(sock) here!!
>     return err;
>   }
> #endif


After hooked, should call done_socket(sock) before return.

Thank you.

Masakazu <kneko715>

 

(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 kneko715 (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
    2023-10-11 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.2.1

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code