diff options
author | Erik Hugne <erik.hugne@ericsson.com> | 2013-08-28 09:29:58 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-14 06:54:56 -0700 |
commit | 8db07b82b70897d868d864402b43a68da5e0cd59 (patch) | |
tree | 2a41950c9b2ad22cba6ba1cef2aaae039435fc54 /arch/um/os-Linux | |
parent | b70a23ab4ab5a95ab9be1bf77b73c1ad9f4e15a4 (diff) | |
download | linux-stable-8db07b82b70897d868d864402b43a68da5e0cd59.tar.gz linux-stable-8db07b82b70897d868d864402b43a68da5e0cd59.tar.bz2 linux-stable-8db07b82b70897d868d864402b43a68da5e0cd59.zip |
tipc: set sk_err correctly when connection fails
[ Upstream commit 2c8d85182348021fc0a1bed193a4be4161dc8364 ]
Should a connect fail, if the publication/server is unavailable or
due to some other error, a positive value will be returned and errno
is never set. If the application code checks for an explicit zero
return from connect (success) or a negative return (failure), it
will not catch the error and subsequent send() calls will fail as
shown from the strace snippet below.
socket(0x1e /* PF_??? */, SOCK_SEQPACKET, 0) = 3
connect(3, {sa_family=0x1e /* AF_??? */, sa_data="\2\1\322\4\0\0\322\4\0\0\0\0\0\0"}, 16) = 111
sendto(3, "test", 4, 0, NULL, 0) = -1 EPIPE (Broken pipe)
The reason for this behaviour is that TIPC wrongly inverts error
codes set in sk_err.
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/um/os-Linux')
0 files changed, 0 insertions, 0 deletions