]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - drivers/net/hyperv/netvsc.c
hv_netvsc: fix a race between netvsc_send() and netvsc_init_buf()
[thirdparty/kernel/stable.git] / drivers / net / hyperv / netvsc.c
index 720b5fa9e6254463ce0dde094d6b71afd7e7684d..e2bfaac1801dedc698a83657a0f1f5fdcddefca0 100644 (file)
@@ -888,6 +888,13 @@ int netvsc_send(struct hv_device *device,
        if (!net_device)
                return -ENODEV;
 
+       /* We may race with netvsc_connect_vsp()/netvsc_init_buf() and get
+        * here before the negotiation with the host is finished and
+        * send_section_map may not be allocated yet.
+        */
+       if (!net_device->send_section_map)
+               return -EAGAIN;
+
        out_channel = net_device->chn_table[q_idx];
 
        packet->send_buf_index = NETVSC_INVALID_INDEX;