1. 25 6月, 2019 8 次提交
    • M
      usb: xhci: Don't try to recover an endpoint if port is in error state. · 17027034
      Mathias Nyman 提交于
      commit b8c3b718087bf7c3c8e388eb1f72ac1108a4926e upstream.
      
      A USB3 device needs to be reset and re-enumarated if the port it
      connects to goes to a error state, with link state inactive.
      
      There is no use in trying to recover failed transactions by resetting
      endpoints at this stage. Tests show that in rare cases, after multiple
      endpoint resets of a roothub port the whole host controller might stop
      completely.
      
      Several retries to recover from transaction error can happen as
      it can take a long time before the hub thread discovers the USB3
      port error and inactive link.
      
      We can't reliably detect the port error from slot or endpoint context
      due to a limitation in xhci, see xhci specs section 4.8.3:
      "There are several cases where the EP State field in the Output
      Endpoint Context may not reflect the current state of an endpoint"
      and
      "Software should maintain an accurate value for EP State, by tracking it
      with an internal variable that is driven by Events and Doorbell accesses"
      
      Same appears to be true for slot state.
      
      set a flag to the corresponding slot if a USB3 roothub port link goes
      inactive to prevent both queueing new URBs and resetting endpoints.
      Reported-by: NRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Tested-by: NRapolu Chiranjeevi <chiranjeevi.rapolu@intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17027034
    • M
      xhci: detect USB 3.2 capable host controllers correctly · d606a82c
      Mathias Nyman 提交于
      commit ddd57980a0fde30f7b5d14b888a2cc84d01610e8 upstream.
      
      USB 3.2 capability in a host can be detected from the
      xHCI Supported Protocol Capability major and minor revision fields.
      
      If major is 0x3 and minor 0x20 then the host is USB 3.2 capable.
      
      For USB 3.2 capable hosts set the root hub lane count to 2.
      
      The Major Revision and Minor Revision fields contain a BCD version number.
      The value of the Major Revision field is JJh and the value of the Minor
      Revision field is MNh for version JJ.M.N, where JJ = major revision number,
      M - minor version number, N = sub-minor version number,
      e.g. version 3.1 is represented with a value of 0310h.
      
      Also fix the extra whitespace printed out when announcing regular
      SuperSpeed hosts.
      
      Cc: <stable@vger.kernel.org> # v4.18+
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d606a82c
    • P
      usb: chipidea: udc: workaround for endpoint conflict issue · e6563039
      Peter Chen 提交于
      commit c19dffc0a9511a7d7493ec21019aefd97e9a111b upstream.
      
      An endpoint conflict occurs when the USB is working in device mode
      during an isochronous communication. When the endpointA IN direction
      is an isochronous IN endpoint, and the host sends an IN token to
      endpointA on another device, then the OUT transaction may be missed
      regardless the OUT endpoint number. Generally, this occurs when the
      device is connected to the host through a hub and other devices are
      connected to the same hub.
      
      The affected OUT endpoint can be either control, bulk, isochronous, or
      an interrupt endpoint. After the OUT endpoint is primed, if an IN token
      to the same endpoint number on another device is received, then the OUT
      endpoint may be unprimed (cannot be detected by software), which causes
      this endpoint to no longer respond to the host OUT token, and thus, no
      corresponding interrupt occurs.
      
      There is no good workaround for this issue, the only thing the software
      could do is numbering isochronous IN from the highest endpoint since we
      have observed most of device number endpoint from the lowest.
      
      Cc: <stable@vger.kernel.org> #v3.14+
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Cc: Jun Li <jun.li@nxp.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6563039
    • S
      scsi: ufs: Avoid runtime suspend possibly being blocked forever · 0746b2f5
      Stanley Chu 提交于
      commit 24e2e7a19f7e4b83d0d5189040d997bce3596473 upstream.
      
      UFS runtime suspend can be triggered after pm_runtime_enable() is invoked
      in ufshcd_pltfrm_init(). However if the first runtime suspend is triggered
      before binding ufs_hba structure to ufs device structure via
      platform_set_drvdata(), then UFS runtime suspend will be no longer
      triggered in the future because its dev->power.runtime_error was set in the
      first triggering and does not have any chance to be cleared.
      
      To be more clear, dev->power.runtime_error is set if hba is NULL in
      ufshcd_runtime_suspend() which returns -EINVAL to rpm_callback() where
      dev->power.runtime_error is set as -EINVAL. In this case, any future
      rpm_suspend() for UFS device fails because rpm_check_suspend_allowed()
      fails due to non-zero
      dev->power.runtime_error.
      
      To resolve this issue, make sure the first UFS runtime suspend get valid
      "hba" in ufshcd_runtime_suspend(): Enable UFS runtime PM only after hba is
      successfully bound to UFS device structure.
      
      Fixes: 62694735 ([SCSI] ufs: Add runtime PM support for UFS host controller driver)
      Cc: stable@vger.kernel.org
      Signed-off-by: NStanley Chu <stanley.chu@mediatek.com>
      Reviewed-by: NAvri Altman <avri.altman@wdc.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0746b2f5
    • U
      mmc: core: Prevent processing SDIO IRQs when the card is suspended · 98467b8f
      Ulf Hansson 提交于
      commit 83293386bc95cf5e9f0c0175794455835bd1cb4a upstream.
      
      Processing of SDIO IRQs must obviously be prevented while the card is
      system suspended, otherwise we may end up trying to communicate with an
      uninitialized SDIO card.
      
      Reports throughout the years shows that this is not only a theoretical
      problem, but a real issue. So, let's finally fix this problem, by keeping
      track of the state for the card and bail out before processing the SDIO
      IRQ, in case the card is suspended.
      
      Cc: stable@vger.kernel.org
      Reported-by: NDouglas Anderson <dianders@chromium.org>
      Tested-by: NDouglas Anderson <dianders@chromium.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98467b8f
    • D
      mmc: core: Add sdio_retune_hold_now() and sdio_retune_release() · 0349dbeb
      Douglas Anderson 提交于
      commit b4c9f938d542d5f88c501744d2d12fad4fd2915f upstream.
      
      We want SDIO drivers to be able to temporarily stop retuning when the
      driver knows that the SDIO card is not in a state where retuning will
      work (maybe because the card is asleep).  We'll move the relevant
      functions to a place where drivers can call them.
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0349dbeb
    • D
      mmc: core: API to temporarily disable retuning for SDIO CRC errors · 7ed49e1b
      Douglas Anderson 提交于
      commit 0a55f4ab9678413a01e740c86e9367ba0c612b36 upstream.
      
      Normally when the MMC core sees an "-EILSEQ" error returned by a host
      controller then it will trigger a retuning of the card.  This is
      generally a good idea.
      
      However, if a command is expected to sometimes cause transfer errors
      then these transfer errors shouldn't cause a re-tuning.  This
      re-tuning will be a needless waste of time.  One example case where a
      transfer is expected to cause errors is when transitioning between
      idle (sometimes referred to as "sleep" in Broadcom code) and active
      state on certain Broadcom WiFi SDIO cards.  Specifically if the card
      was already transitioning between states when the command was sent it
      could cause an error on the SDIO bus.
      
      Let's add an API that the SDIO function drivers can call that will
      temporarily disable the auto-tuning functionality.  Then we can add a
      call to this in the Broadcom WiFi driver and any other driver that
      might have similar needs.
      
      NOTE: this makes the assumption that the card is already tuned well
      enough that it's OK to disable the auto-retuning during one of these
      error-prone situations.  Presumably the driver code performing the
      error-prone transfer knows how to recover / retry from errors.  ...and
      after we can get back to a state where transfers are no longer
      error-prone then we can enable the auto-retuning again.  If we truly
      find ourselves in a case where the card needs to be retuned sometimes
      to handle one of these error-prone transfers then we can always try a
      few transfers first without auto-retuning and then re-try with
      auto-retuning if the first few fail.
      
      Without this change on rk3288-veyron-minnie I periodically see this in
      the logs of a machine just sitting there idle:
        dwmmc_rockchip ff0d0000.dwmmc: Successfully tuned phase to XYZ
      
      Cc: stable@vger.kernel.org #v4.18+
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ed49e1b
    • R
      mmc: sdhci: sdhci-pci-o2micro: Correctly set bus width when tuning · 4b6d290c
      Raul E Rangel 提交于
      commit 0f7b79a44e7d7dd3ef1f59758c1a341f217ff5e5 upstream.
      
      The O2Micro controller only supports tuning at 4-bits. So the host driver
      needs to change the bus width while tuning and then set it back when done.
      
      There was a bug in the original implementation in that mmc->ios.bus_width
      also wasn't updated. Thus setting the incorrect blocksize in
      sdhci_send_tuning which results in a tuning failure.
      Signed-off-by: NRaul E Rangel <rrangel@chromium.org>
      Fixes: 0086fc21 ("mmc: sdhci: Add support for O2 hardware tuning")
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b6d290c
  2. 22 6月, 2019 29 次提交
    • A
      mlxsw: spectrum: Prevent force of 56G · fedb1b9c
      Amit Cohen 提交于
      [ Upstream commit 275e928f19117d22f6d26dee94548baf4041b773 ]
      
      Force of 56G is not supported by hardware in Ethernet devices. This
      configuration fails with a bad parameter error from firmware.
      
      Add check of this case. Instead of trying to set 56G with autoneg off,
      return a meaningful error.
      
      Fixes: 56ade8fe ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
      Signed-off-by: NAmit Cohen <amitc@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      fedb1b9c
    • J
      scsi: libsas: delete sas port if expander discover failed · 114e8135
      Jason Yan 提交于
      [ Upstream commit 3b0541791453fbe7f42867e310e0c9eb6295364d ]
      
      The sas_port(phy->port) allocated in sas_ex_discover_expander() will not be
      deleted when the expander failed to discover. This will cause resource leak
      and a further issue of kernel BUG like below:
      
      [159785.843156]  port-2:17:29: trying to add phy phy-2:17:29 fails: it's
      already part of another port
      [159785.852144] ------------[ cut here  ]------------
      [159785.856833] kernel BUG at drivers/scsi/scsi_transport_sas.c:1086!
      [159785.863000] Internal error: Oops - BUG: 0 [#1] SMP
      [159785.867866] CPU: 39 PID: 16993 Comm: kworker/u96:2 Tainted: G
      W  OE     4.19.25-vhulk1901.1.0.h111.aarch64 #1
      [159785.878458] Hardware name: Huawei Technologies Co., Ltd.
      Hi1620EVBCS/Hi1620EVBCS, BIOS Hi1620 CS B070 1P TA 03/21/2019
      [159785.889231] Workqueue: 0000:74:02.0_disco_q sas_discover_domain
      [159785.895224] pstate: 40c00009 (nZcv daif +PAN +UAO)
      [159785.900094] pc : sas_port_add_phy+0x188/0x1b8
      [159785.904524] lr : sas_port_add_phy+0x188/0x1b8
      [159785.908952] sp : ffff0001120e3b80
      [159785.912341] x29: ffff0001120e3b80 x28: 0000000000000000
      [159785.917727] x27: ffff802ade8f5400 x26: ffff0000681b7560
      [159785.923111] x25: ffff802adf11a800 x24: ffff0000680e8000
      [159785.928496] x23: ffff802ade8f5728 x22: ffff802ade8f5708
      [159785.933880] x21: ffff802adea2db40 x20: ffff802ade8f5400
      [159785.939264] x19: ffff802adea2d800 x18: 0000000000000010
      [159785.944649] x17: 00000000821bf734 x16: ffff00006714faa0
      [159785.950033] x15: ffff0000e8ab4ecf x14: 7261702079646165
      [159785.955417] x13: 726c612073277469 x12: ffff00006887b830
      [159785.960802] x11: ffff00006773eaa0 x10: 7968702079687020
      [159785.966186] x9 : 0000000000002453 x8 : 726f702072656874
      [159785.971570] x7 : 6f6e6120666f2074 x6 : ffff802bcfb21290
      [159785.976955] x5 : ffff802bcfb21290 x4 : 0000000000000000
      [159785.982339] x3 : ffff802bcfb298c8 x2 : 337752b234c2ab00
      [159785.987723] x1 : 337752b234c2ab00 x0 : 0000000000000000
      [159785.993108] Process kworker/u96:2 (pid: 16993, stack limit =
      0x0000000072dae094)
      [159786.000576] Call trace:
      [159786.003097]  sas_port_add_phy+0x188/0x1b8
      [159786.007179]  sas_ex_get_linkrate.isra.5+0x134/0x140
      [159786.012130]  sas_ex_discover_expander+0x128/0x408
      [159786.016906]  sas_ex_discover_dev+0x218/0x4c8
      [159786.021249]  sas_ex_discover_devices+0x9c/0x1a8
      [159786.025852]  sas_discover_root_expander+0x134/0x160
      [159786.030802]  sas_discover_domain+0x1b8/0x1e8
      [159786.035148]  process_one_work+0x1b4/0x3f8
      [159786.039230]  worker_thread+0x54/0x470
      [159786.042967]  kthread+0x134/0x138
      [159786.046269]  ret_from_fork+0x10/0x18
      [159786.049918] Code: 91322300 f0004402 91178042 97fe4c9b (d4210000)
      [159786.056083] Modules linked in: hns3_enet_ut(OE) hclge(OE) hnae3(OE)
      hisi_sas_test_hw(OE) hisi_sas_test_main(OE) serdes(OE)
      [159786.067202] ---[ end trace 03622b9e2d99e196  ]---
      [159786.071893] Kernel panic - not syncing: Fatal exception
      [159786.077190] SMP: stopping secondary CPUs
      [159786.081192] Kernel Offset: disabled
      [159786.084753] CPU features: 0x2,a2a00a38
      
      Fixes: 2908d778 ("[SCSI] aic94xx: new driver")
      Reported-by: NJian Luo <luojian5@huawei.com>
      Signed-off-by: NJason Yan <yanaijie@huawei.com>
      CC: John Garry <john.garry@huawei.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      114e8135
    • Y
      scsi: scsi_dh_alua: Fix possible null-ptr-deref · 89ede9d8
      YueHaibing 提交于
      [ Upstream commit 12e750bc62044de096ab9a95201213fd912b9994 ]
      
      If alloc_workqueue fails in alua_init, it should return -ENOMEM, otherwise
      it will trigger null-ptr-deref while unloading module which calls
      destroy_workqueue dereference
      wq->lock like this:
      
      BUG: KASAN: null-ptr-deref in __lock_acquire+0x6b4/0x1ee0
      Read of size 8 at addr 0000000000000080 by task syz-executor.0/7045
      
      CPU: 0 PID: 7045 Comm: syz-executor.0 Tainted: G         C        5.1.0+ #28
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1
      Call Trace:
       dump_stack+0xa9/0x10e
       __kasan_report+0x171/0x18d
       ? __lock_acquire+0x6b4/0x1ee0
       kasan_report+0xe/0x20
       __lock_acquire+0x6b4/0x1ee0
       lock_acquire+0xb4/0x1b0
       __mutex_lock+0xd8/0xb90
       drain_workqueue+0x25/0x290
       destroy_workqueue+0x1f/0x3f0
       __x64_sys_delete_module+0x244/0x330
       do_syscall_64+0x72/0x2a0
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Fixes: 03197b61 ("scsi_dh_alua: Use workqueue for RTPG")
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      89ede9d8
    • L
      scsi: smartpqi: properly set both the DMA mask and the coherent DMA mask · cb7c6c33
      Lianbo Jiang 提交于
      [ Upstream commit 1d94f06e7f5df4064ef336b7b710f50143b64a53 ]
      
      When SME is enabled, the smartpqi driver won't work on the HP DL385 G10
      machine, which causes the failure of kernel boot because it fails to
      allocate pqi error buffer. Please refer to the kernel log:
      ....
      [    9.431749] usbcore: registered new interface driver uas
      [    9.441524] Microsemi PQI Driver (v1.1.4-130)
      [    9.442956] i40e 0000:04:00.0: fw 6.70.48768 api 1.7 nvm 10.2.5
      [    9.447237] smartpqi 0000:23:00.0: Microsemi Smart Family Controller found
               Starting dracut initqueue hook...
      [  OK  ] Started Show Plymouth Boot Scre[    9.471654] Broadcom NetXtreme-C/E driver bnxt_en v1.9.1
      en.
      [  OK  ] Started Forward Password Requests to Plymouth Directory Watch.
      [[0;[    9.487108] smartpqi 0000:23:00.0: failed to allocate PQI error buffer
      ....
      [  139.050544] dracut-initqueue[949]: Warning: dracut-initqueue timeout - starting timeout scripts
      [  139.589779] dracut-initqueue[949]: Warning: dracut-initqueue timeout - starting timeout scripts
      
      Basically, the fact that the coherent DMA mask value wasn't set caused the
      driver to fall back to SWIOTLB when SME is active.
      
      For correct operation, lets call the dma_set_mask_and_coherent() to
      properly set the mask for both streaming and coherent, in order to inform
      the kernel about the devices DMA addressing capabilities.
      Signed-off-by: NLianbo Jiang <lijiang@redhat.com>
      Acked-by: NDon Brace <don.brace@microsemi.com>
      Tested-by: NDon Brace <don.brace@microsemi.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      cb7c6c33
    • V
      scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route() · 214c5933
      Varun Prakash 提交于
      [ Upstream commit cc555759117e8349088e0c5d19f2f2a500bafdbd ]
      
      ip_dev_find() can return NULL so add a check for NULL pointer.
      Signed-off-by: NVarun Prakash <varun@chelsio.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      214c5933
    • M
      net: phy: dp83867: Set up RGMII TX delay · 7b9e1094
      Max Uvarov 提交于
      [ Upstream commit 2b892649254fec01678c64f16427622b41fa27f4 ]
      
      PHY_INTERFACE_MODE_RGMII_RXID is less then TXID
      so code to set tx delay is never called.
      
      Fixes: 2a10154a ("net: phy: dp83867: Add TI dp83867 phy")
      Signed-off-by: NMax Uvarov <muvarov@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      7b9e1094
    • R
      net: phylink: ensure consistent phy interface mode · 7698ad8c
      Russell King 提交于
      [ Upstream commit c678726305b9425454be7c8a7624290b602602fc ]
      
      Ensure that we supply the same phy interface mode to mac_link_down() as
      we did for the corresponding mac_link_up() call.  This ensures that MAC
      drivers that use the phy interface mode in these methods can depend on
      mac_link_down() always corresponding to a mac_link_up() call for the
      same interface mode.
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      7698ad8c
    • Y
      net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs · 8fb2c796
      Yoshihiro Shimoda 提交于
      [ Upstream commit 315ca92dd863fecbffc0bb52ae0ac11e0398726a ]
      
      The sh_eth_close() resets the MAC and then calls phy_stop()
      so that mdio read access result is incorrect without any error
      according to kernel trace like below:
      
      ifconfig-216   [003] .n..   109.133124: mdio_access: ee700000.ethernet-ffffffff read  phy:0x01 reg:0x00 val:0xffff
      
      According to the hardware manual, the RMII mode should be set to 1
      before operation the Ethernet MAC. However, the previous code was not
      set to 1 after the driver issued the soft_reset in sh_eth_dev_exit()
      so that the mdio read access result seemed incorrect. To fix the issue,
      this patch adds a condition and set the RMII mode register in
      sh_eth_dev_exit() for R-Car Gen2 and RZ/A1 SoCs.
      
      Note that when I have tried to move the sh_eth_dev_exit() calling
      after phy_stop() on sh_eth_close(), but it gets worse (kernel panic
      happened and it seems that a register is accessed while the clock is
      off).
      Signed-off-by: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      8fb2c796
    • R
      xenbus: Avoid deadlock during suspend due to open transactions · 4acce744
      Ross Lagerwall 提交于
      [ Upstream commit d10e0cc113c9e1b64b5c6e3db37b5c839794f3df ]
      
      During a suspend/resume, the xenwatch thread waits for all outstanding
      xenstore requests and transactions to complete. This does not work
      correctly for transactions started by userspace because it waits for
      them to complete after freezing userspace threads which means the
      transactions have no way of completing, resulting in a deadlock. This is
      trivial to reproduce by running this script and then suspending the VM:
      
          import pyxs, time
          c = pyxs.client.Client(xen_bus_path="/dev/xen/xenbus")
          c.connect()
          c.transaction()
          time.sleep(3600)
      
      Even if this deadlock were resolved, misbehaving userspace should not
      prevent a VM from being migrated. So, instead of waiting for these
      transactions to complete before suspending, store the current generation
      id for each transaction when it is started. The global generation id is
      incremented during resume. If the caller commits the transaction and the
      generation id does not match the current generation id, return EAGAIN so
      that they try again. If the transaction was instead discarded, return OK
      since no changes were made anyway.
      
      This only affects users of the xenbus file interface. In-kernel users of
      xenbus are assumed to be well-behaved and complete all transactions
      before freezing.
      Signed-off-by: NRoss Lagerwall <ross.lagerwall@citrix.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      4acce744
    • Y
      xen/pvcalls: Remove set but not used variable · 66f33b2b
      YueHaibing 提交于
      [ Upstream commit 41349672e3cbc2e8349831f21253509c3415aa2b ]
      
      Fixes gcc '-Wunused-but-set-variable' warning:
      
      drivers/xen/pvcalls-front.c: In function pvcalls_front_sendmsg:
      drivers/xen/pvcalls-front.c:543:25: warning: variable bedata set but not used [-Wunused-but-set-variable]
      drivers/xen/pvcalls-front.c: In function pvcalls_front_recvmsg:
      drivers/xen/pvcalls-front.c:638:25: warning: variable bedata set but not used [-Wunused-but-set-variable]
      
      They are never used since introduction.
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      66f33b2b
    • Y
      i2c: dev: fix potential memory leak in i2cdev_ioctl_rdwr · 7bea5618
      Yingjoe Chen 提交于
      [ Upstream commit a0692f0eef91354b62c2b4c94954536536be5425 ]
      
      If I2C_M_RECV_LEN check failed, msgs[i].buf allocated by memdup_user
      will not be freed. Pump index up so it will be freed.
      
      Fixes: 838bfa60 ("i2c-dev: Add support for I2C_M_RECV_LEN")
      Signed-off-by: NYingjoe Chen <yingjoe.chen@mediatek.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      7bea5618
    • D
      net: aquantia: fix LRO with FCS error · 197501af
      Dmitry Bogdanov 提交于
      [ Upstream commit eaeb3b7494ba9159323814a8ce8af06a9277d99b ]
      
      Driver stops producing skbs on ring if a packet with FCS error
      was coalesced into LRO session. Ring gets hang forever.
      
      Thats a logical error in driver processing descriptors:
      When rx_stat indicates MAC Error, next pointer and eop flags
      are not filled. This confuses driver so it waits for descriptor 0
      to be filled by HW.
      
      Solution is fill next pointer and eop flag even for packets with FCS error.
      
      Fixes: bab6de8f ("net: ethernet: aquantia: Atlantic A0 and B0 specific functions.")
      Signed-off-by: NIgor Russkikh <igor.russkikh@aquantia.com>
      Signed-off-by: NDmitry Bogdanov <dmitry.bogdanov@aquantia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      197501af
    • I
      net: aquantia: tx clean budget logic error · 388534d4
      Igor Russkikh 提交于
      [ Upstream commit 31bafc49a7736989e4c2d9f7280002c66536e590 ]
      
      In case no other traffic happening on the ring, full tx cleanup
      may not be completed. That may cause socket buffer to overflow
      and tx traffic to stuck until next activity on the ring happens.
      
      This is due to logic error in budget variable decrementor.
      Variable is compared with zero, and then post decremented,
      causing it to become MAX_INT. Solution is remove decrementor
      from the `for` statement and rewrite it in a clear way.
      
      Fixes: b647d398 ("net: aquantia: Add tx clean budget and valid budget handling logic")
      Signed-off-by: NIgor Russkikh <igor.russkikh@aquantia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      388534d4
    • L
      drm/etnaviv: lock MMU while dumping core · b7ca3f33
      Lucas Stach 提交于
      [ Upstream commit 1396500d673bd027683a0609ff84dca7eb6ea2e7 ]
      
      The devcoredump needs to operate on a stable state of the MMU while
      it is writing the MMU state to the coredump. The missing lock
      allowed both the userspace submit, as well as the GPU job finish
      paths to mutate the MMU state while a coredump is under way.
      
      Fixes: a8c21a54 (drm/etnaviv: add initial etnaviv DRM driver)
      Reported-by: NDavid Jander <david@protonic.nl>
      Signed-off-by: NLucas Stach <l.stach@pengutronix.de>
      Tested-by: NDavid Jander <david@protonic.nl>
      Reviewed-by: NPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      b7ca3f33
    • R
      ACPI/PCI: PM: Add missing wakeup.flags.valid checks · ee61fb4d
      Rafael J. Wysocki 提交于
      [ Upstream commit 9a51c6b1f9e0239a9435db036b212498a2a3b75c ]
      
      Both acpi_pci_need_resume() and acpi_dev_needs_resume() check if the
      current ACPI wakeup configuration of the device matches what is
      expected as far as system wakeup from sleep states is concerned, as
      reflected by the device_may_wakeup() return value for the device.
      
      However, they only should do that if wakeup.flags.valid is set for
      the device's ACPI companion, because otherwise the wakeup.prepare_count
      value for it is meaningless.
      
      Add the missing wakeup.flags.valid checks to these functions.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ee61fb4d
    • K
      net: tulip: de4x5: Drop redundant MODULE_DEVICE_TABLE() · bc19b50b
      Kees Cook 提交于
      [ Upstream commit 3e66b7cc50ef921121babc91487e1fb98af1ba6e ]
      
      Building with Clang reports the redundant use of MODULE_DEVICE_TABLE():
      
      drivers/net/ethernet/dec/tulip/de4x5.c:2110:1: error: redefinition of '__mod_eisa__de4x5_eisa_ids_device_table'
      MODULE_DEVICE_TABLE(eisa, de4x5_eisa_ids);
      ^
      ./include/linux/module.h:229:21: note: expanded from macro 'MODULE_DEVICE_TABLE'
      extern typeof(name) __mod_##type##__##name##_device_table               \
                          ^
      <scratch space>:90:1: note: expanded from here
      __mod_eisa__de4x5_eisa_ids_device_table
      ^
      drivers/net/ethernet/dec/tulip/de4x5.c:2100:1: note: previous definition is here
      MODULE_DEVICE_TABLE(eisa, de4x5_eisa_ids);
      ^
      ./include/linux/module.h:229:21: note: expanded from macro 'MODULE_DEVICE_TABLE'
      extern typeof(name) __mod_##type##__##name##_device_table               \
                          ^
      <scratch space>:85:1: note: expanded from here
      __mod_eisa__de4x5_eisa_ids_device_table
      ^
      
      This drops the one further from the table definition to match the common
      use of MODULE_DEVICE_TABLE().
      
      Fixes: 07563c71 ("EISA bus MODALIAS attributes support")
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      bc19b50b
    • B
      net: stmmac: update rx tail pointer register to fix rx dma hang issue. · 9a3208b6
      Biao Huang 提交于
      [ Upstream commit 4523a5611526709ec9b4e2574f1bb7818212651e ]
      
      Currently we will not update the receive descriptor tail pointer in
      stmmac_rx_refill. Rx dma will think no available descriptors and stop
      once received packets exceed DMA_RX_SIZE, so that the rx only test will fail.
      
      Update the receive tail pointer in stmmac_rx_refill to add more descriptors
      to the rx channel, so packets can be received continually
      
      Fixes: 54139cf3 ("net: stmmac: adding multiple buffers for rx")
      Signed-off-by: NBiao Huang <biao.huang@mediatek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      9a3208b6
    • R
      gpio: fix gpio-adp5588 build errors · 3fbcef33
      Randy Dunlap 提交于
      [ Upstream commit e9646f0f5bb62b7d43f0968f39d536cfe7123b53 ]
      
      The gpio-adp5588 driver uses interfaces that are provided by
      GPIOLIB_IRQCHIP, so select that symbol in its Kconfig entry.
      
      Fixes these build errors:
      
      ../drivers/gpio/gpio-adp5588.c: In function ‘adp5588_irq_handler’:
      ../drivers/gpio/gpio-adp5588.c:266:26: error: ‘struct gpio_chip’ has no member named ‘irq’
                  dev->gpio_chip.irq.domain, gpio));
                                ^
      ../drivers/gpio/gpio-adp5588.c: In function ‘adp5588_irq_setup’:
      ../drivers/gpio/gpio-adp5588.c:298:2: error: implicit declaration of function ‘gpiochip_irqchip_add_nested’ [-Werror=implicit-function-declaration]
        ret = gpiochip_irqchip_add_nested(&dev->gpio_chip,
        ^
      ../drivers/gpio/gpio-adp5588.c:307:2: error: implicit declaration of function ‘gpiochip_set_nested_irqchip’ [-Werror=implicit-function-declaration]
        gpiochip_set_nested_irqchip(&dev->gpio_chip,
        ^
      
      Fixes: 459773ae ("gpio: adp5588-gpio: support interrupt controller")
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: linux-gpio@vger.kernel.org
      Reviewed-by: NBartosz Golaszewski <bgolaszewski@baylibre.com>
      Acked-by: NMichael Hennerich <michael.hennerich@analog.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      3fbcef33
    • D
      mISDN: make sure device name is NUL terminated · 8e5666cd
      Dan Carpenter 提交于
      [ Upstream commit ccfb62f27beb295103e9392462b20a6ed807d0ea ]
      
      The user can change the device_name with the IMSETDEVNAME ioctl, but we
      need to ensure that the user's name is NUL terminated.  Otherwise it
      could result in a buffer overflow when we copy the name back to the user
      with IMGETDEVINFO ioctl.
      
      I also changed two strcpy() calls which handle the name to strscpy().
      Hopefully, there aren't any other ways to create a too long name, but
      it's nice to do this as a kernel hardening measure.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      8e5666cd
    • J
      usb: xhci: Fix a potential null pointer dereference in xhci_debugfs_create_endpoint() · f3885eec
      Jia-Ju Bai 提交于
      [ Upstream commit 5bce256f0b528624a34fe907db385133bb7be33e ]
      
      In xhci_debugfs_create_slot(), kzalloc() can fail and
      dev->debugfs_private will be NULL.
      In xhci_debugfs_create_endpoint(), dev->debugfs_private is used without
      any null-pointer check, and can cause a null pointer dereference.
      
      To fix this bug, a null-pointer check is added in
      xhci_debugfs_create_endpoint().
      
      This bug is found by a runtime fuzzing tool named FIZZER written by us.
      
      [subjet line change change, add potential -Mathais]
      Signed-off-by: NJia-Ju Bai <baijiaju1990@gmail.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      f3885eec
    • T
      clk: ti: clkctrl: Fix clkdm_clk handling · 00ed897d
      Tony Lindgren 提交于
      [ Upstream commit 1cc54078d104f5b4d7e9f8d55362efa5a8daffdb ]
      
      We need to always call clkdm_clk_enable() and clkdm_clk_disable() even
      the clkctrl clock(s) enabled for the domain do not have any gate register
      bits. Otherwise clockdomains may never get enabled except when devices get
      probed with the legacy "ti,hwmods" devicetree property.
      
      Fixes: 88a17252 ("clk: ti: add support for clkctrl clocks")
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      00ed897d
    • D
      Staging: vc04_services: Fix a couple error codes · dd9b6de7
      Dan Carpenter 提交于
      [ Upstream commit ca4e4efbefbbdde0a7bb3023ea08d491f4daf9b9 ]
      
      These are accidentally returning positive EINVAL instead of negative
      -EINVAL.  Some of the callers treat positive values as success.
      
      Fixes: 7b3ad5ab ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: NStefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      dd9b6de7
    • M
      net: mvpp2: prs: Use the correct helpers when removing all VID filters · 97605ba6
      Maxime Chevallier 提交于
      [ Upstream commit 6b7a3430c163455cf8a514d636bda52b04654972 ]
      
      When removing all VID filters, the mvpp2_prs_vid_entry_remove would be
      called with the TCAM id incorrectly used as a VID, causing the wrong
      TCAM entries to be invalidated.
      
      Fix this by directly invalidating entries in the VID range.
      
      Fixes: 56beda3d ("net: mvpp2: Add hardware offloading for VLAN filtering")
      Suggested-by: NYuri Chipchev <yuric@marvell.com>
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97605ba6
    • M
      net: mvpp2: prs: Fix parser range for VID filtering · b6a1eabf
      Maxime Chevallier 提交于
      [ Upstream commit 46b0090a6636cf34c0e856f15dd03e15ba4cdda6 ]
      
      VID filtering is implemented in the Header Parser, with one range of 11
      vids being assigned for each no-loopback port.
      
      Make sure we use the per-port range when looking for existing entries in
      the Parser.
      
      Since we used a global range instead of a per-port one, this causes VIDs
      to be removed from the whitelist from all ports of the same PPv2
      instance.
      
      Fixes: 56beda3d ("net: mvpp2: Add hardware offloading for VLAN filtering")
      Suggested-by: NYuri Chipchev <yuric@marvell.com>
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6a1eabf
    • A
      net/mlx5: Avoid reloading already removed devices · 4642a659
      Alaa Hleihel 提交于
      Prior to reloading a device we must first verify that it was not already
      removed. Otherwise, the attempt to remove the device will do nothing, and
      in that case we will end up proceeding with adding an new device that no
      one was expecting to remove, leaving behind used resources such as EQs that
      causes a failure to destroy comp EQs and syndrome (0x30f433).
      
      Fix that by making sure that we try to remove and add a device (based on a
      protocol) only if the device is already added.
      
      Fixes: c5447c70 ("net/mlx5: E-Switch, Reload IB interface when switching devlink modes")
      Signed-off-by: NAlaa Hleihel <alaa@mellanox.com>
      Signed-off-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4642a659
    • J
      sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg · e1b0c311
      John Paul Adrian Glaubitz 提交于
      [ Upstream commit 07a6d63eb1b54b5fb38092780fe618dfe1d96e23 ]
      
      In d5a2aa24, the name in struct console sunhv_console was changed from "ttyS"
      to "ttyHV" while the name in struct uart_ops sunhv_pops remained unchanged.
      
      This results in the hypervisor console device to be listed as "ttyHV0" under
      /proc/consoles while the device node is still named "ttyS0":
      
      root@osaka:~# cat /proc/consoles
      ttyHV0               -W- (EC p  )    4:64
      tty0                 -WU (E     )    4:1
      root@osaka:~# readlink /sys/dev/char/4:64
      ../../devices/root/f02836f0/f0285690/tty/ttyS0
      root@osaka:~#
      
      This means that any userland code which tries to determine the name of the
      device file of the hypervisor console device can not rely on the information
      provided by /proc/consoles. In particular, booting current versions of debian-
      installer inside a SPARC LDOM will fail with the installer unable to determine
      the console device.
      
      After renaming the device in struct uart_ops sunhv_pops to "ttyHV" as well,
      the inconsistency is fixed and it is possible again to determine the name
      of the device file of the hypervisor console device by reading the contents
      of /proc/console:
      
      root@osaka:~# cat /proc/consoles
      ttyHV0               -W- (EC p  )    4:64
      tty0                 -WU (E     )    4:1
      root@osaka:~# readlink /sys/dev/char/4:64
      ../../devices/root/f02836f0/f0285690/tty/ttyHV0
      root@osaka:~#
      
      With this change, debian-installer works correctly when installing inside
      a SPARC LDOM.
      Signed-off-by: NJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e1b0c311
    • L
      net: dsa: rtl8366: Fix up VLAN filtering · fc762c99
      Linus Walleij 提交于
      [ Upstream commit 760c80b70bed2cd01630e8595d1bbde910339f31 ]
      
      We get this regression when using RTL8366RB as part of a bridge
      with OpenWrt:
      
      WARNING: CPU: 0 PID: 1347 at net/switchdev/switchdev.c:291
      	 switchdev_port_attr_set_now+0x80/0xa4
      lan0: Commit of attribute (id=7) failed.
      (...)
      realtek-smi switch lan0: failed to initialize vlan filtering on this port
      
      This is because it is trying to disable VLAN filtering
      on VLAN0, as we have forgot to add 1 to the port number
      to get the right VLAN in rtl8366_vlan_filtering(): when
      we initialize the VLAN we associate VLAN1 with port 0,
      VLAN2 with port 1 etc, so we need to add 1 to the port
      offset.
      
      Fixes: d8652956 ("net: dsa: realtek-smi: Add Realtek SMI driver")
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc762c99
    • H
      hv_netvsc: Set probe mode to sync · a5ae5920
      Haiyang Zhang 提交于
      [ Upstream commit 9a33629ba6b26caebd73e3c581ba1e6068c696a7 ]
      
      For better consistency of synthetic NIC names, we set the probe mode to
      PROBE_FORCE_SYNCHRONOUS. So the names can be aligned with the vmbus
      channel offer sequence.
      
      Fixes: af0a5646 ("use the new async probing feature for the hyperv drivers")
      Signed-off-by: NHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a5ae5920
    • I
      be2net: Fix number of Rx queues used for flow hashing · 674dc77b
      Ivan Vecera 提交于
      [ Upstream commit 718f4a2537089ea41903bf357071306163bc7c04 ]
      
      Number of Rx queues used for flow hashing returned by the driver is
      incorrect and this bug prevents user to use the last Rx queue in
      indirection table.
      
      Let's say we have a NIC with 6 combined queues:
      
      [root@sm-03 ~]# ethtool -l enp4s0f0
      Channel parameters for enp4s0f0:
      Pre-set maximums:
      RX:             5
      TX:             5
      Other:          0
      Combined:       6
      Current hardware settings:
      RX:             0
      TX:             0
      Other:          0
      Combined:       6
      
      Default indirection table maps all (6) queues equally but the driver
      reports only 5 rings available.
      
      [root@sm-03 ~]# ethtool -x enp4s0f0
      RX flow hash indirection table for enp4s0f0 with 5 RX ring(s):
          0:      0     1     2     3     4     5     0     1
          8:      2     3     4     5     0     1     2     3
         16:      4     5     0     1     2     3     4     5
         24:      0     1     2     3     4     5     0     1
      ...
      
      Now change indirection table somehow:
      
      [root@sm-03 ~]# ethtool -X enp4s0f0 weight 1 1
      [root@sm-03 ~]# ethtool -x enp4s0f0
      RX flow hash indirection table for enp4s0f0 with 6 RX ring(s):
          0:      0     0     0     0     0     0     0     0
      ...
         64:      1     1     1     1     1     1     1     1
      ...
      
      Now it is not possible to change mapping back to equal (default) state:
      
      [root@sm-03 ~]# ethtool -X enp4s0f0 equal 6
      Cannot set RX flow hash configuration: Invalid argument
      
      Fixes: 594ad54a ("be2net: Add support for setting and getting rx flow hash options")
      Reported-by: NTianhao <tizhao@redhat.com>
      Signed-off-by: NIvan Vecera <ivecera@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      674dc77b
  3. 19 6月, 2019 3 次提交