mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
[IrDA]: MSG_NOSIGNAL support for IrDA sockets
Signed-off-by: Samuel Ortiz <samuel@sortiz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
172589ccdd
commit
bcb5e0eef3
1 changed files with 12 additions and 9 deletions
|
@ -1245,18 +1245,17 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct irda_sock *self;
|
struct irda_sock *self;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
int err;
|
int err = -EPIPE;
|
||||||
|
|
||||||
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
|
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
|
||||||
|
|
||||||
/* Note : socket.c set MSG_EOR on SEQPACKET sockets */
|
/* Note : socket.c set MSG_EOR on SEQPACKET sockets */
|
||||||
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
|
if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT |
|
||||||
|
MSG_NOSIGNAL))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (sk->sk_shutdown & SEND_SHUTDOWN) {
|
if (sk->sk_shutdown & SEND_SHUTDOWN)
|
||||||
send_sig(SIGPIPE, current, 0);
|
goto out_err;
|
||||||
return -EPIPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sk->sk_state != TCP_ESTABLISHED)
|
if (sk->sk_state != TCP_ESTABLISHED)
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
|
@ -1283,7 +1282,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16,
|
skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16,
|
||||||
msg->msg_flags & MSG_DONTWAIT, &err);
|
msg->msg_flags & MSG_DONTWAIT, &err);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
return -ENOBUFS;
|
goto out_err;
|
||||||
|
|
||||||
skb_reserve(skb, self->max_header_size + 16);
|
skb_reserve(skb, self->max_header_size + 16);
|
||||||
skb_reset_transport_header(skb);
|
skb_reset_transport_header(skb);
|
||||||
|
@ -1291,7 +1290,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
|
err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len);
|
||||||
if (err) {
|
if (err) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1301,10 +1300,14 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
err = irttp_data_request(self->tsap, skb);
|
err = irttp_data_request(self->tsap, skb);
|
||||||
if (err) {
|
if (err) {
|
||||||
IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err);
|
IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err);
|
||||||
return err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
/* Tell client how much data we actually sent */
|
/* Tell client how much data we actually sent */
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
|
out_err:
|
||||||
|
return sk_stream_error(sk, msg->msg_flags, err);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue