bugGNU GRUB - Bugs: bug #56922, Resource Leak in TCP packet...


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

bug #56922: Resource Leak in TCP packet handling in grub, trivial patch

Submitted by:  Manfred Härtel <mhaertel>
Submitted on:  Fri 20 Sep 2019 03:42:22 PM UTC  
Category:  Network Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open Release: 
Release:  Git master Reproducibility:  Every Time
Planned Release:  None

Fri 20 Sep 2019 03:42:22 PM UTC, original submission:  

I wrote a grub module which uses the TCP communication functions included in grub for educating myself. :-)

During stress tests I recognized a resource leak. Naturally, I suspected my program first, but could not find a reason why this would happen.

Then I got the feeling that the problem has something to do with the list of unacked outgoing packets in grub, it seems as if some of them do not get unallocated from memory. I also recognized that the unacked queue for a certain socket never exceeds the size of 2 packets, even if it should actually.

While looking through the source code of tcp.c, I think I found the problem and made a trivial patch (attached).

Without my patch, a new packet is inserted in the link list after socket->unack_last, but socket->unack_last does not change, so when another unacked packet comes it is prepended to the same packet in the list as before, so the packet we inserted before is not in the linked list anymore, and so never gets unallocated.

The patch seems to solve my problem and I did not recognize any side effects.

Manfred Härtel <mhaertel>


Attached Files
file #47553:  tcp.c.patch added by mhaertel (374B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mhaertel (Submitted the item)

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

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-20 mhaertel Attached File- => Added tcp.c.patch, #47553

    Back to the top

    Powered by Savane 3.5