mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
af_iucv: Change if condition in sendmsg() for more readability
Change the if condition to exit sendmsg() if the socket in not connected. Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
cb2107be43
commit
bb664f49f8
1 changed files with 87 additions and 88 deletions
|
@ -747,7 +747,12 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sk->sk_state == IUCV_CONNECTED) {
|
/* Return if the socket is not in connected state */
|
||||||
|
if (sk->sk_state != IUCV_CONNECTED) {
|
||||||
|
err = -ENOTCONN;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* initialize defaults */
|
/* initialize defaults */
|
||||||
cmsg_done = 0; /* check for duplicate headers */
|
cmsg_done = 0; /* check for duplicate headers */
|
||||||
txmsg.class = 0;
|
txmsg.class = 0;
|
||||||
|
@ -794,11 +799,10 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
* this is fine for SOCK_SEQPACKET (unless we want to support
|
* this is fine for SOCK_SEQPACKET (unless we want to support
|
||||||
* segmented records using the MSG_EOR flag), but
|
* segmented records using the MSG_EOR flag), but
|
||||||
* for SOCK_STREAM we might want to improve it in future */
|
* for SOCK_STREAM we might want to improve it in future */
|
||||||
if (!(skb = sock_alloc_send_skb(sk, len,
|
skb = sock_alloc_send_skb(sk, len, msg->msg_flags & MSG_DONTWAIT,
|
||||||
msg->msg_flags & MSG_DONTWAIT,
|
&err);
|
||||||
&err)))
|
if (!skb)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
|
if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) {
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -839,18 +843,13 @@ static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
|
||||||
memcpy(appl_id, iucv->dst_name, 8);
|
memcpy(appl_id, iucv->dst_name, 8);
|
||||||
pr_err("Application %s on z/VM guest %s"
|
pr_err("Application %s on z/VM guest %s"
|
||||||
" exceeds message limit\n",
|
" exceeds message limit\n",
|
||||||
user_id, appl_id);
|
appl_id, user_id);
|
||||||
}
|
}
|
||||||
skb_unlink(skb, &iucv->send_skb_q);
|
skb_unlink(skb, &iucv->send_skb_q);
|
||||||
err = -EPIPE;
|
err = -EPIPE;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
err = -ENOTCONN;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
release_sock(sk);
|
release_sock(sk);
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue