Skip to content

Commit 050cdc6

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) ICE, E1000, IGB, IXGBE, and I40E bug fixes from the Intel folks. 2) Better fix for AB-BA deadlock in packet scheduler code, from Cong Wang. 3) bpf sockmap fixes (zero sized key handling, etc.) from Daniel Borkmann. 4) Send zero IPID in TCP resets and SYN-RECV state ACKs, to prevent attackers using it as a side-channel. From Eric Dumazet. 5) Memory leak in mediatek bluetooth driver, from Gustavo A. R. Silva. 6) Hook up rt->dst.input of ipv6 anycast routes properly, from Hangbin Liu. 7) hns and hns3 bug fixes from Huazhong Tan. 8) Fix RIF leak in mlxsw driver, from Ido Schimmel. 9) iova range check fix in vhost, from Jason Wang. 10) Fix hang in do_tcp_sendpages() with tls, from John Fastabend. 11) More r8152 chips need to disable RX aggregation, from Kai-Heng Feng. 12) Memory exposure in TCA_U32_SEL handling, from Kees Cook. 13) TCP BBR congestion control fixes from Kevin Yang. 14) hv_netvsc, ignore non-PCI devices, from Stephen Hemminger. 15) qed driver fixes from Tomer Tayar. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (77 commits) net: sched: Fix memory exposure from short TCA_U32_SEL qed: fix spelling mistake "comparsion" -> "comparison" vhost: correctly check the iova range when waking virtqueue qlge: Fix netdev features configuration. net: macb: do not disable MDIO bus at open/close time Revert "net: stmmac: fix build failure due to missing COMMON_CLK dependency" net: macb: Fix regression breaking non-MDIO fixed-link PHYs mlxsw: spectrum_switchdev: Do not leak RIFs when removing bridge i40e: fix condition of WARN_ONCE for stat strings i40e: Fix for Tx timeouts when interface is brought up if DCB is enabled ixgbe: fix driver behaviour after issuing VFLR ixgbe: Prevent unsupported configurations with XDP ixgbe: Replace GFP_ATOMIC with GFP_KERNEL igb: Replace mdelay() with msleep() in igb_integrated_phy_loopback() igb: Replace GFP_ATOMIC with GFP_KERNEL in igb_sw_init() igb: Use an advanced ctx descriptor for launchtime e1000: ensure to free old tx/rx rings in set_ringparam() e1000: check on netif_running() before calling e1000_up() ixgb: use dma_zalloc_coherent instead of allocator/memset ice: Trivial formatting fixes ...
2 parents 908946c + 98c8f12 commit 050cdc6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+754
-711
lines changed

drivers/bluetooth/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ config BT_HCIUART_RTL
200200
depends on BT_HCIUART
201201
depends on BT_HCIUART_SERDEV
202202
depends on GPIOLIB
203+
depends on ACPI
203204
select BT_HCIUART_3WIRE
204205
select BT_RTL
205206
help

drivers/bluetooth/btmtkuart.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ static int mtk_setup_fw(struct hci_dev *hdev)
144144
fw_size = fw->size;
145145

146146
/* The size of patch header is 30 bytes, should be skip */
147-
if (fw_size < 30)
148-
return -EINVAL;
147+
if (fw_size < 30) {
148+
err = -EINVAL;
149+
goto free_fw;
150+
}
149151

150152
fw_size -= 30;
151153
fw_ptr += 30;
@@ -172,8 +174,8 @@ static int mtk_setup_fw(struct hci_dev *hdev)
172174
fw_ptr += dlen;
173175
}
174176

177+
free_fw:
175178
release_firmware(fw);
176-
177179
return err;
178180
}
179181

drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@ static int bnxt_tc_parse_actions(struct bnxt *bp,
110110
struct tcf_exts *tc_exts)
111111
{
112112
const struct tc_action *tc_act;
113-
LIST_HEAD(tc_actions);
114-
int rc;
113+
int i, rc;
115114

116115
if (!tcf_exts_has_actions(tc_exts)) {
117116
netdev_info(bp->dev, "no actions");
118117
return -EINVAL;
119118
}
120119

121-
tcf_exts_to_list(tc_exts, &tc_actions);
122-
list_for_each_entry(tc_act, &tc_actions, list) {
120+
tcf_exts_for_each_action(i, tc_act, tc_exts) {
123121
/* Drop action */
124122
if (is_tcf_gact_shot(tc_act)) {
125123
actions->flags |= BNXT_TC_ACTION_FLAG_DROP;

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,6 @@ static int macb_mii_probe(struct net_device *dev)
482482

483483
if (np) {
484484
if (of_phy_is_fixed_link(np)) {
485-
if (of_phy_register_fixed_link(np) < 0) {
486-
dev_err(&bp->pdev->dev,
487-
"broken fixed-link specification\n");
488-
return -ENODEV;
489-
}
490485
bp->phy_node = of_node_get(np);
491486
} else {
492487
bp->phy_node = of_parse_phandle(np, "phy-handle", 0);
@@ -569,7 +564,7 @@ static int macb_mii_init(struct macb *bp)
569564
{
570565
struct macb_platform_data *pdata;
571566
struct device_node *np;
572-
int err;
567+
int err = -ENXIO;
573568

574569
/* Enable management port */
575570
macb_writel(bp, NCR, MACB_BIT(MPE));
@@ -592,12 +587,23 @@ static int macb_mii_init(struct macb *bp)
592587
dev_set_drvdata(&bp->dev->dev, bp->mii_bus);
593588

594589
np = bp->pdev->dev.of_node;
595-
if (pdata)
596-
bp->mii_bus->phy_mask = pdata->phy_mask;
590+
if (np && of_phy_is_fixed_link(np)) {
591+
if (of_phy_register_fixed_link(np) < 0) {
592+
dev_err(&bp->pdev->dev,
593+
"broken fixed-link specification %pOF\n", np);
594+
goto err_out_free_mdiobus;
595+
}
596+
597+
err = mdiobus_register(bp->mii_bus);
598+
} else {
599+
if (pdata)
600+
bp->mii_bus->phy_mask = pdata->phy_mask;
601+
602+
err = of_mdiobus_register(bp->mii_bus, np);
603+
}
597604

598-
err = of_mdiobus_register(bp->mii_bus, np);
599605
if (err)
600-
goto err_out_free_mdiobus;
606+
goto err_out_free_fixed_link;
601607

602608
err = macb_mii_probe(bp->dev);
603609
if (err)
@@ -607,6 +613,7 @@ static int macb_mii_init(struct macb *bp)
607613

608614
err_out_unregister_bus:
609615
mdiobus_unregister(bp->mii_bus);
616+
err_out_free_fixed_link:
610617
if (np && of_phy_is_fixed_link(np))
611618
of_phy_deregister_fixed_link(np);
612619
err_out_free_mdiobus:
@@ -2028,14 +2035,17 @@ static void macb_reset_hw(struct macb *bp)
20282035
{
20292036
struct macb_queue *queue;
20302037
unsigned int q;
2038+
u32 ctrl = macb_readl(bp, NCR);
20312039

20322040
/* Disable RX and TX (XXX: Should we halt the transmission
20332041
* more gracefully?)
20342042
*/
2035-
macb_writel(bp, NCR, 0);
2043+
ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
20362044

20372045
/* Clear the stats registers (XXX: Update stats first?) */
2038-
macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
2046+
ctrl |= MACB_BIT(CLRSTAT);
2047+
2048+
macb_writel(bp, NCR, ctrl);
20392049

20402050
/* Clear all status flags */
20412051
macb_writel(bp, TSR, -1);
@@ -2223,7 +2233,7 @@ static void macb_init_hw(struct macb *bp)
22232233
}
22242234

22252235
/* Enable TX and RX */
2226-
macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
2236+
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
22272237
}
22282238

22292239
/* The hash address register is 64 bits long and takes up two

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,9 @@ static void cxgb4_process_flow_actions(struct net_device *in,
417417
struct ch_filter_specification *fs)
418418
{
419419
const struct tc_action *a;
420-
LIST_HEAD(actions);
420+
int i;
421421

422-
tcf_exts_to_list(cls->exts, &actions);
423-
list_for_each_entry(a, &actions, list) {
422+
tcf_exts_for_each_action(i, a, cls->exts) {
424423
if (is_tcf_gact_ok(a)) {
425424
fs->action = FILTER_PASS;
426425
} else if (is_tcf_gact_shot(a)) {
@@ -591,10 +590,9 @@ static int cxgb4_validate_flow_actions(struct net_device *dev,
591590
bool act_redir = false;
592591
bool act_pedit = false;
593592
bool act_vlan = false;
594-
LIST_HEAD(actions);
593+
int i;
595594

596-
tcf_exts_to_list(cls->exts, &actions);
597-
list_for_each_entry(a, &actions, list) {
595+
tcf_exts_for_each_action(i, a, cls->exts) {
598596
if (is_tcf_gact_ok(a)) {
599597
/* Do nothing */
600598
} else if (is_tcf_gact_shot(a)) {

drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@ static int fill_action_fields(struct adapter *adap,
9393
unsigned int num_actions = 0;
9494
const struct tc_action *a;
9595
struct tcf_exts *exts;
96-
LIST_HEAD(actions);
96+
int i;
9797

9898
exts = cls->knode.exts;
9999
if (!tcf_exts_has_actions(exts))
100100
return -EINVAL;
101101

102-
tcf_exts_to_list(exts, &actions);
103-
list_for_each_entry(a, &actions, list) {
102+
tcf_exts_for_each_action(i, a, exts) {
104103
/* Don't allow more than one action per rule. */
105104
if (num_actions)
106105
return -EINVAL;

drivers/net/ethernet/hisilicon/hns/hnae.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ struct hnae_desc_cb {
220220

221221
/* priv data for the desc, e.g. skb when use with ip stack*/
222222
void *priv;
223-
u16 page_offset;
224-
u16 reuse_flag;
223+
u32 page_offset;
224+
u32 length; /* length of the buffer */
225225

226-
u16 length; /* length of the buffer */
226+
u16 reuse_flag;
227227

228228
/* desc type, used by the ring user to mark the type of the priv data */
229229
u16 type;

drivers/net/ethernet/hisilicon/hns/hns_enet.c

Lines changed: 4 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -406,113 +406,13 @@ netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev,
406406
return NETDEV_TX_BUSY;
407407
}
408408

409-
/**
410-
* hns_nic_get_headlen - determine size of header for RSC/LRO/GRO/FCOE
411-
* @data: pointer to the start of the headers
412-
* @max: total length of section to find headers in
413-
*
414-
* This function is meant to determine the length of headers that will
415-
* be recognized by hardware for LRO, GRO, and RSC offloads. The main
416-
* motivation of doing this is to only perform one pull for IPv4 TCP
417-
* packets so that we can do basic things like calculating the gso_size
418-
* based on the average data per packet.
419-
**/
420-
static unsigned int hns_nic_get_headlen(unsigned char *data, u32 flag,
421-
unsigned int max_size)
422-
{
423-
unsigned char *network;
424-
u8 hlen;
425-
426-
/* this should never happen, but better safe than sorry */
427-
if (max_size < ETH_HLEN)
428-
return max_size;
429-
430-
/* initialize network frame pointer */
431-
network = data;
432-
433-
/* set first protocol and move network header forward */
434-
network += ETH_HLEN;
435-
436-
/* handle any vlan tag if present */
437-
if (hnae_get_field(flag, HNS_RXD_VLAN_M, HNS_RXD_VLAN_S)
438-
== HNS_RX_FLAG_VLAN_PRESENT) {
439-
if ((typeof(max_size))(network - data) > (max_size - VLAN_HLEN))
440-
return max_size;
441-
442-
network += VLAN_HLEN;
443-
}
444-
445-
/* handle L3 protocols */
446-
if (hnae_get_field(flag, HNS_RXD_L3ID_M, HNS_RXD_L3ID_S)
447-
== HNS_RX_FLAG_L3ID_IPV4) {
448-
if ((typeof(max_size))(network - data) >
449-
(max_size - sizeof(struct iphdr)))
450-
return max_size;
451-
452-
/* access ihl as a u8 to avoid unaligned access on ia64 */
453-
hlen = (network[0] & 0x0F) << 2;
454-
455-
/* verify hlen meets minimum size requirements */
456-
if (hlen < sizeof(struct iphdr))
457-
return network - data;
458-
459-
/* record next protocol if header is present */
460-
} else if (hnae_get_field(flag, HNS_RXD_L3ID_M, HNS_RXD_L3ID_S)
461-
== HNS_RX_FLAG_L3ID_IPV6) {
462-
if ((typeof(max_size))(network - data) >
463-
(max_size - sizeof(struct ipv6hdr)))
464-
return max_size;
465-
466-
/* record next protocol */
467-
hlen = sizeof(struct ipv6hdr);
468-
} else {
469-
return network - data;
470-
}
471-
472-
/* relocate pointer to start of L4 header */
473-
network += hlen;
474-
475-
/* finally sort out TCP/UDP */
476-
if (hnae_get_field(flag, HNS_RXD_L4ID_M, HNS_RXD_L4ID_S)
477-
== HNS_RX_FLAG_L4ID_TCP) {
478-
if ((typeof(max_size))(network - data) >
479-
(max_size - sizeof(struct tcphdr)))
480-
return max_size;
481-
482-
/* access doff as a u8 to avoid unaligned access on ia64 */
483-
hlen = (network[12] & 0xF0) >> 2;
484-
485-
/* verify hlen meets minimum size requirements */
486-
if (hlen < sizeof(struct tcphdr))
487-
return network - data;
488-
489-
network += hlen;
490-
} else if (hnae_get_field(flag, HNS_RXD_L4ID_M, HNS_RXD_L4ID_S)
491-
== HNS_RX_FLAG_L4ID_UDP) {
492-
if ((typeof(max_size))(network - data) >
493-
(max_size - sizeof(struct udphdr)))
494-
return max_size;
495-
496-
network += sizeof(struct udphdr);
497-
}
498-
499-
/* If everything has gone correctly network should be the
500-
* data section of the packet and will be the end of the header.
501-
* If not then it probably represents the end of the last recognized
502-
* header.
503-
*/
504-
if ((typeof(max_size))(network - data) < max_size)
505-
return network - data;
506-
else
507-
return max_size;
508-
}
509-
510409
static void hns_nic_reuse_page(struct sk_buff *skb, int i,
511410
struct hnae_ring *ring, int pull_len,
512411
struct hnae_desc_cb *desc_cb)
513412
{
514413
struct hnae_desc *desc;
515-
int truesize, size;
414+
u32 truesize;
415+
int size;
516416
int last_offset;
517417
bool twobufs;
518418

@@ -530,7 +430,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i,
530430
}
531431

532432
skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len,
533-
size - pull_len, truesize - pull_len);
433+
size - pull_len, truesize);
534434

535435
/* avoid re-using remote pages,flag default unreuse */
536436
if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))
@@ -695,7 +595,7 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
695595
} else {
696596
ring->stats.seg_pkt_cnt++;
697597

698-
pull_len = hns_nic_get_headlen(va, bnum_flag, HNS_RX_HEAD_SIZE);
598+
pull_len = eth_get_headlen(va, HNS_RX_HEAD_SIZE);
699599
memcpy(__skb_put(skb, pull_len), va,
700600
ALIGN(pull_len, sizeof(long)));
701601

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,8 @@ static void hns3_nic_reuse_page(struct sk_buff *skb, int i,
20192019
struct hns3_desc_cb *desc_cb)
20202020
{
20212021
struct hns3_desc *desc;
2022-
int truesize, size;
2022+
u32 truesize;
2023+
int size;
20232024
int last_offset;
20242025
bool twobufs;
20252026

drivers/net/ethernet/hisilicon/hns3/hns3_enet.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@ struct hns3_desc_cb {
284284

285285
/* priv data for the desc, e.g. skb when use with ip stack*/
286286
void *priv;
287-
u16 page_offset;
288-
u16 reuse_flag;
289-
287+
u32 page_offset;
290288
u32 length; /* length of the buffer */
291289

290+
u16 reuse_flag;
291+
292292
/* desc type, used by the ring user to mark the type of the priv data */
293293
u16 type;
294294
};

drivers/net/ethernet/intel/e1000/e1000_ethtool.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,14 @@ static int e1000_set_ringparam(struct net_device *netdev,
624624
adapter->tx_ring = tx_old;
625625
e1000_free_all_rx_resources(adapter);
626626
e1000_free_all_tx_resources(adapter);
627-
kfree(tx_old);
628-
kfree(rx_old);
629627
adapter->rx_ring = rxdr;
630628
adapter->tx_ring = txdr;
631629
err = e1000_up(adapter);
632630
if (err)
633631
goto err_setup;
634632
}
633+
kfree(tx_old);
634+
kfree(rx_old);
635635

636636
clear_bit(__E1000_RESETTING, &adapter->flags);
637637
return 0;
@@ -644,7 +644,8 @@ static int e1000_set_ringparam(struct net_device *netdev,
644644
err_alloc_rx:
645645
kfree(txdr);
646646
err_alloc_tx:
647-
e1000_up(adapter);
647+
if (netif_running(adapter->netdev))
648+
e1000_up(adapter);
648649
err_setup:
649650
clear_bit(__E1000_RESETTING, &adapter->flags);
650651
return err;

drivers/net/ethernet/intel/i40e/i40e_ethtool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ static void i40e_get_stat_strings(struct net_device *netdev, u8 *data)
20132013
for (i = 0; i < I40E_MAX_USER_PRIORITY; i++)
20142014
i40e_add_stat_strings(&data, i40e_gstrings_pfc_stats, i);
20152015

2016-
WARN_ONCE(p - data != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
2016+
WARN_ONCE(data - p != i40e_get_stats_count(netdev) * ETH_GSTRING_LEN,
20172017
"stat strings count mismatch!");
20182018
}
20192019

0 commit comments

Comments
 (0)