• Mitko Haralanov's avatar
    IB/hfi1: Fix memory leak in user ExpRcv and SDMA · 0ad2d3d0
    Mitko Haralanov authored
    The driver had two memory leaks - one in the user
    expected receive code and one in SDMA buffer cache.
    
    The leak in the expected receive code only showed up
    when the user/admin had set ulimit sufficiently low
    and the driver did not have enough room in the cache
    before hitting the limit of allowed cachable memory.
    
    When this condition occurred, the driver returned
    early signaling userland that it needed to free some
    buffers to free up room in the cache.
    
    The bug was that the driver was not cleaning up
    allocated memory prior to returning early.
    
    The leak in the SDMA buffer cache could occur (even
    though it never did), when the insertion of a buffer
    node in the interval RB tree failed. In this case, the
    driver failed to unpin the pages of the node instead
    erroneously returning success.
    Reviewed-by: default avatarDean Luick <dean.luick@intel.com>
    Signed-off-by: default avatarMitko Haralanov <mitko.haralanov@intel.com>
    Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
    0ad2d3d0
user_exp_rcv.c 30.3 KB