diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 16faa9dffd4433bf0564eb65e624f02454bd80f6..8902c4aa900f9cb408c9ce56b41e241da16e167b 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1513,13 +1513,18 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, static int unix_seqpacket_sendmsg(struct kiocb *kiocb, struct socket *sock, struct msghdr *msg, size_t len) { + int err; struct sock *sk = sock->sk; + err = sock_error(sk); + if (err) + return err; + if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; - if (msg->msg_name || msg->msg_namelen) - return -EINVAL; + if (msg->msg_namelen) + msg->msg_namelen = 0; return unix_dgram_sendmsg(kiocb, sock, msg, len); }