Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:

1) Fix divide by zero in mlx5, from Talut Batheesh.

2) Guard against invalid GSO packets coming from untrusted guests and
arriving in qdisc_pkt_len_init(), from Eric Dumazet.

3) Similarly add such protection to the various protocol GSO handlers.
From Willem de Bruijn.

4) Fix regression added to IGMP source address checking for IGMPv3
reports, from Felix Feitkau.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
tls: Correct length of scatterlist in tls_sw_sendpage
be2net: restore properly promisc mode after queues reconfiguration
net: igmp: fix source address check for IGMPv3 reports
gso: validate gso_type in GSO handlers
net: qdisc_pkt_len_init() should be more robust
ibmvnic: Allocate and request vpd in init_resources
ibmvnic: Revert to previous mtu when unsupported value requested
ibmvnic: Modify buffer size and number of queues on failover
rds: tcp: compute m_ack_seq as offset from ->write_seq
usbnet: silence an unnecessary warning
cxgb4: fix endianness for vlan value in cxgb4_tc_flower
cxgb4: set filter type to 1 for ETH_P_IPV6
net/mlx5e: Fix fixpoint divide exception in mlx5e_am_stats_compare

+128 -32
+5 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
··· 111 111 ethtype_mask = 0; 112 112 } 113 113 114 + if (ethtype_key == ETH_P_IPV6) 115 + fs->type = 1; 116 + 114 117 fs->val.ethtype = ethtype_key; 115 118 fs->mask.ethtype = ethtype_mask; 116 119 fs->val.proto = key->ip_proto; ··· 208 205 VLAN_PRIO_SHIFT); 209 206 vlan_tci_mask = mask->vlan_id | (mask->vlan_priority << 210 207 VLAN_PRIO_SHIFT); 211 - fs->val.ivlan = cpu_to_be16(vlan_tci); 212 - fs->mask.ivlan = cpu_to_be16(vlan_tci_mask); 208 + fs->val.ivlan = vlan_tci; 209 + fs->mask.ivlan = vlan_tci_mask; 213 210 214 211 /* Chelsio adapters use ivlan_vld bit to match vlan packets 215 212 * as 802.1Q. Also, when vlan tag is present in packets,
+9
drivers/net/ethernet/emulex/benet/be_main.c
··· 4634 4634 4635 4635 be_schedule_worker(adapter); 4636 4636 4637 + /* 4638 + * The IF was destroyed and re-created. We need to clear 4639 + * all promiscuous flags valid for the destroyed IF. 4640 + * Without this promisc mode is not restored during 4641 + * be_open() because the driver thinks that it is 4642 + * already enabled in HW. 4643 + */ 4644 + adapter->if_flags &= ~BE_IF_FLAGS_ALL_PROMISCUOUS; 4645 + 4637 4646 if (netif_running(netdev)) 4638 4647 status = be_open(netdev); 4639 4648
+58 -15
drivers/net/ethernet/ibm/ibmvnic.c
··· 410 410 struct ibmvnic_rx_pool *rx_pool; 411 411 int rx_scrqs; 412 412 int i, j, rc; 413 + u64 *size_array; 414 + 415 + size_array = (u64 *)((u8 *)(adapter->login_rsp_buf) + 416 + be32_to_cpu(adapter->login_rsp_buf->off_rxadd_buff_size)); 413 417 414 418 rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs); 415 419 for (i = 0; i < rx_scrqs; i++) { ··· 421 417 422 418 netdev_dbg(adapter->netdev, "Re-setting rx_pool[%d]\n", i); 423 419 424 - rc = reset_long_term_buff(adapter, &rx_pool->long_term_buff); 420 + if (rx_pool->buff_size != be64_to_cpu(size_array[i])) { 421 + free_long_term_buff(adapter, &rx_pool->long_term_buff); 422 + rx_pool->buff_size = be64_to_cpu(size_array[i]); 423 + alloc_long_term_buff(adapter, &rx_pool->long_term_buff, 424 + rx_pool->size * 425 + rx_pool->buff_size); 426 + } else { 427 + rc = reset_long_term_buff(adapter, 428 + &rx_pool->long_term_buff); 429 + } 430 + 425 431 if (rc) 426 432 return rc; 427 433 ··· 453 439 static void release_rx_pools(struct ibmvnic_adapter *adapter) 454 440 { 455 441 struct ibmvnic_rx_pool *rx_pool; 456 - int rx_scrqs; 457 442 int i, j; 458 443 459 444 if (!adapter->rx_pool) 460 445 return; 461 446 462 - rx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_rxadd_subcrqs); 463 - for (i = 0; i < rx_scrqs; i++) { 447 + for (i = 0; i < adapter->num_active_rx_pools; i++) { 464 448 rx_pool = &adapter->rx_pool[i]; 465 449 466 450 netdev_dbg(adapter->netdev, "Releasing rx_pool[%d]\n", i); ··· 481 469 482 470 kfree(adapter->rx_pool); 483 471 adapter->rx_pool = NULL; 472 + adapter->num_active_rx_pools = 0; 484 473 } 485 474 486 475 static int init_rx_pools(struct net_device *netdev) ··· 505 492 dev_err(dev, "Failed to allocate rx pools\n"); 506 493 return -1; 507 494 } 495 + 496 + adapter->num_active_rx_pools = 0; 508 497 509 498 for (i = 0; i < rxadd_subcrqs; i++) { 510 499 rx_pool = &adapter->rx_pool[i]; ··· 550 535 rx_pool->next_alloc = 0; 551 536 rx_pool->next_free = 0; 552 537 } 538 + 539 + adapter->num_active_rx_pools = rxadd_subcrqs; 553 540 554 541 return 0; 555 542 } ··· 603 586 static void release_tx_pools(struct ibmvnic_adapter *adapter) 604 587 { 605 588 struct ibmvnic_tx_pool *tx_pool; 606 - int i, tx_scrqs; 589 + int i; 607 590 608 591 if (!adapter->tx_pool) 609 592 return; 610 593 611 - tx_scrqs = be32_to_cpu(adapter->login_rsp_buf->num_txsubm_subcrqs); 612 - for (i = 0; i < tx_scrqs; i++) { 594 + for (i = 0; i < adapter->num_active_tx_pools; i++) { 613 595 netdev_dbg(adapter->netdev, "Releasing tx_pool[%d]\n", i); 614 596 tx_pool = &adapter->tx_pool[i]; 615 597 kfree(tx_pool->tx_buff); ··· 619 603 620 604 kfree(adapter->tx_pool); 621 605 adapter->tx_pool = NULL; 606 + adapter->num_active_tx_pools = 0; 622 607 } 623 608 624 609 static int init_tx_pools(struct net_device *netdev) ··· 635 618 sizeof(struct ibmvnic_tx_pool), GFP_KERNEL); 636 619 if (!adapter->tx_pool) 637 620 return -1; 621 + 622 + adapter->num_active_tx_pools = 0; 638 623 639 624 for (i = 0; i < tx_subcrqs; i++) { 640 625 tx_pool = &adapter->tx_pool[i]; ··· 684 665 tx_pool->consumer_index = 0; 685 666 tx_pool->producer_index = 0; 686 667 } 668 + 669 + adapter->num_active_tx_pools = tx_subcrqs; 687 670 688 671 return 0; 689 672 } ··· 881 860 if (adapter->vpd->buff) 882 861 len = adapter->vpd->len; 883 862 884 - reinit_completion(&adapter->fw_done); 863 + init_completion(&adapter->fw_done); 885 864 crq.get_vpd_size.first = IBMVNIC_CRQ_CMD; 886 865 crq.get_vpd_size.cmd = GET_VPD_SIZE; 887 866 ibmvnic_send_crq(adapter, &crq); ··· 942 921 adapter->vpd = kzalloc(sizeof(*adapter->vpd), GFP_KERNEL); 943 922 if (!adapter->vpd) 944 923 return -ENOMEM; 924 + 925 + /* Vital Product Data (VPD) */ 926 + rc = ibmvnic_get_vpd(adapter); 927 + if (rc) { 928 + netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n"); 929 + return rc; 930 + } 945 931 946 932 adapter->map_id = 1; 947 933 adapter->napi = kcalloc(adapter->req_rx_queues, ··· 1023 995 static int ibmvnic_open(struct net_device *netdev) 1024 996 { 1025 997 struct ibmvnic_adapter *adapter = netdev_priv(netdev); 1026 - int rc, vpd; 998 + int rc; 1027 999 1028 1000 mutex_lock(&adapter->reset_lock); 1029 1001 ··· 1045 1017 1046 1018 rc = __ibmvnic_open(netdev); 1047 1019 netif_carrier_on(netdev); 1048 - 1049 - /* Vital Product Data (VPD) */ 1050 - vpd = ibmvnic_get_vpd(adapter); 1051 - if (vpd) 1052 - netdev_err(netdev, "failed to initialize Vital Product Data (VPD)\n"); 1053 1020 1054 1021 mutex_unlock(&adapter->reset_lock); 1055 1022 ··· 1571 1548 static int do_reset(struct ibmvnic_adapter *adapter, 1572 1549 struct ibmvnic_rwi *rwi, u32 reset_state) 1573 1550 { 1551 + u64 old_num_rx_queues, old_num_tx_queues; 1574 1552 struct net_device *netdev = adapter->netdev; 1575 1553 int i, rc; 1576 1554 ··· 1580 1556 1581 1557 netif_carrier_off(netdev); 1582 1558 adapter->reset_reason = rwi->reset_reason; 1559 + 1560 + old_num_rx_queues = adapter->req_rx_queues; 1561 + old_num_tx_queues = adapter->req_tx_queues; 1583 1562 1584 1563 if (rwi->reset_reason == VNIC_RESET_MOBILITY) { 1585 1564 rc = ibmvnic_reenable_crq_queue(adapter); ··· 1628 1601 rc = init_resources(adapter); 1629 1602 if (rc) 1630 1603 return rc; 1604 + } else if (adapter->req_rx_queues != old_num_rx_queues || 1605 + adapter->req_tx_queues != old_num_tx_queues) { 1606 + release_rx_pools(adapter); 1607 + release_tx_pools(adapter); 1608 + init_rx_pools(netdev); 1609 + init_tx_pools(netdev); 1631 1610 } else { 1632 1611 rc = reset_tx_pools(adapter); 1633 1612 if (rc) ··· 3625 3592 *req_value, 3626 3593 (long int)be64_to_cpu(crq->request_capability_rsp. 3627 3594 number), name); 3628 - *req_value = be64_to_cpu(crq->request_capability_rsp.number); 3595 + 3596 + if (be16_to_cpu(crq->request_capability_rsp.capability) == 3597 + REQ_MTU) { 3598 + pr_err("mtu of %llu is not supported. Reverting.\n", 3599 + *req_value); 3600 + *req_value = adapter->fallback.mtu; 3601 + } else { 3602 + *req_value = 3603 + be64_to_cpu(crq->request_capability_rsp.number); 3604 + } 3605 + 3629 3606 ibmvnic_send_req_caps(adapter, 1); 3630 3607 return; 3631 3608 default:
+2
drivers/net/ethernet/ibm/ibmvnic.h
··· 1091 1091 u64 opt_rxba_entries_per_subcrq; 1092 1092 __be64 tx_rx_desc_req; 1093 1093 u8 map_id; 1094 + u64 num_active_rx_pools; 1095 + u64 num_active_tx_pools; 1094 1096 1095 1097 struct tasklet_struct tasklet; 1096 1098 enum vnic_state state;
+6
drivers/net/ethernet/mellanox/mlx5/core/en_rx_am.c
··· 201 201 return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER : 202 202 MLX5E_AM_STATS_WORSE; 203 203 204 + if (!prev->ppms) 205 + return curr->ppms ? MLX5E_AM_STATS_BETTER : 206 + MLX5E_AM_STATS_SAME; 207 + 204 208 if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms)) 205 209 return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER : 206 210 MLX5E_AM_STATS_WORSE; 211 + if (!prev->epms) 212 + return MLX5E_AM_STATS_SAME; 207 213 208 214 if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms)) 209 215 return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
+3 -5
drivers/net/usb/usbnet.c
··· 457 457 void usbnet_defer_kevent (struct usbnet *dev, int work) 458 458 { 459 459 set_bit (work, &dev->flags); 460 - if (!schedule_work (&dev->kevent)) { 461 - if (net_ratelimit()) 462 - netdev_err(dev->net, "kevent %d may have been dropped\n", work); 463 - } else { 460 + if (!schedule_work (&dev->kevent)) 461 + netdev_dbg(dev->net, "kevent %d may have been dropped\n", work); 462 + else 464 463 netdev_dbg(dev->net, "kevent %d scheduled\n", work); 465 - } 466 464 } 467 465 EXPORT_SYMBOL_GPL(usbnet_defer_kevent); 468 466
+15 -4
net/core/dev.c
··· 3151 3151 hdr_len = skb_transport_header(skb) - skb_mac_header(skb); 3152 3152 3153 3153 /* + transport layer */ 3154 - if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) 3155 - hdr_len += tcp_hdrlen(skb); 3156 - else 3157 - hdr_len += sizeof(struct udphdr); 3154 + if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) { 3155 + const struct tcphdr *th; 3156 + struct tcphdr _tcphdr; 3157 + 3158 + th = skb_header_pointer(skb, skb_transport_offset(skb), 3159 + sizeof(_tcphdr), &_tcphdr); 3160 + if (likely(th)) 3161 + hdr_len += __tcp_hdrlen(th); 3162 + } else { 3163 + struct udphdr _udphdr; 3164 + 3165 + if (skb_header_pointer(skb, skb_transport_offset(skb), 3166 + sizeof(_udphdr), &_udphdr)) 3167 + hdr_len += sizeof(struct udphdr); 3168 + } 3158 3169 3159 3170 if (shinfo->gso_type & SKB_GSO_DODGY) 3160 3171 gso_segs = DIV_ROUND_UP(skb->len - hdr_len,
+3
net/ipv4/esp4_offload.c
··· 122 122 if (!xo) 123 123 goto out; 124 124 125 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) 126 + goto out; 127 + 125 128 seq = xo->seq.low; 126 129 127 130 x = skb->sp->xvec[skb->sp->len - 1];
+1 -1
net/ipv4/igmp.c
··· 332 332 return htonl(INADDR_ANY); 333 333 334 334 for_ifa(in_dev) { 335 - if (inet_ifa_match(fl4->saddr, ifa)) 335 + if (fl4->saddr == ifa->ifa_local) 336 336 return fl4->saddr; 337 337 } endfor_ifa(in_dev); 338 338
+3
net/ipv4/tcp_offload.c
··· 32 32 static struct sk_buff *tcp4_gso_segment(struct sk_buff *skb, 33 33 netdev_features_t features) 34 34 { 35 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)) 36 + return ERR_PTR(-EINVAL); 37 + 35 38 if (!pskb_may_pull(skb, sizeof(struct tcphdr))) 36 39 return ERR_PTR(-EINVAL); 37 40
+3
net/ipv4/udp_offload.c
··· 203 203 goto out; 204 204 } 205 205 206 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP)) 207 + goto out; 208 + 206 209 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 207 210 goto out; 208 211
+3
net/ipv6/esp6_offload.c
··· 149 149 if (!xo) 150 150 goto out; 151 151 152 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_ESP)) 153 + goto out; 154 + 152 155 seq = xo->seq.low; 153 156 154 157 x = skb->sp->xvec[skb->sp->len - 1];
+3
net/ipv6/tcpv6_offload.c
··· 46 46 { 47 47 struct tcphdr *th; 48 48 49 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) 50 + return ERR_PTR(-EINVAL); 51 + 49 52 if (!pskb_may_pull(skb, sizeof(*th))) 50 53 return ERR_PTR(-EINVAL); 51 54
+3
net/ipv6/udp_offload.c
··· 42 42 const struct ipv6hdr *ipv6h; 43 43 struct udphdr *uh; 44 44 45 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP)) 46 + goto out; 47 + 45 48 if (!pskb_may_pull(skb, sizeof(struct udphdr))) 46 49 goto out; 47 50
+3 -2
net/rds/tcp.c
··· 90 90 sizeof(val)); 91 91 } 92 92 93 - u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc) 93 + u32 rds_tcp_write_seq(struct rds_tcp_connection *tc) 94 94 { 95 - return tcp_sk(tc->t_sock->sk)->snd_nxt; 95 + /* seq# of the last byte of data in tcp send buffer */ 96 + return tcp_sk(tc->t_sock->sk)->write_seq; 96 97 } 97 98 98 99 u32 rds_tcp_snd_una(struct rds_tcp_connection *tc)
+1 -1
net/rds/tcp.h
··· 54 54 void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp); 55 55 void rds_tcp_restore_callbacks(struct socket *sock, 56 56 struct rds_tcp_connection *tc); 57 - u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc); 57 + u32 rds_tcp_write_seq(struct rds_tcp_connection *tc); 58 58 u32 rds_tcp_snd_una(struct rds_tcp_connection *tc); 59 59 u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq); 60 60 extern struct rds_transport rds_tcp_transport;
+2 -2
net/rds/tcp_send.c
··· 86 86 * m_ack_seq is set to the sequence number of the last byte of 87 87 * header and data. see rds_tcp_is_acked(). 88 88 */ 89 - tc->t_last_sent_nxt = rds_tcp_snd_nxt(tc); 89 + tc->t_last_sent_nxt = rds_tcp_write_seq(tc); 90 90 rm->m_ack_seq = tc->t_last_sent_nxt + 91 91 sizeof(struct rds_header) + 92 92 be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1; ··· 98 98 rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED; 99 99 100 100 rdsdebug("rm %p tcp nxt %u ack_seq %llu\n", 101 - rm, rds_tcp_snd_nxt(tc), 101 + rm, rds_tcp_write_seq(tc), 102 102 (unsigned long long)rm->m_ack_seq); 103 103 } 104 104
+3
net/sctp/offload.c
··· 45 45 struct sk_buff *segs = ERR_PTR(-EINVAL); 46 46 struct sctphdr *sh; 47 47 48 + if (!(skb_shinfo(skb)->gso_type & SKB_GSO_SCTP)) 49 + goto out; 50 + 48 51 sh = sctp_hdr(skb); 49 52 if (!pskb_may_pull(skb, sizeof(*sh))) 50 53 goto out;
+2
net/tls/tls_sw.c
··· 577 577 get_page(page); 578 578 sg = ctx->sg_plaintext_data + ctx->sg_plaintext_num_elem; 579 579 sg_set_page(sg, page, copy, offset); 580 + sg_unmark_end(sg); 581 + 580 582 ctx->sg_plaintext_num_elem++; 581 583 582 584 sk_mem_charge(sk, copy);