Skip to content
  1. Mar 20, 2020
    • Vasundhara Volam's avatar
      bnxt_en: reinitialize IRQs when MTU is modified · 1da8359e
      Vasundhara Volam authored
      [ Upstream commit a9b952d2 ]
      
      MTU changes may affect the number of IRQs so we must call
      bnxt_close_nic()/bnxt_open_nic() with the irq_re_init parameter
      set to true.  The reason is that a larger MTU may require
      aggregation rings not needed with smaller MTU.  We may not be
      able to allocate the required number of aggregation rings and
      so we reduce the number of channels which will change the number
      of IRQs.  Without this patch, it may crash eventually in
      pci_disable_msix() when the IRQs are not properly unwound.
      
      Fixes: c0c050c5
      
       ("bnxt_en: New Broadcom ethernet driver.")
      Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1da8359e
    • Dan Carpenter's avatar
      net: nfc: fix bounds checking bugs on "pipe" · 3587ae04
      Dan Carpenter authored
      [ Upstream commit a3aefbfe ]
      
      This is similar to commit 674d9de0 ("NFC: Fix possible memory
      corruption when handling SHDLC I-Frame commands") and commit d7ee81ad
      ("NFC: nci: Add some bounds checking in nci_hci_cmd_received()") which
      added range checks on "pipe".
      
      The "pipe" variable comes skb->data[0] in nfc_hci_msg_rx_work().
      It's in the 0-255 range.  We're using it as the array index into the
      hdev->pipes[] array which has NFC_HCI_MAX_PIPES (128) members.
      
      Fixes: 118278f2
      
       ("NFC: hci: Add pipes table to reference them with a tuple {gate, host}")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3587ae04
    • You-Sheng Yang's avatar
      r8152: check disconnect status after long sleep · 5f73ce9e
      You-Sheng Yang authored
      [ Upstream commit d64c7a08
      
       ]
      
      Dell USB Type C docking WD19/WD19DC attaches additional peripherals as:
      
        /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M
            |__ Port 1: Dev 11, If 0, Class=Hub, Driver=hub/4p, 5000M
                |__ Port 3: Dev 12, If 0, Class=Hub, Driver=hub/4p, 5000M
                |__ Port 4: Dev 13, If 0, Class=Vendor Specific Class,
                    Driver=r8152, 5000M
      
      where usb 2-1-3 is a hub connecting all USB Type-A/C ports on the dock.
      
      When hotplugging such dock with additional usb devices already attached on
      it, the probing process may reset usb 2.1 port, therefore r8152 ethernet
      device is also reset. However, during r8152 device init there are several
      for-loops that, when it's unable to retrieve hardware registers due to
      being disconnected from USB, may take up to 14 seconds each in practice,
      and that has to be completed before USB may re-enumerate devices on the
      bus. As a result, devices attached to the dock will only be available
      after nearly 1 minute after the dock was plugged in:
      
        [ 216.388290] [250] r8152 2-1.4:1.0: usb_probe_interface
        [ 216.388292] [250] r8152 2-1.4:1.0: usb_probe_interface - got id
        [ 258.830410] r8152 2-1.4:1.0 (unnamed net_device) (uninitialized): PHY not ready
        [ 258.830460] r8152 2-1.4:1.0 (unnamed net_device) (uninitialized): Invalid header when reading pass-thru MAC addr
        [ 258.830464] r8152 2-1.4:1.0 (unnamed net_device) (uninitialized): Get ether addr fail
      
      This happens in, for example, r8153_init:
      
        static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size,
      			    void *data, u16 type)
        {
          if (test_bit(RTL8152_UNPLUG, &tp->flags))
            return -ENODEV;
          ...
        }
      
        static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index)
        {
          u32 data;
          ...
          generic_ocp_read(tp, index, sizeof(tmp), &tmp, type | byen);
      
          data = __le32_to_cpu(tmp);
          ...
          return (u16)data;
        }
      
        static void r8153_init(struct r8152 *tp)
        {
          ...
          if (test_bit(RTL8152_UNPLUG, &tp->flags))
            return;
      
          for (i = 0; i < 500; i++) {
            if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
                AUTOLOAD_DONE)
              break;
            msleep(20);
          }
          ...
        }
      
      Since ocp_read_word() doesn't check the return status of
      generic_ocp_read(), and the only exit condition for the loop is to have
      a match in the returned value, such loops will only ends after exceeding
      its maximum runs when the device has been marked as disconnected, which
      takes 500 * 20ms = 10 seconds in theory, 14 in practice.
      
      To solve this long latency another test to RTL8152_UNPLUG flag should be
      added after those 20ms sleep to skip unnecessary loops, so that the device
      probe can complete early and proceed to parent port reset/reprobe process.
      
      This can be reproduced on all kernel versions up to latest v5.6-rc2, but
      after v5.5-rc7 the reproduce rate is dramatically lowered to 1/30 or less
      while it was around 1/2.
      
      Signed-off-by: default avatarYou-Sheng Yang <vicamo.yang@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f73ce9e
    • Petr Malat's avatar
      NFS: Remove superfluous kmap in nfs_readdir_xdr_to_array · dc369d74
      Petr Malat authored
      Array is mapped by nfs_readdir_get_array(), the further kmap is a result
      of a bad merge and should be removed.
      
      This resource leakage can be exploited for DoS by receptively reading
      a content of a directory on NFS (e.g. by running ls).
      
      Fixes: 67a56e97
      
       ("NFS: Fix memory leaks and corruption in readdir")
      Signed-off-by: default avatarPetr Malat <oss@malat.biz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dc369d74
  2. Mar 11, 2020