diff options
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r-- | net/tipc/socket.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index e9fc5df79eb0..0895dec2967c 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -563,7 +563,8 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, | |||
563 | 563 | ||
564 | do { | 564 | do { |
565 | if (dest->addrtype == TIPC_ADDR_NAME) { | 565 | if (dest->addrtype == TIPC_ADDR_NAME) { |
566 | if ((res = dest_name_check(dest, m))) | 566 | res = dest_name_check(dest, m); |
567 | if (res) | ||
567 | break; | 568 | break; |
568 | res = tipc_send2name(tport->ref, | 569 | res = tipc_send2name(tport->ref, |
569 | &dest->addr.name.name, | 570 | &dest->addr.name.name, |
@@ -580,7 +581,8 @@ static int send_msg(struct kiocb *iocb, struct socket *sock, | |||
580 | res = -EOPNOTSUPP; | 581 | res = -EOPNOTSUPP; |
581 | break; | 582 | break; |
582 | } | 583 | } |
583 | if ((res = dest_name_check(dest, m))) | 584 | res = dest_name_check(dest, m); |
585 | if (res) | ||
584 | break; | 586 | break; |
585 | res = tipc_multicast(tport->ref, | 587 | res = tipc_multicast(tport->ref, |
586 | &dest->addr.nameseq, | 588 | &dest->addr.nameseq, |
@@ -750,7 +752,8 @@ static int send_stream(struct kiocb *iocb, struct socket *sock, | |||
750 | bytes_to_send = curr_left; | 752 | bytes_to_send = curr_left; |
751 | my_iov.iov_base = curr_start; | 753 | my_iov.iov_base = curr_start; |
752 | my_iov.iov_len = bytes_to_send; | 754 | my_iov.iov_len = bytes_to_send; |
753 | if ((res = send_packet(NULL, sock, &my_msg, 0)) < 0) { | 755 | res = send_packet(NULL, sock, &my_msg, 0); |
756 | if (res < 0) { | ||
754 | if (bytes_sent) | 757 | if (bytes_sent) |
755 | res = bytes_sent; | 758 | res = bytes_sent; |
756 | goto exit; | 759 | goto exit; |
@@ -845,12 +848,15 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, | |||
845 | if (unlikely(err)) { | 848 | if (unlikely(err)) { |
846 | anc_data[0] = err; | 849 | anc_data[0] = err; |
847 | anc_data[1] = msg_data_sz(msg); | 850 | anc_data[1] = msg_data_sz(msg); |
848 | if ((res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data))) | 851 | res = put_cmsg(m, SOL_TIPC, TIPC_ERRINFO, 8, anc_data); |
849 | return res; | 852 | if (res) |
850 | if (anc_data[1] && | ||
851 | (res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], | ||
852 | msg_data(msg)))) | ||
853 | return res; | 853 | return res; |
854 | if (anc_data[1]) { | ||
855 | res = put_cmsg(m, SOL_TIPC, TIPC_RETDATA, anc_data[1], | ||
856 | msg_data(msg)); | ||
857 | if (res) | ||
858 | return res; | ||
859 | } | ||
854 | } | 860 | } |
855 | 861 | ||
856 | /* Optionally capture message destination object */ | 862 | /* Optionally capture message destination object */ |
@@ -878,9 +884,11 @@ static int anc_data_recv(struct msghdr *m, struct tipc_msg *msg, | |||
878 | default: | 884 | default: |
879 | has_name = 0; | 885 | has_name = 0; |
880 | } | 886 | } |
881 | if (has_name && | 887 | if (has_name) { |
882 | (res = put_cmsg(m, SOL_TIPC, TIPC_DESTNAME, 12, anc_data))) | 888 | res = put_cmsg(m, SOL_TIPC, TIPC_DESTNAME, 12, anc_data); |
883 | return res; | 889 | if (res) |
890 | return res; | ||
891 | } | ||
884 | 892 | ||
885 | return 0; | 893 | return 0; |
886 | } | 894 | } |
@@ -1664,7 +1672,8 @@ static int setsockopt(struct socket *sock, | |||
1664 | return -ENOPROTOOPT; | 1672 | return -ENOPROTOOPT; |
1665 | if (ol < sizeof(value)) | 1673 | if (ol < sizeof(value)) |
1666 | return -EINVAL; | 1674 | return -EINVAL; |
1667 | if ((res = get_user(value, (u32 __user *)ov))) | 1675 | res = get_user(value, (u32 __user *)ov); |
1676 | if (res) | ||
1668 | return res; | 1677 | return res; |
1669 | 1678 | ||
1670 | lock_sock(sk); | 1679 | lock_sock(sk); |
@@ -1722,7 +1731,8 @@ static int getsockopt(struct socket *sock, | |||
1722 | return put_user(0, ol); | 1731 | return put_user(0, ol); |
1723 | if (lvl != SOL_TIPC) | 1732 | if (lvl != SOL_TIPC) |
1724 | return -ENOPROTOOPT; | 1733 | return -ENOPROTOOPT; |
1725 | if ((res = get_user(len, ol))) | 1734 | res = get_user(len, ol); |
1735 | if (res) | ||
1726 | return res; | 1736 | return res; |
1727 | 1737 | ||
1728 | lock_sock(sk); | 1738 | lock_sock(sk); |