Commit 6e14891f authored by James Morris's avatar James Morris Committed by David S. Miller

[AF_UNIX]: Don't lose ECONNRESET in unix_seqpacket_sendmsg()

The fix for SELinux w/SOCK_SEQPACKET had an error,
noted by Alan Cox.  This fixes it.
Signed-off-by: default avatarJames Morris <jmorris@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1514a193
...@@ -1513,13 +1513,18 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, ...@@ -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, static int unix_seqpacket_sendmsg(struct kiocb *kiocb, struct socket *sock,
struct msghdr *msg, size_t len) struct msghdr *msg, size_t len)
{ {
int err;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
err = sock_error(sk);
if (err)
return err;
if (sk->sk_state != TCP_ESTABLISHED) if (sk->sk_state != TCP_ESTABLISHED)
return -ENOTCONN; return -ENOTCONN;
if (msg->msg_name || msg->msg_namelen) if (msg->msg_namelen)
return -EINVAL; msg->msg_namelen = 0;
return unix_dgram_sendmsg(kiocb, sock, msg, len); return unix_dgram_sendmsg(kiocb, sock, msg, len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment