]> 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:37:55 +0000 (14:37 +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 638b14f28101e242965edf30aa03934aeb824f77..c49f9295fce975af64fec6af7d6c95ca63e568fe 100644 (file)
@@ -797,9 +797,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);
+       }
 }
 
 /*