Skip to content

Commit f02ab9d

Browse files
amschuma-ntapgregkh
authored andcommitted
sunrpc: Fix return value of get_srcport()
[ Upstream commit 5d46dd0 ] Since bc1c56e 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: bc1c56e (SUNRPC: prevent port reuse on transports which don't request it) Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 21a2be1 commit f02ab9d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/sunrpc/xprtsock.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ static int xs_get_srcport(struct sock_xprt *transport)
16421642
unsigned short get_srcport(struct rpc_xprt *xprt)
16431643
{
16441644
struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt);
1645-
return sock->srcport;
1645+
return xs_sock_getport(sock->sock);
16461646
}
16471647
EXPORT_SYMBOL(get_srcport);
16481648

0 commit comments

Comments
 (0)