Skip to content
  1. Sep 03, 2021
    • Shreyansh Chouhan's avatar
      ip_gre: add validation for csum_start · 53b480e6
      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>
      53b480e6
    • Gal Pressman's avatar
      RDMA/efa: Free IRQ vectors on error flow · bb8ca7e2
      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>
      bb8ca7e2
    • Sasha Neftin's avatar
      e1000e: Fix the max snoop/no-snoop latency for 10M · e29565b4
      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>
      e29565b4
    • Tuo Li's avatar
      IB/hfi1: Fix possible null-pointer dereference in _extend_sdma_tx_descs() · 8a21e843
      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>
      8a21e843
    • Naresh Kumar PBS's avatar
      RDMA/bnxt_re: Add missing spin lock initialization · 944a50f5
      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>
      944a50f5
    • Li Jinlin's avatar
      scsi: core: Fix hang of freezing queue between blocking and running device · 28b18954
      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>
      28b18954
    • Wesley Cheng's avatar
      usb: dwc3: gadget: Stop EP0 transfers during pullup disable · 628c5828
      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>
      628c5828
    • Thinh Nguyen's avatar
      usb: dwc3: gadget: Fix dwc3_calc_trbs_left() · d9da281c
      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>
      d9da281c
    • Zhengjun Zhang's avatar
      USB: serial: option: add new VID/PID to support Fibocom FG150 · 21880abf
      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>
      21880abf
    • Johan Hovold's avatar
      Revert "USB: serial: ch341: fix character loss at high transfer rates" · 2e098e91
      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>
      2e098e91
    • Stefan Mätje's avatar
      can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters · 16b281a7
      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>
      16b281a7
    • Yafang Shao's avatar
      mm, oom: make the calculation of oom badness more accurate · 765437d1
      Yafang Shao authored
      [ Upstream commit 9066e5cf
      
       ]
      
      Recently we found an issue on our production environment that when memcg
      oom is triggered the oom killer doesn't chose the process with largest
      resident memory but chose the first scanned process.  Note that all
      processes in this memcg have the same oom_score_adj, so the oom killer
      should chose the process with largest resident memory.
      
      Bellow is part of the oom info, which is enough to analyze this issue.
      [7516987.983223] memory: usage 16777216kB, limit 16777216kB, failcnt 52843037
      [7516987.983224] memory+swap: usage 16777216kB, limit 9007199254740988kB, failcnt 0
      [7516987.983225] kmem: usage 301464kB, limit 9007199254740988kB, failcnt 0
      [...]
      [7516987.983293] [ pid ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
      [7516987.983510] [ 5740]     0  5740      257        1    32768        0          -998 pause
      [7516987.983574] [58804]     0 58804     4594      771    81920        0          -998 entry_point.bas
      [7516987.983577] [58908]     0 58908     7089      689    98304        0          -998 cron
      [7516987.983580] [58910]     0 58910    16235     5576   163840        0          -998 supervisord
      [7516987.983590] [59620]     0 59620    18074     1395   188416        0          -998 sshd
      [7516987.983594] [59622]     0 59622    18680     6679   188416        0          -998 python
      [7516987.983598] [59624]     0 59624  1859266     5161   548864        0          -998 odin-agent
      [7516987.983600] [59625]     0 59625   707223     9248   983040        0          -998 filebeat
      [7516987.983604] [59627]     0 59627   416433    64239   774144        0          -998 odin-log-agent
      [7516987.983607] [59631]     0 59631   180671    15012   385024        0          -998 python3
      [7516987.983612] [61396]     0 61396   791287     3189   352256        0          -998 client
      [7516987.983615] [61641]     0 61641  1844642    29089   946176        0          -998 client
      [7516987.983765] [ 9236]     0  9236     2642      467    53248        0          -998 php_scanner
      [7516987.983911] [42898]     0 42898    15543      838   167936        0          -998 su
      [7516987.983915] [42900]  1000 42900     3673      867    77824        0          -998 exec_script_vr2
      [7516987.983918] [42925]  1000 42925    36475    19033   335872        0          -998 python
      [7516987.983921] [57146]  1000 57146     3673      848    73728        0          -998 exec_script_J2p
      [7516987.983925] [57195]  1000 57195   186359    22958   491520        0          -998 python2
      [7516987.983928] [58376]  1000 58376   275764    14402   290816        0          -998 rosmaster
      [7516987.983931] [58395]  1000 58395   155166     4449   245760        0          -998 rosout
      [7516987.983935] [58406]  1000 58406 18285584  3967322 37101568        0          -998 data_sim
      [7516987.984221] oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=3aa16c9482ae3a6f6b78bda68a55d32c87c99b985e0f11331cddf05af6c4d753,mems_allowed=0-1,oom_memcg=/kubepods/podf1c273d3-9b36-11ea-b3df-246e9693c184,task_memcg=/kubepods/podf1c273d3-9b36-11ea-b3df-246e9693c184/1f246a3eeea8f70bf91141eeaf1805346a666e225f823906485ea0b6c37dfc3d,task=pause,pid=5740,uid=0
      [7516987.984254] Memory cgroup out of memory: Killed process 5740 (pause) total-vm:1028kB, anon-rss:4kB, file-rss:0kB, shmem-rss:0kB
      [7516988.092344] oom_reaper: reaped process 5740 (pause), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
      
      We can find that the first scanned process 5740 (pause) was killed, but
      its rss is only one page.  That is because, when we calculate the oom
      badness in oom_badness(), we always ignore the negtive point and convert
      all of these negtive points to 1.  Now as oom_score_adj of all the
      processes in this targeted memcg have the same value -998, the points of
      these processes are all negtive value.  As a result, the first scanned
      process will be killed.
      
      The oom_socre_adj (-998) in this memcg is set by kubelet, because it is a
      a Guaranteed pod, which has higher priority to prevent from being killed
      by system oom.
      
      To fix this issue, we should make the calculation of oom point more
      accurate.  We can achieve it by convert the chosen_point from 'unsigned
      long' to 'long'.
      
      [cai@lca.pw: reported a issue in the previous version]
      [mhocko@suse.com: fixed the issue reported by Cai]
      [mhocko@suse.com: add the comment in proc_oom_score()]
      [laoar.shao@gmail.com: v3]
        Link: http://lkml.kernel.org/r/1594396651-9931-1-git-send-email-laoar.shao@gmail.com
      
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Tested-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Qian Cai <cai@lca.pw>
      Link: http://lkml.kernel.org/r/1594309987-9919-1-git-send-email-laoar.shao@gmail.com
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      765437d1
    • Shaik Sajida Bhanu's avatar
      mmc: sdhci-msm: Update the software timeout value for sdhc · 1cccf5c0
      Shaik Sajida Bhanu authored
      [ Upstream commit 67b13f3e
      
       ]
      
      Whenever SDHC run at clock rate 50MHZ or below, the hardware data
      timeout value will be 21.47secs, which is approx. 22secs and we have
      a current software timeout value as 10secs. We have to set software
      timeout value more than the hardware data timeout value to avioid seeing
      the below register dumps.
      
      [  332.953670] mmc2: Timeout waiting for hardware interrupt.
      [  332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
      [  332.966450] mmc2: sdhci: Sys addr:  0x00000000 | Version:  0x00007202
      [  332.973256] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
      [  332.980054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000027
      [  332.986864] mmc2: sdhci: Present:   0x01f801f6 | Host ctl: 0x0000001f
      [  332.993671] mmc2: sdhci: Power:     0x00000001 | Blk gap:  0x00000000
      [  333.000583] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
      [  333.007386] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
      [  333.014182] mmc2: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
      [  333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
      [  333.027771] mmc2: sdhci: Caps:      0x322dc8b2 | Caps_1:   0x0000808f
      [  333.034561] mmc2: sdhci: Cmd:       0x0000183a | Max curr: 0x00000000
      [  333.041359] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
      [  333.048157] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
      [  333.054945] mmc2: sdhci: Host ctl2: 0x00000000
      [  333.059657] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr:
      0x0000000ffffff218
      [  333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP
      -----------
      [  333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg:
      0x6000642c | DLL cfg2: 0x0020a000
      [  333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl:
      0x00000000 | DDR cfg: 0x80040873
      [  333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 :
      0xf88218a8 Vndr func3: 0x02626040
      [  333.102371] mmc2: sdhci: ============================================
      
      So, set software timeout value more than hardware timeout value.
      
      Signed-off-by: default avatarShaik Sajida Bhanu <sbhanu@codeaurora.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/1626435974-14462-1-git-send-email-sbhanu@codeaurora.org
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1cccf5c0
    • Miklos Szeredi's avatar
      ovl: fix uninitialized pointer read in ovl_lookup_real_one() · aec1e470
      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>
      aec1e470
    • Kefeng Wang's avatar
      once: Fix panic when module unload · 57bd5b59
      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: default avatarMinmin chen <chenmingmin@huawei.com>
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      57bd5b59
    • Florian Westphal's avatar
      netfilter: conntrack: collect all entries in one cycle · 5892f910
      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>
      5892f910
    • Guenter Roeck's avatar
      ARC: Fix CONFIG_STACKDEPOT · 7c95c89b
      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>
      7c95c89b
    • Xiaolong Huang's avatar
      net: qrtr: fix another OOB Read in qrtr_endpoint_post · a6b049ae
      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@linuxfoundation.org>
      a6b049ae
  2. Aug 26, 2021
    • Sasha Levin's avatar
    • Sergey Marinkevich's avatar
      netfilter: nft_exthdr: fix endianness of tcp option cast · 4bf19415
      Sergey Marinkevich authored
      [ Upstream commit 2e34328b
      
       ]
      
      I got a problem on MIPS with Big-Endian is turned on: every time when
      NF trying to change TCP MSS it returns because of new.v16 was greater
      than old.v16. But real MSS was 1460 and my rule was like this:
      
      	add rule table chain tcp option maxseg size set 1400
      
      And 1400 is lesser that 1460, not greater.
      
      Later I founded that main causer is cast from u32 to __be16.
      
      Debugging:
      
      In example MSS = 1400(HEX: 0x578). Here is representation of each byte
      like it is in memory by addresses from left to right(e.g. [0x0 0x1 0x2
      0x3]). LE — Little-Endian system, BE — Big-Endian, left column is type.
      
      	     LE               BE
      	u32: [78 05 00 00]    [00 00 05 78]
      
      As you can see, u32 representation will be casted to u16 from different
      half of 4-byte address range. But actually nf_tables uses registers and
      store data of various size. Actually TCP MSS stored in 2 bytes. But
      registers are still u32 in definition:
      
      	struct nft_regs {
      		union {
      			u32			data[20];
      			struct nft_verdict	verdict;
      		};
      	};
      
      So, access like regs->data[priv->sreg] exactly u32. So, according to
      table presents above, per-byte representation of stored TCP MSS in
      register will be:
      
      	                     LE               BE
      	(u32)regs->data[]:   [78 05 00 00]    [05 78 00 00]
      	                                       ^^ ^^
      
      We see that register uses just half of u32 and other 2 bytes may be
      used for some another data. But in nft_exthdr_tcp_set_eval() it casted
      just like u32 -> __be16:
      
      	new.v16 = src
      
      But u32 overfill __be16, so it get 2 low bytes. For clarity draw
      one more table(<xx xx> means that bytes will be used for cast).
      
      	                     LE                 BE
      	u32:                 [<78 05> 00 00]    [00 00 <05 78>]
      	(u32)regs->data[]:   [<78 05> 00 00]    [05 78 <00 00>]
      
      As you can see, for Little-Endian nothing changes, but for Big-endian we
      take the wrong half. In my case there is some other data instead of
      zeros, so new MSS was wrongly greater.
      
      For shooting this bug I used solution for ports ranges. Applying of this
      patch does not affect Little-Endian systems.
      
      Signed-off-by: default avatarSergey Marinkevich <sergey.marinkevich@eltex-co.ru>
      Acked-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>
      4bf19415
    • Jeff Layton's avatar
      fs: warn about impending deprecation of mandatory locks · e4fd994f
      Jeff Layton authored
      [ Upstream commit fdd92b64
      
       ]
      
      We've had CONFIG_MANDATORY_FILE_LOCKING since 2015 and a lot of distros
      have disabled it. Warn the stragglers that still use "-o mand" that
      we'll be dropping support for that mount option.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e4fd994f
    • Johannes Weiner's avatar
      mm: memcontrol: fix occasional OOMs due to proportional memory.low reclaim · 41c7f46c
      Johannes Weiner authored
      [ Upstream commit f56ce412 ]
      
      We've noticed occasional OOM killing when memory.low settings are in
      effect for cgroups.  This is unexpected and undesirable as memory.low is
      supposed to express non-OOMing memory priorities between cgroups.
      
      The reason for this is proportional memory.low reclaim.  When cgroups
      are below their memory.low threshold, reclaim passes them over in the
      first round, and then retries if it couldn't find pages anywhere else.
      But when cgroups are slightly above their memory.low setting, page scan
      force is scaled down and diminished in proportion to the overage, to the
      point where it can cause reclaim to fail as well - only in that case we
      currently don't retry, and instead trigger OOM.
      
      To fix this, hook proportional reclaim into the same retry logic we have
      in place for when cgroups are skipped entirely.  This way if reclaim
      fails and some cgroups were scanned with diminished pressure, we'll try
      another full-force cycle before giving up and OOMing.
      
      [akpm@linux-foundation.org: coding-style fixes]
      
      Link: https://lkml.kernel.org/r/20210817180506.220056-1-hannes@cmpxchg.org
      Fixes: 9783aa99
      
       ("mm, memcg: proportional memory.{low,min} reclaim")
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Reported-by: default avatarLeon Yang <lnyng@fb.com>
      Reviewed-by: default avatarRik van Riel <riel@surriel.com>
      Reviewed-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Acked-by: default avatarChris Down <chris@chrisdown.name>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: <stable@vger.kernel.org>		[5.4+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      41c7f46c
    • Yafang Shao's avatar
      mm, memcg: avoid stale protection values when cgroup is above protection · 1a3aa814
      Yafang Shao authored
      [ Upstream commit 22f7496f ]
      
      Patch series "mm, memcg: memory.{low,min} reclaim fix & cleanup", v4.
      
      This series contains a fix for a edge case in my earlier protection
      calculation patches, and a patch to make the area overall a little more
      robust to hopefully help avoid this in future.
      
      This patch (of 2):
      
      A cgroup can have both memory protection and a memory limit to isolate it
      from its siblings in both directions - for example, to prevent it from
      being shrunk below 2G under high pressure from outside, but also from
      growing beyond 4G under low pressure.
      
      Commit 9783aa99 ("mm, memcg: proportional memory.{low,min} reclaim")
      implemented proportional scan pressure so that multiple siblings in excess
      of their protection settings don't get reclaimed equally but instead in
      accordance to their unprotected portion.
      
      During limit reclaim, this proportionality shouldn't apply of course:
      there is no competition, all pressure is from within the cgroup and should
      be applied as such.  Reclaim should operate at full efficiency.
      
      However, mem_cgroup_protected() never expected anybody to look at the
      effective protection values when it indicated that the cgroup is above its
      protection.  As a result, a query during limit reclaim may return stale
      protection values that were calculated by a previous reclaim cycle in
      which the cgroup did have siblings.
      
      When this happens, reclaim is unnecessarily hesitant and potentially slow
      to meet the desired limit.  In theory this could lead to premature OOM
      kills, although it's not obvious this has occurred in practice.
      
      Workaround the problem by special casing reclaim roots in
      mem_cgroup_protection.  These memcgs are never participating in the
      reclaim protection because the reclaim is internal.
      
      We have to ignore effective protection values for reclaim roots because
      mem_cgroup_protected might be called from racing reclaim contexts with
      different roots.  Calculation is relying on root -> leaf tree traversal
      therefore top-down reclaim protection invariants should hold.  The only
      exception is the reclaim root which should have effective protection set
      to 0 but that would be problematic for the following setup:
      
       Let's have global and A's reclaim in parallel:
        |
        A (low=2G, usage = 3G, max = 3G, children_low_usage = 1.5G)
        |\
        | C (low = 1G, usage = 2.5G)
        B (low = 1G, usage = 0.5G)
      
       for A reclaim we have
       B.elow = B.low
       C.elow = C.low
      
       For the global reclaim
       A.elow = A.low
       B.elow = min(B.usage, B.low) because children_low_usage <= A.elow
       C.elow = min(C.usage, C.low)
      
       With the effective values resetting we have A reclaim
       A.elow = 0
       B.elow = B.low
       C.elow = C.low
      
       and global reclaim could see the above and then
       B.elow = C.elow = 0 because children_low_usage > A.elow
      
      Which means that protected memcgs would get reclaimed.
      
      In future we would like to make mem_cgroup_protected more robust against
      racing reclaim contexts but that is likely more complex solution than this
      simple workaround.
      
      [hannes@cmpxchg.org - large part of the changelog]
      [mhocko@suse.com - workaround explanation]
      [chris@chrisdown.name - retitle]
      
      Fixes: 9783aa99
      
       ("mm, memcg: proportional memory.{low,min} reclaim")
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Signed-off-by: default avatarChris Down <chris@chrisdown.name>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarChris Down <chris@chrisdown.name>
      Acked-by: default avatarRoman Gushchin <guro@fb.com>
      Link: http://lkml.kernel.org/r/cover.1594638158.git.chris@chrisdown.name
      Link: http://lkml.kernel.org/r/044fb8ecffd001c7905d27c0c2ad998069fdc396.1594638158.git.chris@chrisdown.name
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1a3aa814
    • Takashi Iwai's avatar
      ASoC: intel: atom: Fix breakage for PCM buffer address setup · 9c1c449d
      Takashi Iwai authored
      [ Upstream commit 65ca89c2 ]
      
      The commit 2e6b8363 ("ASoC: intel: atom: Fix reference to PCM
      buffer address") changed the reference of PCM buffer address to
      substream->runtime->dma_addr as the buffer address may change
      dynamically.  However, I forgot that the dma_addr field is still not
      set up for the CONTINUOUS buffer type (that this driver uses) yet in
      5.14 and earlier kernels, and it resulted in garbage I/O.  The problem
      will be fixed in 5.15, but we need to address it quickly for now.
      
      The fix is to deduce the address again from the DMA pointer with
      virt_to_phys(), but from the right one, substream->runtime->dma_area.
      
      Fixes: 2e6b8363
      
       ("ASoC: intel: atom: Fix reference to PCM buffer address")
      Reported-and-tested-by: default avatarHans de Goede <hdegoede@redhat.com>
      Cc: <stable@vger.kernel.org>
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Link: https://lore.kernel.org/r/2048c6aa-2187-46bd-6772-36a4fb3c5aeb@redhat.com
      Link: https://lore.kernel.org/r/20210819152945.8510-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9c1c449d
    • Marcin Bachry's avatar
      PCI: Increase D3 delay for AMD Renoir/Cezanne XHCI · 846ba58a
      Marcin Bachry authored
      [ Upstream commit e0bff432
      
       ]
      
      The Renoir XHCI controller apparently doesn't resume reliably with the
      standard D3hot-to-D0 delay.  Increase it to 20ms.
      
      [Alex: I talked to the AMD USB hardware team and the AMD Windows team and
      they are not aware of any HW errata or specific issues.  The HW works fine
      in Windows.  I was told Windows uses a rather generous default delay of
      100ms for PCI state transitions.]
      
      Link: https://lore.kernel.org/r/20210722025858.220064-1-alexander.deucher@amd.com
      Signed-off-by: default avatarMarcin Bachry <hegel666@gmail.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Cc: Prike Liang <prike.liang@amd.com>
      Cc: Shyam Sundar S K <shyam-sundar.s-k@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      846ba58a
    • NeilBrown's avatar
      btrfs: prevent rename2 from exchanging a subvol with a directory from different parents · 548b75f4
      NeilBrown authored
      [ Upstream commit 3f79f6f6 ]
      
      Cross-rename lacks a check when that would prevent exchanging a
      directory and subvolume from different parent subvolume. This causes
      data inconsistencies and is caught before commit by tree-checker,
      turning the filesystem to read-only.
      
      Calling the renameat2 with RENAME_EXCHANGE flags like
      
        renameat2(AT_FDCWD, namesrc, AT_FDCWD, namedest, (1 << 1))
      
      on two paths:
      
        namesrc = dir1/subvol1/dir2
       namedest = subvol2/subvol3
      
      will cause key order problem with following write time tree-checker
      report:
      
        [1194842.307890] BTRFS critical (device loop1): corrupt leaf: root=5 block=27574272 slot=10 ino=258, invalid previous key objectid, have 257 expect 258
        [1194842.322221] BTRFS info (device loop1): leaf 27574272 gen 8 total ptrs 11 free space 15444 owner 5
        [1194842.331562] BTRFS info (device loop1): refs 2 lock_owner 0 current 26561
        [1194842.338772]        item 0 key (256 1 0) itemoff 16123 itemsize 160
        [1194842.338793]                inode generation 3 size 16 mode 40755
        [1194842.338801]        item 1 key (256 12 256) itemoff 16111 itemsize 12
        [1194842.338809]        item 2 key (256 84 2248503653) itemoff 16077 itemsize 34
        [1194842.338817]                dir oid 258 type 2
        [1194842.338823]        item 3 key (256 84 2363071922) itemoff 16043 itemsize 34
        [1194842.338830]                dir oid 257 type 2
        [1194842.338836]        item 4 key (256 96 2) itemoff 16009 itemsize 34
        [1194842.338843]        item 5 key (256 96 3) itemoff 15975 itemsize 34
        [1194842.338852]        item 6 key (257 1 0) itemoff 15815 itemsize 160
        [1194842.338863]                inode generation 6 size 8 mode 40755
        [1194842.338869]        item 7 key (257 12 256) itemoff 15801 itemsize 14
        [1194842.338876]        item 8 key (257 84 2505409169) itemoff 15767 itemsize 34
        [1194842.338883]                dir oid 256 type 2
        [1194842.338888]        item 9 key (257 96 2) itemoff 15733 itemsize 34
        [1194842.338895]        item 10 key (258 12 256) itemoff 15719 itemsize 14
        [1194842.339163] BTRFS error (device loop1): block=27574272 write time tree block corruption detected
        [1194842.339245] ------------[ cut here ]------------
        [1194842.443422] WARNING: CPU: 6 PID: 26561 at fs/btrfs/disk-io.c:449 csum_one_extent_buffer+0xed/0x100 [btrfs]
        [1194842.511863] CPU: 6 PID: 26561 Comm: kworker/u17:2 Not tainted 5.14.0-rc3-git+ #793
        [1194842.511870] Hardware name: empty empty/S3993, BIOS PAQEX0-3 02/24/2008
        [1194842.511876] Workqueue: btrfs-worker-high btrfs_work_helper [btrfs]
        [1194842.511976] RIP: 0010:csum_one_extent_buffer+0xed/0x100 [btrfs]
        [1194842.512068] RSP: 0018:ffffa2c284d77da0 EFLAGS: 00010282
        [1194842.512074] RAX: 0000000000000000 RBX: 0000000000001000 RCX: ffff928867bd9978
        [1194842.512078] RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff928867bd9970
        [1194842.512081] RBP: ffff92876b958000 R08: 0000000000000001 R09: 00000000000c0003
        [1194842.512085] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
        [1194842.512088] R13: ffff92875f989f98 R14: 0000000000000000 R15: 0000000000000000
        [1194842.512092] FS:  0000000000000000(0000) GS:ffff928867a00000(0000) knlGS:0000000000000000
        [1194842.512095] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [1194842.512099] CR2: 000055f5384da1f0 CR3: 0000000102fe4000 CR4: 00000000000006e0
        [1194842.512103] Call Trace:
        [1194842.512128]  ? run_one_async_free+0x10/0x10 [btrfs]
        [1194842.631729]  btree_csum_one_bio+0x1ac/0x1d0 [btrfs]
        [1194842.631837]  run_one_async_start+0x18/0x30 [btrfs]
        [1194842.631938]  btrfs_work_helper+0xd5/0x1d0 [btrfs]
        [1194842.647482]  process_one_work+0x262/0x5e0
        [1194842.647520]  worker_thread+0x4c/0x320
        [1194842.655935]  ? process_one_work+0x5e0/0x5e0
        [1194842.655946]  kthread+0x135/0x160
        [1194842.655953]  ? set_kthread_struct+0x40/0x40
        [1194842.655965]  ret_from_fork+0x1f/0x30
        [1194842.672465] irq event stamp: 1729
        [1194842.672469] hardirqs last  enabled at (1735): [<ffffffffbd1104f5>] console_trylock_spinning+0x185/0x1a0
        [1194842.672477] hardirqs last disabled at (1740): [<ffffffffbd1104cc>] console_trylock_spinning+0x15c/0x1a0
        [1194842.672482] softirqs last  enabled at (1666): [<ffffffffbdc002e1>] __do_softirq+0x2e1/0x50a
        [1194842.672491] softirqs last disabled at (1651): [<ffffffffbd08aab7>] __irq_exit_rcu+0xa7/0xd0
      
      The corrupted data will not be written, and filesystem can be unmounted
      and mounted again (all changes since the last commit will be lost).
      
      Add the missing check for new_ino so that all non-subvolumes must reside
      under the same parent subvolume. There's an exception allowing to
      exchange two subvolumes from any parents as the directory representing a
      subvolume is only a logical link and does not have any other structures
      related to the parent subvolume, unlike files, directories etc, that
      are always in the inode namespace of the parent subvolume.
      
      Fixes: cdd1fedf
      
       ("btrfs: add support for RENAME_EXCHANGE and RENAME_WHITEOUT")
      CC: stable@vger.kernel.org # 4.7+
      Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      548b75f4
    • Dongliang Mu's avatar
      ipack: tpci200: fix memory leak in the tpci200_register · 0fc6a9c2
      Dongliang Mu authored
      [ Upstream commit 50f05bd1 ]
      
      The error handling code in tpci200_register does not free interface_regs
      allocated by ioremap and the current version of error handling code is
      problematic.
      
      Fix this by refactoring the error handling code and free interface_regs
      when necessary.
      
      Fixes: 43986798
      
       ("ipack: add error handling for ioremap_nocache")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Link: https://lore.kernel.org/r/20210810100323.3938492-2-mudongliangabcd@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0fc6a9c2
    • Dongliang Mu's avatar
      ipack: tpci200: fix many double free issues in tpci200_pci_probe · 280d66b3
      Dongliang Mu authored
      [ Upstream commit 57a16810 ]
      
      The function tpci200_register called by tpci200_install and
      tpci200_unregister called by tpci200_uninstall are in pair. However,
      tpci200_unregister has some cleanup operations not in the
      tpci200_register. So the error handling code of tpci200_pci_probe has
      many different double free issues.
      
      Fix this problem by moving those cleanup operations out of
      tpci200_unregister, into tpci200_pci_remove and reverting
      the previous commit 9272e5d0 ("ipack/carriers/tpci200:
      Fix a double free in tpci200_pci_probe").
      
      Fixes: 9272e5d0
      
       ("ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Signed-off-by: default avatarDongliang Mu <mudongliangabcd@gmail.com>
      Link: https://lore.kernel.org/r/20210810100323.3938492-1-mudongliangabcd@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      280d66b3
    • Srinivas Kandagatla's avatar
      slimbus: ngd: reset dma setup during runtime pm · cb7aa510
      Srinivas Kandagatla authored
      [ Upstream commit d7777253 ]
      
      During suspend/resume NGD remote instance is power cycled along
      with remotely controlled bam dma engine.
      So Reset the dma configuration during this suspend resume path
      so that we are not dealing with any stale dma setup.
      
      Without this transactions timeout after first suspend resume path.
      
      Fixes: 917809e2
      
       ("slimbus: ngd: Add qcom SLIMBus NGD driver")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20210809082428.11236-5-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cb7aa510
    • Srinivas Kandagatla's avatar
      slimbus: messaging: check for valid transaction id · abce32d0
      Srinivas Kandagatla authored
      [ Upstream commit a263c1ff ]
      
      In some usecases transaction ids are dynamically allocated inside
      the controller driver after sending the messages which have generic
      acknowledge responses. So check for this before refcounting pm_runtime.
      
      Without this we would end up imbalancing runtime pm count by
      doing pm_runtime_put() in both slim_do_transfer() and slim_msg_response()
      for a single  pm_runtime_get() in slim_do_transfer()
      
      Fixes: d3062a21
      
       ("slimbus: messaging: add slim_alloc/free_txn_tid()")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20210809082428.11236-3-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      abce32d0
    • Srinivas Kandagatla's avatar
      slimbus: messaging: start transaction ids from 1 instead of zero · 0786d315
      Srinivas Kandagatla authored
      [ Upstream commit 9659281c ]
      
      As tid is unsigned its hard to figure out if the tid is valid or
      invalid. So Start the transaction ids from 1 instead of zero
      so that we could differentiate between a valid tid and invalid tids
      
      This is useful in cases where controller would add a tid for controller
      specific transfers.
      
      Fixes: d3062a21
      
       ("slimbus: messaging: add slim_alloc/free_txn_tid()")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20210809082428.11236-2-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0786d315
    • Steven Rostedt (VMware)'s avatar
      tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL event name · 20c2f141
      Steven Rostedt (VMware) authored
      [ Upstream commit 5acce0bf ]
      
      The following commands:
      
       # echo 'read_max u64 size;' > synthetic_events
       # echo 'hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)' > events/syscalls/sys_enter_read/trigger
      
      Causes:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP
       CPU: 4 PID: 1763 Comm: bash Not tainted 5.14.0-rc2-test+ #155
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01
      v03.03 07/14/2016
       RIP: 0010:strcmp+0xc/0x20
       Code: 75 f7 31 c0 0f b6 0c 06 88 0c 02 48 83 c0 01 84 c9 75 f1 4c 89 c0
      c3 0f 1f 80 00 00 00 00 31 c0 eb 08 48 83 c0 01 84 d2 74 0f <0f> b6 14 07
      3a 14 06 74 ef 19 c0 83 c8 01 c3 31 c0 c3 66 90 48 89
       RSP: 0018:ffffb5fdc0963ca8 EFLAGS: 00010246
       RAX: 0000000000000000 RBX: ffffffffb3a4e040 RCX: 0000000000000000
       RDX: 0000000000000000 RSI: ffff9714c0d0b640 RDI: 0000000000000000
       RBP: 0000000000000000 R08: 00000022986b7cde R09: ffffffffb3a4dff8
       R10: 0000000000000000 R11: 0000000000000000 R12: ffff9714c50603c8
       R13: 0000000000000000 R14: ffff97143fdf9e48 R15: ffff9714c01a2210
       FS:  00007f1fa6785740(0000) GS:ffff9714da400000(0000)
      knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000000 CR3: 000000002d863004 CR4: 00000000001706e0
       Call Trace:
        __find_event_file+0x4e/0x80
        action_create+0x6b7/0xeb0
        ? kstrdup+0x44/0x60
        event_hist_trigger_func+0x1a07/0x2130
        trigger_process_regex+0xbd/0x110
        event_trigger_write+0x71/0xd0
        vfs_write+0xe9/0x310
        ksys_write+0x68/0xe0
        do_syscall_64+0x3b/0x90
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f1fa6879e87
      
      The problem was the "trace(read_max,count)" where the "count" should be
      "$count" as "onmax()" only handles variables (although it really should be
      able to figure out that "count" is a field of sys_enter_read). But there's
      a path that does not find the variable and ends up passing a NULL for the
      event, which ends up getting passed to "strcmp()".
      
      Add a check for NULL to return and error on the command with:
      
       # cat error_log
        hist:syscalls:sys_enter_read: error: Couldn't create or find variable
        Command: hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)
                                      ^
      Link: https://lkml.kernel.org/r/20210808003011.4037f8d0@oasis.local.home
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: stable@vger.kernel.org
      Fixes: 50450603
      
       tracing: Add 'onmax' hist trigger action support
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      20c2f141
    • Jaroslav Kysela's avatar
      ALSA: hda - fix the 'Capture Switch' value change notifications · 8fbfebe1
      Jaroslav Kysela authored
      [ Upstream commit a2befe93 ]
      
      The original code in the cap_put_caller() function does not
      handle correctly the positive values returned from the passed
      function for multiple iterations. It means that the change
      notifications may be lost.
      
      Fixes: 352f7f91
      
       ("ALSA: hda - Merge Realtek parser code to generic parser")
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213851
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
      Link: https://lore.kernel.org/r/20210811161441.1325250-1-perex@perex.cz
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8fbfebe1
    • Vincent Whitchurch's avatar
      mmc: dw_mmc: Fix hang on data CRC error · 85e60614
      Vincent Whitchurch authored
      [ Upstream commit 25f8203b
      
       ]
      
      When a Data CRC interrupt is received, the driver disables the DMA, then
      sends the stop/abort command and then waits for Data Transfer Over.
      
      However, sometimes, when a data CRC error is received in the middle of a
      multi-block write transfer, the Data Transfer Over interrupt is never
      received, and the driver hangs and never completes the request.
      
      The driver sets the BMOD.SWR bit (SDMMC_IDMAC_SWRESET) when stopping the
      DMA, but according to the manual CMD.STOP_ABORT_CMD should be programmed
      "before assertion of SWR".  Do these operations in the recommended
      order.  With this change the Data Transfer Over is always received
      correctly in my tests.
      
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Reviewed-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210630102232.16011-1-vincent.whitchurch@axis.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      85e60614
    • Murphy Zhou's avatar
      ovl: add splice file read write helper · 4f6c9caf
      Murphy Zhou authored
      [ Upstream commit 1a980b8c
      
       ]
      
      Now overlayfs falls back to use default file splice read
      and write, which is not compatiple with overlayfs, returning
      EFAULT. xfstests generic/591 can reproduce part of this.
      
      Tested this patch with xfstests auto group tests.
      
      Signed-off-by: default avatarMurphy Zhou <jencce.kernel@gmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4f6c9caf
    • Sylwester Dziedziuch's avatar
      iavf: Fix ping is lost after untrusted VF had tried to change MAC · 85813f1f
      Sylwester Dziedziuch authored
      [ Upstream commit 8da80c9d ]
      
      Make changes to MAC address dependent on the response of PF.
      Disallow changes to HW MAC address and MAC filter from untrusted
      VF, thanks to that ping is not lost if VF tries to change MAC.
      Add a new field in iavf_mac_filter, to indicate whether there
      was response from PF for given filter. Based on this field pass
      or discard the filter.
      If untrusted VF tried to change it's address, it's not changed.
      Still filter was changed, because of that ping couldn't go through.
      
      Fixes: c5c922b3
      
       ("iavf: fix MAC address setting for VFs when filter is rejected")
      Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Signed-off-by: default avatarSylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
      Signed-off-by: default avatarMateusz Palczewski <mateusz.palczewski@intel.com>
      Tested-by: default avatarGurucharan G <Gurucharanx.g@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      85813f1f
    • Arkadiusz Kubalewski's avatar
      i40e: Fix ATR queue selection · a498115d
      Arkadiusz Kubalewski authored
      [ Upstream commit a222be59 ]
      
      Without this patch, ATR does not work. Receive/transmit uses queue
      selection based on SW DCB hashing method.
      
      If traffic classes are not configured for PF, then use
      netdev_pick_tx function for selecting queue for packet transmission.
      Instead of calling i40e_swdcb_skb_tx_hash, call netdev_pick_tx,
      which ensures that packet is transmitted/received from CPU that is
      running the application.
      
      Reproduction steps:
      1. Load i40e driver
      2. Map each MSI interrupt of i40e port for each CPU
      3. Disable ntuple, enable ATR i.e.:
      ethtool -K $interface ntuple off
      ethtool --set-priv-flags $interface flow-director-atr
      4. Run application that is generating traffic and is bound to a
      single CPU, i.e.:
      taskset -c 9 netperf -H 1.1.1.1 -t TCP_RR -l 10
      5. Observe behavior:
      Application's traffic should be restricted to the CPU provided in
      taskset.
      
      Fixes: 89ec1f08
      
       ("i40e: Fix queue-to-TC mapping on Tx")
      Signed-off-by: default avatarPrzemyslaw Patynowski <przemyslawx.patynowski@intel.com>
      Signed-off-by: default avatarArkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
      Tested-by: default avatarDave Switzer <david.switzer@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a498115d
    • kaixi.fan's avatar
      ovs: clear skb->tstamp in forwarding path · 1b8a8fba
      kaixi.fan authored
      [ Upstream commit 01634047 ]
      
      fq qdisc requires tstamp to be cleared in the forwarding path. Now ovs
      doesn't clear skb->tstamp. We encountered a problem with linux
      version 5.4.56 and ovs version 2.14.1, and packets failed to
      dequeue from qdisc when fq qdisc was attached to ovs port.
      
      Fixes: fb420d5d
      
       ("tcp/fq: move back to CLOCK_MONOTONIC")
      Signed-off-by: default avatarkaixi.fan <fankaixi.li@bytedance.com>
      Signed-off-by: default avatarxiexiaohui <xiexiaohui.xxh@bytedance.com>
      Reviewed-by: default avatarCong Wang <cong.wang@bytedance.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1b8a8fba
    • Saravana Kannan's avatar
      net: mdio-mux: Handle -EPROBE_DEFER correctly · 84dbbf54
      Saravana Kannan authored
      [ Upstream commit 7bd0cef5 ]
      
      When registering mdiobus children, if we get an -EPROBE_DEFER, we shouldn't
      ignore it and continue registering the rest of the mdiobus children. This
      would permanently prevent the deferring child mdiobus from working instead
      of reattempting it in the future. So, if a child mdiobus needs to be
      reattempted in the future, defer the entire mdio-mux initialization.
      
      This fixes the issue where PHYs sitting under the mdio-mux aren't
      initialized correctly if the PHY's interrupt controller is not yet ready
      when the mdio-mux is being probed. Additional context in the link below.
      
      Fixes: 0ca2997d
      
       ("netdev/of/phy: Add MDIO bus multiplexer support.")
      Link: https://lore.kernel.org/lkml/CAGETcx95kHrv8wA-O+-JtfH7H9biJEGJtijuPVN0V5dUKUAB3A@mail.gmail.com/#t
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Tested-by: default avatarMarc Zyngier <maz@kernel.org>
      Acked-by: default avatarKevin Hilman <khilman@baylibre.com>
      Tested-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      84dbbf54
    • Saravana Kannan's avatar
      net: mdio-mux: Don't ignore memory allocation errors · 453486e7
      Saravana Kannan authored
      [ Upstream commit 99d81e94 ]
      
      If we are seeing memory allocation errors, don't try to continue
      registering child mdiobus devices. It's unlikely they'll succeed.
      
      Fixes: 342fa196
      
       ("mdio: mux: make child bus walking more permissive and errors more verbose")
      Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Acked-by: default avatarMarc Zyngier <maz@kernel.org>
      Tested-by: default avatarMarc Zyngier <maz@kernel.org>
      Acked-by: default avatarKevin Hilman <khilman@baylibre.com>
      Tested-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      453486e7