1. 15 6月, 2018 6 次提交
  2. 13 6月, 2018 11 次提交
  3. 11 6月, 2018 6 次提交
  4. 09 6月, 2018 3 次提交
    • B
      cdc_ncm: avoid padding beyond end of skb · 49c2c3f2
      Bjørn Mork 提交于
      Commit 4a0e3e98 ("cdc_ncm: Add support for moving NDP to end
      of NCM frame") added logic to reserve space for the NDP at the
      end of the NTB/skb.  This reservation did not take the final
      alignment of the NDP into account, causing us to reserve too
      little space. Additionally the padding prior to NDP addition did
      not ensure there was enough space for the NDP.
      
      The NTB/skb with the NDP appended would then exceed the configured
      max size. This caused the final padding of the NTB to use a
      negative count, padding to almost INT_MAX, and resulting in:
      
      [60103.825970] BUG: unable to handle kernel paging request at ffff9641f2004000
      [60103.825998] IP: __memset+0x24/0x30
      [60103.826001] PGD a6a06067 P4D a6a06067 PUD 4f65a063 PMD 72003063 PTE 0
      [60103.826013] Oops: 0002 [#1] SMP NOPTI
      [60103.826018] Modules linked in: (removed(
      [60103.826158] CPU: 0 PID: 5990 Comm: Chrome_DevTools Tainted: G           O 4.14.0-3-amd64 #1 Debian 4.14.17-1
      [60103.826162] Hardware name: LENOVO 20081 BIOS 41CN28WW(V2.04) 05/03/2012
      [60103.826166] task: ffff964193484fc0 task.stack: ffffb2890137c000
      [60103.826171] RIP: 0010:__memset+0x24/0x30
      [60103.826174] RSP: 0000:ffff964316c03b68 EFLAGS: 00010216
      [60103.826178] RAX: 0000000000000000 RBX: 00000000fffffffd RCX: 000000001ffa5000
      [60103.826181] RDX: 0000000000000005 RSI: 0000000000000000 RDI: ffff9641f2003ffc
      [60103.826184] RBP: ffff964192f6c800 R08: 00000000304d434e R09: ffff9641f1d2c004
      [60103.826187] R10: 0000000000000002 R11: 00000000000005ae R12: ffff9642e6957a80
      [60103.826190] R13: ffff964282ff2ee8 R14: 000000000000000d R15: ffff9642e4843900
      [60103.826194] FS:  00007f395aaf6700(0000) GS:ffff964316c00000(0000) knlGS:0000000000000000
      [60103.826197] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [60103.826200] CR2: ffff9641f2004000 CR3: 0000000013b0c000 CR4: 00000000000006f0
      [60103.826204] Call Trace:
      [60103.826212]  <IRQ>
      [60103.826225]  cdc_ncm_fill_tx_frame+0x5e3/0x740 [cdc_ncm]
      [60103.826236]  cdc_ncm_tx_fixup+0x57/0x70 [cdc_ncm]
      [60103.826246]  usbnet_start_xmit+0x5d/0x710 [usbnet]
      [60103.826254]  ? netif_skb_features+0x119/0x250
      [60103.826259]  dev_hard_start_xmit+0xa1/0x200
      [60103.826267]  sch_direct_xmit+0xf2/0x1b0
      [60103.826273]  __dev_queue_xmit+0x5e3/0x7c0
      [60103.826280]  ? ip_finish_output2+0x263/0x3c0
      [60103.826284]  ip_finish_output2+0x263/0x3c0
      [60103.826289]  ? ip_output+0x6c/0xe0
      [60103.826293]  ip_output+0x6c/0xe0
      [60103.826298]  ? ip_forward_options+0x1a0/0x1a0
      [60103.826303]  tcp_transmit_skb+0x516/0x9b0
      [60103.826309]  tcp_write_xmit+0x1aa/0xee0
      [60103.826313]  ? sch_direct_xmit+0x71/0x1b0
      [60103.826318]  tcp_tasklet_func+0x177/0x180
      [60103.826325]  tasklet_action+0x5f/0x110
      [60103.826332]  __do_softirq+0xde/0x2b3
      [60103.826337]  irq_exit+0xae/0xb0
      [60103.826342]  do_IRQ+0x81/0xd0
      [60103.826347]  common_interrupt+0x98/0x98
      [60103.826351]  </IRQ>
      [60103.826355] RIP: 0033:0x7f397bdf2282
      [60103.826358] RSP: 002b:00007f395aaf57d8 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff6e
      [60103.826362] RAX: 0000000000000000 RBX: 00002f07bc6d0900 RCX: 00007f39752d7fe7
      [60103.826365] RDX: 0000000000000022 RSI: 0000000000000147 RDI: 00002f07baea02c0
      [60103.826368] RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
      [60103.826371] R10: 00000000ffffffff R11: 0000000000000000 R12: 00002f07baea02c0
      [60103.826373] R13: 00002f07bba227a0 R14: 00002f07bc6d090c R15: 0000000000000000
      [60103.826377] Code: 90 90 90 90 90 90 90 0f 1f 44 00 00 49 89 f9 48 89 d1 83
      e2 07 48 c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c6 <f3> 48
      ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1
      [60103.826442] RIP: __memset+0x24/0x30 RSP: ffff964316c03b68
      [60103.826444] CR2: ffff9641f2004000
      
      Commit e1069bbf ("net: cdc_ncm: Reduce memory use when kernel
      memory low") made this bug much more likely to trigger by reducing
      the NTB size under memory pressure.
      
      Link: https://bugs.debian.org/893393Reported-by: NГорбешко Богдан <bodqhrohro@gmail.com>
      Reported-and-tested-by: NDennis Wassenberg <dennis.wassenberg@secunet.com>
      Cc: Enrico Mioso <mrkiko.rs@gmail.com>
      Fixes: 4a0e3e98 ("cdc_ncm: Add support for moving NDP to end of NCM frame")
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      49c2c3f2
    • Y
      net: fddi: fix a possible null-ptr-deref · 6310a882
      YueHaibing 提交于
      bp->SharedMemAddr is set to NULL while bp->SharedMemSize lesser-or-equal 0,
      then memset will trigger null-ptr-deref.
      
      fix it by replacing pci_alloc_consistent with dma_zalloc_coherent.
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6310a882
    • C
      net: aquantia: fix unsigned numvecs comparison with less than zero · 58d813af
      Colin Ian King 提交于
      From: Colin Ian King <colin.king@canonical.com>
      
      This was originally mistakenly submitted to net-next. Resubmitting to net.
      
      The comparison of numvecs < 0 is always false because numvecs is a u32
      and hence the error return from a failed call to pci_alloc_irq_vectores
      is never detected.  Fix this by using the signed int ret to handle the
      error return and assign numvecs to err.
      
      Detected by CoverityScan, CID#1468650 ("Unsigned compared against 0")
      
      Fixes: a09bd81b ("net: aquantia: Limit number of vectors to actually allocated irqs")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NIgor Russkikh <igor.russkikh@aquantia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      58d813af
  5. 08 6月, 2018 5 次提交
    • C
      net: stmmac: fix build failure due to missing COMMON_CLK dependency · bde49753
      Corentin Labbe 提交于
      This patch fix the build failure on m68k;
      drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.o: In function `ipq806x_gmac_probe':
      dwmac-ipq806x.c:(.text+0xda): undefined reference to `clk_set_rate'
      drivers/net/ethernet/stmicro/stmmac/dwmac-rk.o: In function `rk_gmac_probe':
      dwmac-rk.c:(.text+0x1e58): undefined reference to `clk_set_rate'
      drivers/net/ethernet/stmicro/stmmac/dwmac-sti.o: In function `stid127_fix_retime_src':
      dwmac-sti.c:(.text+0xd8): undefined reference to `clk_set_rate'
      dwmac-sti.c:(.text+0x114): undefined reference to `clk_set_rate'
      drivers/net/ethernet/stmicro/stmmac/dwmac-sti.o:dwmac-sti.c:(.text+0x12c): more undefined references to `clk_set_rate' follow
      Lots of stmmac platform drivers need COMMON_CLK in their Kconfig depends.
      Signed-off-by: NCorentin Labbe <clabbe@baylibre.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bde49753
    • G
      net: mscc: ocelot: Fix uninitialized error in ocelot_netdevice_event() · 2ac0e152
      Geert Uytterhoeven 提交于
      With gcc-4.1.2:
      
          drivers/net/ethernet/mscc/ocelot.c: In function ‘ocelot_netdevice_event’:
          drivers/net/ethernet/mscc/ocelot.c:1129: warning: ‘ret’ may be used uninitialized in this function
      
      If the list iterated over by netdev_for_each_lower_dev() is empty, ret
      is never initialized, and converted into a notifier return value.
      
      Fix this by preinitializing ret to zero.
      
      Fixes: a556c76a ("net: mscc: Add initial Ocelot switch support")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2ac0e152
    • X
      bonding: re-evaluate force_primary when the primary slave name changes · eb55bbf8
      Xiangning Yu 提交于
      There is a timing issue under active-standy mode, when bond_enslave() is
      called, bond->params.primary might not be initialized yet.
      
      Any time the primary slave string changes, bond->force_primary should be
      set to true to make sure the primary becomes the active slave.
      Signed-off-by: NXiangning Yu <yuxiangning@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eb55bbf8
    • D
      hv_netvsc: Fix a network regression after ifdown/ifup · 52acf73b
      Dexuan Cui 提交于
      Recently people reported the NIC stops working after
      "ifdown eth0; ifup eth0". It turns out in this case the TX queues are not
      enabled, after the refactoring of the common detach logic: when the NIC
      has sub-channels, usually we enable all the TX queues after all
      sub-channels are set up: see rndis_set_subchannel() ->
      netif_device_attach(), but in the case of "ifdown eth0; ifup eth0" where
      the number of channels doesn't change, we also must make sure the TX queues
      are enabled. The patch fixes the regression.
      
      Fixes: 7b2ee50c ("hv_netvsc: common detach logic")
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      52acf73b
    • W
      net: in virtio_net_hdr only add VLAN_HLEN to csum_start if payload holds vlan · fd3a8862
      Willem de Bruijn 提交于
      Tun, tap, virtio, packet and uml vector all use struct virtio_net_hdr
      to communicate packet metadata to userspace.
      
      For skbuffs with vlan, the first two return the packet as it may have
      existed on the wire, inserting the VLAN tag in the user buffer.  Then
      virtio_net_hdr.csum_start needs to be adjusted by VLAN_HLEN bytes.
      
      Commit f09e2249 ("macvtap: restore vlan header on user read")
      added this feature to macvtap. Commit 3ce9b20f ("macvtap: Fix
      csum_start when VLAN tags are present") then fixed up csum_start.
      
      Virtio, packet and uml do not insert the vlan header in the user
      buffer.
      
      When introducing virtio_net_hdr_from_skb to deduplicate filling in
      the virtio_net_hdr, the variant from macvtap which adds VLAN_HLEN was
      applied uniformly, breaking csum offset for packets with vlan on
      virtio and packet.
      
      Make insertion of VLAN_HLEN optional. Convert the callers to pass it
      when needed.
      
      Fixes: e858fae2 ("virtio_net: use common code for virtio_net_hdr and skb GSO conversion")
      Fixes: 1276f24e ("packet: use common code for virtio_net_hdr and skb GSO conversion")
      Signed-off-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fd3a8862
  6. 07 6月, 2018 7 次提交
    • K
      treewide: Use struct_size() for devm_kmalloc() and friends · 0ed2dd03
      Kees Cook 提交于
      Replaces open-coded struct size calculations with struct_size() for
      devm_*, f2fs_*, and sock_* allocations. Automatically generated (and
      manually adjusted) from the following Coccinelle script:
      
      // Direct reference to struct field.
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
      expression HANDLE;
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(HANDLE, sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(HANDLE, CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      0ed2dd03
    • K
      treewide: Use struct_size() for kmalloc()-family · acafe7e3
      Kees Cook 提交于
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          void *entry[];
      };
      
      instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
      uses. It was done via automatic conversion with manual review for the
      "CHECKME" non-standard cases noted below, using the following Coccinelle
      script:
      
      // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
      //                      sizeof *pkey_cache->table, GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      acafe7e3
    • X
      net: hns3: Optimize PF CMDQ interrupt switching process · 8e52a602
      Xi Wang 提交于
      When the PF frequently switches the CMDQ interrupt, if the CMDQ_SRC is
      not cleared before the hardware interrupt is generated, the new interrupt
      will not be reported.
      
      This patch optimizes this problem by clearing CMDQ_SRC and RESET_STS
      before enabling interrupt and syncing pending IRQ handlers after disabling
      interrupt.
      
      Fixes: 466b0c00 ("net: hns3: Add support for misc interrupt")
      Signed-off-by: NXi Wang <wangxi11@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8e52a602
    • X
      net: hns3: Fix for VF mailbox receiving unknown message · 6444e2a5
      Xi Wang 提交于
      Before the firmware updates the crq's tail pointer, if the VF driver
      reads the data in the crq, the data may be incomplete at this time,
      which will lead to the driver read an unknown message.
      
      This patch fixes it by checking if crq is empty before reading the
      message.
      
      Fixes: b11a0bb2 ("net: hns3: Add mailbox support to VF driver")
      Signed-off-by: NXi Wang <wangxi11@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6444e2a5
    • X
      net: hns3: Fix for VF mailbox cannot receiving PF response · 1819e409
      Xi Wang 提交于
      When the VF frequently switches the CMDQ interrupt, if the CMDQ_SRC is not
      cleared, the VF will not receive the new PF response after the interrupt
      is re-enabled, the corresponding log is as follows:
      
      [  317.482222] hns3 0000:00:03.0: VF could not get mbx resp(=0) from PF
      in 500 tries
      [  317.483137] hns3 0000:00:03.0: VF request to get tqp info from PF
      failed -5
      
      This patch fixes this problem by clearing CMDQ_SRC before enabling
      interrupt and syncing pending IRQ handlers after disabling interrupt.
      
      Fixes: e2cb1dec ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
      Signed-off-by: NXi Wang <wangxi11@huawei.com>
      Signed-off-by: NPeng Li <lipeng321@huawei.com>
      Signed-off-by: NSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1819e409
    • J
      bnx2x: use the right constant · dd612f18
      Julia Lawall 提交于
      Nearby code that also tests port suggests that the P0 constant should be
      used when port is zero.
      
      The semantic match that finds this problem is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression e,e1;
      @@
      
      * e ? e1 : e1
      // </smpl>
      
      Fixes: 6c3218c6 ("bnx2x: Adjust ETS to 578xx")
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dd612f18
    • A
      net: dsa: b53: Fix for brcm tag issue in Cygnus SoC · 5040cc99
      Arun Parameswaran 提交于
      In the Broadcom Cygnus SoC, the brcm tag needs to be inserted
      in between the mac address and the ether type (should use
      'DSA_PROTO_TAG_BRCM') for the packets sent to the internal
      b53 switch.
      
      Since the Cygnus was added with the BCM58XX device id and the
      BCM58XX uses 'DSA_PROTO_TAG_BRCM_PREPEND', the data path is
      broken, due to the incorrect brcm tag location.
      
      Add a new b53 device id (BCM583XX) for Cygnus family to fix the
      issue. Add the new device id to the BCM58XX family as Cygnus
      is similar to the BCM58XX in most other functionalities.
      
      Fixes: 11606039 ("net: dsa: b53: Support prepended Broadcom tags")
      Signed-off-by: NArun Parameswaran <arun.parameswaran@broadcom.com>
      Acked-by: NScott Branden <scott.branden@broadcom.com>
      Reported-by: NClément Péron <peron.clem@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NClément Péron <peron.clem@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5040cc99
  7. 06 6月, 2018 2 次提交