Skip to content
  1. Sep 03, 2021
    • Shreyansh Chouhan's avatar
      ip_gre: add validation for csum_start · fb45459d
      Shreyansh Chouhan authored
      [ Upstream commit 1d011c48 ]
      
      Validate csum_start in gre_handle_offloads before we call _gre_xmit so
      that we do not crash later when the csum_start value is used in the
      lco_csum function call.
      
      This patch deals with ipv4 code.
      
      Fixes: c5441932
      
       ("GRE: Refactor GRE tunneling code.")
      Reported-by: default avatar <syzbot+ff8e1b9f2f36481e2efc@syzkaller.appspotmail.com>
      Signed-off-by: default avatarShreyansh Chouhan <chouhan.shreyansh630@gmail.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fb45459d
    • Gal Pressman's avatar
      RDMA/efa: Free IRQ vectors on error flow · e78006b5
      Gal Pressman authored
      [ Upstream commit dbe986bd ]
      
      Make sure to free the IRQ vectors in case the allocation doesn't return
      the expected number of IRQs.
      
      Fixes: b7f5e880
      
       ("RDMA/efa: Add the efa module")
      Link: https://lore.kernel.org/r/20210811151131.39138-2-galpress@amazon.com
      Reviewed-by: default avatarFiras JahJah <firasj@amazon.com>
      Reviewed-by: default avatarYossi Leybovich <sleybo@amazon.com>
      Signed-off-by: default avatarGal Pressman <galpress@amazon.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e78006b5
    • Sasha Neftin's avatar
      e1000e: Do not take care about recovery NVM checksum · 8f1e3ad9
      Sasha Neftin authored
      [ Upstream commit 4051f683 ]
      
      On new platforms, the NVM is read-only. Attempting to update the NVM
      is causing a lockup to occur. Do not attempt to write to the NVM
      on platforms where it's not supported.
      Emit an error message when the NVM checksum is invalid.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213667
      Fixes: fb776f5d
      
       ("e1000e: Add support for Tiger Lake")
      Suggested-by: default avatarDima Ruinskiy <dima.ruinskiy@intel.com>
      Suggested-by: default avatarVitaly Lifshits <vitaly.lifshits@intel.com>
      Signed-off-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8f1e3ad9
    • Sasha Neftin's avatar
      e1000e: Fix the max snoop/no-snoop latency for 10M · 87285ac5
      Sasha Neftin authored
      [ Upstream commit 44a13a5d ]
      
      We should decode the latency and the max_latency before directly compare.
      The latency should be presented as lat_enc = scale x value:
      lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00)
      >> 10)))
      
      Fixes: cf8fb73c
      
       ("e1000e: add support for LTR on I217/I218")
      Suggested-by: default avatarYee Li <seven.yi.lee@gmail.com>
      Signed-off-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87285ac5
    • Toshiki Nishioka's avatar
      igc: Use num_tx_queues when iterating over tx_ring queue · 58b3dbf1
      Toshiki Nishioka authored
      [ Upstream commit 691bd4d7 ]
      
      Use num_tx_queues rather than the IGC_MAX_TX_QUEUES fixed number 4 when
      iterating over tx_ring queue since instantiated queue count could be
      less than 4 where on-line cpu count is less than 4.
      
      Fixes: ec50a9d4
      
       ("igc: Add support for taprio offloading")
      Signed-off-by: default avatarToshiki Nishioka <toshiki.nishioka@intel.com>
      Signed-off-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
      Tested-by: default avatarMuhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>
      Acked-by: default avatarSasha Neftin <sasha.neftin@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      58b3dbf1
    • Aaron Ma's avatar
      igc: fix page fault when thunderbolt is unplugged · ae6480ba
      Aaron Ma authored
      [ Upstream commit 4b799595 ]
      
      After unplug thunderbolt dock with i225, pciehp interrupt is triggered,
      remove call will read/write mmio address which is already disconnected,
      then cause page fault and make system hang.
      
      Check PCI state to remove device safely.
      
      Trace:
      BUG: unable to handle page fault for address: 000000000000b604
      Oops: 0000 [#1] SMP NOPTI
      RIP: 0010:igc_rd32+0x1c/0x90 [igc]
      Call Trace:
      igc_ptp_suspend+0x6c/0xa0 [igc]
      igc_ptp_stop+0x12/0x50 [igc]
      igc_remove+0x7f/0x1c0 [igc]
      pci_device_remove+0x3e/0xb0
      __device_release_driver+0x181/0x240
      
      Fixes: 13b5b7fd ("igc: Add support for Tx/Rx rings")
      Fixes: b03c49cd
      
       ("igc: Save PTP time before a reset")
      Signed-off-by: default avatarAaron Ma <aaron.ma@canonical.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ae6480ba
    • Petko Manolov's avatar
      net: usb: pegasus: fixes of set_register(s) return value evaluation; · 384dea50
      Petko Manolov authored
      [ Upstream commit ffc9c3eb ]
      
      - restore the behavior in enable_net_traffic() to avoid regressions - Jakub
          Kicinski;
        - hurried up and removed redundant assignment in pegasus_open() before yet
          another checker complains;
      
      Fixes: 8a160e2e
      
       ("net: usb: pegasus: Check the return value of get_geristers() and friends;")
      Reported-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarPetko Manolov <petko.manolov@konsulko.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      384dea50
    • Jacob Keller's avatar
      ice: do not abort devlink info if board identifier can't be found · 3217c9d4
      Jacob Keller authored
      [ Upstream commit a8f89fa2 ]
      
      The devlink dev info command reports version information about the
      device and firmware running on the board. This includes the "board.id"
      field which is supposed to represent an identifier of the board design.
      The ice driver uses the Product Board Assembly identifier for this.
      
      In some cases, the PBA is not present in the NVM. If this happens,
      devlink dev info will fail with an error. Instead, modify the
      ice_info_pba function to just exit without filling in the context
      buffer. This will cause the board.id field to be skipped. Log a dev_dbg
      message in case someone wants to confirm why board.id is not showing up
      for them.
      
      Fixes: e961b679
      
       ("ice: add board identifier info to devlink .info_get")
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Link: https://lore.kernel.org/r/20210819223451.245613-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3217c9d4
    • Dinghao Liu's avatar
      RDMA/bnxt_re: Remove unpaired rtnl unlock in bnxt_re_dev_init() · 3a2c5fbb
      Dinghao Liu authored
      [ Upstream commit a036ad08 ]
      
      The fixed commit removes all rtnl_lock() and rtnl_unlock() calls in
      function bnxt_re_dev_init(), but forgets to remove a rtnl_unlock() in the
      error handling path of bnxt_re_register_netdev(), which may cause a
      deadlock. This bug is suggested by a static analysis tool.
      
      Fixes: c2b777a9
      
       ("RDMA/bnxt_re: Refactor device add/remove functionalities")
      Link: https://lore.kernel.org/r/20210816085531.12167-1-dinghao.liu@zju.edu.cn
      Signed-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
      Acked-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a2c5fbb
    • Tuo Li's avatar
      IB/hfi1: Fix possible null-pointer dereference in _extend_sdma_tx_descs() · 56ac7463
      Tuo Li authored
      [ Upstream commit cbe71c61 ]
      
      kmalloc_array() is called to allocate memory for tx->descp. If it fails,
      the function __sdma_txclean() is called:
        __sdma_txclean(dd, tx);
      
      However, in the function __sdma_txclean(), tx-descp is dereferenced if
      tx->num_desc is not zero:
        sdma_unmap_desc(dd, &tx->descp[0]);
      
      To fix this possible null-pointer dereference, assign the return value of
      kmalloc_array() to a local variable descp, and then assign it to tx->descp
      if it is not NULL. Otherwise, go to enomem.
      
      Fixes: 77241056
      
       ("IB/hfi1: add driver files")
      Link: https://lore.kernel.org/r/20210806133029.194964-1-islituo@gmail.com
      Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
      Signed-off-by: default avatarTuo Li <islituo@gmail.com>
      Tested-by: default avatarMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
      Acked-by: default avatarMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      56ac7463
    • Naresh Kumar PBS's avatar
      RDMA/bnxt_re: Add missing spin lock initialization · 3e949aaa
      Naresh Kumar PBS authored
      [ Upstream commit 17f2569d ]
      
      Add the missing initialization of srq lock.
      
      Fixes: 37cb11ac
      
       ("RDMA/bnxt_re: Add SRQ support for Broadcom adapters")
      Link: https://lore.kernel.org/r/1629343553-5843-3-git-send-email-selvin.xavier@broadcom.com
      Signed-off-by: default avatarNaresh Kumar PBS <nareshkumar.pbs@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e949aaa
    • Li Jinlin's avatar
      scsi: core: Fix hang of freezing queue between blocking and running device · 22c18102
      Li Jinlin authored
      commit 02c6dcd5 upstream.
      
      We found a hang, the steps to reproduce  are as follows:
      
        1. blocking device via scsi_device_set_state()
      
        2. dd if=/dev/sda of=/mnt/t.log bs=1M count=10
      
        3. echo none > /sys/block/sda/queue/scheduler
      
        4. echo "running" >/sys/block/sda/device/state
      
      Step 3 and 4 should complete after step 4, but they hang.
      
        CPU#0               CPU#1                CPU#2
        ---------------     ----------------     ----------------
                                                 Step 1: blocking device
      
                                                 Step 2: dd xxxx
                                                        ^^^^^^ get request
                                                               q_usage_counter++
      
                            Step 3: switching scheculer
                            elv_iosched_store
                              elevator_switch
                                blk_mq_freeze_queue
                                  blk_freeze_queue
                                    > blk_freeze_queue_start
                                      ^^^^^^ mq_freeze_depth++
      
                                    > blk_mq_run_hw_queues
                                      ^^^^^^ can't run queue when dev blocked
      
                                    > blk_mq_freeze_queue_wait
                                      ^^^^^^ Hang here!!!
                                             wait q_usage_counter==0
      
        Step 4: running device
        store_state_field
          scsi_rescan_device
            scsi_attach_vpd
              scsi_vpd_inquiry
                __scsi_execute
                  blk_get_request
                    blk_mq_alloc_request
                      blk_queue_enter
                      ^^^^^^ Hang here!!!
                             wait mq_freeze_depth==0
      
          blk_mq_run_hw_queues
          ^^^^^^ dispatch IO, q_usage_counter will reduce to zero
      
                                  blk_mq_unfreeze_queue
                                  ^^^^^ mq_freeze_depth--
      
      To fix this, we need to run queue before rescanning device when the device
      state changes to SDEV_RUNNING.
      
      Link: https://lore.kernel.org/r/20210824025921.3277629-1-lijinlin3@huawei.com
      Fixes: f0f82e24
      
       ("scsi: core: Fix capacity set to zero after offlinining device")
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarLi Jinlin <lijinlin3@huawei.com>
      Signed-off-by: default avatarQiu Laibin <qiulaibin@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22c18102
    • Wesley Cheng's avatar
      usb: dwc3: gadget: Stop EP0 transfers during pullup disable · 01da7c1d
      Wesley Cheng authored
      commit 4a1e25c0 upstream.
      
      During a USB cable disconnect, or soft disconnect scenario, a pending
      SETUP transaction may not be completed, leading to the following
      error:
      
          dwc3 a600000.dwc3: timed out waiting for SETUP phase
      
      If this occurs, then the entire pullup disable routine is skipped and
      proper cleanup and halting of the controller does not complete.
      
      Instead of returning an error (which is ignored from the UDC
      perspective), allow the pullup disable routine to continue, which
      will also handle disabling of EP0/1.  This will end any active
      transfers as well.  Ensure to clear any delayed_status also, as the
      timeout could happen within the STATUS stage.
      
      Fixes: bb014736
      
       ("usb: dwc3: gadget: don't clear RUN/STOP when it's invalid to do so")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Acked-by: default avatarFelipe Balbi <balbi@kernel.org>
      Signed-off-by: default avatarWesley Cheng <wcheng@codeaurora.org>
      Link: https://lore.kernel.org/r/20210825042855.7977-1-wcheng@codeaurora.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      01da7c1d
    • Thinh Nguyen's avatar
      usb: dwc3: gadget: Fix dwc3_calc_trbs_left() · 87b20164
      Thinh Nguyen authored
      commit 51f1954a upstream.
      
      We can't depend on the TRB's HWO bit to determine if the TRB ring is
      "full". A TRB is only available when the driver had processed it, not
      when the controller consumed and relinquished the TRB's ownership to the
      driver. Otherwise, the driver may overwrite unprocessed TRBs. This can
      happen when many transfer events accumulate and the system is slow to
      process them and/or when there are too many small requests.
      
      If a request is in the started_list, that means there is one or more
      unprocessed TRBs remained. Check this instead of the TRB's HWO bit
      whether the TRB ring is full.
      
      Fixes: c4233573
      
       ("usb: dwc3: gadget: prepare TRBs on update transfers too")
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarFelipe Balbi <balbi@kernel.org>
      Signed-off-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Link: https://lore.kernel.org/r/e91e975affb0d0d02770686afc3a5b9eb84409f6.1629335416.git.Thinh.Nguyen@synopsys.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87b20164
    • Takashi Iwai's avatar
      usb: renesas-xhci: Prefer firmware loading on unknown ROM state · 56c92b8d
      Takashi Iwai authored
      commit c82cacd2 upstream.
      
      The recent attempt to handle an unknown ROM state in the commit
      d143825b ("usb: renesas-xhci: Fix handling of unknown ROM state")
      resulted in a regression and reverted later by the commit 44cf5360
      ("Revert "usb: renesas-xhci: Fix handling of unknown ROM state"").
      The problem of the former fix was that it treated the failure of
      firmware loading as a fatal error.  Since the firmware files aren't
      included in the standard linux-firmware tree, most users don't have
      them, hence they got the non-working system after that.  The revert
      fixed the regression, but also it didn't make the firmware loading
      triggered even on the devices that do need it.  So we need still a fix
      for them.
      
      This is another attempt to handle the unknown ROM state.  Like the
      previous fix, this also tries to load the firmware when ROM shows
      unknown state.  In this patch, however, the failure of a firmware
      loading (such as a missing firmware file) isn't handled as a fatal
      error any longer when ROM has been already detected, but it falls back
      to the ROM mode like before.  The error is returned only when no ROM
      is detected and the firmware loading failed.
      
      Along with it, for simplifying the code flow, the detection and the
      check of ROM is factored out from renesas_fw_check_running() and done
      in the caller side, renesas_xhci_check_request_fw().  It avoids the
      redundant ROM checks.
      
      The patch was tested on Lenovo Thinkpad T14 gen (BIOS 1.34).  Also it
      was confirmed that no regression is seen on another Thinkpad T14
      machine that has worked without the patch, too.
      
      Fixes: 44cf5360
      
       ("Revert "usb: renesas-xhci: Fix handling of unknown ROM state"")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1189207
      Link: https://lore.kernel.org/r/20210826124127.14789-1-tiwai@suse.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56c92b8d
    • Zhengjun Zhang's avatar
      USB: serial: option: add new VID/PID to support Fibocom FG150 · b0bcc803
      Zhengjun Zhang authored
      commit 2829a4e3
      
       upstream.
      
      Fibocom FG150 is a 5G module based on Qualcomm SDX55 platform,
      support Sub-6G band.
      
      Here are the outputs of lsusb -v and usb-devices:
      
      > T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      > D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      > P:  Vendor=2cb7 ProdID=010b Rev=04.14
      > S:  Manufacturer=Fibocom
      > S:  Product=Fibocom Modem_SN:XXXXXXXX
      > S:  SerialNumber=XXXXXXXX
      > C:  #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
      > I:  If#=0x0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host
      > I:  If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host
      > I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      > I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
      > I:  If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      
      > Bus 002 Device 002: ID 2cb7:010b Fibocom Fibocom Modem_SN:XXXXXXXX
      > Device Descriptor:
      >   bLength                18
      >   bDescriptorType         1
      >   bcdUSB               3.20
      >   bDeviceClass            0
      >   bDeviceSubClass         0
      >   bDeviceProtocol         0
      >   bMaxPacketSize0         9
      >   idVendor           0x2cb7 Fibocom
      >   idProduct          0x010b
      >   bcdDevice            4.14
      >   iManufacturer           1 Fibocom
      >   iProduct                2 Fibocom Modem_SN:XXXXXXXX
      >   iSerial                 3 XXXXXXXX
      >   bNumConfigurations      1
      >   Configuration Descriptor:
      >     bLength                 9
      >     bDescriptorType         2
      >     wTotalLength       0x00e6
      >     bNumInterfaces          5
      >     bConfigurationValue     1
      >     iConfiguration          4 RNDIS_DUN_DIAG_ADB
      >     bmAttributes         0xa0
      >       (Bus Powered)
      >       Remote Wakeup
      >     MaxPower              896mA
      >     Interface Association:
      >       bLength                 8
      >       bDescriptorType        11
      >       bFirstInterface         0
      >       bInterfaceCount         2
      >       bFunctionClass        239 Miscellaneous Device
      >       bFunctionSubClass       4
      >       bFunctionProtocol       1
      >       iFunction               7 RNDIS
      >     Interface Descriptor:
      >       bLength                 9
      >       bDescriptorType         4
      >       bInterfaceNumber        0
      >       bAlternateSetting       0
      >       bNumEndpoints           1
      >       bInterfaceClass       239 Miscellaneous Device
      >       bInterfaceSubClass      4
      >       bInterfaceProtocol      1
      >       iInterface              0
      >       ** UNRECOGNIZED:  05 24 00 10 01
      >       ** UNRECOGNIZED:  05 24 01 00 01
      >       ** UNRECOGNIZED:  04 24 02 00
      >       ** UNRECOGNIZED:  05 24 06 00 01
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x81  EP 1 IN
      >         bmAttributes            3
      >           Transfer Type            Interrupt
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0008  1x 8 bytes
      >         bInterval               9
      >         bMaxBurst               0
      >     Interface Descriptor:
      >       bLength                 9
      >       bDescriptorType         4
      >       bInterfaceNumber        1
      >       bAlternateSetting       0
      >       bNumEndpoints           2
      >       bInterfaceClass        10 CDC Data
      >       bInterfaceSubClass      0
      >       bInterfaceProtocol      0
      >       iInterface              0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x8e  EP 14 IN
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               6
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x0f  EP 15 OUT
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               6
      >     Interface Descriptor:
      >       bLength                 9
      >       bDescriptorType         4
      >       bInterfaceNumber        2
      >       bAlternateSetting       0
      >       bNumEndpoints           3
      >       bInterfaceClass       255 Vendor Specific Class
      >       bInterfaceSubClass      0
      >       bInterfaceProtocol      0
      >       iInterface              0
      >       ** UNRECOGNIZED:  05 24 00 10 01
      >       ** UNRECOGNIZED:  05 24 01 00 00
      >       ** UNRECOGNIZED:  04 24 02 02
      >       ** UNRECOGNIZED:  05 24 06 00 00
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x83  EP 3 IN
      >         bmAttributes            3
      >           Transfer Type            Interrupt
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x000a  1x 10 bytes
      >         bInterval               9
      >         bMaxBurst               0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x82  EP 2 IN
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x01  EP 1 OUT
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               0
      >     Interface Descriptor:
      >       bLength                 9
      >       bDescriptorType         4
      >       bInterfaceNumber        3
      >       bAlternateSetting       0
      >       bNumEndpoints           2
      >       bInterfaceClass       255 Vendor Specific Class
      >       bInterfaceSubClass    255 Vendor Specific Subclass
      >       bInterfaceProtocol     48
      >       iInterface              0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x84  EP 4 IN
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x02  EP 2 OUT
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               0
      >     Interface Descriptor:
      >       bLength                 9
      >       bDescriptorType         4
      >       bInterfaceNumber        4
      >       bAlternateSetting       0
      >       bNumEndpoints           2
      >       bInterfaceClass       255 Vendor Specific Class
      >       bInterfaceSubClass     66
      >       bInterfaceProtocol      1
      >       iInterface              0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x03  EP 3 OUT
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               0
      >       Endpoint Descriptor:
      >         bLength                 7
      >         bDescriptorType         5
      >         bEndpointAddress     0x85  EP 5 IN
      >         bmAttributes            2
      >           Transfer Type            Bulk
      >           Synch Type               None
      >           Usage Type               Data
      >         wMaxPacketSize     0x0400  1x 1024 bytes
      >         bInterval               0
      >         bMaxBurst               0
      > Binary Object Store Descriptor:
      >   bLength                 5
      >   bDescriptorType        15
      >   wTotalLength       0x0016
      >   bNumDeviceCaps          2
      >   USB 2.0 Extension Device Capability:
      >     bLength                 7
      >     bDescriptorType        16
      >     bDevCapabilityType      2
      >     bmAttributes   0x00000006
      >       BESL Link Power Management (LPM) Supported
      >   SuperSpeed USB Device Capability:
      >     bLength                10
      >     bDescriptorType        16
      >     bDevCapabilityType      3
      >     bmAttributes         0x00
      >     wSpeedsSupported   0x000f
      >       Device can operate at Low Speed (1Mbps)
      >       Device can operate at Full Speed (12Mbps)
      >       Device can operate at High Speed (480Mbps)
      >       Device can operate at SuperSpeed (5Gbps)
      >     bFunctionalitySupport   1
      >       Lowest fully-functional device speed is Full Speed (12Mbps)
      >     bU1DevExitLat           1 micro seconds
      >     bU2DevExitLat         500 micro seconds
      > Device Status:     0x0000
      >   (Bus Powered)
      
      Signed-off-by: default avatarZhengjun Zhang <zhangzhengjun@aicrobo.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0bcc803
    • Johan Hovold's avatar
      Revert "USB: serial: ch341: fix character loss at high transfer rates" · 8437e07c
      Johan Hovold authored
      commit df7b16d1 upstream.
      
      This reverts commit 3c18e9ba
      
      .
      
      These devices do not appear to send a zero-length packet when the
      transfer size is a multiple of the bulk-endpoint max-packet size. This
      means that incoming data may not be processed by the driver until a
      short packet is received or the receive buffer is full.
      
      Revert back to using endpoint-sized receive buffers to avoid stalled
      reads.
      
      Reported-by: default avatarPaul Größel <pb.g@gmx.de>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=214131
      Fixes: 3c18e9ba
      
       ("USB: serial: ch341: fix character loss at high transfer rates")
      Cc: stable@vger.kernel.org
      Cc: Willy Tarreau <w@1wt.eu>
      Link: https://lore.kernel.org/r/20210824121926.19311-1-johan@kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8437e07c
    • Michel Dänzer's avatar
      drm/amdgpu: Cancel delayed work when GFXOFF is disabled · da3067ea
      Michel Dänzer authored
      commit 32bc8f83
      
       upstream.
      
      schedule_delayed_work does not push back the work if it was already
      scheduled before, so amdgpu_device_delay_enable_gfx_off ran ~100 ms
      after the first time GFXOFF was disabled and re-enabled, even if GFXOFF
      was disabled and re-enabled again during those 100 ms.
      
      This resulted in frame drops / stutter with the upcoming mutter 41
      release on Navi 14, due to constantly enabling GFXOFF in the HW and
      disabling it again (for getting the GPU clock counter).
      
      To fix this, call cancel_delayed_work_sync when the disable count
      transitions from 0 to 1, and only schedule the delayed work on the
      reverse transition, not if the disable count was already 0. This makes
      sure the delayed work doesn't run at unexpected times, and allows it to
      be lock-free.
      
      v2:
      * Use cancel_delayed_work_sync & mutex_trylock instead of
        mod_delayed_work.
      v3:
      * Make amdgpu_device_delay_enable_gfx_off lock-free (Christian König)
      v4:
      * Fix race condition between amdgpu_gfx_off_ctrl incrementing
        adev->gfx.gfx_off_req_count and amdgpu_device_delay_enable_gfx_off
        checking for it to be 0 (Evan Quan)
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
      Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> # v3
      Acked-by: Christian König <christian.koenig@amd.com> # v3
      Signed-off-by: default avatarMichel Dänzer <mdaenzer@redhat.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      da3067ea
    • Qu Wenruo's avatar
      Revert "btrfs: compression: don't try to compress if we don't have enough pages" · 3134292a
      Qu Wenruo authored
      commit 4e965576 upstream.
      
      This reverts commit f2165627.
      
      [BUG]
      It's no longer possible to create compressed inline extent after commit
      f2165627
      
       ("btrfs: compression: don't try to compress if we don't
      have enough pages").
      
      [CAUSE]
      For compression code, there are several possible reasons we have a range
      that needs to be compressed while it's no more than one page.
      
      - Compressed inline write
        The data is always smaller than one sector and the test lacks the
        condition to properly recognize a non-inline extent.
      
      - Compressed subpage write
        For the incoming subpage compressed write support, we require page
        alignment of the delalloc range.
        And for 64K page size, we can compress just one page into smaller
        sectors.
      
      For those reasons, the requirement for the data to be more than one page
      is not correct, and is already causing regression for compressed inline
      data writeback.  The idea of skipping one page to avoid wasting CPU time
      could be revisited in the future.
      
      [FIX]
      Fix it by reverting the offending commit.
      
      Reported-by: default avatarZygo Blaxell <ce3g8jdj@umail.furryterror.org>
      Link: https://lore.kernel.org/linux-btrfs/afa2742.c084f5d6.17b6b08dffc@tnonline.net
      Fixes: f2165627
      
       ("btrfs: compression: don't try to compress if we don't have enough pages")
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3134292a
    • Vincent Chen's avatar
      riscv: Ensure the value of FP registers in the core dump file is up to date · 921c2533
      Vincent Chen authored
      commit 379eb01c
      
       upstream.
      
      The value of FP registers in the core dump file comes from the
      thread.fstate. However, kernel saves the FP registers to the thread.fstate
      only before scheduling out the process. If no process switch happens
      during the exception handling process, kernel will not have a chance to
      save the latest value of FP registers to thread.fstate. It will cause the
      value of FP registers in the core dump file may be incorrect. To solve this
      problem, this patch force lets kernel save the FP register into the
      thread.fstate if the target task_struct equals the current.
      
      Signed-off-by: default avatarVincent Chen <vincent.chen@sifive.com>
      Reviewed-by: default avatarJisheng Zhang <jszhang@kernel.org>
      Fixes: b8c8a959
      
       ("RISC-V: Add FP register ptrace support for gdb.")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      921c2533
    • Xiubo Li's avatar
      ceph: correctly handle releasing an embedded cap flush · e55a8b46
      Xiubo Li authored
      commit b2f9fa1f
      
       upstream.
      
      The ceph_cap_flush structures are usually dynamically allocated, but
      the ceph_cap_snap has an embedded one.
      
      When force umounting, the client will try to remove all the session
      caps. During this, it will free them, but that should not be done
      with the ones embedded in a capsnap.
      
      Fix this by adding a new boolean that indicates that the cap flush is
      embedded in a capsnap, and skip freeing it if that's set.
      
      At the same time, switch to using list_del_init() when detaching the
      i_list and g_list heads.  It's possible for a forced umount to remove
      these objects but then handle_cap_flushsnap_ack() races in and does the
      list_del_init() again, corrupting memory.
      
      Cc: stable@vger.kernel.org
      URL: https://tracker.ceph.com/issues/52283
      Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e55a8b46
    • Stefan Mätje's avatar
      can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters · 7008b998
      Stefan Mätje authored
      commit 044012b5 upstream.
      
      This patch fixes the interchanged fetch of the CAN RX and TX error
      counters from the ESD_EV_CAN_ERROR_EXT message. The RX error counter
      is really in struct rx_msg::data[2] and the TX error counter is in
      struct rx_msg::data[3].
      
      Fixes: 96d8e903
      
       ("can: Add driver for esd CAN-USB/2 device")
      Link: https://lore.kernel.org/r/20210825215227.4947-2-stefan.maetje@esd.eu
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarStefan Mätje <stefan.maetje@esd.eu>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7008b998
    • Mark Brown's avatar
      net: mscc: Fix non-GPL export of regmap APIs · 45b7b209
      Mark Brown authored
      [ Upstream commit 48c812e0
      
       ]
      
      The ocelot driver makes use of regmap, wrapping it with driver specific
      operations that are thin wrappers around the core regmap APIs. These are
      exported with EXPORT_SYMBOL, dropping the _GPL from the core regmap
      exports which is frowned upon. Add _GPL suffixes to at least the APIs that
      are doing register I/O.
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Acked-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      45b7b209
    • Miklos Szeredi's avatar
      ovl: fix uninitialized pointer read in ovl_lookup_real_one() · ef2d68ef
      Miklos Szeredi authored
      [ Upstream commit 580c6104
      
       ]
      
      One error path can result in release_dentry_name_snapshot() being called
      before "name" was initialized by take_dentry_name_snapshot().
      
      Fix by moving the release_dentry_name_snapshot() to immediately after the
      only use.
      
      Reported-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ef2d68ef
    • Ming Lei's avatar
      blk-iocost: fix lockdep warning on blkcg->lock · c94d5097
      Ming Lei authored
      [ Upstream commit 11431e26
      
       ]
      
      blkcg->lock depends on q->queue_lock which may depend on another driver
      lock required in irq context, one example is dm-thin:
      
      	Chain exists of:
      	  &pool->lock#3 --> &q->queue_lock --> &blkcg->lock
      
      	 Possible interrupt unsafe locking scenario:
      
      	       CPU0                    CPU1
      	       ----                    ----
      	  lock(&blkcg->lock);
      	                               local_irq_disable();
      	                               lock(&pool->lock#3);
      	                               lock(&q->queue_lock);
      	  <Interrupt>
      	    lock(&pool->lock#3);
      
      Fix the issue by using spin_lock_irq(&blkcg->lock) in ioc_weight_write().
      
      Cc: Tejun Heo <tj@kernel.org>
      Reported-by: default avatarBruno Goncalves <bgoncalv@redhat.com>
      Link: https://lore.kernel.org/linux-block/CA+QYu4rzz6079ighEanS3Qq_Dmnczcf45ZoJoHKVLVATTo1e4Q@mail.gmail.com/T/#u
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Link: https://lore.kernel.org/r/20210803070608.1766400-1-ming.lei@redhat.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c94d5097
    • Kefeng Wang's avatar
      once: Fix panic when module unload · 6815e21f
      Kefeng Wang authored
      [ Upstream commit 1027b96e ]
      
      DO_ONCE
      DEFINE_STATIC_KEY_TRUE(___once_key);
      __do_once_done
        once_disable_jump(once_key);
          INIT_WORK(&w->work, once_deferred);
          struct once_work *w;
          w->key = key;
          schedule_work(&w->work);                     module unload
                                                         //*the key is
      destroy*
      process_one_work
        once_deferred
          BUG_ON(!static_key_enabled(work->key));
             static_key_count((struct static_key *)x)    //*access key, crash*
      
      When module uses DO_ONCE mechanism, it could crash due to the above
      concurrency problem, we could reproduce it with link[1].
      
      Fix it by add/put module refcount in the once work process.
      
      [1] https://lore.kernel.org/netdev/eaa6c371-465e-57eb-6be9-f4b16b9d7cbf@huawei.com/
      
      Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Reported-by...
      6815e21f
    • Florian Westphal's avatar
      netfilter: conntrack: collect all entries in one cycle · f68ad168
      Florian Westphal authored
      [ Upstream commit 4608fdfc
      
       ]
      
      Michal Kubecek reports that conntrack gc is responsible for frequent
      wakeups (every 125ms) on idle systems.
      
      On busy systems, timed out entries are evicted during lookup.
      The gc worker is only needed to remove entries after system becomes idle
      after a busy period.
      
      To resolve this, always scan the entire table.
      If the scan is taking too long, reschedule so other work_structs can run
      and resume from next bucket.
      
      After a completed scan, wait for 2 minutes before the next cycle.
      Heuristics for faster re-schedule are removed.
      
      GC_SCAN_INTERVAL could be exposed as a sysctl in the future to allow
      tuning this as-needed or even turn the gc worker off.
      
      Reported-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f68ad168
    • Guenter Roeck's avatar
      ARC: Fix CONFIG_STACKDEPOT · a13a2df0
      Guenter Roeck authored
      [ Upstream commit bf79167f
      
       ]
      
      Enabling CONFIG_STACKDEPOT results in the following build error.
      
      arc-elf-ld: lib/stackdepot.o: in function `filter_irq_stacks':
      stackdepot.c:(.text+0x456): undefined reference to `__irqentry_text_start'
      arc-elf-ld: stackdepot.c:(.text+0x456): undefined reference to `__irqentry_text_start'
      arc-elf-ld: stackdepot.c:(.text+0x476): undefined reference to `__irqentry_text_end'
      arc-elf-ld: stackdepot.c:(.text+0x476): undefined reference to `__irqentry_text_end'
      arc-elf-ld: stackdepot.c:(.text+0x484): undefined reference to `__softirqentry_text_start'
      arc-elf-ld: stackdepot.c:(.text+0x484): undefined reference to `__softirqentry_text_start'
      arc-elf-ld: stackdepot.c:(.text+0x48c): undefined reference to `__softirqentry_text_end'
      arc-elf-ld: stackdepot.c:(.text+0x48c): undefined reference to `__softirqentry_text_end'
      
      Other architectures address this problem by adding IRQENTRY_TEXT and
      SOFTIRQENTRY_TEXT to the text segment, so do the same here.
      
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a13a2df0
    • Mark Brown's avatar
      ASoC: component: Remove misplaced prefix handling in pin control functions · 0af6a9f8
      Mark Brown authored
      [ Upstream commit 31428c78 ]
      
      When the component level pin control functions were added they for some
      no longer obvious reason handled adding prefixing of widget names. This
      meant that when the lack of prefix handling in the DAPM level pin
      operations was fixed by ae4fc532
      
       (ASoC: dapm: use component
      prefix when checking widget names) the one device using the component
      level API ended up with the prefix being applied twice, causing all
      lookups to fail.
      
      Fix this by removing the redundant prefixing from the component code,
      which has the nice side effect of also making that code much simpler.
      
      Reported-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Tested-by: default avatarLucas Tanure <tanureal@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20210726194123.54585-1-broonie@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0af6a9f8
    • Derek Fang's avatar
      ASoC: rt5682: Adjust headset volume button threshold · 34cc80ec
      Derek Fang authored
      [ Upstream commit 6d20bf7c
      
       ]
      
      Adjust the threshold of headset button volume+ to fix
      the wrong button detection issue with some brand headsets.
      
      Signed-off-by: default avatarDerek Fang <derek.fang@realtek.com>
      Link: https://lore.kernel.org/r/20210721133121.12333-1-derek.fang@realtek.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34cc80ec
    • Yonghong Song's avatar
      bpf: Fix NULL pointer dereference in bpf_get_local_storage() helper · d81ddada
      Yonghong Song authored
      commit b910eaaa
      
       upstream.
      
      Jiri Olsa reported a bug ([1]) in kernel where cgroup local
      storage pointer may be NULL in bpf_get_local_storage() helper.
      There are two issues uncovered by this bug:
        (1). kprobe or tracepoint prog incorrectly sets cgroup local storage
             before prog run,
        (2). due to change from preempt_disable to migrate_disable,
             preemption is possible and percpu storage might be overwritten
             by other tasks.
      
      This issue (1) is fixed in [2]. This patch tried to address issue (2).
      The following shows how things can go wrong:
        task 1:   bpf_cgroup_storage_set() for percpu local storage
               preemption happens
        task 2:   bpf_cgroup_storage_set() for percpu local storage
               preemption happens
        task 1:   run bpf program
      
      task 1 will effectively use the percpu local storage setting by task 2
      which will be either NULL or incorrect ones.
      
      Instead of just one common local storage per cpu, this patch fixed
      the issue by permitting 8 local storages per cpu and each local
      storage is identified by a task_struct pointer. This way, we
      allow at most 8 nested preemption between bpf_cgroup_storage_set()
      and bpf_cgroup_storage_unset(). The percpu local storage slot
      is released (calling bpf_cgroup_storage_unset()) by the same task
      after bpf program finished running.
      bpf_test_run() is also fixed to use the new bpf_cgroup_storage_set()
      interface.
      
      The patch is tested on top of [2] with reproducer in [1].
      Without this patch, kernel will emit error in 2-3 minutes.
      With this patch, after one hour, still no error.
      
       [1] https://lore.kernel.org/bpf/CAKH8qBuXCfUz=w8L+Fj74OaUpbosO29niYwTki7e3Ag044_aww@mail.gmail.com/T
       [2] https://lore.kernel.org/bpf/20210309185028.3763817-1-yhs@fb.com
      
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Link: https://lore.kernel.org/bpf/20210323055146.3334476-1-yhs@fb.com
      Cc: <stable@vger.kernel.org> # 5.10.x
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d81ddada
    • Daniel Borkmann's avatar
      bpf: Fix ringbuf helper function compatibility · 9dd6f6d8
      Daniel Borkmann authored
      commit 5b029a32 upstream.
      
      Commit 457f4436 ("bpf: Implement BPF ring buffer and verifier support
      for it") extended check_map_func_compatibility() by enforcing map -> helper
      function match, but not helper -> map type match.
      
      Due to this all of the bpf_ringbuf_*() helper functions could be used with
      a wrong map type such as array or hash map, leading to invalid access due
      to type confusion.
      
      Also, both BPF_FUNC_ringbuf_{submit,discard} have ARG_PTR_TO_ALLOC_MEM as
      argument and not a BPF map. Therefore, their check_map_func_compatibility()
      presence is incorrect since it's only for map type checking.
      
      Fixes: 457f4436
      
       ("bpf: Implement BPF ring buffer and verifier support for it")
      Reported-by: Ryota Shiga (Flatt Security)
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9dd6f6d8
    • Xiaolong Huang's avatar
      net: qrtr: fix another OOB Read in qrtr_endpoint_post · ad41706c
      Xiaolong Huang authored
      commit 7e78c597 upstream.
      
      This check was incomplete, did not consider size is 0:
      
      	if (len != ALIGN(size, 4) + hdrlen)
                          goto err;
      
      if size from qrtr_hdr is 0, the result of ALIGN(size, 4)
      will be 0, In case of len == hdrlen and size == 0
      in header this check won't fail and
      
      	if (cb->type == QRTR_TYPE_NEW_SERVER) {
                      /* Remote node endpoint can bridge other distant nodes */
                      const struct qrtr_ctrl_pkt *pkt = data + hdrlen;
      
                      qrtr_node_assign(node, le32_to_cpu(pkt->server.node));
              }
      
      will also read out of bound from data, which is hdrlen allocated block.
      
      Fixes: 194ccc88 ("net: qrtr: Support decoding incoming v2 packets")
      Fixes: ad9d24c9
      
       ("net: qrtr: fix OOB Read in qrtr_endpoint_post")
      Signed-off-by: default avatarXiaolong Huang <butterflyhuangxx@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfo...>
      ad41706c
  2. Aug 26, 2021