summaryrefslogtreecommitdiffstats
path: root/net/vmw_vsock
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-06-22 01:23:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-06-22 01:23:35 -0400
commitc356dc4b540edd6c02b409dd8cf3208ba2804c38 (patch)
tree457d971da033bfb11c85aaee260d9811937fa2c4 /net/vmw_vsock
parent121bddf39a8e39baf0df9ef1d688392c179935cd (diff)
parentb6653b3629e5b88202be3c9abc44713973f5c4b4 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix leak of unqueued fragments in ipv6 nf_defrag, from Guillaume Nault. 2) Don't access the DDM interface unless the transceiver implements it in bnx2x, from Mauro S. M. Rodrigues. 3) Don't double fetch 'len' from userspace in sock_getsockopt(), from JingYi Hou. 4) Sign extension overflow in lio_core, from Colin Ian King. 5) Various netem bug fixes wrt. corrupted packets from Jakub Kicinski. 6) Fix epollout hang in hvsock, from Sunil Muthuswamy. 7) Fix regression in default fib6_type, from David Ahern. 8) Handle memory limits in tcp_fragment more appropriately, from Eric Dumazet. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (24 commits) tcp: refine memory limit test in tcp_fragment() inet: clear num_timeout reqsk_alloc() net: mvpp2: debugfs: Add pmap to fs dump ipv6: Default fib6_type to RTN_UNICAST when not set net: hns3: Fix inconsistent indenting net/af_iucv: always register net_device notifier net/af_iucv: build proper skbs for HiperTransport net/af_iucv: remove GFP_DMA restriction for HiperTransport net: dsa: mv88e6xxx: fix shift of FID bits in mv88e6185_g1_vtu_loadpurge() hvsock: fix epollout hang from race condition net/udp_gso: Allow TX timestamp with UDP GSO net: netem: fix use after free and double free with packet corruption net: netem: fix backlog accounting for corrupted GSO frames net: lio_core: fix potential sign-extension overflow on large shift tipc: pass tunnel dev as NULL to udp_tunnel(6)_xmit_skb ip6_tunnel: allow not to count pkts on tstats by passing dev as NULL ip_tunnel: allow not to count pkts on tstats by setting skb's dev to NULL tun: wake up waitqueues after IFF_UP is set net: remove duplicate fetch in sock_getsockopt tipc: fix issues with early FAILOVER_MSG from peer ...
Diffstat (limited to 'net/vmw_vsock')
-rw-r--r--net/vmw_vsock/hyperv_transport.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/net/vmw_vsock/hyperv_transport.c b/net/vmw_vsock/hyperv_transport.c
index fb2df6e068fa..62dcdf082349 100644
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -211,18 +211,6 @@ static void hvs_set_channel_pending_send_size(struct vmbus_channel *chan)
211 set_channel_pending_send_size(chan, 211 set_channel_pending_send_size(chan,
212 HVS_PKT_LEN(HVS_SEND_BUF_SIZE)); 212 HVS_PKT_LEN(HVS_SEND_BUF_SIZE));
213 213
214 /* See hvs_stream_has_space(): we must make sure the host has seen
215 * the new pending send size, before we can re-check the writable
216 * bytes.
217 */
218 virt_mb();
219}
220
221static void hvs_clear_channel_pending_send_size(struct vmbus_channel *chan)
222{
223 set_channel_pending_send_size(chan, 0);
224
225 /* Ditto */
226 virt_mb(); 214 virt_mb();
227} 215}
228 216
@@ -292,9 +280,6 @@ static void hvs_channel_cb(void *ctx)
292 if (hvs_channel_readable(chan)) 280 if (hvs_channel_readable(chan))
293 sk->sk_data_ready(sk); 281 sk->sk_data_ready(sk);
294 282
295 /* See hvs_stream_has_space(): when we reach here, the writable bytes
296 * may be already less than HVS_PKT_LEN(HVS_SEND_BUF_SIZE).
297 */
298 if (hv_get_bytes_to_write(&chan->outbound) > 0) 283 if (hv_get_bytes_to_write(&chan->outbound) > 0)
299 sk->sk_write_space(sk); 284 sk->sk_write_space(sk);
300} 285}
@@ -395,6 +380,13 @@ static void hvs_open_connection(struct vmbus_channel *chan)
395 set_per_channel_state(chan, conn_from_host ? new : sk); 380 set_per_channel_state(chan, conn_from_host ? new : sk);
396 vmbus_set_chn_rescind_callback(chan, hvs_close_connection); 381 vmbus_set_chn_rescind_callback(chan, hvs_close_connection);
397 382
383 /* Set the pending send size to max packet size to always get
384 * notifications from the host when there is enough writable space.
385 * The host is optimized to send notifications only when the pending
386 * size boundary is crossed, and not always.
387 */
388 hvs_set_channel_pending_send_size(chan);
389
398 if (conn_from_host) { 390 if (conn_from_host) {
399 new->sk_state = TCP_ESTABLISHED; 391 new->sk_state = TCP_ESTABLISHED;
400 sk->sk_ack_backlog++; 392 sk->sk_ack_backlog++;
@@ -688,23 +680,8 @@ static s64 hvs_stream_has_data(struct vsock_sock *vsk)
688static s64 hvs_stream_has_space(struct vsock_sock *vsk) 680static s64 hvs_stream_has_space(struct vsock_sock *vsk)
689{ 681{
690 struct hvsock *hvs = vsk->trans; 682 struct hvsock *hvs = vsk->trans;
691 struct vmbus_channel *chan = hvs->chan;
692 s64 ret;
693
694 ret = hvs_channel_writable_bytes(chan);
695 if (ret > 0) {
696 hvs_clear_channel_pending_send_size(chan);
697 } else {
698 /* See hvs_channel_cb() */
699 hvs_set_channel_pending_send_size(chan);
700
701 /* Re-check the writable bytes to avoid race */
702 ret = hvs_channel_writable_bytes(chan);
703 if (ret > 0)
704 hvs_clear_channel_pending_send_size(chan);
705 }
706 683
707 return ret; 684 return hvs_channel_writable_bytes(hvs->chan);
708} 685}
709 686
710static u64 hvs_stream_rcvhiwat(struct vsock_sock *vsk) 687static u64 hvs_stream_rcvhiwat(struct vsock_sock *vsk)