• Shyam Prasad N's avatar
    cifs: fix mid leak during reconnection after timeout threshold · 69cba9d3
    Shyam Prasad N authored
    When the number of responses with status of STATUS_IO_TIMEOUT
    exceeds a specified threshold (NUM_STATUS_IO_TIMEOUT), we reconnect
    the connection. But we do not return the mid, or the credits
    returned for the mid, or reduce the number of in-flight requests.
    
    This bug could result in the server->in_flight count to go bad,
    and also cause a leak in the mids.
    
    This change moves the check to a few lines below where the
    response is decrypted, even of the response is read from the
    transform header. This way, the code for returning the mids
    can be reused.
    
    Also, the cifs_reconnect was reconnecting just the transport
    connection before. In case of multi-channel, this may not be
    what we want to do after several timeouts. Changed that to
    reconnect the session and the tree too.
    
    Also renamed NUM_STATUS_IO_TIMEOUT to a more appropriate name
    MAX_STATUS_IO_TIMEOUT.
    
    Fixes: 8e670f77 ("Handle STATUS_IO_TIMEOUT gracefully")
    Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
    Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
    69cba9d3
connect.c 111 KB