summaryrefslogtreecommitdiff
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 07d6fba99a7c..111f95384990 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2046,11 +2046,6 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
restart:
if (!other) {
- if (!sunaddr) {
- err = -ECONNRESET;
- goto out_free;
- }
-
other = unix_find_other(sock_net(sk), sunaddr, msg->msg_namelen,
sk->sk_type);
if (IS_ERR(other)) {
@@ -2105,6 +2100,9 @@ restart_locked:
err = -ECONNREFUSED;
} else {
unix_state_unlock(sk);
+
+ if (!sunaddr)
+ err = -ECONNRESET;
}
other = NULL;