]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
SUNRPC: rpcbind should never reset the port to the value '0'
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 24 Mar 2025 23:05:48 +0000 (19:05 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:36:59 +0000 (14:36 +0200)
[ Upstream commit 214c13e380ad7636631279f426387f9c4e3c14d9 ]

If we already had a valid port number for the RPC service, then we
should not allow the rpcbind client to set it to the invalid value '0'.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/rpcb_clnt.c

index 8fad45320e1b98a4f7ba6d6bf35430c0535e2041..f1bb4fd2a27074a12c207c2b2e9bb382cf30c0ba 100644 (file)
@@ -794,9 +794,10 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
        }
 
        trace_rpcb_setport(child, map->r_status, map->r_port);
-       xprt->ops->set_port(xprt, map->r_port);
-       if (map->r_port)
+       if (map->r_port) {
+               xprt->ops->set_port(xprt, map->r_port);
                xprt_set_bound(xprt);
+       }
 }
 
 /*