aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-07 18:41:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-07 18:41:10 -0500
commite2857b8f11a289ed2b61d18d0665e05c1053c446 (patch)
treecb986b593757fac11f5b897a02db38de3aeefe67 /net/tipc/socket.c
parent01ffa3df223c061435dfaab8daba7c0109a3c6d5 (diff)
parent6faac63a6986f29ef39827f460edd3a5ba64ad5c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix ordering of WEXT netlink messages so we don't see a newlink after a dellink, from Johannes Berg. 2) Out of bounds access in minstrel_ht_set_best_prob_rage, from Konstantin Khlebnikov. 3) Paging buffer memory leak in iwlwifi, from Matti Gottlieb. 4) Wrong units used to set initial TCP rto from cached metrics, also from Konstantin Khlebnikov. 5) Fix stale IP options data in the SKB control block from leaking through layers of encapsulation, from Bernie Harris. 6) Zero padding len miscalculated in bnxt_en, from Michael Chan. 7) Only CHECKSUM_PARTIAL packets should be passed down through GSO, fix from Hannes Frederic Sowa. 8) Fix suspend/resume with JME networking devices, from Diego Violat and Guo-Fu Tseng. 9) Checksums not validated properly in bridge multicast support due to the placement of the SKB header pointers at the time of the check, fix from Álvaro Fernández Rojas. 10) Fix hang/tiemout with r8169 if a stats fetch is done while the device is runtime suspended. From Chun-Hao Lin. 11) The forwarding database netlink dump facilities don't track the state of the dump properly, resulting in skipped/missed entries. From Minoura Makoto. 12) Fix regression from a recent 3c59x bug fix, from Neil Horman. 13) Fix list corruption in bna driver, from Ivan Vecera. 14) Big endian machines crash on vlan add in bnx2x, fix from Michal Schmidt. 15) Ethtool RSS configuration not propagated properly in mlx5 driver, from Tariq Toukan. 16) Fix regression in PHY probing in stmmac driver, from Gabriel Fernandez. 17) Fix SKB tailroom calculation in igmp/mld code, from Benjamin Poirier. 18) A past change to skip empty routing headers in ipv6 extention header parsing accidently caused fragment headers to not be matched any longer. Fix from Florian Westphal. 19) eTSEC-106 erratum needs to be applied to more gianfar chips, from Atsushi Nemoto. 20) Fix netdev reference after free via workqueues in usb networking drivers, from Oliver Neukum and Bjørn Mork. 21) mdio->irq is now an array rather than a pointer to dynamic memory, but several drivers were still trying to free it :-/ Fixes from Colin Ian King. 22) act_ipt iptables action forgets to set the family field, thus LOG netfilter targets don't work with it. Fix from Phil Sutter. 23) SKB leak in ibmveth when skb_linearize() fails, from Thomas Falcon. 24) pskb_may_pull() cannot be called with interrupts disabled, fix code that tries to do this in vmxnet3 driver, from Neil Horman. 25) be2net driver leaks iomap'd memory on removal, fix from Douglas Miller. 26) Forgotton RTNL mutex unlock in ppp_create_interface() error paths, from Guillaume Nault. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (97 commits) ppp: release rtnl mutex when interface creation fails cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind tcp: fix tcpi_segs_in after connection establishment net: hns: fix the bug about loopback jme: Fix device PM wakeup API usage jme: Do not enable NIC WoL functions on S0 udp6: fix UDP/IPv6 encap resubmit path be2net: Don't leak iomapped memory on removal. vmxnet3: avoid calling pskb_may_pull with interrupts disabled net: ethernet: Add missing MFD_SYSCON dependency on HAS_IOMEM ibmveth: check return of skb_linearize in ibmveth_start_xmit cdc_ncm: toggle altsetting to force reset before setup usbnet: cleanup after bind() in probe() mlxsw: pci: Correctly determine if descriptor queue is full mlxsw: spectrum: Always decrement bridge's ref count tipc: fix nullptr crash during subscription cancel net: eth: altera: do not free array priv->mdio->irq net/ethoc: do not free array priv->mdio->irq net: sched: fix act_ipt for LOG target asix: do not free array priv->mdio->irq ...
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 69c29050f14a..4d420bb27396 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -673,7 +673,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq,
673 struct tipc_sock *tsk = tipc_sk(sk); 673 struct tipc_sock *tsk = tipc_sk(sk);
674 struct net *net = sock_net(sk); 674 struct net *net = sock_net(sk);
675 struct tipc_msg *mhdr = &tsk->phdr; 675 struct tipc_msg *mhdr = &tsk->phdr;
676 struct sk_buff_head *pktchain = &sk->sk_write_queue; 676 struct sk_buff_head pktchain;
677 struct iov_iter save = msg->msg_iter; 677 struct iov_iter save = msg->msg_iter;
678 uint mtu; 678 uint mtu;
679 int rc; 679 int rc;
@@ -687,14 +687,16 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq,
687 msg_set_nameupper(mhdr, seq->upper); 687 msg_set_nameupper(mhdr, seq->upper);
688 msg_set_hdr_sz(mhdr, MCAST_H_SIZE); 688 msg_set_hdr_sz(mhdr, MCAST_H_SIZE);
689 689
690 skb_queue_head_init(&pktchain);
691
690new_mtu: 692new_mtu:
691 mtu = tipc_bcast_get_mtu(net); 693 mtu = tipc_bcast_get_mtu(net);
692 rc = tipc_msg_build(mhdr, msg, 0, dsz, mtu, pktchain); 694 rc = tipc_msg_build(mhdr, msg, 0, dsz, mtu, &pktchain);
693 if (unlikely(rc < 0)) 695 if (unlikely(rc < 0))
694 return rc; 696 return rc;
695 697
696 do { 698 do {
697 rc = tipc_bcast_xmit(net, pktchain); 699 rc = tipc_bcast_xmit(net, &pktchain);
698 if (likely(!rc)) 700 if (likely(!rc))
699 return dsz; 701 return dsz;
700 702
@@ -704,7 +706,7 @@ new_mtu:
704 if (!rc) 706 if (!rc)
705 continue; 707 continue;
706 } 708 }
707 __skb_queue_purge(pktchain); 709 __skb_queue_purge(&pktchain);
708 if (rc == -EMSGSIZE) { 710 if (rc == -EMSGSIZE) {
709 msg->msg_iter = save; 711 msg->msg_iter = save;
710 goto new_mtu; 712 goto new_mtu;
@@ -863,7 +865,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dsz)
863 struct net *net = sock_net(sk); 865 struct net *net = sock_net(sk);
864 struct tipc_msg *mhdr = &tsk->phdr; 866 struct tipc_msg *mhdr = &tsk->phdr;
865 u32 dnode, dport; 867 u32 dnode, dport;
866 struct sk_buff_head *pktchain = &sk->sk_write_queue; 868 struct sk_buff_head pktchain;
867 struct sk_buff *skb; 869 struct sk_buff *skb;
868 struct tipc_name_seq *seq; 870 struct tipc_name_seq *seq;
869 struct iov_iter save; 871 struct iov_iter save;
@@ -924,17 +926,18 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dsz)
924 msg_set_hdr_sz(mhdr, BASIC_H_SIZE); 926 msg_set_hdr_sz(mhdr, BASIC_H_SIZE);
925 } 927 }
926 928
929 skb_queue_head_init(&pktchain);
927 save = m->msg_iter; 930 save = m->msg_iter;
928new_mtu: 931new_mtu:
929 mtu = tipc_node_get_mtu(net, dnode, tsk->portid); 932 mtu = tipc_node_get_mtu(net, dnode, tsk->portid);
930 rc = tipc_msg_build(mhdr, m, 0, dsz, mtu, pktchain); 933 rc = tipc_msg_build(mhdr, m, 0, dsz, mtu, &pktchain);
931 if (rc < 0) 934 if (rc < 0)
932 return rc; 935 return rc;
933 936
934 do { 937 do {
935 skb = skb_peek(pktchain); 938 skb = skb_peek(&pktchain);
936 TIPC_SKB_CB(skb)->wakeup_pending = tsk->link_cong; 939 TIPC_SKB_CB(skb)->wakeup_pending = tsk->link_cong;
937 rc = tipc_node_xmit(net, pktchain, dnode, tsk->portid); 940 rc = tipc_node_xmit(net, &pktchain, dnode, tsk->portid);
938 if (likely(!rc)) { 941 if (likely(!rc)) {
939 if (sock->state != SS_READY) 942 if (sock->state != SS_READY)
940 sock->state = SS_CONNECTING; 943 sock->state = SS_CONNECTING;
@@ -946,7 +949,7 @@ new_mtu:
946 if (!rc) 949 if (!rc)
947 continue; 950 continue;
948 } 951 }
949 __skb_queue_purge(pktchain); 952 __skb_queue_purge(&pktchain);
950 if (rc == -EMSGSIZE) { 953 if (rc == -EMSGSIZE) {
951 m->msg_iter = save; 954 m->msg_iter = save;
952 goto new_mtu; 955 goto new_mtu;
@@ -1016,7 +1019,7 @@ static int __tipc_send_stream(struct socket *sock, struct msghdr *m, size_t dsz)
1016 struct net *net = sock_net(sk); 1019 struct net *net = sock_net(sk);
1017 struct tipc_sock *tsk = tipc_sk(sk); 1020 struct tipc_sock *tsk = tipc_sk(sk);
1018 struct tipc_msg *mhdr = &tsk->phdr; 1021 struct tipc_msg *mhdr = &tsk->phdr;
1019 struct sk_buff_head *pktchain = &sk->sk_write_queue; 1022 struct sk_buff_head pktchain;
1020 DECLARE_SOCKADDR(struct sockaddr_tipc *, dest, m->msg_name); 1023 DECLARE_SOCKADDR(struct sockaddr_tipc *, dest, m->msg_name);
1021 u32 portid = tsk->portid; 1024 u32 portid = tsk->portid;
1022 int rc = -EINVAL; 1025 int rc = -EINVAL;
@@ -1044,17 +1047,19 @@ static int __tipc_send_stream(struct socket *sock, struct msghdr *m, size_t dsz)
1044 1047
1045 timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT); 1048 timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT);
1046 dnode = tsk_peer_node(tsk); 1049 dnode = tsk_peer_node(tsk);
1050 skb_queue_head_init(&pktchain);
1047 1051
1048next: 1052next:
1049 save = m->msg_iter; 1053 save = m->msg_iter;
1050 mtu = tsk->max_pkt; 1054 mtu = tsk->max_pkt;
1051 send = min_t(uint, dsz - sent, TIPC_MAX_USER_MSG_SIZE); 1055 send = min_t(uint, dsz - sent, TIPC_MAX_USER_MSG_SIZE);
1052 rc = tipc_msg_build(mhdr, m, sent, send, mtu, pktchain); 1056 rc = tipc_msg_build(mhdr, m, sent, send, mtu, &pktchain);
1053 if (unlikely(rc < 0)) 1057 if (unlikely(rc < 0))
1054 return rc; 1058 return rc;
1059
1055 do { 1060 do {
1056 if (likely(!tsk_conn_cong(tsk))) { 1061 if (likely(!tsk_conn_cong(tsk))) {
1057 rc = tipc_node_xmit(net, pktchain, dnode, portid); 1062 rc = tipc_node_xmit(net, &pktchain, dnode, portid);
1058 if (likely(!rc)) { 1063 if (likely(!rc)) {
1059 tsk->sent_unacked++; 1064 tsk->sent_unacked++;
1060 sent += send; 1065 sent += send;
@@ -1063,7 +1068,7 @@ next:
1063 goto next; 1068 goto next;
1064 } 1069 }
1065 if (rc == -EMSGSIZE) { 1070 if (rc == -EMSGSIZE) {
1066 __skb_queue_purge(pktchain); 1071 __skb_queue_purge(&pktchain);
1067 tsk->max_pkt = tipc_node_get_mtu(net, dnode, 1072 tsk->max_pkt = tipc_node_get_mtu(net, dnode,
1068 portid); 1073 portid);
1069 m->msg_iter = save; 1074 m->msg_iter = save;
@@ -1077,7 +1082,7 @@ next:
1077 rc = tipc_wait_for_sndpkt(sock, &timeo); 1082 rc = tipc_wait_for_sndpkt(sock, &timeo);
1078 } while (!rc); 1083 } while (!rc);
1079 1084
1080 __skb_queue_purge(pktchain); 1085 __skb_queue_purge(&pktchain);
1081 return sent ? sent : rc; 1086 return sent ? sent : rc;
1082} 1087}
1083 1088