diff options
author | Kuniyuki Iwashima | 2022-11-18 10:25:06 -0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2022-12-31 13:32:13 +0100 |
commit | d24fd986ae9d40fe3fcea0c1d7c44605b3527ca4 (patch) | |
tree | 114cb35a9e2a103267b834b14096118451ec25be /net/ipv4/ping.c | |
parent | 073b50de84cbc9064180097d89facecdbb49e177 (diff) |
net: Return errno in sk->sk_prot->get_port().
[ Upstream commit 7a7160edf1bfde25422262fb26851cef65f695d3 ]
We assume the correct errno is -EADDRINUSE when sk->sk_prot->get_port()
fails, so some ->get_port() functions return just 1 on failure and the
callers return -EADDRINUSE instead.
However, mptcp_get_port() can return -EINVAL. Let's not ignore the error.
Note the only exception is inet_autobind(), all of whose callers return
-EAGAIN instead.
Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/ipv4/ping.c')
-rw-r--r-- | net/ipv4/ping.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 04b4ec07bb06..409ec2a1f95b 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -143,7 +143,7 @@ next_port: fail: spin_unlock(&ping_table.lock); - return 1; + return -EADDRINUSE; } EXPORT_SYMBOL_GPL(ping_get_port); |