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

Configure Feed

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

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

Pull networking fixes from David Miller:

1) Fix BUG when decrypting empty packets in mac80211, from Ronald Wahl.

2) nf_nat_range is not fully initialized and this is copied back to
userspace, from Daniel Borkmann.

3) Fix read past end of b uffer in netfilter ipset, also from Dan
Carpenter.

4) Signed integer overflow in ipv4 address mask creation helper
inet_make_mask(), from Vincent BENAYOUN.

5) VXLAN, be2net, mlx4_en, and qlcnic need ->ndo_gso_check() methods to
properly describe the device's capabilities, from Joe Stringer.

6) Fix memory leaks and checksum miscalculations in openvswitch, from
Pravin B SHelar and Jesse Gross.

7) FIB rules passes back ambiguous error code for unreachable routes,
making behavior confusing for userspace. Fix from Panu Matilainen.

8) ieee802154fake_probe() doesn't release resources properly on error,
from Alexey Khoroshilov.

9) Fix skb_over_panic in add_grhead(), from Daniel Borkmann.

10) Fix access of stale slave pointers in bonding code, from Nikolay
Aleksandrov.

11) Fix stack info leak in PPP pptp code, from Mathias Krause.

12) Cure locking bug in IPX stack, from Jiri Bohac.

13) Revert SKB fclone memory freeing optimization that is racey and can
allow accesses to freed up memory, from Eric Dumazet.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (71 commits)
tcp: Restore RFC5961-compliant behavior for SYN packets
net: Revert "net: avoid one atomic operation in skb_clone()"
virtio-net: validate features during probe
cxgb4 : Fix DCB priority groups being returned in wrong order
ipx: fix locking regression in ipx_sendmsg and ipx_recvmsg
openvswitch: Don't validate IPv6 label masks.
pptp: fix stack info leak in pptp_getname()
brcmfmac: don't include linux/unaligned/access_ok.h
cxgb4i : Don't block unload/cxgb4 unload when remote closes TCP connection
ipv6: delete protocol and unregister rtnetlink when cleanup
net/mlx4_en: Add VXLAN ndo calls to the PF net device ops too
bonding: fix curr_active_slave/carrier with loadbalance arp monitoring
mac80211: minstrel_ht: fix a crash in rate sorting
vxlan: Inline vxlan_gso_check().
can: m_can: update to support CAN FD features
can: m_can: fix incorrect error messages
can: m_can: add missing delay after setting CCCR_INIT bit
can: m_can: fix not set can_dlc for remote frame
can: m_can: fix possible sleep in napi poll
can: m_can: add missing message RAM initialization
...

+506 -305
+2 -1
drivers/net/bonding/bond_main.c
··· 2471 2471 bond_slave_state_change(bond); 2472 2472 if (BOND_MODE(bond) == BOND_MODE_XOR) 2473 2473 bond_update_slave_arr(bond, NULL); 2474 - } else if (do_failover) { 2474 + } 2475 + if (do_failover) { 2475 2476 block_netpoll_tx(); 2476 2477 bond_select_active_slave(bond); 2477 2478 unblock_netpoll_tx();
+2 -2
drivers/net/can/dev.c
··· 110 110 long rate; 111 111 u64 v64; 112 112 113 - /* Use CIA recommended sample points */ 113 + /* Use CiA recommended sample points */ 114 114 if (bt->sample_point) { 115 115 sampl_pt = bt->sample_point; 116 116 } else { ··· 382 382 BUG_ON(idx >= priv->echo_skb_max); 383 383 384 384 if (priv->echo_skb[idx]) { 385 - kfree_skb(priv->echo_skb[idx]); 385 + dev_kfree_skb_any(priv->echo_skb[idx]); 386 386 priv->echo_skb[idx] = NULL; 387 387 } 388 388 }
+1
drivers/net/can/m_can/Kconfig
··· 1 1 config CAN_M_CAN 2 + depends on HAS_IOMEM 2 3 tristate "Bosch M_CAN devices" 3 4 ---help--- 4 5 Say Y here if you want to support for Bosch M_CAN controller.
+166 -53
drivers/net/can/m_can/m_can.c
··· 105 105 MRAM_CFG_NUM, 106 106 }; 107 107 108 + /* Fast Bit Timing & Prescaler Register (FBTP) */ 109 + #define FBTR_FBRP_MASK 0x1f 110 + #define FBTR_FBRP_SHIFT 16 111 + #define FBTR_FTSEG1_SHIFT 8 112 + #define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT) 113 + #define FBTR_FTSEG2_SHIFT 4 114 + #define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT) 115 + #define FBTR_FSJW_SHIFT 0 116 + #define FBTR_FSJW_MASK 0x3 117 + 108 118 /* Test Register (TEST) */ 109 119 #define TEST_LBCK BIT(4) 110 120 111 121 /* CC Control Register(CCCR) */ 112 - #define CCCR_TEST BIT(7) 113 - #define CCCR_MON BIT(5) 114 - #define CCCR_CCE BIT(1) 115 - #define CCCR_INIT BIT(0) 122 + #define CCCR_TEST BIT(7) 123 + #define CCCR_CMR_MASK 0x3 124 + #define CCCR_CMR_SHIFT 10 125 + #define CCCR_CMR_CANFD 0x1 126 + #define CCCR_CMR_CANFD_BRS 0x2 127 + #define CCCR_CMR_CAN 0x3 128 + #define CCCR_CME_MASK 0x3 129 + #define CCCR_CME_SHIFT 8 130 + #define CCCR_CME_CAN 0 131 + #define CCCR_CME_CANFD 0x1 132 + #define CCCR_CME_CANFD_BRS 0x2 133 + #define CCCR_TEST BIT(7) 134 + #define CCCR_MON BIT(5) 135 + #define CCCR_CCE BIT(1) 136 + #define CCCR_INIT BIT(0) 137 + #define CCCR_CANFD 0x10 116 138 117 139 /* Bit Timing & Prescaler Register (BTP) */ 118 140 #define BTR_BRP_MASK 0x3ff ··· 226 204 227 205 /* Rx Buffer / FIFO Element Size Configuration (RXESC) */ 228 206 #define M_CAN_RXESC_8BYTES 0x0 207 + #define M_CAN_RXESC_64BYTES 0x777 229 208 230 209 /* Tx Buffer Configuration(TXBC) */ 231 210 #define TXBC_NDTB_OFF 16 ··· 234 211 235 212 /* Tx Buffer Element Size Configuration(TXESC) */ 236 213 #define TXESC_TBDS_8BYTES 0x0 214 + #define TXESC_TBDS_64BYTES 0x7 237 215 238 216 /* Tx Event FIFO Con.guration (TXEFC) */ 239 217 #define TXEFC_EFS_OFF 16 ··· 243 219 /* Message RAM Configuration (in bytes) */ 244 220 #define SIDF_ELEMENT_SIZE 4 245 221 #define XIDF_ELEMENT_SIZE 8 246 - #define RXF0_ELEMENT_SIZE 16 247 - #define RXF1_ELEMENT_SIZE 16 222 + #define RXF0_ELEMENT_SIZE 72 223 + #define RXF1_ELEMENT_SIZE 72 248 224 #define RXB_ELEMENT_SIZE 16 249 225 #define TXE_ELEMENT_SIZE 8 250 - #define TXB_ELEMENT_SIZE 16 226 + #define TXB_ELEMENT_SIZE 72 251 227 252 228 /* Message RAM Elements */ 253 229 #define M_CAN_FIFO_ID 0x0 ··· 255 231 #define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) 256 232 257 233 /* Rx Buffer Element */ 234 + /* R0 */ 258 235 #define RX_BUF_ESI BIT(31) 259 236 #define RX_BUF_XTD BIT(30) 260 237 #define RX_BUF_RTR BIT(29) 238 + /* R1 */ 239 + #define RX_BUF_ANMF BIT(31) 240 + #define RX_BUF_EDL BIT(21) 241 + #define RX_BUF_BRS BIT(20) 261 242 262 243 /* Tx Buffer Element */ 244 + /* R0 */ 263 245 #define TX_BUF_XTD BIT(30) 264 246 #define TX_BUF_RTR BIT(29) 265 247 ··· 326 296 if (enable) { 327 297 /* enable m_can configuration */ 328 298 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); 299 + udelay(5); 329 300 /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ 330 301 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); 331 302 } else { ··· 357 326 m_can_write(priv, M_CAN_ILE, 0x0); 358 327 } 359 328 360 - static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, 361 - u32 rxfs) 329 + static void m_can_read_fifo(struct net_device *dev, u32 rxfs) 362 330 { 331 + struct net_device_stats *stats = &dev->stats; 363 332 struct m_can_priv *priv = netdev_priv(dev); 364 - u32 id, fgi; 333 + struct canfd_frame *cf; 334 + struct sk_buff *skb; 335 + u32 id, fgi, dlc; 336 + int i; 365 337 366 338 /* calculate the fifo get index for where to read data */ 367 339 fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; 340 + dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); 341 + if (dlc & RX_BUF_EDL) 342 + skb = alloc_canfd_skb(dev, &cf); 343 + else 344 + skb = alloc_can_skb(dev, (struct can_frame **)&cf); 345 + if (!skb) { 346 + stats->rx_dropped++; 347 + return; 348 + } 349 + 350 + if (dlc & RX_BUF_EDL) 351 + cf->len = can_dlc2len((dlc >> 16) & 0x0F); 352 + else 353 + cf->len = get_can_dlc((dlc >> 16) & 0x0F); 354 + 368 355 id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); 369 356 if (id & RX_BUF_XTD) 370 357 cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; 371 358 else 372 359 cf->can_id = (id >> 18) & CAN_SFF_MASK; 373 360 374 - if (id & RX_BUF_RTR) { 361 + if (id & RX_BUF_ESI) { 362 + cf->flags |= CANFD_ESI; 363 + netdev_dbg(dev, "ESI Error\n"); 364 + } 365 + 366 + if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) { 375 367 cf->can_id |= CAN_RTR_FLAG; 376 368 } else { 377 - id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); 378 - cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); 379 - *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, 380 - M_CAN_FIFO_DATA(0)); 381 - *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, 382 - M_CAN_FIFO_DATA(1)); 369 + if (dlc & RX_BUF_BRS) 370 + cf->flags |= CANFD_BRS; 371 + 372 + for (i = 0; i < cf->len; i += 4) 373 + *(u32 *)(cf->data + i) = 374 + m_can_fifo_read(priv, fgi, 375 + M_CAN_FIFO_DATA(i / 4)); 383 376 } 384 377 385 378 /* acknowledge rx fifo 0 */ 386 379 m_can_write(priv, M_CAN_RXF0A, fgi); 380 + 381 + stats->rx_packets++; 382 + stats->rx_bytes += cf->len; 383 + 384 + netif_receive_skb(skb); 387 385 } 388 386 389 387 static int m_can_do_rx_poll(struct net_device *dev, int quota) 390 388 { 391 389 struct m_can_priv *priv = netdev_priv(dev); 392 - struct net_device_stats *stats = &dev->stats; 393 - struct sk_buff *skb; 394 - struct can_frame *frame; 395 390 u32 pkts = 0; 396 391 u32 rxfs; 397 392 ··· 431 374 if (rxfs & RXFS_RFL) 432 375 netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); 433 376 434 - skb = alloc_can_skb(dev, &frame); 435 - if (!skb) { 436 - stats->rx_dropped++; 437 - return pkts; 438 - } 439 - 440 - m_can_read_fifo(dev, frame, rxfs); 441 - 442 - stats->rx_packets++; 443 - stats->rx_bytes += frame->can_dlc; 444 - 445 - netif_receive_skb(skb); 377 + m_can_read_fifo(dev, rxfs); 446 378 447 379 quota--; 448 380 pkts++; ··· 527 481 return 1; 528 482 } 529 483 484 + static int __m_can_get_berr_counter(const struct net_device *dev, 485 + struct can_berr_counter *bec) 486 + { 487 + struct m_can_priv *priv = netdev_priv(dev); 488 + unsigned int ecr; 489 + 490 + ecr = m_can_read(priv, M_CAN_ECR); 491 + bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; 492 + bec->txerr = ecr & ECR_TEC_MASK; 493 + 494 + return 0; 495 + } 496 + 530 497 static int m_can_get_berr_counter(const struct net_device *dev, 531 498 struct can_berr_counter *bec) 532 499 { 533 500 struct m_can_priv *priv = netdev_priv(dev); 534 - unsigned int ecr; 535 501 int err; 536 502 537 503 err = clk_prepare_enable(priv->hclk); ··· 556 498 return err; 557 499 } 558 500 559 - ecr = m_can_read(priv, M_CAN_ECR); 560 - bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT; 561 - bec->txerr = ecr & ECR_TEC_MASK; 501 + __m_can_get_berr_counter(dev, bec); 562 502 563 503 clk_disable_unprepare(priv->cclk); 564 504 clk_disable_unprepare(priv->hclk); ··· 600 544 if (unlikely(!skb)) 601 545 return 0; 602 546 603 - m_can_get_berr_counter(dev, &bec); 547 + __m_can_get_berr_counter(dev, &bec); 604 548 605 549 switch (new_state) { 606 550 case CAN_STATE_ERROR_ACTIVE: ··· 652 596 653 597 if ((psr & PSR_EP) && 654 598 (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { 655 - netdev_dbg(dev, "entered error warning state\n"); 599 + netdev_dbg(dev, "entered error passive state\n"); 656 600 work_done += m_can_handle_state_change(dev, 657 601 CAN_STATE_ERROR_PASSIVE); 658 602 } 659 603 660 604 if ((psr & PSR_BO) && 661 605 (priv->can.state != CAN_STATE_BUS_OFF)) { 662 - netdev_dbg(dev, "entered error warning state\n"); 606 + netdev_dbg(dev, "entered error bus off state\n"); 663 607 work_done += m_can_handle_state_change(dev, 664 608 CAN_STATE_BUS_OFF); 665 609 } ··· 671 615 { 672 616 if (irqstatus & IR_WDI) 673 617 netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); 674 - if (irqstatus & IR_BEU) 618 + if (irqstatus & IR_ELO) 675 619 netdev_err(dev, "Error Logging Overflow\n"); 676 620 if (irqstatus & IR_BEU) 677 621 netdev_err(dev, "Bit Error Uncorrected\n"); ··· 789 733 .brp_inc = 1, 790 734 }; 791 735 736 + static const struct can_bittiming_const m_can_data_bittiming_const = { 737 + .name = KBUILD_MODNAME, 738 + .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ 739 + .tseg1_max = 16, 740 + .tseg2_min = 1, /* Time segment 2 = phase_seg2 */ 741 + .tseg2_max = 8, 742 + .sjw_max = 4, 743 + .brp_min = 1, 744 + .brp_max = 32, 745 + .brp_inc = 1, 746 + }; 747 + 792 748 static int m_can_set_bittiming(struct net_device *dev) 793 749 { 794 750 struct m_can_priv *priv = netdev_priv(dev); 795 751 const struct can_bittiming *bt = &priv->can.bittiming; 752 + const struct can_bittiming *dbt = &priv->can.data_bittiming; 796 753 u16 brp, sjw, tseg1, tseg2; 797 754 u32 reg_btp; 798 755 ··· 816 747 reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | 817 748 (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); 818 749 m_can_write(priv, M_CAN_BTP, reg_btp); 819 - netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); 750 + 751 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { 752 + brp = dbt->brp - 1; 753 + sjw = dbt->sjw - 1; 754 + tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1; 755 + tseg2 = dbt->phase_seg2 - 1; 756 + reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) | 757 + (tseg1 << FBTR_FTSEG1_SHIFT) | 758 + (tseg2 << FBTR_FTSEG2_SHIFT); 759 + m_can_write(priv, M_CAN_FBTP, reg_btp); 760 + } 820 761 821 762 return 0; 822 763 } ··· 846 767 847 768 m_can_config_endisable(priv, true); 848 769 849 - /* RX Buffer/FIFO Element Size 8 bytes data field */ 850 - m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); 770 + /* RX Buffer/FIFO Element Size 64 bytes data field */ 771 + m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES); 851 772 852 773 /* Accept Non-matching Frames Into FIFO 0 */ 853 774 m_can_write(priv, M_CAN_GFC, 0x0); ··· 856 777 m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | 857 778 priv->mcfg[MRAM_TXB].off); 858 779 859 - /* only support 8 bytes firstly */ 860 - m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); 780 + /* support 64 bytes payload */ 781 + m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES); 861 782 862 783 m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | 863 784 priv->mcfg[MRAM_TXE].off); ··· 872 793 RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); 873 794 874 795 cccr = m_can_read(priv, M_CAN_CCCR); 875 - cccr &= ~(CCCR_TEST | CCCR_MON); 796 + cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) | 797 + (CCCR_CME_MASK << CCCR_CME_SHIFT)); 876 798 test = m_can_read(priv, M_CAN_TEST); 877 799 test &= ~TEST_LBCK; 878 800 ··· 884 804 cccr |= CCCR_TEST; 885 805 test |= TEST_LBCK; 886 806 } 807 + 808 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) 809 + cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT; 887 810 888 811 m_can_write(priv, M_CAN_CCCR, cccr); 889 812 m_can_write(priv, M_CAN_TEST, test); ··· 952 869 953 870 priv->dev = dev; 954 871 priv->can.bittiming_const = &m_can_bittiming_const; 872 + priv->can.data_bittiming_const = &m_can_data_bittiming_const; 955 873 priv->can.do_set_mode = m_can_set_mode; 956 874 priv->can.do_get_berr_counter = m_can_get_berr_counter; 957 875 priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | 958 876 CAN_CTRLMODE_LISTENONLY | 959 - CAN_CTRLMODE_BERR_REPORTING; 877 + CAN_CTRLMODE_BERR_REPORTING | 878 + CAN_CTRLMODE_FD; 960 879 961 880 return dev; 962 881 } ··· 1041 956 struct net_device *dev) 1042 957 { 1043 958 struct m_can_priv *priv = netdev_priv(dev); 1044 - struct can_frame *cf = (struct can_frame *)skb->data; 1045 - u32 id; 959 + struct canfd_frame *cf = (struct canfd_frame *)skb->data; 960 + u32 id, cccr; 961 + int i; 1046 962 1047 963 if (can_dropped_invalid_skb(dev, skb)) 1048 964 return NETDEV_TX_OK; ··· 1062 976 1063 977 /* message ram configuration */ 1064 978 m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); 1065 - m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); 1066 - m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); 1067 - m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); 979 + m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16); 980 + 981 + for (i = 0; i < cf->len; i += 4) 982 + m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4), 983 + *(u32 *)(cf->data + i)); 984 + 1068 985 can_put_echo_skb(skb, dev, 0); 986 + 987 + if (priv->can.ctrlmode & CAN_CTRLMODE_FD) { 988 + cccr = m_can_read(priv, M_CAN_CCCR); 989 + cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT); 990 + if (can_is_canfd_skb(skb)) { 991 + if (cf->flags & CANFD_BRS) 992 + cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT; 993 + else 994 + cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT; 995 + } else { 996 + cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT; 997 + } 998 + m_can_write(priv, M_CAN_CCCR, cccr); 999 + } 1069 1000 1070 1001 /* enable first TX buffer to start transfer */ 1071 1002 m_can_write(priv, M_CAN_TXBTIE, 0x1); ··· 1095 992 .ndo_open = m_can_open, 1096 993 .ndo_stop = m_can_close, 1097 994 .ndo_start_xmit = m_can_start_xmit, 995 + .ndo_change_mtu = can_change_mtu, 1098 996 }; 1099 997 1100 998 static int register_m_can_dev(struct net_device *dev) ··· 1113 1009 struct resource *res; 1114 1010 void __iomem *addr; 1115 1011 u32 out_val[MRAM_CFG_LEN]; 1116 - int ret; 1012 + int i, start, end, ret; 1117 1013 1118 1014 /* message ram could be shared */ 1119 1015 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); ··· 1163 1059 priv->mcfg[MRAM_RXB].off, priv->mcfg[MRAM_RXB].num, 1164 1060 priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, 1165 1061 priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); 1062 + 1063 + /* initialize the entire Message RAM in use to avoid possible 1064 + * ECC/parity checksum errors when reading an uninitialized buffer 1065 + */ 1066 + start = priv->mcfg[MRAM_SIDF].off; 1067 + end = priv->mcfg[MRAM_TXB].off + 1068 + priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; 1069 + for (i = start; i < end; i += 4) 1070 + writel(0x0, priv->mram_base + i); 1166 1071 1167 1072 return 0; 1168 1073 }
+1
drivers/net/can/rcar_can.c
··· 628 628 .ndo_open = rcar_can_open, 629 629 .ndo_stop = rcar_can_close, 630 630 .ndo_start_xmit = rcar_can_start_xmit, 631 + .ndo_change_mtu = can_change_mtu, 631 632 }; 632 633 633 634 static void rcar_can_rx_pkt(struct rcar_can_priv *priv)
+1 -4
drivers/net/can/sja1000/kvaser_pci.c
··· 214 214 struct net_device *dev; 215 215 struct sja1000_priv *priv; 216 216 struct kvaser_pci *board; 217 - int err, init_step; 217 + int err; 218 218 219 219 dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); 220 220 if (dev == NULL) ··· 235 235 if (channel == 0) { 236 236 board->xilinx_ver = 237 237 ioread8(board->res_addr + XILINX_VERINT) >> 4; 238 - init_step = 2; 239 238 240 239 /* Assert PTADR# - we're in passive mode so the other bits are 241 240 not important */ ··· 262 263 263 264 priv->irq_flags = IRQF_SHARED; 264 265 dev->irq = pdev->irq; 265 - 266 - init_step = 4; 267 266 268 267 dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", 269 268 priv->reg_base, board->conf_addr, dev->irq);
+1 -2
drivers/net/can/usb/ems_usb.c
··· 434 434 if (urb->actual_length > CPC_HEADER_SIZE) { 435 435 struct ems_cpc_msg *msg; 436 436 u8 *ibuf = urb->transfer_buffer; 437 - u8 msg_count, again, start; 437 + u8 msg_count, start; 438 438 439 439 msg_count = ibuf[0] & ~0x80; 440 - again = ibuf[0] & 0x80; 441 440 442 441 start = CPC_HEADER_SIZE; 443 442
+1 -2
drivers/net/can/usb/esd_usb2.c
··· 464 464 { 465 465 struct esd_tx_urb_context *context = urb->context; 466 466 struct esd_usb2_net_priv *priv; 467 - struct esd_usb2 *dev; 468 467 struct net_device *netdev; 469 468 size_t size = sizeof(struct esd_usb2_msg); 470 469 ··· 471 472 472 473 priv = context->priv; 473 474 netdev = priv->netdev; 474 - dev = priv->usb2; 475 475 476 476 /* free up our allocated buffer */ 477 477 usb_free_coherent(urb->dev, size, ··· 1141 1143 } 1142 1144 } 1143 1145 unlink_all_urbs(dev); 1146 + kfree(dev); 1144 1147 } 1145 1148 } 1146 1149
+1
drivers/net/can/usb/gs_usb.c
··· 718 718 .ndo_open = gs_can_open, 719 719 .ndo_stop = gs_can_close, 720 720 .ndo_start_xmit = gs_can_start_xmit, 721 + .ndo_change_mtu = can_change_mtu, 721 722 }; 722 723 723 724 static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf)
+3 -1
drivers/net/can/xilinx_can.c
··· 300 300 static int xcan_chip_start(struct net_device *ndev) 301 301 { 302 302 struct xcan_priv *priv = netdev_priv(ndev); 303 - u32 err, reg_msr, reg_sr_mask; 303 + u32 reg_msr, reg_sr_mask; 304 + int err; 304 305 unsigned long timeout; 305 306 306 307 /* Check if it is in reset mode */ ··· 962 961 .ndo_open = xcan_open, 963 962 .ndo_stop = xcan_close, 964 963 .ndo_start_xmit = xcan_start_xmit, 964 + .ndo_change_mtu = can_change_mtu, 965 965 }; 966 966 967 967 /**
+1 -1
drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
··· 1082 1082 pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); 1083 1083 1084 1084 for (i = 0; i < CXGB4_MAX_PRIORITY; i++) 1085 - pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; 1085 + pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF; 1086 1086 1087 1087 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); 1088 1088 pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE;
+6
drivers/net/ethernet/emulex/benet/be_main.c
··· 4421 4421 "Disabled VxLAN offloads for UDP port %d\n", 4422 4422 be16_to_cpu(port)); 4423 4423 } 4424 + 4425 + static bool be_gso_check(struct sk_buff *skb, struct net_device *dev) 4426 + { 4427 + return vxlan_gso_check(skb); 4428 + } 4424 4429 #endif 4425 4430 4426 4431 static const struct net_device_ops be_netdev_ops = { ··· 4455 4450 #ifdef CONFIG_BE2NET_VXLAN 4456 4451 .ndo_add_vxlan_port = be_add_vxlan_port, 4457 4452 .ndo_del_vxlan_port = be_del_vxlan_port, 4453 + .ndo_gso_check = be_gso_check, 4458 4454 #endif 4459 4455 }; 4460 4456
+12 -1
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 1693 1693 mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); 1694 1694 1695 1695 #ifdef CONFIG_MLX4_EN_VXLAN 1696 - if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) 1696 + if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) 1697 1697 vxlan_get_rx_port(dev); 1698 1698 #endif 1699 1699 priv->port_up = true; ··· 2355 2355 2356 2356 queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); 2357 2357 } 2358 + 2359 + static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev) 2360 + { 2361 + return vxlan_gso_check(skb); 2362 + } 2358 2363 #endif 2359 2364 2360 2365 static const struct net_device_ops mlx4_netdev_ops = { ··· 2391 2386 #ifdef CONFIG_MLX4_EN_VXLAN 2392 2387 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2393 2388 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2389 + .ndo_gso_check = mlx4_en_gso_check, 2394 2390 #endif 2395 2391 }; 2396 2392 ··· 2422 2416 .ndo_rx_flow_steer = mlx4_en_filter_rfs, 2423 2417 #endif 2424 2418 .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, 2419 + #ifdef CONFIG_MLX4_EN_VXLAN 2420 + .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2421 + .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2422 + .ndo_gso_check = mlx4_en_gso_check, 2423 + #endif 2425 2424 }; 2426 2425 2427 2426 int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
+6
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 503 503 504 504 adapter->flags |= QLCNIC_DEL_VXLAN_PORT; 505 505 } 506 + 507 + static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev) 508 + { 509 + return vxlan_gso_check(skb); 510 + } 506 511 #endif 507 512 508 513 static const struct net_device_ops qlcnic_netdev_ops = { ··· 531 526 #ifdef CONFIG_QLCNIC_VXLAN 532 527 .ndo_add_vxlan_port = qlcnic_add_vxlan_port, 533 528 .ndo_del_vxlan_port = qlcnic_del_vxlan_port, 529 + .ndo_gso_check = qlcnic_gso_check, 534 530 #endif 535 531 #ifdef CONFIG_NET_POLL_CONTROLLER 536 532 .ndo_poll_controller = qlcnic_poll_controller,
+3 -3
drivers/net/ethernet/ti/cpsw.c
··· 129 129 #define CPSW_VLAN_AWARE BIT(1) 130 130 #define CPSW_ALE_VLAN_AWARE 1 131 131 132 - #define CPSW_FIFO_NORMAL_MODE (0 << 15) 133 - #define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) 134 - #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) 132 + #define CPSW_FIFO_NORMAL_MODE (0 << 16) 133 + #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16) 134 + #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16) 135 135 136 136 #define CPSW_INTPACEEN (0x3f << 16) 137 137 #define CPSW_INTPRESCALE_MASK (0x7FF << 0)
+8 -5
drivers/net/ieee802154/fakehard.c
··· 377 377 378 378 err = wpan_phy_register(phy); 379 379 if (err) 380 - goto out; 380 + goto err_phy_reg; 381 381 382 382 err = register_netdev(dev); 383 - if (err < 0) 384 - goto out; 383 + if (err) 384 + goto err_netdev_reg; 385 385 386 386 dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); 387 387 return 0; 388 388 389 - out: 390 - unregister_netdev(dev); 389 + err_netdev_reg: 390 + wpan_phy_unregister(phy); 391 + err_phy_reg: 392 + free_netdev(dev); 393 + wpan_phy_free(phy); 391 394 return err; 392 395 } 393 396
+3 -1
drivers/net/ppp/pptp.c
··· 506 506 int len = sizeof(struct sockaddr_pppox); 507 507 struct sockaddr_pppox sp; 508 508 509 - sp.sa_family = AF_PPPOX; 509 + memset(&sp.sa_addr, 0, sizeof(sp.sa_addr)); 510 + 511 + sp.sa_family = AF_PPPOX; 510 512 sp.sa_protocol = PX_PROTO_PPTP; 511 513 sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; 512 514
+1
drivers/net/usb/qmi_wwan.c
··· 780 780 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ 781 781 {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ 782 782 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ 783 + {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ 783 784 784 785 /* 4. Gobi 1000 devices */ 785 786 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
+37
drivers/net/virtio_net.c
··· 1673 1673 }; 1674 1674 #endif 1675 1675 1676 + static bool virtnet_fail_on_feature(struct virtio_device *vdev, 1677 + unsigned int fbit, 1678 + const char *fname, const char *dname) 1679 + { 1680 + if (!virtio_has_feature(vdev, fbit)) 1681 + return false; 1682 + 1683 + dev_err(&vdev->dev, "device advertises feature %s but not %s", 1684 + fname, dname); 1685 + 1686 + return true; 1687 + } 1688 + 1689 + #define VIRTNET_FAIL_ON(vdev, fbit, dbit) \ 1690 + virtnet_fail_on_feature(vdev, fbit, #fbit, dbit) 1691 + 1692 + static bool virtnet_validate_features(struct virtio_device *vdev) 1693 + { 1694 + if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) && 1695 + (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX, 1696 + "VIRTIO_NET_F_CTRL_VQ") || 1697 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN, 1698 + "VIRTIO_NET_F_CTRL_VQ") || 1699 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE, 1700 + "VIRTIO_NET_F_CTRL_VQ") || 1701 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") || 1702 + VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR, 1703 + "VIRTIO_NET_F_CTRL_VQ"))) { 1704 + return false; 1705 + } 1706 + 1707 + return true; 1708 + } 1709 + 1676 1710 static int virtnet_probe(struct virtio_device *vdev) 1677 1711 { 1678 1712 int i, err; 1679 1713 struct net_device *dev; 1680 1714 struct virtnet_info *vi; 1681 1715 u16 max_queue_pairs; 1716 + 1717 + if (!virtnet_validate_features(vdev)) 1718 + return -EINVAL; 1682 1719 1683 1720 /* Find if host supports multiqueue virtio_net device */ 1684 1721 err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ,
-6
drivers/net/vxlan.c
··· 67 67 68 68 #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ 69 69 70 - /* VXLAN protocol header */ 71 - struct vxlanhdr { 72 - __be32 vx_flags; 73 - __be32 vx_vni; 74 - }; 75 - 76 70 /* UDP port for VXLAN traffic. 77 71 * The IANA assigned port is 4789, but the Linux default is 8472 78 72 * for compatibility with early adopters.
+13
drivers/net/wireless/ath/ath9k/ar9003_phy.c
··· 664 664 ah->enabled_cals |= TX_CL_CAL; 665 665 else 666 666 ah->enabled_cals &= ~TX_CL_CAL; 667 + 668 + if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) { 669 + if (ah->is_clk_25mhz) { 670 + REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); 671 + REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); 672 + REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); 673 + } else { 674 + REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); 675 + REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); 676 + REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); 677 + } 678 + udelay(100); 679 + } 667 680 } 668 681 669 682 static void ar9003_hw_prog_ini(struct ath_hw *ah,
-13
drivers/net/wireless/ath/ath9k/hw.c
··· 861 861 udelay(RTC_PLL_SETTLE_DELAY); 862 862 863 863 REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); 864 - 865 - if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) { 866 - if (ah->is_clk_25mhz) { 867 - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1); 868 - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7); 869 - REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae); 870 - } else { 871 - REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1); 872 - REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400); 873 - REG_WRITE(ah, AR_SLP32_INC, 0x0001e800); 874 - } 875 - udelay(100); 876 - } 877 864 } 878 865 879 866 static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
+6 -3
drivers/net/wireless/ath/ath9k/main.c
··· 974 974 struct ath_vif *avp; 975 975 976 976 /* 977 - * Pick the MAC address of the first interface as the new hardware 978 - * MAC address. The hardware will use it together with the BSSID mask 979 - * when matching addresses. 977 + * The hardware will use primary station addr together with the 978 + * BSSID mask when matching addresses. 980 979 */ 981 980 memset(iter_data, 0, sizeof(*iter_data)); 982 981 memset(&iter_data->mask, 0xff, ETH_ALEN); ··· 1204 1205 list_add_tail(&avp->list, &avp->chanctx->vifs); 1205 1206 } 1206 1207 1208 + ath9k_calculate_summary_state(sc, avp->chanctx); 1209 + 1207 1210 ath9k_assign_hw_queues(hw, vif); 1208 1211 1209 1212 an->sc = sc; ··· 1274 1273 ath9k_beacon_remove_slot(sc, vif); 1275 1274 1276 1275 ath_tx_node_cleanup(sc, &avp->mcast_node); 1276 + 1277 + ath9k_calculate_summary_state(sc, avp->chanctx); 1277 1278 1278 1279 mutex_unlock(&sc->mutex); 1279 1280 }
+1 -3
drivers/net/wireless/b43/phy_common.c
··· 300 300 301 301 void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) 302 302 { 303 - assert_mac_suspended(dev); 304 - dev->phy.ops->phy_write(dev, destreg, 305 - dev->phy.ops->phy_read(dev, srcreg)); 303 + b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg)); 306 304 } 307 305 308 306 void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
+2 -2
drivers/net/wireless/brcm80211/brcmfmac/of.c
··· 40 40 return; 41 41 42 42 irq = irq_of_parse_and_map(np, 0); 43 - if (irq < 0) { 44 - brcmf_err("interrupt could not be mapped: err=%d\n", irq); 43 + if (!irq) { 44 + brcmf_err("interrupt could not be mapped\n"); 45 45 devm_kfree(dev, sdiodev->pdata); 46 46 return; 47 47 }
+1 -1
drivers/net/wireless/brcm80211/brcmfmac/pcie.c
··· 19 19 #include <linux/pci.h> 20 20 #include <linux/vmalloc.h> 21 21 #include <linux/delay.h> 22 - #include <linux/unaligned/access_ok.h> 23 22 #include <linux/interrupt.h> 24 23 #include <linux/bcma/bcma.h> 25 24 #include <linux/sched.h> 25 + #include <asm/unaligned.h> 26 26 27 27 #include <soc.h> 28 28 #include <chipcommon.h>
+4 -2
drivers/net/wireless/brcm80211/brcmfmac/usb.c
··· 669 669 goto finalize; 670 670 } 671 671 672 - if (!brcmf_usb_ioctl_resp_wait(devinfo)) 672 + if (!brcmf_usb_ioctl_resp_wait(devinfo)) { 673 + usb_kill_urb(devinfo->ctl_urb); 673 674 ret = -ETIMEDOUT; 674 - else 675 + } else { 675 676 memcpy(buffer, tmpbuf, buflen); 677 + } 676 678 677 679 finalize: 678 680 kfree(tmpbuf);
+6
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
··· 299 299 primary_offset = ch->center_freq1 - ch->chan->center_freq; 300 300 switch (ch->width) { 301 301 case NL80211_CHAN_WIDTH_20: 302 + case NL80211_CHAN_WIDTH_20_NOHT: 302 303 ch_inf.bw = BRCMU_CHAN_BW_20; 303 304 WARN_ON(primary_offset != 0); 304 305 break; ··· 324 323 ch_inf.sb = BRCMU_CHAN_SB_LU; 325 324 } 326 325 break; 326 + case NL80211_CHAN_WIDTH_80P80: 327 + case NL80211_CHAN_WIDTH_160: 328 + case NL80211_CHAN_WIDTH_5: 329 + case NL80211_CHAN_WIDTH_10: 327 330 default: 328 331 WARN_ON_ONCE(1); 329 332 } ··· 338 333 case IEEE80211_BAND_5GHZ: 339 334 ch_inf.band = BRCMU_CHAN_BAND_5G; 340 335 break; 336 + case IEEE80211_BAND_60GHZ: 341 337 default: 342 338 WARN_ON_ONCE(1); 343 339 }
+10 -10
drivers/net/wireless/iwlwifi/mvm/scan.c
··· 602 602 SCAN_COMPLETE_NOTIFICATION }; 603 603 int ret; 604 604 605 - if (mvm->scan_status == IWL_MVM_SCAN_NONE) 606 - return 0; 607 - 608 - if (iwl_mvm_is_radio_killed(mvm)) { 609 - ieee80211_scan_completed(mvm->hw, true); 610 - iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); 611 - mvm->scan_status = IWL_MVM_SCAN_NONE; 612 - return 0; 613 - } 614 - 615 605 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, 616 606 scan_abort_notif, 617 607 ARRAY_SIZE(scan_abort_notif), ··· 1390 1400 1391 1401 int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) 1392 1402 { 1403 + if (mvm->scan_status == IWL_MVM_SCAN_NONE) 1404 + return 0; 1405 + 1406 + if (iwl_mvm_is_radio_killed(mvm)) { 1407 + ieee80211_scan_completed(mvm->hw, true); 1408 + iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); 1409 + mvm->scan_status = IWL_MVM_SCAN_NONE; 1410 + return 0; 1411 + } 1412 + 1393 1413 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) 1394 1414 return iwl_mvm_scan_offload_stop(mvm, true); 1395 1415 return iwl_mvm_cancel_regular_scan(mvm);
+1 -2
drivers/net/wireless/iwlwifi/pcie/trans.c
··· 1894 1894 int reg; 1895 1895 __le32 *val; 1896 1896 1897 - prph_len += sizeof(*data) + sizeof(*prph) + 1898 - num_bytes_in_chunk; 1897 + prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk; 1899 1898 1900 1899 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); 1901 1900 (*data)->len = cpu_to_le32(sizeof(*prph) +
+18 -44
drivers/net/wireless/rt2x00/rt2x00queue.c
··· 158 158 skb_trim(skb, frame_length); 159 159 } 160 160 161 - void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) 161 + /* 162 + * H/W needs L2 padding between the header and the paylod if header size 163 + * is not 4 bytes aligned. 164 + */ 165 + void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len) 162 166 { 163 - unsigned int payload_length = skb->len - header_length; 164 - unsigned int header_align = ALIGN_SIZE(skb, 0); 165 - unsigned int payload_align = ALIGN_SIZE(skb, header_length); 166 - unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0; 167 - 168 - /* 169 - * Adjust the header alignment if the payload needs to be moved more 170 - * than the header. 171 - */ 172 - if (payload_align > header_align) 173 - header_align += 4; 174 - 175 - /* There is nothing to do if no alignment is needed */ 176 - if (!header_align) 177 - return; 178 - 179 - /* Reserve the amount of space needed in front of the frame */ 180 - skb_push(skb, header_align); 181 - 182 - /* 183 - * Move the header. 184 - */ 185 - memmove(skb->data, skb->data + header_align, header_length); 186 - 187 - /* Move the payload, if present and if required */ 188 - if (payload_length && payload_align) 189 - memmove(skb->data + header_length + l2pad, 190 - skb->data + header_length + l2pad + payload_align, 191 - payload_length); 192 - 193 - /* Trim the skb to the correct size */ 194 - skb_trim(skb, header_length + l2pad + payload_length); 195 - } 196 - 197 - void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) 198 - { 199 - /* 200 - * L2 padding is only present if the skb contains more than just the 201 - * IEEE 802.11 header. 202 - */ 203 - unsigned int l2pad = (skb->len > header_length) ? 204 - L2PAD_SIZE(header_length) : 0; 167 + unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; 205 168 206 169 if (!l2pad) 207 170 return; 208 171 209 - memmove(skb->data + l2pad, skb->data, header_length); 172 + skb_push(skb, l2pad); 173 + memmove(skb->data, skb->data + l2pad, hdr_len); 174 + } 175 + 176 + void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len) 177 + { 178 + unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0; 179 + 180 + if (!l2pad) 181 + return; 182 + 183 + memmove(skb->data + l2pad, skb->data, hdr_len); 210 184 skb_pull(skb, l2pad); 211 185 } 212 186
+12 -7
drivers/net/wireless/rtlwifi/pci.c
··· 842 842 break; 843 843 } 844 844 /* handle command packet here */ 845 - if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { 845 + if (rtlpriv->cfg->ops->rx_command_packet && 846 + rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { 846 847 dev_kfree_skb_any(skb); 847 848 goto end; 848 849 } ··· 1128 1127 1129 1128 __skb_queue_tail(&ring->queue, pskb); 1130 1129 1131 - rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, 1132 - &temp_one); 1133 - 1130 + if (rtlpriv->use_new_trx_flow) { 1131 + temp_one = 4; 1132 + rtlpriv->cfg->ops->set_desc(hw, (u8 *)pbuffer_desc, true, 1133 + HW_DESC_OWN, (u8 *)&temp_one); 1134 + } else { 1135 + rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, 1136 + &temp_one); 1137 + } 1134 1138 return; 1135 1139 } 1136 1140 ··· 1376 1370 ring->desc = NULL; 1377 1371 if (rtlpriv->use_new_trx_flow) { 1378 1372 pci_free_consistent(rtlpci->pdev, 1379 - sizeof(*ring->desc) * ring->entries, 1373 + sizeof(*ring->buffer_desc) * ring->entries, 1380 1374 ring->buffer_desc, ring->buffer_desc_dma); 1381 - ring->desc = NULL; 1375 + ring->buffer_desc = NULL; 1382 1376 } 1383 1377 } 1384 1378 ··· 1549 1543 true, 1550 1544 HW_DESC_TXBUFF_ADDR), 1551 1545 skb->len, PCI_DMA_TODEVICE); 1552 - ring->idx = (ring->idx + 1) % ring->entries; 1553 1546 kfree_skb(skb); 1554 1547 ring->idx = (ring->idx + 1) % ring->entries; 1555 1548 }
+5 -2
drivers/net/wireless/rtlwifi/rtl8192se/hw.c
··· 1201 1201 1202 1202 } 1203 1203 1204 + if (type != NL80211_IFTYPE_AP && 1205 + rtlpriv->mac80211.link_state < MAC80211_LINKED) 1206 + bt_msr = rtl_read_byte(rtlpriv, MSR) & ~MSR_LINK_MASK; 1204 1207 rtl_write_byte(rtlpriv, (MSR), bt_msr); 1205 1208 1206 1209 temp = rtl_read_dword(rtlpriv, TCR); ··· 1265 1262 rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); 1266 1263 /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ 1267 1264 rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); 1265 + rtlpci->irq_enabled = true; 1268 1266 } 1269 1267 1270 1268 void rtl92se_disable_interrupt(struct ieee80211_hw *hw) ··· 1280 1276 rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1281 1277 rtl_write_dword(rtlpriv, INTA_MASK, 0); 1282 1278 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); 1283 - 1284 - synchronize_irq(rtlpci->pdev->irq); 1279 + rtlpci->irq_enabled = false; 1285 1280 } 1286 1281 1287 1282 static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data)
+2
drivers/net/wireless/rtlwifi/rtl8192se/phy.c
··· 399 399 case 2: 400 400 currentcmd = &postcommoncmd[*step]; 401 401 break; 402 + default: 403 + return true; 402 404 } 403 405 404 406 if (currentcmd->cmdid == CMDID_END) {
+16
drivers/net/wireless/rtlwifi/rtl8192se/sw.c
··· 236 236 } 237 237 } 238 238 239 + static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue, 240 + u16 index) 241 + { 242 + struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 243 + struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue]; 244 + u8 *entry = (u8 *)(&ring->desc[ring->idx]); 245 + u8 own = (u8)rtl92se_get_desc(entry, true, HW_DESC_OWN); 246 + 247 + if (own) 248 + return false; 249 + return true; 250 + } 251 + 239 252 static struct rtl_hal_ops rtl8192se_hal_ops = { 240 253 .init_sw_vars = rtl92s_init_sw_vars, 241 254 .deinit_sw_vars = rtl92s_deinit_sw_vars, ··· 282 269 .led_control = rtl92se_led_control, 283 270 .set_desc = rtl92se_set_desc, 284 271 .get_desc = rtl92se_get_desc, 272 + .is_tx_desc_closed = rtl92se_is_tx_desc_closed, 285 273 .tx_polling = rtl92se_tx_polling, 286 274 .enable_hw_sec = rtl92se_enable_hw_security_config, 287 275 .set_key = rtl92se_set_key, ··· 320 306 .maps[MAC_RCR_ACRC32] = RCR_ACRC32, 321 307 .maps[MAC_RCR_ACF] = RCR_ACF, 322 308 .maps[MAC_RCR_AAP] = RCR_AAP, 309 + .maps[MAC_HIMR] = INTA_MASK, 310 + .maps[MAC_HIMRE] = INTA_MASK + 4, 323 311 324 312 .maps[EFUSE_TEST] = REG_EFUSE_TEST, 325 313 .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
+2
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
··· 828 828 if (status == CPL_ERR_RTX_NEG_ADVICE) 829 829 goto rel_skb; 830 830 831 + module_put(THIS_MODULE); 832 + 831 833 if (status && status != CPL_ERR_TCAM_FULL && 832 834 status != CPL_ERR_CONN_EXIST && 833 835 status != CPL_ERR_ARP_MISS)
+1 -1
drivers/scsi/cxgbi/libcxgbi.c
··· 816 816 read_lock_bh(&csk->callback_lock); 817 817 if (csk->user_data) 818 818 iscsi_conn_failure(csk->user_data, 819 - ISCSI_ERR_CONN_FAILED); 819 + ISCSI_ERR_TCP_CONN_CLOSE); 820 820 read_unlock_bh(&csk->callback_lock); 821 821 } 822 822 }
+6
include/linux/can/dev.h
··· 99 99 return 1; 100 100 } 101 101 102 + static inline bool can_is_canfd_skb(const struct sk_buff *skb) 103 + { 104 + /* the CAN specific type of skb is identified by its data length */ 105 + return skb->len == CANFD_MTU; 106 + } 107 + 102 108 /* get data length from can_dlc with sanitized can_dlc */ 103 109 u8 can_dlc2len(u8 can_dlc); 104 110
+1 -1
include/linux/inetdevice.h
··· 242 242 static __inline__ __be32 inet_make_mask(int logmask) 243 243 { 244 244 if (logmask) 245 - return htonl(~((1<<(32-logmask))-1)); 245 + return htonl(~((1U<<(32-logmask))-1)); 246 246 return 0; 247 247 } 248 248
-2
include/net/netfilter/nf_tables.h
··· 396 396 /** 397 397 * struct nft_trans - nf_tables object update in transaction 398 398 * 399 - * @rcu_head: rcu head to defer release of transaction data 400 399 * @list: used internally 401 400 * @msg_type: message type 402 401 * @ctx: transaction context 403 402 * @data: internal information related to the transaction 404 403 */ 405 404 struct nft_trans { 406 - struct rcu_head rcu_head; 407 405 struct list_head list; 408 406 int msg_type; 409 407 struct nft_ctx ctx;
+18
include/net/vxlan.h
··· 8 8 #define VNI_HASH_BITS 10 9 9 #define VNI_HASH_SIZE (1<<VNI_HASH_BITS) 10 10 11 + /* VXLAN protocol header */ 12 + struct vxlanhdr { 13 + __be32 vx_flags; 14 + __be32 vx_vni; 15 + }; 16 + 11 17 struct vxlan_sock; 12 18 typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); 13 19 ··· 50 44 struct rtable *rt, struct sk_buff *skb, 51 45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 52 46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); 47 + 48 + static inline bool vxlan_gso_check(struct sk_buff *skb) 49 + { 50 + if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) && 51 + (skb->inner_protocol_type != ENCAP_TYPE_ETHER || 52 + skb->inner_protocol != htons(ETH_P_TEB) || 53 + (skb_inner_mac_header(skb) - skb_transport_header(skb) != 54 + sizeof(struct udphdr) + sizeof(struct vxlanhdr)))) 55 + return false; 56 + 57 + return true; 58 + } 53 59 54 60 /* IP header + UDP + VXLAN + Ethernet header */ 55 61 #define VXLAN_HEADROOM (20 + 8 + 8 + 14)
+2 -2
lib/Makefile
··· 10 10 lib-y := ctype.o string.o vsprintf.o cmdline.o \ 11 11 rbtree.o radix-tree.o dump_stack.o timerqueue.o\ 12 12 idr.o int_sqrt.o extable.o \ 13 - sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ 13 + sha1.o md5.o irq_regs.o argv_split.o \ 14 14 proportions.o flex_proportions.o ratelimit.o show_mem.o \ 15 15 is_single_threaded.o plist.o decompress.o kobject_uevent.o \ 16 16 earlycpio.o ··· 26 26 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ 27 27 gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ 28 28 bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ 29 - percpu-refcount.o percpu_ida.o hash.o rhashtable.o 29 + percpu-refcount.o percpu_ida.o hash.o rhashtable.o reciprocal_div.o 30 30 obj-y += string_helpers.o 31 31 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o 32 32 obj-y += kstrtox.o
+1 -2
net/bridge/br_multicast.c
··· 813 813 return; 814 814 815 815 if (port) { 816 - __skb_push(skb, sizeof(struct ethhdr)); 817 816 skb->dev = port->dev; 818 817 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 819 - dev_queue_xmit); 818 + br_dev_queue_push_xmit); 820 819 } else { 821 820 br_multicast_select_own_querier(br, ip, skb); 822 821 netif_rx(skb);
+6 -17
net/core/skbuff.c
··· 552 552 case SKB_FCLONE_CLONE: 553 553 fclones = container_of(skb, struct sk_buff_fclones, skb2); 554 554 555 - /* Warning : We must perform the atomic_dec_and_test() before 556 - * setting skb->fclone back to SKB_FCLONE_FREE, otherwise 557 - * skb_clone() could set clone_ref to 2 before our decrement. 558 - * Anyway, if we are going to free the structure, no need to 559 - * rewrite skb->fclone. 555 + /* The clone portion is available for 556 + * fast-cloning again. 560 557 */ 561 - if (atomic_dec_and_test(&fclones->fclone_ref)) { 558 + skb->fclone = SKB_FCLONE_FREE; 559 + 560 + if (atomic_dec_and_test(&fclones->fclone_ref)) 562 561 kmem_cache_free(skbuff_fclone_cache, fclones); 563 - } else { 564 - /* The clone portion is available for 565 - * fast-cloning again. 566 - */ 567 - skb->fclone = SKB_FCLONE_FREE; 568 - } 569 562 break; 570 563 } 571 564 } ··· 880 887 if (skb->fclone == SKB_FCLONE_ORIG && 881 888 n->fclone == SKB_FCLONE_FREE) { 882 889 n->fclone = SKB_FCLONE_CLONE; 883 - /* As our fastclone was free, clone_ref must be 1 at this point. 884 - * We could use atomic_inc() here, but it is faster 885 - * to set the final value. 886 - */ 887 - atomic_set(&fclones->fclone_ref, 2); 890 + atomic_inc(&fclones->fclone_ref); 888 891 } else { 889 892 if (skb_pfmemalloc(skb)) 890 893 gfp_mask |= __GFP_MEMALLOC;
+18 -18
net/dcb/dcbnl.c
··· 1080 1080 if (!app) 1081 1081 return -EMSGSIZE; 1082 1082 1083 - spin_lock(&dcb_lock); 1083 + spin_lock_bh(&dcb_lock); 1084 1084 list_for_each_entry(itr, &dcb_app_list, list) { 1085 1085 if (itr->ifindex == netdev->ifindex) { 1086 1086 err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), 1087 1087 &itr->app); 1088 1088 if (err) { 1089 - spin_unlock(&dcb_lock); 1089 + spin_unlock_bh(&dcb_lock); 1090 1090 return -EMSGSIZE; 1091 1091 } 1092 1092 } ··· 1097 1097 else 1098 1098 dcbx = -EOPNOTSUPP; 1099 1099 1100 - spin_unlock(&dcb_lock); 1100 + spin_unlock_bh(&dcb_lock); 1101 1101 nla_nest_end(skb, app); 1102 1102 1103 1103 /* get peer info if available */ ··· 1234 1234 } 1235 1235 1236 1236 /* local app */ 1237 - spin_lock(&dcb_lock); 1237 + spin_lock_bh(&dcb_lock); 1238 1238 app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); 1239 1239 if (!app) 1240 1240 goto dcb_unlock; ··· 1271 1271 else 1272 1272 dcbx = -EOPNOTSUPP; 1273 1273 1274 - spin_unlock(&dcb_lock); 1274 + spin_unlock_bh(&dcb_lock); 1275 1275 1276 1276 /* features flags */ 1277 1277 if (ops->getfeatcfg) { ··· 1326 1326 return 0; 1327 1327 1328 1328 dcb_unlock: 1329 - spin_unlock(&dcb_lock); 1329 + spin_unlock_bh(&dcb_lock); 1330 1330 nla_put_failure: 1331 1331 return err; 1332 1332 } ··· 1762 1762 struct dcb_app_type *itr; 1763 1763 u8 prio = 0; 1764 1764 1765 - spin_lock(&dcb_lock); 1765 + spin_lock_bh(&dcb_lock); 1766 1766 if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) 1767 1767 prio = itr->app.priority; 1768 - spin_unlock(&dcb_lock); 1768 + spin_unlock_bh(&dcb_lock); 1769 1769 1770 1770 return prio; 1771 1771 } ··· 1789 1789 if (dev->dcbnl_ops->getdcbx) 1790 1790 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1791 1791 1792 - spin_lock(&dcb_lock); 1792 + spin_lock_bh(&dcb_lock); 1793 1793 /* Search for existing match and replace */ 1794 1794 if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { 1795 1795 if (new->priority) ··· 1804 1804 if (new->priority) 1805 1805 err = dcb_app_add(new, dev->ifindex); 1806 1806 out: 1807 - spin_unlock(&dcb_lock); 1807 + spin_unlock_bh(&dcb_lock); 1808 1808 if (!err) 1809 1809 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1810 1810 return err; ··· 1823 1823 struct dcb_app_type *itr; 1824 1824 u8 prio = 0; 1825 1825 1826 - spin_lock(&dcb_lock); 1826 + spin_lock_bh(&dcb_lock); 1827 1827 if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) 1828 1828 prio |= 1 << itr->app.priority; 1829 - spin_unlock(&dcb_lock); 1829 + spin_unlock_bh(&dcb_lock); 1830 1830 1831 1831 return prio; 1832 1832 } ··· 1850 1850 if (dev->dcbnl_ops->getdcbx) 1851 1851 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1852 1852 1853 - spin_lock(&dcb_lock); 1853 + spin_lock_bh(&dcb_lock); 1854 1854 /* Search for existing match and abort if found */ 1855 1855 if (dcb_app_lookup(new, dev->ifindex, new->priority)) { 1856 1856 err = -EEXIST; ··· 1859 1859 1860 1860 err = dcb_app_add(new, dev->ifindex); 1861 1861 out: 1862 - spin_unlock(&dcb_lock); 1862 + spin_unlock_bh(&dcb_lock); 1863 1863 if (!err) 1864 1864 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1865 1865 return err; ··· 1882 1882 if (dev->dcbnl_ops->getdcbx) 1883 1883 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1884 1884 1885 - spin_lock(&dcb_lock); 1885 + spin_lock_bh(&dcb_lock); 1886 1886 /* Search for existing match and remove it. */ 1887 1887 if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { 1888 1888 list_del(&itr->list); ··· 1890 1890 err = 0; 1891 1891 } 1892 1892 1893 - spin_unlock(&dcb_lock); 1893 + spin_unlock_bh(&dcb_lock); 1894 1894 if (!err) 1895 1895 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1896 1896 return err; ··· 1902 1902 struct dcb_app_type *app; 1903 1903 struct dcb_app_type *tmp; 1904 1904 1905 - spin_lock(&dcb_lock); 1905 + spin_lock_bh(&dcb_lock); 1906 1906 list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { 1907 1907 list_del(&app->list); 1908 1908 kfree(app); 1909 1909 } 1910 - spin_unlock(&dcb_lock); 1910 + spin_unlock_bh(&dcb_lock); 1911 1911 } 1912 1912 1913 1913 static int __init dcbnl_init(void)
+4
net/ipv4/fib_rules.c
··· 62 62 else 63 63 res->tclassid = 0; 64 64 #endif 65 + 66 + if (err == -ESRCH) 67 + err = -ENETUNREACH; 68 + 65 69 return err; 66 70 } 67 71 EXPORT_SYMBOL_GPL(__fib_lookup);
+5 -6
net/ipv4/igmp.c
··· 318 318 return scount; 319 319 } 320 320 321 - #define igmp_skb_size(skb) (*(unsigned int *)((skb)->cb)) 322 - 323 - static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size) 321 + static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu) 324 322 { 325 323 struct sk_buff *skb; 326 324 struct rtable *rt; ··· 328 330 struct flowi4 fl4; 329 331 int hlen = LL_RESERVED_SPACE(dev); 330 332 int tlen = dev->needed_tailroom; 333 + unsigned int size = mtu; 331 334 332 335 while (1) { 333 336 skb = alloc_skb(size + hlen + tlen, ··· 340 341 return NULL; 341 342 } 342 343 skb->priority = TC_PRIO_CONTROL; 343 - igmp_skb_size(skb) = size; 344 344 345 345 rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, 346 346 0, 0, ··· 352 354 skb_dst_set(skb, &rt->dst); 353 355 skb->dev = dev; 354 356 357 + skb->reserved_tailroom = skb_end_offset(skb) - 358 + min(mtu, skb_end_offset(skb)); 355 359 skb_reserve(skb, hlen); 356 360 357 361 skb_reset_network_header(skb); ··· 423 423 return skb; 424 424 } 425 425 426 - #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \ 427 - skb_tailroom(skb)) : 0) 426 + #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) 428 427 429 428 static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, 430 429 int type, int gdeleted, int sdeleted)
+1
net/ipv4/netfilter/nft_masq_ipv4.c
··· 24 24 struct nf_nat_range range; 25 25 unsigned int verdict; 26 26 27 + memset(&range, 0, sizeof(range)); 27 28 range.flags = priv->flags; 28 29 29 30 verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum,
+2 -2
net/ipv4/tcp_input.c
··· 5231 5231 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) 5232 5232 goto csum_error; 5233 5233 5234 - if (!th->ack && !th->rst) 5234 + if (!th->ack && !th->rst && !th->syn) 5235 5235 goto discard; 5236 5236 5237 5237 /* ··· 5650 5650 goto discard; 5651 5651 } 5652 5652 5653 - if (!th->ack && !th->rst) 5653 + if (!th->ack && !th->rst && !th->syn) 5654 5654 goto discard; 5655 5655 5656 5656 if (!tcp_validate_incoming(sk, skb, th, 0))
+4
net/ipv6/ip6mr.c
··· 1439 1439 1440 1440 void ip6_mr_cleanup(void) 1441 1441 { 1442 + rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE); 1443 + #ifdef CONFIG_IPV6_PIMSM_V2 1444 + inet6_del_protocol(&pim6_protocol, IPPROTO_PIM); 1445 + #endif 1442 1446 unregister_netdevice_notifier(&ip6_mr_notifier); 1443 1447 unregister_pernet_subsys(&ip6mr_net_ops); 1444 1448 kmem_cache_destroy(mrt_cachep);
+5 -4
net/ipv6/mcast.c
··· 1550 1550 hdr->daddr = *daddr; 1551 1551 } 1552 1552 1553 - static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) 1553 + static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) 1554 1554 { 1555 1555 struct net_device *dev = idev->dev; 1556 1556 struct net *net = dev_net(dev); ··· 1561 1561 const struct in6_addr *saddr; 1562 1562 int hlen = LL_RESERVED_SPACE(dev); 1563 1563 int tlen = dev->needed_tailroom; 1564 + unsigned int size = mtu + hlen + tlen; 1564 1565 int err; 1565 1566 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1566 1567 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1567 1568 IPV6_TLV_PADN, 0 }; 1568 1569 1569 1570 /* we assume size > sizeof(ra) here */ 1570 - size += hlen + tlen; 1571 1571 /* limit our allocations to order-0 page */ 1572 1572 size = min_t(int, size, SKB_MAX_ORDER(0, 0)); 1573 1573 skb = sock_alloc_send_skb(sk, size, 1, &err); ··· 1576 1576 return NULL; 1577 1577 1578 1578 skb->priority = TC_PRIO_CONTROL; 1579 + skb->reserved_tailroom = skb_end_offset(skb) - 1580 + min(mtu, skb_end_offset(skb)); 1579 1581 skb_reserve(skb, hlen); 1580 1582 1581 1583 if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { ··· 1692 1690 return skb; 1693 1691 } 1694 1692 1695 - #define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ 1696 - skb_tailroom(skb)) : 0) 1693 + #define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0) 1697 1694 1698 1695 static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, 1699 1696 int type, int gdeleted, int sdeleted, int crsend)
+1
net/ipv6/netfilter/nft_masq_ipv6.c
··· 25 25 struct nf_nat_range range; 26 26 unsigned int verdict; 27 27 28 + memset(&range, 0, sizeof(range)); 28 29 range.flags = priv->flags; 29 30 30 31 verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out);
+5 -1
net/ipx/af_ipx.c
··· 1764 1764 struct ipxhdr *ipx = NULL; 1765 1765 struct sk_buff *skb; 1766 1766 int copied, rc; 1767 + bool locked = true; 1767 1768 1768 1769 lock_sock(sk); 1769 1770 /* put the autobinding in */ ··· 1791 1790 if (sock_flag(sk, SOCK_ZAPPED)) 1792 1791 goto out; 1793 1792 1793 + release_sock(sk); 1794 + locked = false; 1794 1795 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 1795 1796 flags & MSG_DONTWAIT, &rc); 1796 1797 if (!skb) { ··· 1829 1826 out_free: 1830 1827 skb_free_datagram(sk, skb); 1831 1828 out: 1832 - release_sock(sk); 1829 + if (locked) 1830 + release_sock(sk); 1833 1831 return rc; 1834 1832 } 1835 1833
+3
net/mac80211/aes_ccm.c
··· 53 53 __aligned(__alignof__(struct aead_request)); 54 54 struct aead_request *aead_req = (void *) aead_req_data; 55 55 56 + if (data_len == 0) 57 + return -EINVAL; 58 + 56 59 memset(aead_req, 0, sizeof(aead_req_data)); 57 60 58 61 sg_init_one(&pt, data, data_len);
+6 -9
net/mac80211/rc80211_minstrel_ht.c
··· 252 252 cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; 253 253 cur_prob = mi->groups[cur_group].rates[cur_idx].probability; 254 254 255 - tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; 256 - tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; 257 - tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; 258 - tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; 259 - 260 - while (j > 0 && (cur_thr > tmp_thr || 261 - (cur_thr == tmp_thr && cur_prob > tmp_prob))) { 262 - j--; 255 + do { 263 256 tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; 264 257 tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; 265 258 tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; 266 259 tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; 267 - } 260 + if (cur_thr < tmp_thr || 261 + (cur_thr == tmp_thr && cur_prob <= tmp_prob)) 262 + break; 263 + j--; 264 + } while (j > 0); 268 265 269 266 if (j < MAX_THR_RATES - 1) { 270 267 memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) *
+6
net/netfilter/ipset/ip_set_core.c
··· 1863 1863 if (*op < IP_SET_OP_VERSION) { 1864 1864 /* Check the version at the beginning of operations */ 1865 1865 struct ip_set_req_version *req_version = data; 1866 + 1867 + if (*len < sizeof(struct ip_set_req_version)) { 1868 + ret = -EINVAL; 1869 + goto done; 1870 + } 1871 + 1866 1872 if (req_version->version != IPSET_PROTOCOL) { 1867 1873 ret = -EPROTO; 1868 1874 goto done;
+2
net/netfilter/ipvs/ip_vs_xmit.c
··· 846 846 new_skb = skb_realloc_headroom(skb, max_headroom); 847 847 if (!new_skb) 848 848 goto error; 849 + if (skb->sk) 850 + skb_set_owner_w(new_skb, skb->sk); 849 851 consume_skb(skb); 850 852 skb = new_skb; 851 853 }
+8 -6
net/netfilter/nf_conntrack_core.c
··· 611 611 */ 612 612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); 613 613 pr_debug("Confirming conntrack %p\n", ct); 614 - /* We have to check the DYING flag inside the lock to prevent 615 - a race against nf_ct_get_next_corpse() possibly called from 616 - user context, else we insert an already 'dead' hash, blocking 617 - further use of that particular connection -JM */ 614 + 615 + /* We have to check the DYING flag after unlink to prevent 616 + * a race against nf_ct_get_next_corpse() possibly called from 617 + * user context, else we insert an already 'dead' hash, blocking 618 + * further use of that particular connection -JM. 619 + */ 620 + nf_ct_del_from_dying_or_unconfirmed_list(ct); 618 621 619 622 if (unlikely(nf_ct_is_dying(ct))) { 623 + nf_ct_add_to_dying_list(ct); 620 624 nf_conntrack_double_unlock(hash, reply_hash); 621 625 local_bh_enable(); 622 626 return NF_ACCEPT; ··· 639 635 &h->tuple) && 640 636 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) 641 637 goto out; 642 - 643 - nf_ct_del_from_dying_or_unconfirmed_list(ct); 644 638 645 639 /* Timer relative to confirmation time, not original 646 640 setting time, otherwise we'd get timer wrap in
+8 -16
net/netfilter/nf_tables_api.c
··· 3484 3484 } 3485 3485 } 3486 3486 3487 - /* Schedule objects for release via rcu to make sure no packets are accesing 3488 - * removed rules. 3489 - */ 3490 - static void nf_tables_commit_release_rcu(struct rcu_head *rt) 3487 + static void nf_tables_commit_release(struct nft_trans *trans) 3491 3488 { 3492 - struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); 3493 - 3494 3489 switch (trans->msg_type) { 3495 3490 case NFT_MSG_DELTABLE: 3496 3491 nf_tables_table_destroy(&trans->ctx); ··· 3607 3612 } 3608 3613 } 3609 3614 3615 + synchronize_rcu(); 3616 + 3610 3617 list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { 3611 3618 list_del(&trans->list); 3612 - trans->ctx.nla = NULL; 3613 - call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu); 3619 + nf_tables_commit_release(trans); 3614 3620 } 3615 3621 3616 3622 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); ··· 3619 3623 return 0; 3620 3624 } 3621 3625 3622 - /* Schedule objects for release via rcu to make sure no packets are accesing 3623 - * aborted rules. 3624 - */ 3625 - static void nf_tables_abort_release_rcu(struct rcu_head *rt) 3626 + static void nf_tables_abort_release(struct nft_trans *trans) 3626 3627 { 3627 - struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); 3628 - 3629 3628 switch (trans->msg_type) { 3630 3629 case NFT_MSG_NEWTABLE: 3631 3630 nf_tables_table_destroy(&trans->ctx); ··· 3716 3725 } 3717 3726 } 3718 3727 3728 + synchronize_rcu(); 3729 + 3719 3730 list_for_each_entry_safe_reverse(trans, next, 3720 3731 &net->nft.commit_list, list) { 3721 3732 list_del(&trans->list); 3722 - trans->ctx.nla = NULL; 3723 - call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu); 3733 + nf_tables_abort_release(trans); 3724 3734 } 3725 3735 3726 3736 return 0;
+11 -1
net/netfilter/nfnetlink.c
··· 47 47 [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, 48 48 [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, 49 49 [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, 50 + [NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES, 51 + [NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT, 50 52 }; 51 53 52 54 void nfnl_lock(__u8 subsys_id) ··· 466 464 static int nfnetlink_bind(int group) 467 465 { 468 466 const struct nfnetlink_subsystem *ss; 469 - int type = nfnl_group2type[group]; 467 + int type; 468 + 469 + if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX) 470 + return -EINVAL; 471 + 472 + type = nfnl_group2type[group]; 470 473 471 474 rcu_read_lock(); 472 475 ss = nfnetlink_get_subsys(type); ··· 520 513 static int __init nfnetlink_init(void) 521 514 { 522 515 int i; 516 + 517 + for (i = NFNLGRP_NONE + 1; i <= NFNLGRP_MAX; i++) 518 + BUG_ON(nfnl_group2type[i] == NFNL_SUBSYS_NONE); 523 519 524 520 for (i=0; i<NFNL_SUBSYS_COUNT; i++) 525 521 mutex_init(&table[i].mutex);
+6 -34
net/netfilter/nft_compat.c
··· 21 21 #include <linux/netfilter_ipv6/ip6_tables.h> 22 22 #include <net/netfilter/nf_tables.h> 23 23 24 - static const struct { 25 - const char *name; 26 - u8 type; 27 - } table_to_chaintype[] = { 28 - { "filter", NFT_CHAIN_T_DEFAULT }, 29 - { "raw", NFT_CHAIN_T_DEFAULT }, 30 - { "security", NFT_CHAIN_T_DEFAULT }, 31 - { "mangle", NFT_CHAIN_T_ROUTE }, 32 - { "nat", NFT_CHAIN_T_NAT }, 33 - { }, 34 - }; 35 - 36 - static int nft_compat_table_to_chaintype(const char *table) 37 - { 38 - int i; 39 - 40 - for (i = 0; table_to_chaintype[i].name != NULL; i++) { 41 - if (strcmp(table_to_chaintype[i].name, table) == 0) 42 - return table_to_chaintype[i].type; 43 - } 44 - 45 - return -1; 46 - } 47 - 48 24 static int nft_compat_chain_validate_dependency(const char *tablename, 49 25 const struct nft_chain *chain) 50 26 { 51 - enum nft_chain_type type; 52 27 const struct nft_base_chain *basechain; 53 28 54 29 if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) 55 30 return 0; 56 31 57 - type = nft_compat_table_to_chaintype(tablename); 58 - if (type < 0) 59 - return -EINVAL; 60 - 61 32 basechain = nft_base_chain(chain); 62 - if (basechain->type->type != type) 33 + if (strcmp(tablename, "nat") == 0 && 34 + basechain->type->type != NFT_CHAIN_T_NAT) 63 35 return -EINVAL; 64 36 65 37 return 0; ··· 89 117 struct xt_target *target, void *info, 90 118 union nft_entry *entry, u8 proto, bool inv) 91 119 { 92 - par->net = &init_net; 120 + par->net = ctx->net; 93 121 par->table = ctx->table->name; 94 122 switch (ctx->afi->family) { 95 123 case AF_INET: ··· 296 324 struct xt_match *match, void *info, 297 325 union nft_entry *entry, u8 proto, bool inv) 298 326 { 299 - par->net = &init_net; 327 + par->net = ctx->net; 300 328 par->table = ctx->table->name; 301 329 switch (ctx->afi->family) { 302 330 case AF_INET: ··· 346 374 union nft_entry e = {}; 347 375 int ret; 348 376 349 - ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); 377 + ret = nft_compat_chain_validate_dependency(match->table, ctx->chain); 350 378 if (ret < 0) 351 379 goto err; 352 380 ··· 420 448 if (!(hook_mask & match->hooks)) 421 449 return -EINVAL; 422 450 423 - ret = nft_compat_chain_validate_dependency(match->name, 451 + ret = nft_compat_chain_validate_dependency(match->table, 424 452 ctx->chain); 425 453 if (ret < 0) 426 454 return ret;
+6 -4
net/openvswitch/actions.c
··· 246 246 { 247 247 int transport_len = skb->len - skb_transport_offset(skb); 248 248 249 - if (l4_proto == IPPROTO_TCP) { 249 + if (l4_proto == NEXTHDR_TCP) { 250 250 if (likely(transport_len >= sizeof(struct tcphdr))) 251 251 inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, 252 252 addr, new_addr, 1); 253 - } else if (l4_proto == IPPROTO_UDP) { 253 + } else if (l4_proto == NEXTHDR_UDP) { 254 254 if (likely(transport_len >= sizeof(struct udphdr))) { 255 255 struct udphdr *uh = udp_hdr(skb); 256 256 ··· 261 261 uh->check = CSUM_MANGLED_0; 262 262 } 263 263 } 264 + } else if (l4_proto == NEXTHDR_ICMP) { 265 + if (likely(transport_len >= sizeof(struct icmp6hdr))) 266 + inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum, 267 + skb, addr, new_addr, 1); 264 268 } 265 269 } 266 270 ··· 726 722 727 723 case OVS_ACTION_ATTR_SAMPLE: 728 724 err = sample(dp, skb, key, a); 729 - if (unlikely(err)) /* skb already freed. */ 730 - return err; 731 725 break; 732 726 } 733 727
+7 -7
net/openvswitch/datapath.c
··· 1265 1265 return msgsize; 1266 1266 } 1267 1267 1268 - /* Called with ovs_mutex or RCU read lock. */ 1268 + /* Called with ovs_mutex. */ 1269 1269 static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, 1270 1270 u32 portid, u32 seq, u32 flags, u8 cmd) 1271 1271 { ··· 1555 1555 if (!reply) 1556 1556 return -ENOMEM; 1557 1557 1558 - rcu_read_lock(); 1558 + ovs_lock(); 1559 1559 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); 1560 1560 if (IS_ERR(dp)) { 1561 1561 err = PTR_ERR(dp); ··· 1564 1564 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, 1565 1565 info->snd_seq, 0, OVS_DP_CMD_NEW); 1566 1566 BUG_ON(err < 0); 1567 - rcu_read_unlock(); 1567 + ovs_unlock(); 1568 1568 1569 1569 return genlmsg_reply(reply, info); 1570 1570 1571 1571 err_unlock_free: 1572 - rcu_read_unlock(); 1572 + ovs_unlock(); 1573 1573 kfree_skb(reply); 1574 1574 return err; 1575 1575 } ··· 1581 1581 int skip = cb->args[0]; 1582 1582 int i = 0; 1583 1583 1584 - rcu_read_lock(); 1585 - list_for_each_entry_rcu(dp, &ovs_net->dps, list_node) { 1584 + ovs_lock(); 1585 + list_for_each_entry(dp, &ovs_net->dps, list_node) { 1586 1586 if (i >= skip && 1587 1587 ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, 1588 1588 cb->nlh->nlmsg_seq, NLM_F_MULTI, ··· 1590 1590 break; 1591 1591 i++; 1592 1592 } 1593 - rcu_read_unlock(); 1593 + ovs_unlock(); 1594 1594 1595 1595 cb->args[0] = i; 1596 1596
+8 -1
net/openvswitch/flow_netlink.c
··· 145 145 if (match->key->eth.type == htons(ETH_P_ARP) 146 146 || match->key->eth.type == htons(ETH_P_RARP)) { 147 147 key_expected |= 1 << OVS_KEY_ATTR_ARP; 148 - if (match->mask && (match->mask->key.eth.type == htons(0xffff))) 148 + if (match->mask && (match->mask->key.tp.src == htons(0xff))) 149 149 mask_allowed |= 1 << OVS_KEY_ATTR_ARP; 150 150 } 151 151 ··· 689 689 ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); 690 690 return -EINVAL; 691 691 } 692 + 693 + if (!is_mask && ipv6_key->ipv6_label & htonl(0xFFF00000)) { 694 + OVS_NLERR("IPv6 flow label %x is out of range (max=%x).\n", 695 + ntohl(ipv6_key->ipv6_label), (1 << 20) - 1); 696 + return -EINVAL; 697 + } 698 + 692 699 SW_FLOW_KEY_PUT(match, ipv6.label, 693 700 ipv6_key->ipv6_label, is_mask); 694 701 SW_FLOW_KEY_PUT(match, ip.proto,