]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sunrpc: Fix return value of get_srcport()
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 20 Jul 2021 20:04:42 +0000 (16:04 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 9 Aug 2021 21:25:36 +0000 (17:25 -0400)
Since bc1c56e9bbe9 transport->srcport may by unset, causing
get_srcport() to return 0 when called. Fix this by querying the port
from the underlying socket instead of the transport.

Fixes: bc1c56e9bbe9 (SUNRPC: prevent port reuse on transports which don't request it)
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtsock.c

index e573dcecdd66f286860f6c0ba11d61b4db12a4a6..02b071dbdd225b49c4d7ea4fe215013c3a3e847e 100644 (file)
@@ -1656,7 +1656,7 @@ static int xs_get_srcport(struct sock_xprt *transport)
 unsigned short get_srcport(struct rpc_xprt *xprt)
 {
        struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt);
-       return sock->srcport;
+       return xs_sock_getport(sock->sock);
 }
 EXPORT_SYMBOL(get_srcport);