diff options
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/af_irda.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 4c670cf6aefa..c80949a71923 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1245,18 +1245,17 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1245 | struct sock *sk = sock->sk; | 1245 | struct sock *sk = sock->sk; |
1246 | struct irda_sock *self; | 1246 | struct irda_sock *self; |
1247 | struct sk_buff *skb; | 1247 | struct sk_buff *skb; |
1248 | int err; | 1248 | int err = -EPIPE; |
1249 | 1249 | ||
1250 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); | 1250 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); |
1251 | 1251 | ||
1252 | /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ | 1252 | /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ |
1253 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) | 1253 | if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT | |
1254 | MSG_NOSIGNAL)) | ||
1254 | return -EINVAL; | 1255 | return -EINVAL; |
1255 | 1256 | ||
1256 | if (sk->sk_shutdown & SEND_SHUTDOWN) { | 1257 | if (sk->sk_shutdown & SEND_SHUTDOWN) |
1257 | send_sig(SIGPIPE, current, 0); | 1258 | goto out_err; |
1258 | return -EPIPE; | ||
1259 | } | ||
1260 | 1259 | ||
1261 | if (sk->sk_state != TCP_ESTABLISHED) | 1260 | if (sk->sk_state != TCP_ESTABLISHED) |
1262 | return -ENOTCONN; | 1261 | return -ENOTCONN; |
@@ -1283,7 +1282,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1283 | skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, | 1282 | skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, |
1284 | msg->msg_flags & MSG_DONTWAIT, &err); | 1283 | msg->msg_flags & MSG_DONTWAIT, &err); |
1285 | if (!skb) | 1284 | if (!skb) |
1286 | return -ENOBUFS; | 1285 | goto out_err; |
1287 | 1286 | ||
1288 | skb_reserve(skb, self->max_header_size + 16); | 1287 | skb_reserve(skb, self->max_header_size + 16); |
1289 | skb_reset_transport_header(skb); | 1288 | skb_reset_transport_header(skb); |
@@ -1291,7 +1290,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1291 | err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len); | 1290 | err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len); |
1292 | if (err) { | 1291 | if (err) { |
1293 | kfree_skb(skb); | 1292 | kfree_skb(skb); |
1294 | return err; | 1293 | goto out_err; |
1295 | } | 1294 | } |
1296 | 1295 | ||
1297 | /* | 1296 | /* |
@@ -1301,10 +1300,14 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1301 | err = irttp_data_request(self->tsap, skb); | 1300 | err = irttp_data_request(self->tsap, skb); |
1302 | if (err) { | 1301 | if (err) { |
1303 | IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err); | 1302 | IRDA_DEBUG(0, "%s(), err=%d\n", __FUNCTION__, err); |
1304 | return err; | 1303 | goto out_err; |
1305 | } | 1304 | } |
1306 | /* Tell client how much data we actually sent */ | 1305 | /* Tell client how much data we actually sent */ |
1307 | return len; | 1306 | return len; |
1307 | |||
1308 | out_err: | ||
1309 | return sk_stream_error(sk, msg->msg_flags, err); | ||
1310 | |||
1308 | } | 1311 | } |
1309 | 1312 | ||
1310 | /* | 1313 | /* |