]> 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:40:03 +0000 (14:40 +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 82afb56695f8d30d99b3e28c57a22929d407e14b..1ec20163a0b7dadca3049f0f4c3057ed5b3ab9a6 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);
+       }
 }
 
 /*