diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-12-31 17:40:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-12-31 17:40:43 -0500 |
commit | 8f5daf2a49545374b5b433f0ee3ae62fc6e63d4d (patch) | |
tree | cb7c48d3761caafaace6732d0c5ed191a65ce8da | |
parent | c6169202e40868fd00de7ce35ee16c81b1f9e123 (diff) | |
parent | 068d8bd338e855286aea54e70d1c101569284b21 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller:
1) Prevent XFRM per-cpu counter updates for one namespace from being
applied to another namespace. Fix from DanS treetman.
2) Fix RCU de-reference in iwl_mvm_get_key_sta_id(), from Johannes
Berg.
3) Remove ethernet header assumption in nft_do_chain_netdev(), from
Pablo Neira Ayuso.
4) Fix cpsw PHY ident with multiple slaves and fixed-phy, from Pascal
Speck.
5) Fix use after free in sixpack_close and mkiss_close.
6) Fix VXLAN fw assertion on bnx2x, from Yuval Mintz.
7) natsemi doesn't check for DMA mapping errors, from Alexey
Khoroshilov.
8) Fix inverted test in ip6addrlbl_get(), from ANdrey Ryabinin.
9) Missing initialization of needed_headroom in geneve tunnel driver,
from Paolo Abeni.
10) Fix conntrack template leak in openvswitch, from Joe Stringer.
11) Mission initialization of wq->flags in sock_alloc_inode(), from
Nicolai Stange.
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (35 commits)
sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close
net, socket, socket_wq: fix missing initialization of flags
drivers: net: cpsw: fix error return code
openvswitch: Fix template leak in error cases.
sctp: label accepted/peeled off sockets
sctp: use GFP_USER for user-controlled kmalloc
qlcnic: fix a loop exit condition better
net: cdc_ncm: avoid changing RX/TX buffers on MTU changes
geneve: initialize needed_headroom
ipv6: honor ifindex in case we receive ll addresses in router advertisements
addrconf: always initialize sysctl table data
ipv6/addrlabel: fix ip6addrlbl_get()
switchdev: bridge: Pass ageing time as clock_t instead of jiffies
sh_eth: fix 16-bit descriptor field access endianness too
veth: don’t modify ip_summed; doing so treats packets with bad checksums as good.
net: usb: cdc_ncm: Adding Dell DW5813 LTE AT&T Mobile Broadband Card
net: usb: cdc_ncm: Adding Dell DW5812 LTE Verizon Mobile Broadband Card
natsemi: add checks for dma mapping errors
rhashtable: Kill harmless RCU warning in rhashtable_walk_init
openvswitch: correct encoding of set tunnel action attributes
...
36 files changed, 334 insertions, 198 deletions
diff --git a/Documentation/devicetree/bindings/net/cpsw.txt b/Documentation/devicetree/bindings/net/cpsw.txt index 9853f8e70966..28a4781ab6d7 100644 --- a/Documentation/devicetree/bindings/net/cpsw.txt +++ b/Documentation/devicetree/bindings/net/cpsw.txt | |||
@@ -40,18 +40,18 @@ Optional properties: | |||
40 | 40 | ||
41 | Slave Properties: | 41 | Slave Properties: |
42 | Required properties: | 42 | Required properties: |
43 | - phy_id : Specifies slave phy id | ||
44 | - phy-mode : See ethernet.txt file in the same directory | 43 | - phy-mode : See ethernet.txt file in the same directory |
45 | 44 | ||
46 | Optional properties: | 45 | Optional properties: |
47 | - dual_emac_res_vlan : Specifies VID to be used to segregate the ports | 46 | - dual_emac_res_vlan : Specifies VID to be used to segregate the ports |
48 | - mac-address : See ethernet.txt file in the same directory | 47 | - mac-address : See ethernet.txt file in the same directory |
48 | - phy_id : Specifies slave phy id | ||
49 | - phy-handle : See ethernet.txt file in the same directory | 49 | - phy-handle : See ethernet.txt file in the same directory |
50 | 50 | ||
51 | Slave sub-nodes: | 51 | Slave sub-nodes: |
52 | - fixed-link : See fixed-link.txt file in the same directory | 52 | - fixed-link : See fixed-link.txt file in the same directory |
53 | Either the properties phy_id and phy-mode, | 53 | Either the property phy_id, or the sub-node |
54 | or the sub-node fixed-link can be specified | 54 | fixed-link can be specified |
55 | 55 | ||
56 | Note: "ti,hwmods" field is used to fetch the base address and irq | 56 | Note: "ti,hwmods" field is used to fetch the base address and irq |
57 | resources from TI, omap hwmod data base during device registration. | 57 | resources from TI, omap hwmod data base during device registration. |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index f8d7a2f06950..c82ab87fcbe8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3430,25 +3430,29 @@ static u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb) | |||
3430 | return rc; | 3430 | return rc; |
3431 | } | 3431 | } |
3432 | 3432 | ||
3433 | #if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3) | 3433 | /* VXLAN: 4 = 1 (for linear data BD) + 3 (2 for PBD and last BD) */ |
3434 | #define BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS 4 | ||
3435 | |||
3436 | /* Regular: 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */ | ||
3437 | #define BNX2X_NUM_TSO_WIN_SUB_BDS 3 | ||
3438 | |||
3439 | #if (MAX_SKB_FRAGS >= MAX_FETCH_BD - BDS_PER_TX_PKT) | ||
3434 | /* check if packet requires linearization (packet is too fragmented) | 3440 | /* check if packet requires linearization (packet is too fragmented) |
3435 | no need to check fragmentation if page size > 8K (there will be no | 3441 | no need to check fragmentation if page size > 8K (there will be no |
3436 | violation to FW restrictions) */ | 3442 | violation to FW restrictions) */ |
3437 | static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb, | 3443 | static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb, |
3438 | u32 xmit_type) | 3444 | u32 xmit_type) |
3439 | { | 3445 | { |
3440 | int to_copy = 0; | 3446 | int first_bd_sz = 0, num_tso_win_sub = BNX2X_NUM_TSO_WIN_SUB_BDS; |
3441 | int hlen = 0; | 3447 | int to_copy = 0, hlen = 0; |
3442 | int first_bd_sz = 0; | ||
3443 | 3448 | ||
3444 | /* 3 = 1 (for linear data BD) + 2 (for PBD and last BD) */ | 3449 | if (xmit_type & XMIT_GSO_ENC) |
3445 | if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - 3)) { | 3450 | num_tso_win_sub = BNX2X_NUM_VXLAN_TSO_WIN_SUB_BDS; |
3446 | 3451 | ||
3452 | if (skb_shinfo(skb)->nr_frags >= (MAX_FETCH_BD - num_tso_win_sub)) { | ||
3447 | if (xmit_type & XMIT_GSO) { | 3453 | if (xmit_type & XMIT_GSO) { |
3448 | unsigned short lso_mss = skb_shinfo(skb)->gso_size; | 3454 | unsigned short lso_mss = skb_shinfo(skb)->gso_size; |
3449 | /* Check if LSO packet needs to be copied: | 3455 | int wnd_size = MAX_FETCH_BD - num_tso_win_sub; |
3450 | 3 = 1 (for headers BD) + 2 (for PBD and last BD) */ | ||
3451 | int wnd_size = MAX_FETCH_BD - 3; | ||
3452 | /* Number of windows to check */ | 3456 | /* Number of windows to check */ |
3453 | int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size; | 3457 | int num_wnds = skb_shinfo(skb)->nr_frags - wnd_size; |
3454 | int wnd_idx = 0; | 3458 | int wnd_idx = 0; |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index ff2ff8946671..8a1d9fffd7d6 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -3299,8 +3299,10 @@ static int be_msix_register(struct be_adapter *adapter) | |||
3299 | 3299 | ||
3300 | return 0; | 3300 | return 0; |
3301 | err_msix: | 3301 | err_msix: |
3302 | for (i--, eqo = &adapter->eq_obj[i]; i >= 0; i--, eqo--) | 3302 | for (i--; i >= 0; i--) { |
3303 | eqo = &adapter->eq_obj[i]; | ||
3303 | free_irq(be_msix_vec_get(adapter, eqo), eqo); | 3304 | free_irq(be_msix_vec_get(adapter, eqo), eqo); |
3305 | } | ||
3304 | dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n", | 3306 | dev_warn(&adapter->pdev->dev, "MSIX Request IRQ failed - err %d\n", |
3305 | status); | 3307 | status); |
3306 | be_msix_disable(adapter); | 3308 | be_msix_disable(adapter); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index 8a083d73efdb..038f9ce391e6 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c | |||
@@ -242,6 +242,13 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) | |||
242 | unsigned long flags; | 242 | unsigned long flags; |
243 | u64 ns, zero = 0; | 243 | u64 ns, zero = 0; |
244 | 244 | ||
245 | /* mlx4_en_init_timestamp is called for each netdev. | ||
246 | * mdev->ptp_clock is common for all ports, skip initialization if | ||
247 | * was done for other port. | ||
248 | */ | ||
249 | if (mdev->ptp_clock) | ||
250 | return; | ||
251 | |||
245 | rwlock_init(&mdev->clock_lock); | 252 | rwlock_init(&mdev->clock_lock); |
246 | 253 | ||
247 | memset(&mdev->cycles, 0, sizeof(mdev->cycles)); | 254 | memset(&mdev->cycles, 0, sizeof(mdev->cycles)); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_main.c b/drivers/net/ethernet/mellanox/mlx4/en_main.c index 005f910ec955..e0ec280a7fa1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_main.c | |||
@@ -232,9 +232,6 @@ static void mlx4_en_remove(struct mlx4_dev *dev, void *endev_ptr) | |||
232 | if (mdev->pndev[i]) | 232 | if (mdev->pndev[i]) |
233 | mlx4_en_destroy_netdev(mdev->pndev[i]); | 233 | mlx4_en_destroy_netdev(mdev->pndev[i]); |
234 | 234 | ||
235 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) | ||
236 | mlx4_en_remove_timestamp(mdev); | ||
237 | |||
238 | flush_workqueue(mdev->workqueue); | 235 | flush_workqueue(mdev->workqueue); |
239 | destroy_workqueue(mdev->workqueue); | 236 | destroy_workqueue(mdev->workqueue); |
240 | (void) mlx4_mr_free(dev, &mdev->mr); | 237 | (void) mlx4_mr_free(dev, &mdev->mr); |
@@ -320,10 +317,6 @@ static void *mlx4_en_add(struct mlx4_dev *dev) | |||
320 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) | 317 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH) |
321 | mdev->port_cnt++; | 318 | mdev->port_cnt++; |
322 | 319 | ||
323 | /* Initialize time stamp mechanism */ | ||
324 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) | ||
325 | mlx4_en_init_timestamp(mdev); | ||
326 | |||
327 | /* Set default number of RX rings*/ | 320 | /* Set default number of RX rings*/ |
328 | mlx4_en_set_num_rx_rings(mdev); | 321 | mlx4_en_set_num_rx_rings(mdev); |
329 | 322 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 886e1bc86374..7869f97de5da 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -2072,6 +2072,9 @@ void mlx4_en_destroy_netdev(struct net_device *dev) | |||
2072 | /* flush any pending task for this netdev */ | 2072 | /* flush any pending task for this netdev */ |
2073 | flush_workqueue(mdev->workqueue); | 2073 | flush_workqueue(mdev->workqueue); |
2074 | 2074 | ||
2075 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) | ||
2076 | mlx4_en_remove_timestamp(mdev); | ||
2077 | |||
2075 | /* Detach the netdev so tasks would not attempt to access it */ | 2078 | /* Detach the netdev so tasks would not attempt to access it */ |
2076 | mutex_lock(&mdev->state_lock); | 2079 | mutex_lock(&mdev->state_lock); |
2077 | mdev->pndev[priv->port] = NULL; | 2080 | mdev->pndev[priv->port] = NULL; |
@@ -3058,9 +3061,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
3058 | } | 3061 | } |
3059 | queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); | 3062 | queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY); |
3060 | 3063 | ||
3064 | /* Initialize time stamp mechanism */ | ||
3061 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) | 3065 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) |
3062 | queue_delayed_work(mdev->workqueue, &priv->service_task, | 3066 | mlx4_en_init_timestamp(mdev); |
3063 | SERVICE_TASK_DELAY); | 3067 | |
3068 | queue_delayed_work(mdev->workqueue, &priv->service_task, | ||
3069 | SERVICE_TASK_DELAY); | ||
3064 | 3070 | ||
3065 | mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap, | 3071 | mlx4_en_set_stats_bitmap(mdev->dev, &priv->stats_bitmap, |
3066 | mdev->profile.prof[priv->port].rx_ppp, | 3072 | mdev->profile.prof[priv->port].rx_ppp, |
diff --git a/drivers/net/ethernet/natsemi/natsemi.c b/drivers/net/ethernet/natsemi/natsemi.c index b83f7c0fcf99..122c2ee3dfe2 100644 --- a/drivers/net/ethernet/natsemi/natsemi.c +++ b/drivers/net/ethernet/natsemi/natsemi.c | |||
@@ -1937,6 +1937,12 @@ static void refill_rx(struct net_device *dev) | |||
1937 | break; /* Better luck next round. */ | 1937 | break; /* Better luck next round. */ |
1938 | np->rx_dma[entry] = pci_map_single(np->pci_dev, | 1938 | np->rx_dma[entry] = pci_map_single(np->pci_dev, |
1939 | skb->data, buflen, PCI_DMA_FROMDEVICE); | 1939 | skb->data, buflen, PCI_DMA_FROMDEVICE); |
1940 | if (pci_dma_mapping_error(np->pci_dev, | ||
1941 | np->rx_dma[entry])) { | ||
1942 | dev_kfree_skb_any(skb); | ||
1943 | np->rx_skbuff[entry] = NULL; | ||
1944 | break; /* Better luck next round. */ | ||
1945 | } | ||
1940 | np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); | 1946 | np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]); |
1941 | } | 1947 | } |
1942 | np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); | 1948 | np->rx_ring[entry].cmd_status = cpu_to_le32(np->rx_buf_sz); |
@@ -2093,6 +2099,12 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) | |||
2093 | np->tx_skbuff[entry] = skb; | 2099 | np->tx_skbuff[entry] = skb; |
2094 | np->tx_dma[entry] = pci_map_single(np->pci_dev, | 2100 | np->tx_dma[entry] = pci_map_single(np->pci_dev, |
2095 | skb->data,skb->len, PCI_DMA_TODEVICE); | 2101 | skb->data,skb->len, PCI_DMA_TODEVICE); |
2102 | if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) { | ||
2103 | np->tx_skbuff[entry] = NULL; | ||
2104 | dev_kfree_skb_irq(skb); | ||
2105 | dev->stats.tx_dropped++; | ||
2106 | return NETDEV_TX_OK; | ||
2107 | } | ||
2096 | 2108 | ||
2097 | np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]); | 2109 | np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]); |
2098 | 2110 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c index b1a452f291ee..34906750b7e7 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c | |||
@@ -252,7 +252,7 @@ int qlcnic_83xx_check_vnic_state(struct qlcnic_adapter *adapter) | |||
252 | state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); | 252 | state = QLCRDX(ahw, QLC_83XX_VNIC_STATE); |
253 | } | 253 | } |
254 | 254 | ||
255 | if (!idc->vnic_wait_limit) { | 255 | if (state != QLCNIC_DEV_NPAR_OPER) { |
256 | dev_err(&adapter->pdev->dev, | 256 | dev_err(&adapter->pdev->dev, |
257 | "vNIC mode not operational, state check timed out.\n"); | 257 | "vNIC mode not operational, state check timed out.\n"); |
258 | return -EIO; | 258 | return -EIO; |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index a0eaf50499a2..6a8fc0f341ff 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1167,6 +1167,7 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1167 | int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; | 1167 | int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring; |
1168 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1; | 1168 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1; |
1169 | dma_addr_t dma_addr; | 1169 | dma_addr_t dma_addr; |
1170 | u32 buf_len; | ||
1170 | 1171 | ||
1171 | mdp->cur_rx = 0; | 1172 | mdp->cur_rx = 0; |
1172 | mdp->cur_tx = 0; | 1173 | mdp->cur_tx = 0; |
@@ -1187,9 +1188,9 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1187 | /* RX descriptor */ | 1188 | /* RX descriptor */ |
1188 | rxdesc = &mdp->rx_ring[i]; | 1189 | rxdesc = &mdp->rx_ring[i]; |
1189 | /* The size of the buffer is a multiple of 32 bytes. */ | 1190 | /* The size of the buffer is a multiple of 32 bytes. */ |
1190 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32); | 1191 | buf_len = ALIGN(mdp->rx_buf_sz, 32); |
1191 | dma_addr = dma_map_single(&ndev->dev, skb->data, | 1192 | rxdesc->len = cpu_to_edmac(mdp, buf_len << 16); |
1192 | rxdesc->buffer_length, | 1193 | dma_addr = dma_map_single(&ndev->dev, skb->data, buf_len, |
1193 | DMA_FROM_DEVICE); | 1194 | DMA_FROM_DEVICE); |
1194 | if (dma_mapping_error(&ndev->dev, dma_addr)) { | 1195 | if (dma_mapping_error(&ndev->dev, dma_addr)) { |
1195 | kfree_skb(skb); | 1196 | kfree_skb(skb); |
@@ -1220,7 +1221,7 @@ static void sh_eth_ring_format(struct net_device *ndev) | |||
1220 | mdp->tx_skbuff[i] = NULL; | 1221 | mdp->tx_skbuff[i] = NULL; |
1221 | txdesc = &mdp->tx_ring[i]; | 1222 | txdesc = &mdp->tx_ring[i]; |
1222 | txdesc->status = cpu_to_edmac(mdp, TD_TFP); | 1223 | txdesc->status = cpu_to_edmac(mdp, TD_TFP); |
1223 | txdesc->buffer_length = 0; | 1224 | txdesc->len = cpu_to_edmac(mdp, 0); |
1224 | if (i == 0) { | 1225 | if (i == 0) { |
1225 | /* Tx descriptor address set */ | 1226 | /* Tx descriptor address set */ |
1226 | sh_eth_write(ndev, mdp->tx_desc_dma, TDLAR); | 1227 | sh_eth_write(ndev, mdp->tx_desc_dma, TDLAR); |
@@ -1429,7 +1430,8 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
1429 | if (mdp->tx_skbuff[entry]) { | 1430 | if (mdp->tx_skbuff[entry]) { |
1430 | dma_unmap_single(&ndev->dev, | 1431 | dma_unmap_single(&ndev->dev, |
1431 | edmac_to_cpu(mdp, txdesc->addr), | 1432 | edmac_to_cpu(mdp, txdesc->addr), |
1432 | txdesc->buffer_length, DMA_TO_DEVICE); | 1433 | edmac_to_cpu(mdp, txdesc->len) >> 16, |
1434 | DMA_TO_DEVICE); | ||
1433 | dev_kfree_skb_irq(mdp->tx_skbuff[entry]); | 1435 | dev_kfree_skb_irq(mdp->tx_skbuff[entry]); |
1434 | mdp->tx_skbuff[entry] = NULL; | 1436 | mdp->tx_skbuff[entry] = NULL; |
1435 | free_num++; | 1437 | free_num++; |
@@ -1439,7 +1441,7 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
1439 | txdesc->status |= cpu_to_edmac(mdp, TD_TDLE); | 1441 | txdesc->status |= cpu_to_edmac(mdp, TD_TDLE); |
1440 | 1442 | ||
1441 | ndev->stats.tx_packets++; | 1443 | ndev->stats.tx_packets++; |
1442 | ndev->stats.tx_bytes += txdesc->buffer_length; | 1444 | ndev->stats.tx_bytes += edmac_to_cpu(mdp, txdesc->len) >> 16; |
1443 | } | 1445 | } |
1444 | return free_num; | 1446 | return free_num; |
1445 | } | 1447 | } |
@@ -1458,6 +1460,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1458 | u32 desc_status; | 1460 | u32 desc_status; |
1459 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1; | 1461 | int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1; |
1460 | dma_addr_t dma_addr; | 1462 | dma_addr_t dma_addr; |
1463 | u32 buf_len; | ||
1461 | 1464 | ||
1462 | boguscnt = min(boguscnt, *quota); | 1465 | boguscnt = min(boguscnt, *quota); |
1463 | limit = boguscnt; | 1466 | limit = boguscnt; |
@@ -1466,7 +1469,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1466 | /* RACT bit must be checked before all the following reads */ | 1469 | /* RACT bit must be checked before all the following reads */ |
1467 | dma_rmb(); | 1470 | dma_rmb(); |
1468 | desc_status = edmac_to_cpu(mdp, rxdesc->status); | 1471 | desc_status = edmac_to_cpu(mdp, rxdesc->status); |
1469 | pkt_len = rxdesc->frame_length; | 1472 | pkt_len = edmac_to_cpu(mdp, rxdesc->len) & RD_RFL; |
1470 | 1473 | ||
1471 | if (--boguscnt < 0) | 1474 | if (--boguscnt < 0) |
1472 | break; | 1475 | break; |
@@ -1532,7 +1535,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1532 | entry = mdp->dirty_rx % mdp->num_rx_ring; | 1535 | entry = mdp->dirty_rx % mdp->num_rx_ring; |
1533 | rxdesc = &mdp->rx_ring[entry]; | 1536 | rxdesc = &mdp->rx_ring[entry]; |
1534 | /* The size of the buffer is 32 byte boundary. */ | 1537 | /* The size of the buffer is 32 byte boundary. */ |
1535 | rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32); | 1538 | buf_len = ALIGN(mdp->rx_buf_sz, 32); |
1539 | rxdesc->len = cpu_to_edmac(mdp, buf_len << 16); | ||
1536 | 1540 | ||
1537 | if (mdp->rx_skbuff[entry] == NULL) { | 1541 | if (mdp->rx_skbuff[entry] == NULL) { |
1538 | skb = netdev_alloc_skb(ndev, skbuff_size); | 1542 | skb = netdev_alloc_skb(ndev, skbuff_size); |
@@ -1540,8 +1544,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota) | |||
1540 | break; /* Better luck next round. */ | 1544 | break; /* Better luck next round. */ |
1541 | sh_eth_set_receive_align(skb); | 1545 | sh_eth_set_receive_align(skb); |
1542 | dma_addr = dma_map_single(&ndev->dev, skb->data, | 1546 | dma_addr = dma_map_single(&ndev->dev, skb->data, |
1543 | rxdesc->buffer_length, | 1547 | buf_len, DMA_FROM_DEVICE); |
1544 | DMA_FROM_DEVICE); | ||
1545 | if (dma_mapping_error(&ndev->dev, dma_addr)) { | 1548 | if (dma_mapping_error(&ndev->dev, dma_addr)) { |
1546 | kfree_skb(skb); | 1549 | kfree_skb(skb); |
1547 | break; | 1550 | break; |
@@ -2407,7 +2410,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
2407 | return NETDEV_TX_OK; | 2410 | return NETDEV_TX_OK; |
2408 | } | 2411 | } |
2409 | txdesc->addr = cpu_to_edmac(mdp, dma_addr); | 2412 | txdesc->addr = cpu_to_edmac(mdp, dma_addr); |
2410 | txdesc->buffer_length = skb->len; | 2413 | txdesc->len = cpu_to_edmac(mdp, skb->len << 16); |
2411 | 2414 | ||
2412 | dma_wmb(); /* TACT bit must be set after all the above writes */ | 2415 | dma_wmb(); /* TACT bit must be set after all the above writes */ |
2413 | if (entry >= mdp->num_tx_ring - 1) | 2416 | if (entry >= mdp->num_tx_ring - 1) |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index 26ad1cf0bcf1..72fcfc924589 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -283,7 +283,7 @@ enum DMAC_IM_BIT { | |||
283 | DMAC_M_RINT1 = 0x00000001, | 283 | DMAC_M_RINT1 = 0x00000001, |
284 | }; | 284 | }; |
285 | 285 | ||
286 | /* Receive descriptor bit */ | 286 | /* Receive descriptor 0 bits */ |
287 | enum RD_STS_BIT { | 287 | enum RD_STS_BIT { |
288 | RD_RACT = 0x80000000, RD_RDLE = 0x40000000, | 288 | RD_RACT = 0x80000000, RD_RDLE = 0x40000000, |
289 | RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000, | 289 | RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000, |
@@ -298,6 +298,12 @@ enum RD_STS_BIT { | |||
298 | #define RDFEND RD_RFP0 | 298 | #define RDFEND RD_RFP0 |
299 | #define RD_RFP (RD_RFP1|RD_RFP0) | 299 | #define RD_RFP (RD_RFP1|RD_RFP0) |
300 | 300 | ||
301 | /* Receive descriptor 1 bits */ | ||
302 | enum RD_LEN_BIT { | ||
303 | RD_RFL = 0x0000ffff, /* receive frame length */ | ||
304 | RD_RBL = 0xffff0000, /* receive buffer length */ | ||
305 | }; | ||
306 | |||
301 | /* FCFTR */ | 307 | /* FCFTR */ |
302 | enum FCFTR_BIT { | 308 | enum FCFTR_BIT { |
303 | FCFTR_RFF2 = 0x00040000, FCFTR_RFF1 = 0x00020000, | 309 | FCFTR_RFF2 = 0x00040000, FCFTR_RFF1 = 0x00020000, |
@@ -307,7 +313,7 @@ enum FCFTR_BIT { | |||
307 | #define DEFAULT_FIFO_F_D_RFF (FCFTR_RFF2 | FCFTR_RFF1 | FCFTR_RFF0) | 313 | #define DEFAULT_FIFO_F_D_RFF (FCFTR_RFF2 | FCFTR_RFF1 | FCFTR_RFF0) |
308 | #define DEFAULT_FIFO_F_D_RFD (FCFTR_RFD2 | FCFTR_RFD1 | FCFTR_RFD0) | 314 | #define DEFAULT_FIFO_F_D_RFD (FCFTR_RFD2 | FCFTR_RFD1 | FCFTR_RFD0) |
309 | 315 | ||
310 | /* Transmit descriptor bit */ | 316 | /* Transmit descriptor 0 bits */ |
311 | enum TD_STS_BIT { | 317 | enum TD_STS_BIT { |
312 | TD_TACT = 0x80000000, TD_TDLE = 0x40000000, | 318 | TD_TACT = 0x80000000, TD_TDLE = 0x40000000, |
313 | TD_TFP1 = 0x20000000, TD_TFP0 = 0x10000000, | 319 | TD_TFP1 = 0x20000000, TD_TFP0 = 0x10000000, |
@@ -317,6 +323,11 @@ enum TD_STS_BIT { | |||
317 | #define TDFEND TD_TFP0 | 323 | #define TDFEND TD_TFP0 |
318 | #define TD_TFP (TD_TFP1|TD_TFP0) | 324 | #define TD_TFP (TD_TFP1|TD_TFP0) |
319 | 325 | ||
326 | /* Transmit descriptor 1 bits */ | ||
327 | enum TD_LEN_BIT { | ||
328 | TD_TBL = 0xffff0000, /* transmit buffer length */ | ||
329 | }; | ||
330 | |||
320 | /* RMCR */ | 331 | /* RMCR */ |
321 | enum RMCR_BIT { | 332 | enum RMCR_BIT { |
322 | RMCR_RNC = 0x00000001, | 333 | RMCR_RNC = 0x00000001, |
@@ -425,15 +436,9 @@ enum TSU_FWSLC_BIT { | |||
425 | */ | 436 | */ |
426 | struct sh_eth_txdesc { | 437 | struct sh_eth_txdesc { |
427 | u32 status; /* TD0 */ | 438 | u32 status; /* TD0 */ |
428 | #if defined(__LITTLE_ENDIAN) | 439 | u32 len; /* TD1 */ |
429 | u16 pad0; /* TD1 */ | ||
430 | u16 buffer_length; /* TD1 */ | ||
431 | #else | ||
432 | u16 buffer_length; /* TD1 */ | ||
433 | u16 pad0; /* TD1 */ | ||
434 | #endif | ||
435 | u32 addr; /* TD2 */ | 440 | u32 addr; /* TD2 */ |
436 | u32 pad1; /* padding data */ | 441 | u32 pad0; /* padding data */ |
437 | } __aligned(2) __packed; | 442 | } __aligned(2) __packed; |
438 | 443 | ||
439 | /* The sh ether Rx buffer descriptors. | 444 | /* The sh ether Rx buffer descriptors. |
@@ -441,13 +446,7 @@ struct sh_eth_txdesc { | |||
441 | */ | 446 | */ |
442 | struct sh_eth_rxdesc { | 447 | struct sh_eth_rxdesc { |
443 | u32 status; /* RD0 */ | 448 | u32 status; /* RD0 */ |
444 | #if defined(__LITTLE_ENDIAN) | 449 | u32 len; /* RD1 */ |
445 | u16 frame_length; /* RD1 */ | ||
446 | u16 buffer_length; /* RD1 */ | ||
447 | #else | ||
448 | u16 buffer_length; /* RD1 */ | ||
449 | u16 frame_length; /* RD1 */ | ||
450 | #endif | ||
451 | u32 addr; /* RD2 */ | 450 | u32 addr; /* RD2 */ |
452 | u32 pad0; /* padding data */ | 451 | u32 pad0; /* padding data */ |
453 | } __aligned(2) __packed; | 452 | } __aligned(2) __packed; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 48b92c9de12a..fc958067d10a 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -2026,45 +2026,54 @@ static int cpsw_probe_dt(struct cpsw_priv *priv, | |||
2026 | for_each_child_of_node(node, slave_node) { | 2026 | for_each_child_of_node(node, slave_node) { |
2027 | struct cpsw_slave_data *slave_data = data->slave_data + i; | 2027 | struct cpsw_slave_data *slave_data = data->slave_data + i; |
2028 | const void *mac_addr = NULL; | 2028 | const void *mac_addr = NULL; |
2029 | u32 phyid; | ||
2030 | int lenp; | 2029 | int lenp; |
2031 | const __be32 *parp; | 2030 | const __be32 *parp; |
2032 | struct device_node *mdio_node; | ||
2033 | struct platform_device *mdio; | ||
2034 | 2031 | ||
2035 | /* This is no slave child node, continue */ | 2032 | /* This is no slave child node, continue */ |
2036 | if (strcmp(slave_node->name, "slave")) | 2033 | if (strcmp(slave_node->name, "slave")) |
2037 | continue; | 2034 | continue; |
2038 | 2035 | ||
2039 | priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); | 2036 | priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); |
2037 | parp = of_get_property(slave_node, "phy_id", &lenp); | ||
2040 | if (of_phy_is_fixed_link(slave_node)) { | 2038 | if (of_phy_is_fixed_link(slave_node)) { |
2041 | struct phy_device *pd; | 2039 | struct device_node *phy_node; |
2040 | struct phy_device *phy_dev; | ||
2042 | 2041 | ||
2042 | /* In the case of a fixed PHY, the DT node associated | ||
2043 | * to the PHY is the Ethernet MAC DT node. | ||
2044 | */ | ||
2043 | ret = of_phy_register_fixed_link(slave_node); | 2045 | ret = of_phy_register_fixed_link(slave_node); |
2044 | if (ret) | 2046 | if (ret) |
2045 | return ret; | 2047 | return ret; |
2046 | pd = of_phy_find_device(slave_node); | 2048 | phy_node = of_node_get(slave_node); |
2047 | if (!pd) | 2049 | phy_dev = of_phy_find_device(phy_node); |
2050 | if (!phy_dev) | ||
2048 | return -ENODEV; | 2051 | return -ENODEV; |
2049 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), | 2052 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), |
2050 | PHY_ID_FMT, pd->bus->id, pd->phy_id); | 2053 | PHY_ID_FMT, phy_dev->bus->id, phy_dev->addr); |
2051 | goto no_phy_slave; | 2054 | } else if (parp) { |
2052 | } | 2055 | u32 phyid; |
2053 | parp = of_get_property(slave_node, "phy_id", &lenp); | 2056 | struct device_node *mdio_node; |
2054 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { | 2057 | struct platform_device *mdio; |
2055 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); | 2058 | |
2059 | if (lenp != (sizeof(__be32) * 2)) { | ||
2060 | dev_err(&pdev->dev, "Invalid slave[%d] phy_id property\n", i); | ||
2061 | goto no_phy_slave; | ||
2062 | } | ||
2063 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); | ||
2064 | phyid = be32_to_cpup(parp+1); | ||
2065 | mdio = of_find_device_by_node(mdio_node); | ||
2066 | of_node_put(mdio_node); | ||
2067 | if (!mdio) { | ||
2068 | dev_err(&pdev->dev, "Missing mdio platform device\n"); | ||
2069 | return -EINVAL; | ||
2070 | } | ||
2071 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), | ||
2072 | PHY_ID_FMT, mdio->name, phyid); | ||
2073 | } else { | ||
2074 | dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i); | ||
2056 | goto no_phy_slave; | 2075 | goto no_phy_slave; |
2057 | } | 2076 | } |
2058 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); | ||
2059 | phyid = be32_to_cpup(parp+1); | ||
2060 | mdio = of_find_device_by_node(mdio_node); | ||
2061 | of_node_put(mdio_node); | ||
2062 | if (!mdio) { | ||
2063 | dev_err(&pdev->dev, "Missing mdio platform device\n"); | ||
2064 | return -EINVAL; | ||
2065 | } | ||
2066 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), | ||
2067 | PHY_ID_FMT, mdio->name, phyid); | ||
2068 | slave_data->phy_if = of_get_phy_mode(slave_node); | 2077 | slave_data->phy_if = of_get_phy_mode(slave_node); |
2069 | if (slave_data->phy_if < 0) { | 2078 | if (slave_data->phy_if < 0) { |
2070 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", | 2079 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", |
@@ -2418,7 +2427,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2418 | ndev->irq = platform_get_irq(pdev, 1); | 2427 | ndev->irq = platform_get_irq(pdev, 1); |
2419 | if (ndev->irq < 0) { | 2428 | if (ndev->irq < 0) { |
2420 | dev_err(priv->dev, "error getting irq resource\n"); | 2429 | dev_err(priv->dev, "error getting irq resource\n"); |
2421 | ret = -ENOENT; | 2430 | ret = ndev->irq; |
2422 | goto clean_ale_ret; | 2431 | goto clean_ale_ret; |
2423 | } | 2432 | } |
2424 | 2433 | ||
@@ -2439,8 +2448,10 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2439 | 2448 | ||
2440 | /* RX IRQ */ | 2449 | /* RX IRQ */ |
2441 | irq = platform_get_irq(pdev, 1); | 2450 | irq = platform_get_irq(pdev, 1); |
2442 | if (irq < 0) | 2451 | if (irq < 0) { |
2452 | ret = irq; | ||
2443 | goto clean_ale_ret; | 2453 | goto clean_ale_ret; |
2454 | } | ||
2444 | 2455 | ||
2445 | priv->irqs_table[0] = irq; | 2456 | priv->irqs_table[0] = irq; |
2446 | ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, | 2457 | ret = devm_request_irq(&pdev->dev, irq, cpsw_rx_interrupt, |
@@ -2452,8 +2463,10 @@ static int cpsw_probe(struct platform_device *pdev) | |||
2452 | 2463 | ||
2453 | /* TX IRQ */ | 2464 | /* TX IRQ */ |
2454 | irq = platform_get_irq(pdev, 2); | 2465 | irq = platform_get_irq(pdev, 2); |
2455 | if (irq < 0) | 2466 | if (irq < 0) { |
2467 | ret = irq; | ||
2456 | goto clean_ale_ret; | 2468 | goto clean_ale_ret; |
2469 | } | ||
2457 | 2470 | ||
2458 | priv->irqs_table[1] = irq; | 2471 | priv->irqs_table[1] = irq; |
2459 | ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt, | 2472 | ret = devm_request_irq(&pdev->dev, irq, cpsw_tx_interrupt, |
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index c2b79f5d1c89..58efdec12f30 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c | |||
@@ -1155,7 +1155,7 @@ static int geneve_configure(struct net *net, struct net_device *dev, | |||
1155 | struct geneve_net *gn = net_generic(net, geneve_net_id); | 1155 | struct geneve_net *gn = net_generic(net, geneve_net_id); |
1156 | struct geneve_dev *t, *geneve = netdev_priv(dev); | 1156 | struct geneve_dev *t, *geneve = netdev_priv(dev); |
1157 | bool tun_collect_md, tun_on_same_port; | 1157 | bool tun_collect_md, tun_on_same_port; |
1158 | int err; | 1158 | int err, encap_len; |
1159 | 1159 | ||
1160 | if (!remote) | 1160 | if (!remote) |
1161 | return -EINVAL; | 1161 | return -EINVAL; |
@@ -1187,6 +1187,14 @@ static int geneve_configure(struct net *net, struct net_device *dev, | |||
1187 | if (t) | 1187 | if (t) |
1188 | return -EBUSY; | 1188 | return -EBUSY; |
1189 | 1189 | ||
1190 | /* make enough headroom for basic scenario */ | ||
1191 | encap_len = GENEVE_BASE_HLEN + ETH_HLEN; | ||
1192 | if (remote->sa.sa_family == AF_INET) | ||
1193 | encap_len += sizeof(struct iphdr); | ||
1194 | else | ||
1195 | encap_len += sizeof(struct ipv6hdr); | ||
1196 | dev->needed_headroom = encap_len + ETH_HLEN; | ||
1197 | |||
1190 | if (metadata) { | 1198 | if (metadata) { |
1191 | if (tun_on_same_port) | 1199 | if (tun_on_same_port) |
1192 | return -EPERM; | 1200 | return -EPERM; |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 7c4a4151ef0f..9f0b1c342b77 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -683,14 +683,14 @@ static void sixpack_close(struct tty_struct *tty) | |||
683 | if (!atomic_dec_and_test(&sp->refcnt)) | 683 | if (!atomic_dec_and_test(&sp->refcnt)) |
684 | down(&sp->dead_sem); | 684 | down(&sp->dead_sem); |
685 | 685 | ||
686 | unregister_netdev(sp->dev); | 686 | del_timer_sync(&sp->tx_t); |
687 | 687 | del_timer_sync(&sp->resync_t); | |
688 | del_timer(&sp->tx_t); | ||
689 | del_timer(&sp->resync_t); | ||
690 | 688 | ||
691 | /* Free all 6pack frame buffers. */ | 689 | /* Free all 6pack frame buffers. */ |
692 | kfree(sp->rbuff); | 690 | kfree(sp->rbuff); |
693 | kfree(sp->xbuff); | 691 | kfree(sp->xbuff); |
692 | |||
693 | unregister_netdev(sp->dev); | ||
694 | } | 694 | } |
695 | 695 | ||
696 | /* Perform I/O control on an active 6pack channel. */ | 696 | /* Perform I/O control on an active 6pack channel. */ |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 216bfd350169..0b72b9de5207 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -798,13 +798,13 @@ static void mkiss_close(struct tty_struct *tty) | |||
798 | if (!atomic_dec_and_test(&ax->refcnt)) | 798 | if (!atomic_dec_and_test(&ax->refcnt)) |
799 | down(&ax->dead_sem); | 799 | down(&ax->dead_sem); |
800 | 800 | ||
801 | unregister_netdev(ax->dev); | ||
802 | |||
803 | /* Free all AX25 frame buffers. */ | 801 | /* Free all AX25 frame buffers. */ |
804 | kfree(ax->rbuff); | 802 | kfree(ax->rbuff); |
805 | kfree(ax->xbuff); | 803 | kfree(ax->xbuff); |
806 | 804 | ||
807 | ax->tty = NULL; | 805 | ax->tty = NULL; |
806 | |||
807 | unregister_netdev(ax->dev); | ||
808 | } | 808 | } |
809 | 809 | ||
810 | /* Perform I/O control on an active ax25 channel. */ | 810 | /* Perform I/O control on an active ax25 channel. */ |
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index 8973abdec9f6..bdd83d95ec0a 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c | |||
@@ -100,7 +100,7 @@ static const struct net_device_ops cdc_mbim_netdev_ops = { | |||
100 | .ndo_stop = usbnet_stop, | 100 | .ndo_stop = usbnet_stop, |
101 | .ndo_start_xmit = usbnet_start_xmit, | 101 | .ndo_start_xmit = usbnet_start_xmit, |
102 | .ndo_tx_timeout = usbnet_tx_timeout, | 102 | .ndo_tx_timeout = usbnet_tx_timeout, |
103 | .ndo_change_mtu = usbnet_change_mtu, | 103 | .ndo_change_mtu = cdc_ncm_change_mtu, |
104 | .ndo_set_mac_address = eth_mac_addr, | 104 | .ndo_set_mac_address = eth_mac_addr, |
105 | .ndo_validate_addr = eth_validate_addr, | 105 | .ndo_validate_addr = eth_validate_addr, |
106 | .ndo_vlan_rx_add_vid = cdc_mbim_rx_add_vid, | 106 | .ndo_vlan_rx_add_vid = cdc_mbim_rx_add_vid, |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 1e9843a41168..e8a1144c5a8b 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/module.h> | 41 | #include <linux/module.h> |
42 | #include <linux/netdevice.h> | 42 | #include <linux/netdevice.h> |
43 | #include <linux/ctype.h> | 43 | #include <linux/ctype.h> |
44 | #include <linux/etherdevice.h> | ||
44 | #include <linux/ethtool.h> | 45 | #include <linux/ethtool.h> |
45 | #include <linux/workqueue.h> | 46 | #include <linux/workqueue.h> |
46 | #include <linux/mii.h> | 47 | #include <linux/mii.h> |
@@ -689,6 +690,33 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx) | |||
689 | kfree(ctx); | 690 | kfree(ctx); |
690 | } | 691 | } |
691 | 692 | ||
693 | /* we need to override the usbnet change_mtu ndo for two reasons: | ||
694 | * - respect the negotiated maximum datagram size | ||
695 | * - avoid unwanted changes to rx and tx buffers | ||
696 | */ | ||
697 | int cdc_ncm_change_mtu(struct net_device *net, int new_mtu) | ||
698 | { | ||
699 | struct usbnet *dev = netdev_priv(net); | ||
700 | struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; | ||
701 | int maxmtu = ctx->max_datagram_size - cdc_ncm_eth_hlen(dev); | ||
702 | |||
703 | if (new_mtu <= 0 || new_mtu > maxmtu) | ||
704 | return -EINVAL; | ||
705 | net->mtu = new_mtu; | ||
706 | return 0; | ||
707 | } | ||
708 | EXPORT_SYMBOL_GPL(cdc_ncm_change_mtu); | ||
709 | |||
710 | static const struct net_device_ops cdc_ncm_netdev_ops = { | ||
711 | .ndo_open = usbnet_open, | ||
712 | .ndo_stop = usbnet_stop, | ||
713 | .ndo_start_xmit = usbnet_start_xmit, | ||
714 | .ndo_tx_timeout = usbnet_tx_timeout, | ||
715 | .ndo_change_mtu = cdc_ncm_change_mtu, | ||
716 | .ndo_set_mac_address = eth_mac_addr, | ||
717 | .ndo_validate_addr = eth_validate_addr, | ||
718 | }; | ||
719 | |||
692 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) | 720 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags) |
693 | { | 721 | { |
694 | struct cdc_ncm_ctx *ctx; | 722 | struct cdc_ncm_ctx *ctx; |
@@ -823,6 +851,9 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_ | |||
823 | /* add our sysfs attrs */ | 851 | /* add our sysfs attrs */ |
824 | dev->net->sysfs_groups[0] = &cdc_ncm_sysfs_attr_group; | 852 | dev->net->sysfs_groups[0] = &cdc_ncm_sysfs_attr_group; |
825 | 853 | ||
854 | /* must handle MTU changes */ | ||
855 | dev->net->netdev_ops = &cdc_ncm_netdev_ops; | ||
856 | |||
826 | return 0; | 857 | return 0; |
827 | 858 | ||
828 | error2: | 859 | error2: |
@@ -1558,6 +1589,24 @@ static const struct usb_device_id cdc_devs[] = { | |||
1558 | .driver_info = (unsigned long) &wwan_info, | 1589 | .driver_info = (unsigned long) &wwan_info, |
1559 | }, | 1590 | }, |
1560 | 1591 | ||
1592 | /* DW5812 LTE Verizon Mobile Broadband Card | ||
1593 | * Unlike DW5550 this device requires FLAG_NOARP | ||
1594 | */ | ||
1595 | { USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x81bb, | ||
1596 | USB_CLASS_COMM, | ||
1597 | USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), | ||
1598 | .driver_info = (unsigned long)&wwan_noarp_info, | ||
1599 | }, | ||
1600 | |||
1601 | /* DW5813 LTE AT&T Mobile Broadband Card | ||
1602 | * Unlike DW5550 this device requires FLAG_NOARP | ||
1603 | */ | ||
1604 | { USB_DEVICE_AND_INTERFACE_INFO(0x413c, 0x81bc, | ||
1605 | USB_CLASS_COMM, | ||
1606 | USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE), | ||
1607 | .driver_info = (unsigned long)&wwan_noarp_info, | ||
1608 | }, | ||
1609 | |||
1561 | /* Dell branded MBM devices like DW5550 */ | 1610 | /* Dell branded MBM devices like DW5550 */ |
1562 | { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | 1611 | { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
1563 | | USB_DEVICE_ID_MATCH_VENDOR, | 1612 | | USB_DEVICE_ID_MATCH_VENDOR, |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 0ef4a5ad5557..ba21d072be31 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -117,12 +117,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
117 | kfree_skb(skb); | 117 | kfree_skb(skb); |
118 | goto drop; | 118 | goto drop; |
119 | } | 119 | } |
120 | /* don't change ip_summed == CHECKSUM_PARTIAL, as that | ||
121 | * will cause bad checksum on forwarded packets | ||
122 | */ | ||
123 | if (skb->ip_summed == CHECKSUM_NONE && | ||
124 | rcv->features & NETIF_F_RXCSUM) | ||
125 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
126 | 120 | ||
127 | if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) { | 121 | if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) { |
128 | struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats); | 122 | struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index bf88ec3a65fa..d9a4aee246a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -69,13 +69,19 @@ | |||
69 | #include "iwl-agn-hw.h" | 69 | #include "iwl-agn-hw.h" |
70 | 70 | ||
71 | /* Highest firmware API version supported */ | 71 | /* Highest firmware API version supported */ |
72 | #define IWL7260_UCODE_API_MAX 19 | 72 | #define IWL7260_UCODE_API_MAX 17 |
73 | #define IWL7265_UCODE_API_MAX 19 | ||
74 | #define IWL7265D_UCODE_API_MAX 19 | ||
73 | 75 | ||
74 | /* Oldest version we won't warn about */ | 76 | /* Oldest version we won't warn about */ |
75 | #define IWL7260_UCODE_API_OK 13 | 77 | #define IWL7260_UCODE_API_OK 13 |
78 | #define IWL7265_UCODE_API_OK 13 | ||
79 | #define IWL7265D_UCODE_API_OK 13 | ||
76 | 80 | ||
77 | /* Lowest firmware API version supported */ | 81 | /* Lowest firmware API version supported */ |
78 | #define IWL7260_UCODE_API_MIN 13 | 82 | #define IWL7260_UCODE_API_MIN 13 |
83 | #define IWL7265_UCODE_API_MIN 13 | ||
84 | #define IWL7265D_UCODE_API_MIN 13 | ||
79 | 85 | ||
80 | /* NVM versions */ | 86 | /* NVM versions */ |
81 | #define IWL7260_NVM_VERSION 0x0a1d | 87 | #define IWL7260_NVM_VERSION 0x0a1d |
@@ -149,10 +155,7 @@ static const struct iwl_ht_params iwl7000_ht_params = { | |||
149 | .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), | 155 | .ht40_bands = BIT(IEEE80211_BAND_2GHZ) | BIT(IEEE80211_BAND_5GHZ), |
150 | }; | 156 | }; |
151 | 157 | ||
152 | #define IWL_DEVICE_7000 \ | 158 | #define IWL_DEVICE_7000_COMMON \ |
153 | .ucode_api_max = IWL7260_UCODE_API_MAX, \ | ||
154 | .ucode_api_ok = IWL7260_UCODE_API_OK, \ | ||
155 | .ucode_api_min = IWL7260_UCODE_API_MIN, \ | ||
156 | .device_family = IWL_DEVICE_FAMILY_7000, \ | 159 | .device_family = IWL_DEVICE_FAMILY_7000, \ |
157 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | 160 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
158 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | 161 | .max_data_size = IWL60_RTC_DATA_SIZE, \ |
@@ -163,6 +166,24 @@ static const struct iwl_ht_params iwl7000_ht_params = { | |||
163 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \ | 166 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \ |
164 | .dccm_offset = IWL7000_DCCM_OFFSET | 167 | .dccm_offset = IWL7000_DCCM_OFFSET |
165 | 168 | ||
169 | #define IWL_DEVICE_7000 \ | ||
170 | IWL_DEVICE_7000_COMMON, \ | ||
171 | .ucode_api_max = IWL7260_UCODE_API_MAX, \ | ||
172 | .ucode_api_ok = IWL7260_UCODE_API_OK, \ | ||
173 | .ucode_api_min = IWL7260_UCODE_API_MIN | ||
174 | |||
175 | #define IWL_DEVICE_7005 \ | ||
176 | IWL_DEVICE_7000_COMMON, \ | ||
177 | .ucode_api_max = IWL7265_UCODE_API_MAX, \ | ||
178 | .ucode_api_ok = IWL7265_UCODE_API_OK, \ | ||
179 | .ucode_api_min = IWL7265_UCODE_API_MIN | ||
180 | |||
181 | #define IWL_DEVICE_7005D \ | ||
182 | IWL_DEVICE_7000_COMMON, \ | ||
183 | .ucode_api_max = IWL7265D_UCODE_API_MAX, \ | ||
184 | .ucode_api_ok = IWL7265D_UCODE_API_OK, \ | ||
185 | .ucode_api_min = IWL7265D_UCODE_API_MIN | ||
186 | |||
166 | const struct iwl_cfg iwl7260_2ac_cfg = { | 187 | const struct iwl_cfg iwl7260_2ac_cfg = { |
167 | .name = "Intel(R) Dual Band Wireless AC 7260", | 188 | .name = "Intel(R) Dual Band Wireless AC 7260", |
168 | .fw_name_pre = IWL7260_FW_PRE, | 189 | .fw_name_pre = IWL7260_FW_PRE, |
@@ -266,7 +287,7 @@ static const struct iwl_ht_params iwl7265_ht_params = { | |||
266 | const struct iwl_cfg iwl3165_2ac_cfg = { | 287 | const struct iwl_cfg iwl3165_2ac_cfg = { |
267 | .name = "Intel(R) Dual Band Wireless AC 3165", | 288 | .name = "Intel(R) Dual Band Wireless AC 3165", |
268 | .fw_name_pre = IWL7265D_FW_PRE, | 289 | .fw_name_pre = IWL7265D_FW_PRE, |
269 | IWL_DEVICE_7000, | 290 | IWL_DEVICE_7005D, |
270 | .ht_params = &iwl7000_ht_params, | 291 | .ht_params = &iwl7000_ht_params, |
271 | .nvm_ver = IWL3165_NVM_VERSION, | 292 | .nvm_ver = IWL3165_NVM_VERSION, |
272 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, | 293 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, |
@@ -277,7 +298,7 @@ const struct iwl_cfg iwl3165_2ac_cfg = { | |||
277 | const struct iwl_cfg iwl7265_2ac_cfg = { | 298 | const struct iwl_cfg iwl7265_2ac_cfg = { |
278 | .name = "Intel(R) Dual Band Wireless AC 7265", | 299 | .name = "Intel(R) Dual Band Wireless AC 7265", |
279 | .fw_name_pre = IWL7265_FW_PRE, | 300 | .fw_name_pre = IWL7265_FW_PRE, |
280 | IWL_DEVICE_7000, | 301 | IWL_DEVICE_7005, |
281 | .ht_params = &iwl7265_ht_params, | 302 | .ht_params = &iwl7265_ht_params, |
282 | .nvm_ver = IWL7265_NVM_VERSION, | 303 | .nvm_ver = IWL7265_NVM_VERSION, |
283 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 304 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
@@ -288,7 +309,7 @@ const struct iwl_cfg iwl7265_2ac_cfg = { | |||
288 | const struct iwl_cfg iwl7265_2n_cfg = { | 309 | const struct iwl_cfg iwl7265_2n_cfg = { |
289 | .name = "Intel(R) Dual Band Wireless N 7265", | 310 | .name = "Intel(R) Dual Band Wireless N 7265", |
290 | .fw_name_pre = IWL7265_FW_PRE, | 311 | .fw_name_pre = IWL7265_FW_PRE, |
291 | IWL_DEVICE_7000, | 312 | IWL_DEVICE_7005, |
292 | .ht_params = &iwl7265_ht_params, | 313 | .ht_params = &iwl7265_ht_params, |
293 | .nvm_ver = IWL7265_NVM_VERSION, | 314 | .nvm_ver = IWL7265_NVM_VERSION, |
294 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 315 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
@@ -299,7 +320,7 @@ const struct iwl_cfg iwl7265_2n_cfg = { | |||
299 | const struct iwl_cfg iwl7265_n_cfg = { | 320 | const struct iwl_cfg iwl7265_n_cfg = { |
300 | .name = "Intel(R) Wireless N 7265", | 321 | .name = "Intel(R) Wireless N 7265", |
301 | .fw_name_pre = IWL7265_FW_PRE, | 322 | .fw_name_pre = IWL7265_FW_PRE, |
302 | IWL_DEVICE_7000, | 323 | IWL_DEVICE_7005, |
303 | .ht_params = &iwl7265_ht_params, | 324 | .ht_params = &iwl7265_ht_params, |
304 | .nvm_ver = IWL7265_NVM_VERSION, | 325 | .nvm_ver = IWL7265_NVM_VERSION, |
305 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 326 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
@@ -310,7 +331,7 @@ const struct iwl_cfg iwl7265_n_cfg = { | |||
310 | const struct iwl_cfg iwl7265d_2ac_cfg = { | 331 | const struct iwl_cfg iwl7265d_2ac_cfg = { |
311 | .name = "Intel(R) Dual Band Wireless AC 7265", | 332 | .name = "Intel(R) Dual Band Wireless AC 7265", |
312 | .fw_name_pre = IWL7265D_FW_PRE, | 333 | .fw_name_pre = IWL7265D_FW_PRE, |
313 | IWL_DEVICE_7000, | 334 | IWL_DEVICE_7005D, |
314 | .ht_params = &iwl7265_ht_params, | 335 | .ht_params = &iwl7265_ht_params, |
315 | .nvm_ver = IWL7265D_NVM_VERSION, | 336 | .nvm_ver = IWL7265D_NVM_VERSION, |
316 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 337 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
@@ -321,7 +342,7 @@ const struct iwl_cfg iwl7265d_2ac_cfg = { | |||
321 | const struct iwl_cfg iwl7265d_2n_cfg = { | 342 | const struct iwl_cfg iwl7265d_2n_cfg = { |
322 | .name = "Intel(R) Dual Band Wireless N 7265", | 343 | .name = "Intel(R) Dual Band Wireless N 7265", |
323 | .fw_name_pre = IWL7265D_FW_PRE, | 344 | .fw_name_pre = IWL7265D_FW_PRE, |
324 | IWL_DEVICE_7000, | 345 | IWL_DEVICE_7005D, |
325 | .ht_params = &iwl7265_ht_params, | 346 | .ht_params = &iwl7265_ht_params, |
326 | .nvm_ver = IWL7265D_NVM_VERSION, | 347 | .nvm_ver = IWL7265D_NVM_VERSION, |
327 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 348 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
@@ -332,7 +353,7 @@ const struct iwl_cfg iwl7265d_2n_cfg = { | |||
332 | const struct iwl_cfg iwl7265d_n_cfg = { | 353 | const struct iwl_cfg iwl7265d_n_cfg = { |
333 | .name = "Intel(R) Wireless N 7265", | 354 | .name = "Intel(R) Wireless N 7265", |
334 | .fw_name_pre = IWL7265D_FW_PRE, | 355 | .fw_name_pre = IWL7265D_FW_PRE, |
335 | IWL_DEVICE_7000, | 356 | IWL_DEVICE_7005D, |
336 | .ht_params = &iwl7265_ht_params, | 357 | .ht_params = &iwl7265_ht_params, |
337 | .nvm_ver = IWL7265D_NVM_VERSION, | 358 | .nvm_ver = IWL7265D_NVM_VERSION, |
338 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, | 359 | .nvm_calib_ver = IWL7265_TX_POWER_VERSION, |
@@ -342,5 +363,5 @@ const struct iwl_cfg iwl7265d_n_cfg = { | |||
342 | 363 | ||
343 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 364 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
344 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 365 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
345 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 366 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7265_UCODE_API_OK)); |
346 | MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 367 | MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7265D_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 354acbde088e..2b976b110207 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -1222,8 +1222,8 @@ static u8 iwl_mvm_get_key_sta_id(struct iwl_mvm *mvm, | |||
1222 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { | 1222 | mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { |
1223 | u8 sta_id = mvmvif->ap_sta_id; | 1223 | u8 sta_id = mvmvif->ap_sta_id; |
1224 | 1224 | ||
1225 | sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], | 1225 | sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id], |
1226 | lockdep_is_held(&mvm->mutex)); | 1226 | lockdep_is_held(&mvm->mutex)); |
1227 | /* | 1227 | /* |
1228 | * It is possible that the 'sta' parameter is NULL, | 1228 | * It is possible that the 'sta' parameter is NULL, |
1229 | * for example when a GTK is removed - the sta_id will then | 1229 | * for example when a GTK is removed - the sta_id will then |
@@ -1590,14 +1590,15 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, | |||
1590 | u16 *phase1key) | 1590 | u16 *phase1key) |
1591 | { | 1591 | { |
1592 | struct iwl_mvm_sta *mvm_sta; | 1592 | struct iwl_mvm_sta *mvm_sta; |
1593 | u8 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); | 1593 | u8 sta_id; |
1594 | bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); | 1594 | bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); |
1595 | 1595 | ||
1596 | if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT)) | ||
1597 | return; | ||
1598 | |||
1599 | rcu_read_lock(); | 1596 | rcu_read_lock(); |
1600 | 1597 | ||
1598 | sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); | ||
1599 | if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT)) | ||
1600 | goto unlock; | ||
1601 | |||
1601 | if (!sta) { | 1602 | if (!sta) { |
1602 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); | 1603 | sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); |
1603 | if (WARN_ON(IS_ERR_OR_NULL(sta))) { | 1604 | if (WARN_ON(IS_ERR_OR_NULL(sta))) { |
@@ -1609,6 +1610,8 @@ void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, | |||
1609 | mvm_sta = iwl_mvm_sta_from_mac80211(sta); | 1610 | mvm_sta = iwl_mvm_sta_from_mac80211(sta); |
1610 | iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, | 1611 | iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, |
1611 | iv32, phase1key, CMD_ASYNC, keyconf->hw_key_idx); | 1612 | iv32, phase1key, CMD_ASYNC, keyconf->hw_key_idx); |
1613 | |||
1614 | unlock: | ||
1612 | rcu_read_unlock(); | 1615 | rcu_read_unlock(); |
1613 | } | 1616 | } |
1614 | 1617 | ||
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index 1f6526c76ee8..3a375d07d0dc 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h | |||
@@ -138,6 +138,7 @@ struct cdc_ncm_ctx { | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | u8 cdc_ncm_select_altsetting(struct usb_interface *intf); | 140 | u8 cdc_ncm_select_altsetting(struct usb_interface *intf); |
141 | int cdc_ncm_change_mtu(struct net_device *net, int new_mtu); | ||
141 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); | 142 | int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags); |
142 | void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); | 143 | void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); |
143 | struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); | 144 | struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index eb9240c458fa..51282f579760 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -519,7 +519,8 @@ int rhashtable_walk_init(struct rhashtable *ht, struct rhashtable_iter *iter) | |||
519 | return -ENOMEM; | 519 | return -ENOMEM; |
520 | 520 | ||
521 | spin_lock(&ht->lock); | 521 | spin_lock(&ht->lock); |
522 | iter->walker->tbl = rht_dereference(ht->tbl, ht); | 522 | iter->walker->tbl = |
523 | rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock)); | ||
523 | list_add(&iter->walker->list, &iter->walker->tbl->walkers); | 524 | list_add(&iter->walker->list, &iter->walker->tbl->walkers); |
524 | spin_unlock(&ht->lock); | 525 | spin_unlock(&ht->lock); |
525 | 526 | ||
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c index 5396ff08af32..12045dea276c 100644 --- a/net/bridge/br_stp_if.c +++ b/net/bridge/br_stp_if.c | |||
@@ -39,7 +39,7 @@ void br_init_port(struct net_bridge_port *p) | |||
39 | struct switchdev_attr attr = { | 39 | struct switchdev_attr attr = { |
40 | .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME, | 40 | .id = SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME, |
41 | .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER, | 41 | .flags = SWITCHDEV_F_SKIP_EOPNOTSUPP | SWITCHDEV_F_DEFER, |
42 | .u.ageing_time = p->br->ageing_time, | 42 | .u.ageing_time = jiffies_to_clock_t(p->br->ageing_time), |
43 | }; | 43 | }; |
44 | int err; | 44 | int err; |
45 | 45 | ||
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index f34c31defafe..a09fb0dec725 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -253,9 +253,6 @@ ipip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
253 | 253 | ||
254 | p.i_key = p.o_key = 0; | 254 | p.i_key = p.o_key = 0; |
255 | p.i_flags = p.o_flags = 0; | 255 | p.i_flags = p.o_flags = 0; |
256 | if (p.iph.ttl) | ||
257 | p.iph.frag_off |= htons(IP_DF); | ||
258 | |||
259 | err = ip_tunnel_ioctl(dev, &p, cmd); | 256 | err = ip_tunnel_ioctl(dev, &p, cmd); |
260 | if (err) | 257 | if (err) |
261 | return err; | 258 | return err; |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 1e0c3c835a63..7b0edb37a115 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -259,7 +259,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
259 | xfrm_dst_ifdown(dst, dev); | 259 | xfrm_dst_ifdown(dst, dev); |
260 | } | 260 | } |
261 | 261 | ||
262 | static struct dst_ops xfrm4_dst_ops = { | 262 | static struct dst_ops xfrm4_dst_ops_template = { |
263 | .family = AF_INET, | 263 | .family = AF_INET, |
264 | .gc = xfrm4_garbage_collect, | 264 | .gc = xfrm4_garbage_collect, |
265 | .update_pmtu = xfrm4_update_pmtu, | 265 | .update_pmtu = xfrm4_update_pmtu, |
@@ -273,7 +273,7 @@ static struct dst_ops xfrm4_dst_ops = { | |||
273 | 273 | ||
274 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { | 274 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { |
275 | .family = AF_INET, | 275 | .family = AF_INET, |
276 | .dst_ops = &xfrm4_dst_ops, | 276 | .dst_ops = &xfrm4_dst_ops_template, |
277 | .dst_lookup = xfrm4_dst_lookup, | 277 | .dst_lookup = xfrm4_dst_lookup, |
278 | .get_saddr = xfrm4_get_saddr, | 278 | .get_saddr = xfrm4_get_saddr, |
279 | .decode_session = _decode_session4, | 279 | .decode_session = _decode_session4, |
@@ -295,7 +295,7 @@ static struct ctl_table xfrm4_policy_table[] = { | |||
295 | { } | 295 | { } |
296 | }; | 296 | }; |
297 | 297 | ||
298 | static int __net_init xfrm4_net_init(struct net *net) | 298 | static int __net_init xfrm4_net_sysctl_init(struct net *net) |
299 | { | 299 | { |
300 | struct ctl_table *table; | 300 | struct ctl_table *table; |
301 | struct ctl_table_header *hdr; | 301 | struct ctl_table_header *hdr; |
@@ -323,7 +323,7 @@ err_alloc: | |||
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | 325 | ||
326 | static void __net_exit xfrm4_net_exit(struct net *net) | 326 | static void __net_exit xfrm4_net_sysctl_exit(struct net *net) |
327 | { | 327 | { |
328 | struct ctl_table *table; | 328 | struct ctl_table *table; |
329 | 329 | ||
@@ -335,12 +335,44 @@ static void __net_exit xfrm4_net_exit(struct net *net) | |||
335 | if (!net_eq(net, &init_net)) | 335 | if (!net_eq(net, &init_net)) |
336 | kfree(table); | 336 | kfree(table); |
337 | } | 337 | } |
338 | #else /* CONFIG_SYSCTL */ | ||
339 | static int inline xfrm4_net_sysctl_init(struct net *net) | ||
340 | { | ||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static void inline xfrm4_net_sysctl_exit(struct net *net) | ||
345 | { | ||
346 | } | ||
347 | #endif | ||
348 | |||
349 | static int __net_init xfrm4_net_init(struct net *net) | ||
350 | { | ||
351 | int ret; | ||
352 | |||
353 | memcpy(&net->xfrm.xfrm4_dst_ops, &xfrm4_dst_ops_template, | ||
354 | sizeof(xfrm4_dst_ops_template)); | ||
355 | ret = dst_entries_init(&net->xfrm.xfrm4_dst_ops); | ||
356 | if (ret) | ||
357 | return ret; | ||
358 | |||
359 | ret = xfrm4_net_sysctl_init(net); | ||
360 | if (ret) | ||
361 | dst_entries_destroy(&net->xfrm.xfrm4_dst_ops); | ||
362 | |||
363 | return ret; | ||
364 | } | ||
365 | |||
366 | static void __net_exit xfrm4_net_exit(struct net *net) | ||
367 | { | ||
368 | xfrm4_net_sysctl_exit(net); | ||
369 | dst_entries_destroy(&net->xfrm.xfrm4_dst_ops); | ||
370 | } | ||
338 | 371 | ||
339 | static struct pernet_operations __net_initdata xfrm4_net_ops = { | 372 | static struct pernet_operations __net_initdata xfrm4_net_ops = { |
340 | .init = xfrm4_net_init, | 373 | .init = xfrm4_net_init, |
341 | .exit = xfrm4_net_exit, | 374 | .exit = xfrm4_net_exit, |
342 | }; | 375 | }; |
343 | #endif | ||
344 | 376 | ||
345 | static void __init xfrm4_policy_init(void) | 377 | static void __init xfrm4_policy_init(void) |
346 | { | 378 | { |
@@ -349,13 +381,9 @@ static void __init xfrm4_policy_init(void) | |||
349 | 381 | ||
350 | void __init xfrm4_init(void) | 382 | void __init xfrm4_init(void) |
351 | { | 383 | { |
352 | dst_entries_init(&xfrm4_dst_ops); | ||
353 | |||
354 | xfrm4_state_init(); | 384 | xfrm4_state_init(); |
355 | xfrm4_policy_init(); | 385 | xfrm4_policy_init(); |
356 | xfrm4_protocol_init(); | 386 | xfrm4_protocol_init(); |
357 | #ifdef CONFIG_SYSCTL | ||
358 | register_pernet_subsys(&xfrm4_net_ops); | 387 | register_pernet_subsys(&xfrm4_net_ops); |
359 | #endif | ||
360 | } | 388 | } |
361 | 389 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 17f8e7ea133b..1f21087accab 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -5369,13 +5369,10 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write, | |||
5369 | goto out; | 5369 | goto out; |
5370 | } | 5370 | } |
5371 | 5371 | ||
5372 | if (!write) { | 5372 | err = snprintf(str, sizeof(str), "%pI6", &secret->secret); |
5373 | err = snprintf(str, sizeof(str), "%pI6", | 5373 | if (err >= sizeof(str)) { |
5374 | &secret->secret); | 5374 | err = -EIO; |
5375 | if (err >= sizeof(str)) { | 5375 | goto out; |
5376 | err = -EIO; | ||
5377 | goto out; | ||
5378 | } | ||
5379 | } | 5376 | } |
5380 | 5377 | ||
5381 | err = proc_dostring(&lctl, write, buffer, lenp, ppos); | 5378 | err = proc_dostring(&lctl, write, buffer, lenp, ppos); |
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index 882124ebb438..a8f6986dcbe5 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -552,7 +552,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh) | |||
552 | 552 | ||
553 | rcu_read_lock(); | 553 | rcu_read_lock(); |
554 | p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index); | 554 | p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index); |
555 | if (p && ip6addrlbl_hold(p)) | 555 | if (p && !ip6addrlbl_hold(p)) |
556 | p = NULL; | 556 | p = NULL; |
557 | lseq = ip6addrlbl_table.seq; | 557 | lseq = ip6addrlbl_table.seq; |
558 | rcu_read_unlock(); | 558 | rcu_read_unlock(); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index d6161e1c48c8..84afb9a77278 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1183,7 +1183,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1183 | */ | 1183 | */ |
1184 | if (!in6_dev->cnf.accept_ra_from_local && | 1184 | if (!in6_dev->cnf.accept_ra_from_local && |
1185 | ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, | 1185 | ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, |
1186 | NULL, 0)) { | 1186 | in6_dev->dev, 0)) { |
1187 | ND_PRINTK(2, info, | 1187 | ND_PRINTK(2, info, |
1188 | "RA from local address detected on dev: %s: default router ignored\n", | 1188 | "RA from local address detected on dev: %s: default router ignored\n", |
1189 | skb->dev->name); | 1189 | skb->dev->name); |
@@ -1337,7 +1337,7 @@ skip_linkparms: | |||
1337 | #ifdef CONFIG_IPV6_ROUTE_INFO | 1337 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1338 | if (!in6_dev->cnf.accept_ra_from_local && | 1338 | if (!in6_dev->cnf.accept_ra_from_local && |
1339 | ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, | 1339 | ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, |
1340 | NULL, 0)) { | 1340 | in6_dev->dev, 0)) { |
1341 | ND_PRINTK(2, info, | 1341 | ND_PRINTK(2, info, |
1342 | "RA from local address detected on dev: %s: router info ignored.\n", | 1342 | "RA from local address detected on dev: %s: router info ignored.\n", |
1343 | skb->dev->name); | 1343 | skb->dev->name); |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 5643423fe67a..c074771a10f7 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -279,7 +279,7 @@ static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
279 | xfrm_dst_ifdown(dst, dev); | 279 | xfrm_dst_ifdown(dst, dev); |
280 | } | 280 | } |
281 | 281 | ||
282 | static struct dst_ops xfrm6_dst_ops = { | 282 | static struct dst_ops xfrm6_dst_ops_template = { |
283 | .family = AF_INET6, | 283 | .family = AF_INET6, |
284 | .gc = xfrm6_garbage_collect, | 284 | .gc = xfrm6_garbage_collect, |
285 | .update_pmtu = xfrm6_update_pmtu, | 285 | .update_pmtu = xfrm6_update_pmtu, |
@@ -293,7 +293,7 @@ static struct dst_ops xfrm6_dst_ops = { | |||
293 | 293 | ||
294 | static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { | 294 | static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { |
295 | .family = AF_INET6, | 295 | .family = AF_INET6, |
296 | .dst_ops = &xfrm6_dst_ops, | 296 | .dst_ops = &xfrm6_dst_ops_template, |
297 | .dst_lookup = xfrm6_dst_lookup, | 297 | .dst_lookup = xfrm6_dst_lookup, |
298 | .get_saddr = xfrm6_get_saddr, | 298 | .get_saddr = xfrm6_get_saddr, |
299 | .decode_session = _decode_session6, | 299 | .decode_session = _decode_session6, |
@@ -325,7 +325,7 @@ static struct ctl_table xfrm6_policy_table[] = { | |||
325 | { } | 325 | { } |
326 | }; | 326 | }; |
327 | 327 | ||
328 | static int __net_init xfrm6_net_init(struct net *net) | 328 | static int __net_init xfrm6_net_sysctl_init(struct net *net) |
329 | { | 329 | { |
330 | struct ctl_table *table; | 330 | struct ctl_table *table; |
331 | struct ctl_table_header *hdr; | 331 | struct ctl_table_header *hdr; |
@@ -353,7 +353,7 @@ err_alloc: | |||
353 | return -ENOMEM; | 353 | return -ENOMEM; |
354 | } | 354 | } |
355 | 355 | ||
356 | static void __net_exit xfrm6_net_exit(struct net *net) | 356 | static void __net_exit xfrm6_net_sysctl_exit(struct net *net) |
357 | { | 357 | { |
358 | struct ctl_table *table; | 358 | struct ctl_table *table; |
359 | 359 | ||
@@ -365,24 +365,52 @@ static void __net_exit xfrm6_net_exit(struct net *net) | |||
365 | if (!net_eq(net, &init_net)) | 365 | if (!net_eq(net, &init_net)) |
366 | kfree(table); | 366 | kfree(table); |
367 | } | 367 | } |
368 | #else /* CONFIG_SYSCTL */ | ||
369 | static int inline xfrm6_net_sysctl_init(struct net *net) | ||
370 | { | ||
371 | return 0; | ||
372 | } | ||
373 | |||
374 | static void inline xfrm6_net_sysctl_exit(struct net *net) | ||
375 | { | ||
376 | } | ||
377 | #endif | ||
378 | |||
379 | static int __net_init xfrm6_net_init(struct net *net) | ||
380 | { | ||
381 | int ret; | ||
382 | |||
383 | memcpy(&net->xfrm.xfrm6_dst_ops, &xfrm6_dst_ops_template, | ||
384 | sizeof(xfrm6_dst_ops_template)); | ||
385 | ret = dst_entries_init(&net->xfrm.xfrm6_dst_ops); | ||
386 | if (ret) | ||
387 | return ret; | ||
388 | |||
389 | ret = xfrm6_net_sysctl_init(net); | ||
390 | if (ret) | ||
391 | dst_entries_destroy(&net->xfrm.xfrm6_dst_ops); | ||
392 | |||
393 | return ret; | ||
394 | } | ||
395 | |||
396 | static void __net_exit xfrm6_net_exit(struct net *net) | ||
397 | { | ||
398 | xfrm6_net_sysctl_exit(net); | ||
399 | dst_entries_destroy(&net->xfrm.xfrm6_dst_ops); | ||
400 | } | ||
368 | 401 | ||
369 | static struct pernet_operations xfrm6_net_ops = { | 402 | static struct pernet_operations xfrm6_net_ops = { |
370 | .init = xfrm6_net_init, | 403 | .init = xfrm6_net_init, |
371 | .exit = xfrm6_net_exit, | 404 | .exit = xfrm6_net_exit, |
372 | }; | 405 | }; |
373 | #endif | ||
374 | 406 | ||
375 | int __init xfrm6_init(void) | 407 | int __init xfrm6_init(void) |
376 | { | 408 | { |
377 | int ret; | 409 | int ret; |
378 | 410 | ||
379 | dst_entries_init(&xfrm6_dst_ops); | ||
380 | |||
381 | ret = xfrm6_policy_init(); | 411 | ret = xfrm6_policy_init(); |
382 | if (ret) { | 412 | if (ret) |
383 | dst_entries_destroy(&xfrm6_dst_ops); | ||
384 | goto out; | 413 | goto out; |
385 | } | ||
386 | ret = xfrm6_state_init(); | 414 | ret = xfrm6_state_init(); |
387 | if (ret) | 415 | if (ret) |
388 | goto out_policy; | 416 | goto out_policy; |
@@ -391,9 +419,7 @@ int __init xfrm6_init(void) | |||
391 | if (ret) | 419 | if (ret) |
392 | goto out_state; | 420 | goto out_state; |
393 | 421 | ||
394 | #ifdef CONFIG_SYSCTL | ||
395 | register_pernet_subsys(&xfrm6_net_ops); | 422 | register_pernet_subsys(&xfrm6_net_ops); |
396 | #endif | ||
397 | out: | 423 | out: |
398 | return ret; | 424 | return ret; |
399 | out_state: | 425 | out_state: |
@@ -405,11 +431,8 @@ out_policy: | |||
405 | 431 | ||
406 | void xfrm6_fini(void) | 432 | void xfrm6_fini(void) |
407 | { | 433 | { |
408 | #ifdef CONFIG_SYSCTL | ||
409 | unregister_pernet_subsys(&xfrm6_net_ops); | 434 | unregister_pernet_subsys(&xfrm6_net_ops); |
410 | #endif | ||
411 | xfrm6_protocol_fini(); | 435 | xfrm6_protocol_fini(); |
412 | xfrm6_policy_fini(); | 436 | xfrm6_policy_fini(); |
413 | xfrm6_state_fini(); | 437 | xfrm6_state_fini(); |
414 | dst_entries_destroy(&xfrm6_dst_ops); | ||
415 | } | 438 | } |
diff --git a/net/netfilter/nf_tables_netdev.c b/net/netfilter/nf_tables_netdev.c index 7b9c053ba750..edb3502f2016 100644 --- a/net/netfilter/nf_tables_netdev.c +++ b/net/netfilter/nf_tables_netdev.c | |||
@@ -94,7 +94,7 @@ nft_do_chain_netdev(void *priv, struct sk_buff *skb, | |||
94 | { | 94 | { |
95 | struct nft_pktinfo pkt; | 95 | struct nft_pktinfo pkt; |
96 | 96 | ||
97 | switch (eth_hdr(skb)->h_proto) { | 97 | switch (skb->protocol) { |
98 | case htons(ETH_P_IP): | 98 | case htons(ETH_P_IP): |
99 | nft_netdev_set_pktinfo_ipv4(&pkt, skb, state); | 99 | nft_netdev_set_pktinfo_ipv4(&pkt, skb, state); |
100 | break; | 100 | break; |
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c index 8cbca3432f90..939921532764 100644 --- a/net/netfilter/nft_ct.c +++ b/net/netfilter/nft_ct.c | |||
@@ -366,6 +366,7 @@ static int nft_ct_get_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
366 | goto nla_put_failure; | 366 | goto nla_put_failure; |
367 | 367 | ||
368 | switch (priv->key) { | 368 | switch (priv->key) { |
369 | case NFT_CT_L3PROTOCOL: | ||
369 | case NFT_CT_PROTOCOL: | 370 | case NFT_CT_PROTOCOL: |
370 | case NFT_CT_SRC: | 371 | case NFT_CT_SRC: |
371 | case NFT_CT_DST: | 372 | case NFT_CT_DST: |
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index 3e8892216f94..e004067ec24a 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -698,6 +698,10 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, | |||
698 | OVS_NLERR(log, "Failed to allocate conntrack template"); | 698 | OVS_NLERR(log, "Failed to allocate conntrack template"); |
699 | return -ENOMEM; | 699 | return -ENOMEM; |
700 | } | 700 | } |
701 | |||
702 | __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); | ||
703 | nf_conntrack_get(&ct_info.ct->ct_general); | ||
704 | |||
701 | if (helper) { | 705 | if (helper) { |
702 | err = ovs_ct_add_helper(&ct_info, helper, key, log); | 706 | err = ovs_ct_add_helper(&ct_info, helper, key, log); |
703 | if (err) | 707 | if (err) |
@@ -709,8 +713,6 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, | |||
709 | if (err) | 713 | if (err) |
710 | goto err_free_ct; | 714 | goto err_free_ct; |
711 | 715 | ||
712 | __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); | ||
713 | nf_conntrack_get(&ct_info.ct->ct_general); | ||
714 | return 0; | 716 | return 0; |
715 | err_free_ct: | 717 | err_free_ct: |
716 | __ovs_ct_free_action(&ct_info); | 718 | __ovs_ct_free_action(&ct_info); |
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 907d6fd28ede..d1bd4a45ca2d 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -2434,7 +2434,10 @@ static int set_action_to_attr(const struct nlattr *a, struct sk_buff *skb) | |||
2434 | if (!start) | 2434 | if (!start) |
2435 | return -EMSGSIZE; | 2435 | return -EMSGSIZE; |
2436 | 2436 | ||
2437 | err = ovs_nla_put_tunnel_info(skb, tun_info); | 2437 | err = ip_tun_to_nlattr(skb, &tun_info->key, |
2438 | ip_tunnel_info_opts(tun_info), | ||
2439 | tun_info->options_len, | ||
2440 | ip_tunnel_info_af(tun_info)); | ||
2438 | if (err) | 2441 | if (err) |
2439 | return err; | 2442 | return err; |
2440 | nla_nest_end(skb, start); | 2443 | nla_nest_end(skb, start); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index cd34a4a34065..22c2bf367d7e 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -4829,7 +4829,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort( | |||
4829 | 4829 | ||
4830 | retval = SCTP_DISPOSITION_CONSUME; | 4830 | retval = SCTP_DISPOSITION_CONSUME; |
4831 | 4831 | ||
4832 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); | 4832 | if (abort) |
4833 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); | ||
4833 | 4834 | ||
4834 | /* Even if we can't send the ABORT due to low memory delete the | 4835 | /* Even if we can't send the ABORT due to low memory delete the |
4835 | * TCB. This is a departure from our typical NOMEM handling. | 4836 | * TCB. This is a departure from our typical NOMEM handling. |
@@ -4966,7 +4967,8 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort( | |||
4966 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); | 4967 | SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); |
4967 | retval = SCTP_DISPOSITION_CONSUME; | 4968 | retval = SCTP_DISPOSITION_CONSUME; |
4968 | 4969 | ||
4969 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); | 4970 | if (abort) |
4971 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); | ||
4970 | 4972 | ||
4971 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | 4973 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, |
4972 | SCTP_STATE(SCTP_STATE_CLOSED)); | 4974 | SCTP_STATE(SCTP_STATE_CLOSED)); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 9b6cc6de80d8..ef1d90fdc773 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -1301,8 +1301,9 @@ static int __sctp_setsockopt_connectx(struct sock *sk, | |||
1301 | int addrs_size, | 1301 | int addrs_size, |
1302 | sctp_assoc_t *assoc_id) | 1302 | sctp_assoc_t *assoc_id) |
1303 | { | 1303 | { |
1304 | int err = 0; | ||
1305 | struct sockaddr *kaddrs; | 1304 | struct sockaddr *kaddrs; |
1305 | gfp_t gfp = GFP_KERNEL; | ||
1306 | int err = 0; | ||
1306 | 1307 | ||
1307 | pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", | 1308 | pr_debug("%s: sk:%p addrs:%p addrs_size:%d\n", |
1308 | __func__, sk, addrs, addrs_size); | 1309 | __func__, sk, addrs, addrs_size); |
@@ -1315,7 +1316,9 @@ static int __sctp_setsockopt_connectx(struct sock *sk, | |||
1315 | return -EFAULT; | 1316 | return -EFAULT; |
1316 | 1317 | ||
1317 | /* Alloc space for the address array in kernel memory. */ | 1318 | /* Alloc space for the address array in kernel memory. */ |
1318 | kaddrs = kmalloc(addrs_size, GFP_KERNEL); | 1319 | if (sk->sk_socket->file) |
1320 | gfp = GFP_USER | __GFP_NOWARN; | ||
1321 | kaddrs = kmalloc(addrs_size, gfp); | ||
1319 | if (unlikely(!kaddrs)) | 1322 | if (unlikely(!kaddrs)) |
1320 | return -ENOMEM; | 1323 | return -ENOMEM; |
1321 | 1324 | ||
@@ -1513,8 +1516,7 @@ static void sctp_close(struct sock *sk, long timeout) | |||
1513 | struct sctp_chunk *chunk; | 1516 | struct sctp_chunk *chunk; |
1514 | 1517 | ||
1515 | chunk = sctp_make_abort_user(asoc, NULL, 0); | 1518 | chunk = sctp_make_abort_user(asoc, NULL, 0); |
1516 | if (chunk) | 1519 | sctp_primitive_ABORT(net, asoc, chunk); |
1517 | sctp_primitive_ABORT(net, asoc, chunk); | ||
1518 | } else | 1520 | } else |
1519 | sctp_primitive_SHUTDOWN(net, asoc, NULL); | 1521 | sctp_primitive_SHUTDOWN(net, asoc, NULL); |
1520 | } | 1522 | } |
@@ -5773,7 +5775,7 @@ static int sctp_getsockopt_assoc_ids(struct sock *sk, int len, | |||
5773 | 5775 | ||
5774 | len = sizeof(struct sctp_assoc_ids) + sizeof(sctp_assoc_t) * num; | 5776 | len = sizeof(struct sctp_assoc_ids) + sizeof(sctp_assoc_t) * num; |
5775 | 5777 | ||
5776 | ids = kmalloc(len, GFP_KERNEL); | 5778 | ids = kmalloc(len, GFP_USER | __GFP_NOWARN); |
5777 | if (unlikely(!ids)) | 5779 | if (unlikely(!ids)) |
5778 | return -ENOMEM; | 5780 | return -ENOMEM; |
5779 | 5781 | ||
@@ -7199,6 +7201,8 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, | |||
7199 | 7201 | ||
7200 | if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) | 7202 | if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) |
7201 | net_enable_timestamp(); | 7203 | net_enable_timestamp(); |
7204 | |||
7205 | security_sk_clone(sk, newsk); | ||
7202 | } | 7206 | } |
7203 | 7207 | ||
7204 | static inline void sctp_copy_descendant(struct sock *sk_to, | 7208 | static inline void sctp_copy_descendant(struct sock *sk_to, |
diff --git a/net/socket.c b/net/socket.c index 29822d6dd91e..d730ef9dfbf0 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -257,6 +257,7 @@ static struct inode *sock_alloc_inode(struct super_block *sb) | |||
257 | } | 257 | } |
258 | init_waitqueue_head(&wq->wait); | 258 | init_waitqueue_head(&wq->wait); |
259 | wq->fasync_list = NULL; | 259 | wq->fasync_list = NULL; |
260 | wq->flags = 0; | ||
260 | RCU_INIT_POINTER(ei->socket.wq, wq); | 261 | RCU_INIT_POINTER(ei->socket.wq, wq); |
261 | 262 | ||
262 | ei->socket.state = SS_UNCONNECTED; | 263 | ei->socket.state = SS_UNCONNECTED; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 948fa5560de5..b5e665b3cfb0 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2826,7 +2826,6 @@ static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, | |||
2826 | 2826 | ||
2827 | int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | 2827 | int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) |
2828 | { | 2828 | { |
2829 | struct net *net; | ||
2830 | int err = 0; | 2829 | int err = 0; |
2831 | if (unlikely(afinfo == NULL)) | 2830 | if (unlikely(afinfo == NULL)) |
2832 | return -EINVAL; | 2831 | return -EINVAL; |
@@ -2857,26 +2856,6 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
2857 | } | 2856 | } |
2858 | spin_unlock(&xfrm_policy_afinfo_lock); | 2857 | spin_unlock(&xfrm_policy_afinfo_lock); |
2859 | 2858 | ||
2860 | rtnl_lock(); | ||
2861 | for_each_net(net) { | ||
2862 | struct dst_ops *xfrm_dst_ops; | ||
2863 | |||
2864 | switch (afinfo->family) { | ||
2865 | case AF_INET: | ||
2866 | xfrm_dst_ops = &net->xfrm.xfrm4_dst_ops; | ||
2867 | break; | ||
2868 | #if IS_ENABLED(CONFIG_IPV6) | ||
2869 | case AF_INET6: | ||
2870 | xfrm_dst_ops = &net->xfrm.xfrm6_dst_ops; | ||
2871 | break; | ||
2872 | #endif | ||
2873 | default: | ||
2874 | BUG(); | ||
2875 | } | ||
2876 | *xfrm_dst_ops = *afinfo->dst_ops; | ||
2877 | } | ||
2878 | rtnl_unlock(); | ||
2879 | |||
2880 | return err; | 2859 | return err; |
2881 | } | 2860 | } |
2882 | EXPORT_SYMBOL(xfrm_policy_register_afinfo); | 2861 | EXPORT_SYMBOL(xfrm_policy_register_afinfo); |
@@ -2912,22 +2891,6 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
2912 | } | 2891 | } |
2913 | EXPORT_SYMBOL(xfrm_policy_unregister_afinfo); | 2892 | EXPORT_SYMBOL(xfrm_policy_unregister_afinfo); |
2914 | 2893 | ||
2915 | static void __net_init xfrm_dst_ops_init(struct net *net) | ||
2916 | { | ||
2917 | struct xfrm_policy_afinfo *afinfo; | ||
2918 | |||
2919 | rcu_read_lock(); | ||
2920 | afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]); | ||
2921 | if (afinfo) | ||
2922 | net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops; | ||
2923 | #if IS_ENABLED(CONFIG_IPV6) | ||
2924 | afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET6]); | ||
2925 | if (afinfo) | ||
2926 | net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops; | ||
2927 | #endif | ||
2928 | rcu_read_unlock(); | ||
2929 | } | ||
2930 | |||
2931 | static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) | 2894 | static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) |
2932 | { | 2895 | { |
2933 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); | 2896 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
@@ -3076,7 +3039,6 @@ static int __net_init xfrm_net_init(struct net *net) | |||
3076 | rv = xfrm_policy_init(net); | 3039 | rv = xfrm_policy_init(net); |
3077 | if (rv < 0) | 3040 | if (rv < 0) |
3078 | goto out_policy; | 3041 | goto out_policy; |
3079 | xfrm_dst_ops_init(net); | ||
3080 | rv = xfrm_sysctl_init(net); | 3042 | rv = xfrm_sysctl_init(net); |
3081 | if (rv < 0) | 3043 | if (rv < 0) |
3082 | goto out_sysctl; | 3044 | goto out_sysctl; |