[PATCH] mux: fix incorrect return value check in local forward cancellation

Damien Miller djm at mindrot.org
Fri Jul 4 10:21:04 AEST 2025


On Fri, 20 Jun 2025, Boris Tonofa wrote:

> Hi,
> 
> This patch fixes a logic error in mux_master_process_close_fwd().
> 
> channel_cancel_lport_listener() returns 1 on success and 0 on failure.
> The previous code incorrectly checked for `== -1`, a value the function
> never returns, so failure was not detected and the "port not found"
> error message was never shown when cancelling dynamic or local port
> forwards.
> 
> The patch applies cleanly to current master and all GitHub CI jobs are
> green (see mirror PR):
>   https://github.com/openssh/openssh-portable/pull/577
> 
> If merged, could you please keep the author line
>    From: Boris Tonofa <b.tonofa at ideco.ru>
> in the commit message?  My company would appreciate the attribution.

Thanks for the fix, here's what I committed:

Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Jul 4 00:17:55 2025 +0000

    upstream: mux: fix incorrect return value check in local forward
    
    cancellation
    
    channel_cancel_lport_listener() returns 1 on success and 0 on failure.
    The previous code incorrectly checked for `== -1`, a value the function
    never returns, so failure was not detected and the "port not found"
    error message was never shown when cancelling dynamic or local port
    forwards.
    
    From: Boris Tonofa <b.tonofa at ideco.ru>
    
    OpenBSD-Commit-ID: 3e9d2252a4d0bd318d4f25e2b518afb44acea170


Hope this is okay.

-d


More information about the openssh-unix-dev mailing list