summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@Netapp.com>2021-07-20 22:04:42 +0200
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2021-08-09 23:25:36 +0200
commit5d46dd04cb68771f77ba66dbf6fd323a4a2ce00d (patch)
tree400cd39f33fd91463461774418931a815e2817de /net/sunrpc
parentSUNRPC/xprtrdma: Fix reconnection locking (diff)
downloadlinux-5d46dd04cb68771f77ba66dbf6fd323a4a2ce00d.tar.xz
linux-5d46dd04cb68771f77ba66dbf6fd323a4a2ce00d.zip
sunrpc: Fix return value of get_srcport()
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>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprtsock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index e573dcecdd66..02b071dbdd22 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -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);