1. 31 Dec, 2019 40 commits
    • Marcel Holtmann's avatar
      rfkill: allocate static minor · b5421330
      Marcel Holtmann authored
      [ Upstream commit 8670b2b8 ]
      
      udev has a feature of creating /dev/<node> device-nodes if it finds
      a devnode:<node> modalias. This allows for auto-loading of modules that
      provide the node. This requires to use a statically allocated minor
      number for misc character devices.
      
      However, rfkill uses dynamic minor numbers and prevents auto-loading
      of the module. So allocate the next static misc minor number and use
      it for rfkill.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Link: https://lore.kernel.org/r/20191024174042.19851-1-marcel@holtmann.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b5421330
    • Lucas Stach's avatar
      nvmem: imx-ocotp: reset error status on probe · f8aae26f
      Lucas Stach authored
      [ Upstream commit c33c585f ]
      
      If software running before the OCOTP driver is loaded left the
      controller with the error status pending, the driver will never
      be able to complete the read timing setup. Reset the error status
      on probe to make sure the controller is in usable state.
      Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20191029114240.14905-6-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f8aae26f
    • Vandana BN's avatar
      media: v4l2-core: fix touch support in v4l_g_fmt · 0613a3b9
      Vandana BN authored
      [ Upstream commit 545b618c ]
      
      v4l_s_fmt, for VFL_TYPE_TOUCH, sets unneeded members of
      the v4l2_pix_format structure to default values.This was
      missing in v4l_g_fmt, which would lead to failures in
      v4l2-compliance tests.
      Signed-off-by: default avatarVandana BN <bnvandana@gmail.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0613a3b9
    • Kangjie Lu's avatar
      media: rcar_drif: fix a memory disclosure · debdd16c
      Kangjie Lu authored
      [ Upstream commit d3908323 ]
      
      "f->fmt.sdr.reserved" is uninitialized. As other peer drivers
      like msi2500 and airspy do, the fix initializes it to avoid
      memory disclosures.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      debdd16c
    • Manjunath Patil's avatar
      ixgbe: protect TX timestamping from API misuse · 1b6b6bbf
      Manjunath Patil authored
      [ Upstream commit 07066d9d ]
      
      HW timestamping can only be requested for a packet if the NIC is first
      setup via ioctl(SIOCSHWTSTAMP). If this step was skipped, then the ixgbe
      driver still allowed TX packets to request HW timestamping. In this
      situation, we see 'clearing Tx Timestamp hang' noise in the log.
      
      Fix this by checking that the NIC is configured for HW TX timestamping
      before accepting a HW TX timestamping request.
      
      Similar-to:
         commit 26bd4e2d ("igb: protect TX timestamping from API misuse")
         commit 0a6f2f05 ("igb: Fix a test with HWTSTAMP_TX_ON")
      Signed-off-by: default avatarManjunath Patil <manjunath.b.patil@oracle.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1b6b6bbf
    • Ben Dooks (Codethink)'s avatar
      pinctrl: amd: fix __iomem annotation in amd_gpio_irq_handler() · b2098be0
      Ben Dooks (Codethink) authored
      [ Upstream commit 10ff58aa ]
      
      The regs pointer in amd_gpio_irq_handler() should have __iomem
      on it, so add that to fix the following sparse warnings:
      
      drivers/pinctrl/pinctrl-amd.c:555:14: warning: incorrect type in assignment (different address spaces)
      drivers/pinctrl/pinctrl-amd.c:555:14:    expected unsigned int [usertype] *regs
      drivers/pinctrl/pinctrl-amd.c:555:14:    got void [noderef] <asn:2> *base
      drivers/pinctrl/pinctrl-amd.c:563:34: warning: incorrect type in argument 1 (different address spaces)
      drivers/pinctrl/pinctrl-amd.c:563:34:    expected void const volatile [noderef] <asn:2> *addr
      drivers/pinctrl/pinctrl-amd.c:563:34:    got unsigned int [usertype] *
      drivers/pinctrl/pinctrl-amd.c:580:34: warning: incorrect type in argument 1 (different address spaces)
      drivers/pinctrl/pinctrl-amd.c:580:34:    expected void const volatile [noderef] <asn:2> *addr
      drivers/pinctrl/pinctrl-amd.c:580:34:    got unsigned int [usertype] *
      drivers/pinctrl/pinctrl-amd.c:587:25: warning: incorrect type in argument 2 (different address spaces)
      drivers/pinctrl/pinctrl-amd.c:587:25:    expected void volatile [noderef] <asn:2> *addr
      drivers/pinctrl/pinctrl-amd.c:587:25:    got unsigned int [usertype] *
      Signed-off-by: default avatarBen Dooks (Codethink) <ben.dooks@codethink.co.uk>
      Link: https://lore.kernel.org/r/20191022151154.5986-1-ben.dooks@codethink.co.ukSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b2098be0
    • Luiz Augusto von Dentz's avatar
      Bluetooth: Fix advertising duplicated flags · eef455a9
      Luiz Augusto von Dentz authored
      [ Upstream commit 6012b934 ]
      
      Instances may have flags set as part of its data in which case the code
      should not attempt to add it again otherwise it can cause duplication:
      
      < HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 35
              Handle: 0x00
              Operation: Complete extended advertising data (0x03)
              Fragment preference: Minimize fragmentation (0x01)
              Data length: 0x06
              Flags: 0x04
                BR/EDR Not Supported
              Flags: 0x06
                LE General Discoverable Mode
                BR/EDR Not Supported
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eef455a9
    • Toke Høiland-Jørgensen's avatar
      libbpf: Fix error handling in bpf_map__reuse_fd() · b3051cd8
      Toke Høiland-Jørgensen authored
      [ Upstream commit d1b4574a ]
      
      bpf_map__reuse_fd() was calling close() in the error path before returning
      an error value based on errno. However, close can change errno, so that can
      lead to potentially misleading error messages. Instead, explicitly store
      errno in the err variable before each goto.
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/157269297769.394725.12634985106772698611.stgit@toke.dkSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3051cd8
    • Alexandru Ardelean's avatar
      iio: dln2-adc: fix iio_triggered_buffer_postenable() position · 77a6a265
      Alexandru Ardelean authored
      [ Upstream commit a7bddfe2 ]
      
      The iio_triggered_buffer_postenable() hook should be called first to
      attach the poll function. The iio_triggered_buffer_predisable() hook is
      called last (as is it should).
      
      This change moves iio_triggered_buffer_postenable() to be called first. It
      adds iio_triggered_buffer_predisable() on the error paths of the postenable
      hook.
      For the predisable hook, some code-paths have been changed to make sure
      that the iio_triggered_buffer_predisable() hook gets called in case there
      is an error before it.
      Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      77a6a265
    • Geert Uytterhoeven's avatar
      pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B · a498e02d
      Geert Uytterhoeven authored
      [ Upstream commit 884caada ]
      
      The definitions for bit field [19:18] of the Peripheral Function Select
      Register 3 were accidentally copied from bit field [20], leading to
      duplicates for the TCLK1_B function, and missing TCLK0, CAN_CLK_B, and
      ET0_ETXD4 functions.
      
      Fix this by adding the missing GPIO_FN_CAN_CLK_B and GPIO_FN_ET0_ETXD4
      enum values, and correcting the functions.
      Reported-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20191024131308.16659-1-geert+renesas@glider.beSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      a498e02d
    • Darrick J. Wong's avatar
      loop: fix no-unmap write-zeroes request behavior · 4e004c31
      Darrick J. Wong authored
      [ Upstream commit efcfec57 ]
      
      Currently, if the loop device receives a WRITE_ZEROES request, it asks
      the underlying filesystem to punch out the range.  This behavior is
      correct if unmapping is allowed.  However, a NOUNMAP request means that
      the caller doesn't want us to free the storage backing the range, so
      punching out the range is incorrect behavior.
      
      To satisfy a NOUNMAP | WRITE_ZEROES request, loop should ask the
      underlying filesystem to FALLOC_FL_ZERO_RANGE, which is (according to
      the fallocate documentation) required to ensure that the entire range is
      backed by real storage, which suffices for our purposes.
      
      Fixes: 19372e27 ("loop: implement REQ_OP_WRITE_ZEROES")
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4e004c31
    • John Garry's avatar
      libata: Ensure ata_port probe has completed before detach · c2c58029
      John Garry authored
      [ Upstream commit 130f4caf ]
      
      With CONFIG_DEBUG_TEST_DRIVER_REMOVE set, we may find the following WARN:
      
      [   23.452574] ------------[ cut here ]------------
      [   23.457190] WARNING: CPU: 59 PID: 1 at drivers/ata/libata-core.c:6676 ata_host_detach+0x15c/0x168
      [   23.466047] Modules linked in:
      [   23.469092] CPU: 59 PID: 1 Comm: swapper/0 Not tainted 5.4.0-rc1-00010-g5b83fd27752b-dirty #296
      [   23.477776] Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019
      [   23.486286] pstate: a0c00009 (NzCv daif +PAN +UAO)
      [   23.491065] pc : ata_host_detach+0x15c/0x168
      [   23.495322] lr : ata_host_detach+0x88/0x168
      [   23.499491] sp : ffff800011cabb50
      [   23.502792] x29: ffff800011cabb50 x28: 0000000000000007
      [   23.508091] x27: ffff80001137f068 x26: ffff8000112c0c28
      [   23.513390] x25: 0000000000003848 x24: ffff0023ea185300
      [   23.518689] x23: 0000000000000001 x22: 00000000000014c0
      [   23.523987] x21: 0000000000013740 x20: ffff0023bdc20000
      [   23.529286] x19: 0000000000000000 x18: 0000000000000004
      [   23.534584] x17: 0000000000000001 x16: 00000000000000f0
      [   23.539883] x15: ffff0023eac13790 x14: ffff0023eb76c408
      [   23.545181] x13: 0000000000000000 x12: ffff0023eac13790
      [   23.550480] x11: ffff0023eb76c228 x10: 0000000000000000
      [   23.555779] x9 : ffff0023eac13798 x8 : 0000000040000000
      [   23.561077] x7 : 0000000000000002 x6 : 0000000000000001
      [   23.566376] x5 : 0000000000000002 x4 : 0000000000000000
      [   23.571674] x3 : ffff0023bf08a0bc x2 : 0000000000000000
      [   23.576972] x1 : 3099674201f72700 x0 : 0000000000400284
      [   23.582272] Call trace:
      [   23.584706]  ata_host_detach+0x15c/0x168
      [   23.588616]  ata_pci_remove_one+0x10/0x18
      [   23.592615]  ahci_remove_one+0x20/0x40
      [   23.596356]  pci_device_remove+0x3c/0xe0
      [   23.600267]  really_probe+0xdc/0x3e0
      [   23.603830]  driver_probe_device+0x58/0x100
      [   23.608000]  device_driver_attach+0x6c/0x90
      [   23.612169]  __driver_attach+0x84/0xc8
      [   23.615908]  bus_for_each_dev+0x74/0xc8
      [   23.619730]  driver_attach+0x20/0x28
      [   23.623292]  bus_add_driver+0x148/0x1f0
      [   23.627115]  driver_register+0x60/0x110
      [   23.630938]  __pci_register_driver+0x40/0x48
      [   23.635199]  ahci_pci_driver_init+0x20/0x28
      [   23.639372]  do_one_initcall+0x5c/0x1b0
      [   23.643199]  kernel_init_freeable+0x1a4/0x24c
      [   23.647546]  kernel_init+0x10/0x108
      [   23.651023]  ret_from_fork+0x10/0x18
      [   23.654590] ---[ end trace 634a14b675b71c13 ]---
      
      With KASAN also enabled, we may also get many use-after-free reports.
      
      The issue is that when CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, we may
      attempt to detach the ata_port before it has been probed.
      
      This is because the ata_ports are async probed, meaning that there is no
      guarantee that the ata_port has probed prior to detach. When the ata_port
      does probe in this scenario, we get all sorts of issues as the detach may
      have already happened.
      
      Fix by ensuring synchronisation with async_synchronize_full(). We could
      alternatively use the cookie returned from the ata_port probe
      async_schedule() call, but that means managing the cookie, so more
      complicated.
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c2c58029
    • Yunsheng Lin's avatar
      net: hns3: add struct netdev_queue debug info for TX timeout · e7e11c08
      Yunsheng Lin authored
      [ Upstream commit 647522a5 ]
      
      When there is a TX timeout, we can tell if the driver or stack
      has stopped the queue by looking at state field, and when has
      the last packet transmited by looking at trans_start field.
      
      So this patch prints these two field in the
      hns3_get_tx_timeo_queue_info().
      Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e7e11c08
    • Gerald Schaefer's avatar
      s390/mm: add mm_pxd_folded() checks to pxd_free() · 8eaee8c5
      Gerald Schaefer authored
      [ Upstream commit 2416cefc ]
      
      Unlike pxd_free_tlb(), the pxd_free() functions do not check for folded
      page tables. This is not an issue so far, as those functions will actually
      never be called, since no code will reach them when page tables are folded.
      
      In order to avoid future issues, and to make the s390 code more similar to
      other architectures, add mm_pxd_folded() checks, similar to how it is done
      in pxd_free_tlb().
      
      This was found by testing a patch from from Anshuman Khandual, which is
      currently discussed on LKML ("mm/debug: Add tests validating architecture
      page table helpers").
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8eaee8c5
    • Heiko Carstens's avatar
      s390/time: ensure get_clock_monotonic() returns monotonic values · f95ec2bc
      Heiko Carstens authored
      [ Upstream commit 01162068 ]
      
      The current implementation of get_clock_monotonic() leaves it up to
      the caller to call the function with preemption disabled. The only
      core kernel caller (sched_clock) however does not disable preemption.
      
      In order to make sure that all callers of this function see monotonic
      values handle disabling preemption within the function itself.
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f95ec2bc
    • Stephan Gerhold's avatar
      phy: qcom-usb-hs: Fix extcon double register after power cycle · 8fa7f8d5
      Stephan Gerhold authored
      [ Upstream commit 64f86b99 ]
      
      Commit f0b5c2c9 ("phy: qcom-usb-hs: Replace the extcon API")
      switched from extcon_register_notifier() to the resource-managed
      API, i.e. devm_extcon_register_notifier().
      
      This is problematic in this case, because the extcon notifier
      is dynamically registered/unregistered whenever the PHY is powered
      on/off. The resource-managed API does not unregister the notifier
      until the driver is removed, so as soon as the PHY is power cycled,
      attempting to register the notifier again results in:
      
      	double register detected
      	WARNING: CPU: 1 PID: 182 at kernel/notifier.c:26 notifier_chain_register+0x74/0xa0
      	Call trace:
      	 ...
      	 extcon_register_notifier+0x74/0xb8
      	 devm_extcon_register_notifier+0x54/0xb8
      	 qcom_usb_hs_phy_power_on+0x1fc/0x208
      	 ...
      
      ... and USB stops working after plugging the cable out and in
      another time.
      
      The easiest way to fix this is to make a partial revert of
      commit f0b5c2c9 ("phy: qcom-usb-hs: Replace the extcon API")
      and avoid using the resource-managed API in this case.
      
      Fixes: f0b5c2c9 ("phy: qcom-usb-hs: Replace the extcon API")
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8fa7f8d5
    • Mao Wenan's avatar
      net: dsa: LAN9303: select REGMAP when LAN9303 enable · dfcae415
      Mao Wenan authored
      [ Upstream commit b6989d24 ]
      
      When NET_DSA_SMSC_LAN9303=y and NET_DSA_SMSC_LAN9303_MDIO=y,
      below errors can be seen:
      drivers/net/dsa/lan9303_mdio.c:87:23: error: REGMAP_ENDIAN_LITTLE
      undeclared here (not in a function)
        .reg_format_endian = REGMAP_ENDIAN_LITTLE,
      drivers/net/dsa/lan9303_mdio.c:93:3: error: const struct regmap_config
      has no member named reg_read
        .reg_read = lan9303_mdio_read,
      
      It should select REGMAP in config NET_DSA_SMSC_LAN9303.
      
      Fixes: dc700583 ("net: dsa: LAN9303: add MDIO managed mode support")
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      dfcae415
    • Thierry Reding's avatar
      gpu: host1x: Allocate gather copy for host1x · 9287cc61
      Thierry Reding authored
      [ Upstream commit b78e70c0 ]
      
      Currently when the gather buffers are copied, they are copied to a
      buffer that is allocated for the host1x client that wants to execute the
      command streams in the buffers. However, the gather buffers will be read
      by the host1x device, which causes SMMU faults if the DMA API is backed
      by an IOMMU.
      
      Fix this by allocating the gather buffer copy for the host1x device,
      which makes sure that it will be mapped into the host1x's IOVA space if
      the DMA API is backed by an IOMMU.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9287cc61
    • Michal Kalderon's avatar
      RDMA/qedr: Fix memory leak in user qp and mr · fe9bd986
      Michal Kalderon authored
      [ Upstream commit 24e412c1 ]
      
      User QPs pbl's weren't freed properly.
      MR pbls weren't freed properly.
      
      Fixes: e0290cce ("qedr: Add support for memory registeration verbs")
      Link: https://lore.kernel.org/r/20191027200451.28187-5-michal.kalderon@marvell.comSigned-off-by: default avatarAriel Elior <ariel.elior@marvell.com>
      Signed-off-by: default avatarMichal Kalderon <michal.kalderon@marvell.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fe9bd986
    • Hans de Goede's avatar
      ACPI: button: Add DMI quirk for Medion Akoya E2215T · 2cf968c0
      Hans de Goede authored
      [ Upstream commit 932e1ba4 ]
      
      The Medion Akoya E2215T's ACPI _LID implementation is quite broken:
      
       1. For notifications it uses an ActiveLow Edge GpioInt, rather then
          an ActiveBoth one, meaning that the device is only notified when the
          lid is closed, not when it is opened.
      
      2. Matching with this its _LID method simply always returns 0 (closed)
      
        In order for the Linux LID code to work properly with this implementation,
        the lid_init_state selection needs to be set to ACPI_BUTTON_LID_INIT_OPEN.
      
      This commit adds a DMI quirk for this.
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2cf968c0
    • Lingling Xu's avatar
      spi: sprd: adi: Add missing lock protection when rebooting · 3e3378f6
      Lingling Xu authored
      [ Upstream commit 91ea1d70 ]
      
      When rebooting the system, we should lock the watchdog after
      configuration to make sure the watchdog can reboot the system
      successfully.
      Signed-off-by: default avatarLingling Xu <ling_ling.xu@unisoc.com>
      Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
      Link: https://lore.kernel.org/r/7b04711127434555e3a1a86bc6be99860cd86668.1572257085.git.baolin.wang@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e3378f6
    • Thierry Reding's avatar
      drm/tegra: sor: Use correct SOR index on Tegra210 · 16015bd9
      Thierry Reding authored
      [ Upstream commit 24e64f86 ]
      
      The device tree bindings for the Tegra210 SOR don't require the
      controller instance to be defined, since the instance can be derived
      from the compatible string. The index is never used on Tegra210, so we
      got away with it not getting set. However, subsequent patches will
      change that, so make sure the proper index is used.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      16015bd9
    • Grygorii Strashko's avatar
      net: phy: dp83867: enable robust auto-mdix · 3d097861
      Grygorii Strashko authored
      [ Upstream commit 5a7f08c2 ]
      
      The link detection timeouts can be observed (or link might not be detected
      at all) when dp83867 PHY is configured in manual mode (speed/duplex).
      
      CFG3[9] Robust Auto-MDIX option allows to significantly improve link detection
      in case dp83867 is configured in manual mode and reduce link detection
      time.
      As per DM: "If link partners are configured to operational modes that are
      not supported by normal Auto MDI/MDIX mode (like Auto-Neg versus Force
      100Base-TX or Force 100Base-TX versus Force 100Base-TX), this Robust Auto
      MDI/MDIX mode allows MDI/MDIX resolution and prevents deadlock."
      
      Hence, enable this option by default as there are no known reasons
      not to do so.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3d097861
    • Nicholas Nunley's avatar
      i40e: initialize ITRN registers with correct values · b3e2e106
      Nicholas Nunley authored
      [ Upstream commit 998e5166 ]
      
      Since commit 92418fb1 ("i40e/i40evf: Use usec value instead of reg
      value for ITR defines") the driver tracks the interrupt throttling
      intervals in single usec units, although the actual ITRN/ITR0 registers are
      programmed in 2 usec units. Most register programming flows in the driver
      correctly handle the conversion, although it is currently not applied when
      the registers are initialized to their default values. Most of the time
      this doesn't present a problem since the default values are usually
      immediately overwritten through the standard adaptive throttling mechanism,
      or updated manually by the user, but if adaptive throttling is disabled and
      the interval values are left alone then the incorrect value will persist.
      
      Since the intended default interval of 50 usecs (vs. 100 usecs as
      programmed) performs better for most traffic workloads, this can lead to
      performance regressions.
      
      This patch adds the correct conversion when writing the initial values to
      the ITRN registers.
      Signed-off-by: default avatarNicholas Nunley <nicholas.d.nunley@intel.com>
      Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3e2e106
    • Yunfeng Ye's avatar
      arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill() · 3bb8863b
      Yunfeng Ye authored
      [ Upstream commit bfcef4ab ]
      
      In cases like suspend-to-disk and suspend-to-ram, a large number of CPU
      cores need to be shut down. At present, the CPU hotplug operation is
      serialised, and the CPU cores can only be shut down one by one. In this
      process, if PSCI affinity_info() does not return LEVEL_OFF quickly,
      cpu_psci_cpu_kill() needs to wait for 10ms. If hundreds of CPU cores
      need to be shut down, it will take a long time.
      
      Normally, there is no need to wait 10ms in cpu_psci_cpu_kill(). So
      change the wait interval from 10 ms to max 1 ms and use usleep_range()
      instead of msleep() for more accurate timer.
      
      In addition, reducing the time interval will increase the messages
      output, so remove the "Retry ..." message, instead, track time and
      output to the the sucessful message.
      Signed-off-by: default avatarYunfeng Ye <yeyunfeng@huawei.com>
      Reviewed-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3bb8863b
    • Guoqing Jiang's avatar
      md/bitmap: avoid race window between md_bitmap_resize and bitmap_file_clear_bit · 5d8a64e6
      Guoqing Jiang authored
      [ Upstream commit fadcbd29 ]
      
      We need to move "spin_lock_irq(&bitmap->counts.lock)" before unmap previous
      storage, otherwise panic like belows could happen as follows.
      
      [  902.353802] sdl: detected capacity change from 1077936128 to 3221225472
      [  902.616948] general protection fault: 0000 [#1] SMP
      [snip]
      [  902.618588] CPU: 12 PID: 33698 Comm: md0_raid1 Tainted: G           O    4.14.144-1-pserver #4.14.144-1.1~deb10
      [  902.618870] Hardware name: Supermicro SBA-7142G-T4/BHQGE, BIOS 3.00       10/24/2012
      [  902.619120] task: ffff9ae1860fc600 task.stack: ffffb52e4c704000
      [  902.619301] RIP: 0010:bitmap_file_clear_bit+0x90/0xd0 [md_mod]
      [  902.619464] RSP: 0018:ffffb52e4c707d28 EFLAGS: 00010087
      [  902.619626] RAX: ffe8008b0d061000 RBX: ffff9ad078c87300 RCX: 0000000000000000
      [  902.619792] RDX: ffff9ad986341868 RSI: 0000000000000803 RDI: ffff9ad078c87300
      [  902.619986] RBP: ffff9ad0ed7a8000 R08: 0000000000000000 R09: 0000000000000000
      [  902.620154] R10: ffffb52e4c707ec0 R11: ffff9ad987d1ed44 R12: ffff9ad0ed7a8360
      [  902.620320] R13: 0000000000000003 R14: 0000000000060000 R15: 0000000000000800
      [  902.620487] FS:  0000000000000000(0000) GS:ffff9ad987d00000(0000) knlGS:0000000000000000
      [  902.620738] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  902.620901] CR2: 000055ff12aecec0 CR3: 0000001005207000 CR4: 00000000000406e0
      [  902.621068] Call Trace:
      [  902.621256]  bitmap_daemon_work+0x2dd/0x360 [md_mod]
      [  902.621429]  ? find_pers+0x70/0x70 [md_mod]
      [  902.621597]  md_check_recovery+0x51/0x540 [md_mod]
      [  902.621762]  raid1d+0x5c/0xeb0 [raid1]
      [  902.621939]  ? try_to_del_timer_sync+0x4d/0x80
      [  902.622102]  ? del_timer_sync+0x35/0x40
      [  902.622265]  ? schedule_timeout+0x177/0x360
      [  902.622453]  ? call_timer_fn+0x130/0x130
      [  902.622623]  ? find_pers+0x70/0x70 [md_mod]
      [  902.622794]  ? md_thread+0x94/0x150 [md_mod]
      [  902.622959]  md_thread+0x94/0x150 [md_mod]
      [  902.623121]  ? wait_woken+0x80/0x80
      [  902.623280]  kthread+0x119/0x130
      [  902.623437]  ? kthread_create_on_node+0x60/0x60
      [  902.623600]  ret_from_fork+0x22/0x40
      [  902.624225] RIP: bitmap_file_clear_bit+0x90/0xd0 [md_mod] RSP: ffffb52e4c707d28
      
      Because mdadm was running on another cpu to do resize, so bitmap_resize was
      called to replace bitmap as below shows.
      
      PID: 38801  TASK: ffff9ad074a90e00  CPU: 0   COMMAND: "mdadm"
         [exception RIP: queued_spin_lock_slowpath+56]
         [snip]
      -- <NMI exception stack> --
       #5 [ffffb52e60f17c58] queued_spin_lock_slowpath at ffffffff9c0b27b8
       #6 [ffffb52e60f17c58] bitmap_resize at ffffffffc0399877 [md_mod]
       #7 [ffffb52e60f17d30] raid1_resize at ffffffffc0285bf9 [raid1]
       #8 [ffffb52e60f17d50] update_size at ffffffffc038a31a [md_mod]
       #9 [ffffb52e60f17d70] md_ioctl at ffffffffc0395ca4 [md_mod]
      
      And the procedure to keep resize bitmap safe is allocate new storage
      space, then quiesce, copy bits, replace bitmap, and re-start.
      
      However the daemon (bitmap_daemon_work) could happen even the array is
      quiesced, which means when bitmap_file_clear_bit is triggered by raid1d,
      then it thinks it should be fine to access store->filemap since
      counts->lock is held, but resize could change the storage without the
      protection of the lock.
      
      Cc: Jack Wang <jinpu.wang@cloud.ionos.com>
      Cc: NeilBrown <neilb@suse.com>
      Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d8a64e6
    • Sakari Ailus's avatar
      media: smiapp: Register sensor after enabling runtime PM on the device · 3e1e7489
      Sakari Ailus authored
      [ Upstream commit 90c9e4a4 ]
      
      Earlier it was possible that the parts of the driver that assumed runtime
      PM was enabled were being called before runtime PM was enabled in the
      driver's probe function. So enable runtime PM before registering the
      sub-device.
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e1e7489
    • Thomas Gleixner's avatar
      x86/ioapic: Prevent inconsistent state when moving an interrupt · 00f0f294
      Thomas Gleixner authored
      [ Upstream commit df439342 ]
      
      There is an issue with threaded interrupts which are marked ONESHOT
      and using the fasteoi handler:
      
        if (IS_ONESHOT())
          mask_irq();
        ....
        cond_unmask_eoi_irq()
          chip->irq_eoi();
            if (setaffinity_pending) {
               mask_ioapic();
               ...
      	 move_affinity();
      	 unmask_ioapic();
            }
      
      So if setaffinity is pending the interrupt will be moved and then
      unconditionally unmasked at the ioapic level, which is wrong in two
      aspects:
      
       1) It should be kept masked up to the point where the threaded handler
          finished.
      
       2) The physical chip state and the software masked state are inconsistent
      
      Guard both the mask and the unmask with a check for the software masked
      state. If the line is marked masked then the ioapic line is also masked, so
      both mask_ioapic() and unmask_ioapic() can be skipped safely.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Siewior <bigeasy@linutronix.de>
      Fixes: 3aa551c9 ("genirq: add threaded interrupt handler support")
      Link: https://lkml.kernel.org/r/20191017101938.321393687@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      00f0f294
    • Corey Minyard's avatar
      ipmi: Don't allow device module unload when in use · f9d405a4
      Corey Minyard authored
      [ Upstream commit cbb79863 ]
      
      If something has the IPMI driver open, don't allow the device
      module to be unloaded.  Before it would unload and the user would
      get errors on use.
      
      This change is made on user request, and it makes it consistent
      with the I2C driver, which has the same behavior.
      
      It does change things a little bit with respect to kernel users.
      If the ACPI or IPMI watchdog (or any other kernel user) has
      created a user, then the device module cannot be unloaded.  Before
      it could be unloaded,
      
      This does not affect hot-plug.  If the device goes away (it's on
      something removable that is removed or is hot-removed via sysfs)
      then it still behaves as it did before.
      Reported-by: default avatartony camuso <tcamuso@redhat.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Tested-by: default avatartony camuso <tcamuso@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f9d405a4
    • Chris Chiu's avatar
      rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot · d7607502
      Chris Chiu authored
      [ Upstream commit 0eeb91ad ]
      
      The RTL8723BU has problems connecting to AP after each warm reboot.
      Sometimes it returns no scan result, and in most cases, it fails
      the authentication for unknown reason. However, it works totally
      fine after cold reboot.
      
      Compare the value of register SYS_CR and SYS_CLK_MAC_CLK_ENABLE
      for cold reboot and warm reboot, the registers imply that the MAC
      is already powered and thus some procedures are skipped during
      driver initialization. Double checked the vendor driver, it reads
      the SYS_CR and SYS_CLK_MAC_CLK_ENABLE also but doesn't skip any
      during initialization based on them. This commit only tells the
      RTL8723BU to do full initialization without checking MAC status.
      Signed-off-by: default avatarChris Chiu <chiu@endlessm.com>
      Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d7607502
    • Kangjie Lu's avatar
      drm/gma500: fix memory disclosures due to uninitialized bytes · 7a284055
      Kangjie Lu authored
      [ Upstream commit ec3b7b6e ]
      
      "clock" may be copied to "best_clock". Initializing best_clock
      is not sufficient. The fix initializes clock as well to avoid
      memory disclosures and informaiton leaks.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191018044150.1899-1-kjlu@umn.eduSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      7a284055
    • Leo Yan's avatar
      perf tests: Disable bp_signal testing for arm64 · c761b5ed
      Leo Yan authored
      [ Upstream commit 6a5f3d94 ]
      
      As there are several discussions for enabling perf breakpoint signal
      testing on arm64 platform: arm64 needs to rely on single-step to execute
      the breakpointed instruction and then reinstall the breakpoint exception
      handler.  But if we hook the breakpoint with a signal, the signal
      handler will do the stepping rather than the breakpointed instruction,
      this causes infinite loops as below:
      
               Kernel space              |            Userspace
        ---------------------------------|--------------------------------
                                         |  __test_function() -> hit
      				   |                       breakpoint
        breakpoint_handler()             |
          `-> user_enable_single_step()  |
        do_signal()                      |
                                         |  sig_handler() -> Step one
      				   |                instruction and
      				   |                trap to kernel
        single_step_handler()            |
          `-> reinstall_suspended_bps()  |
                                         |  __test_function() -> hit
      				   |     breakpoint again and
      				   |     repeat up flow infinitely
      
      As Will Deacon mentioned [1]: "that we require the overflow handler to
      do the stepping on arm/arm64, which is relied upon by GDB/ptrace. The
      hw_breakpoint code is a complete disaster so my preference would be to
      rip out the perf part and just implement something directly in ptrace,
      but it's a pretty horrible job".  Though Will commented this on arm
      architecture, but the comment also can apply on arm64 architecture.
      
      For complete information, I searched online and found a few years back,
      Wang Nan sent one patch 'arm64: Store breakpoint single step state into
      pstate' [2]; the patch tried to resolve this issue by avoiding single
      stepping in signal handler and defer to enable the signal stepping when
      return to __test_function().  The fixing was not merged due to the
      concern for missing to handle different usage cases.
      
      Based on the info, the most feasible way is to skip Perf breakpoint
      signal testing for arm64 and this could avoid the duplicate
      investigation efforts when people see the failure.  This patch skips
      this case on arm64 platform, which is same with arm architecture.
      
      [1] https://lkml.org/lkml/2018/11/15/205
      [2] https://lkml.org/lkml/2015/12/23/477Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Brajeswar Ghosh <brajeswar.linux@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Souptick Joarder <jrdr.linux@gmail.com>
      Cc: Will Deacon <will@kernel.org>
      Link: http://lore.kernel.org/lkml/20191018085531.6348-3-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c761b5ed
    • Benjamin Berg's avatar
      x86/mce: Lower throttling MCE messages' priority to warning · 8d492e4b
      Benjamin Berg authored
      [ Upstream commit 9c3bafaa ]
      
      On modern CPUs it is quite normal that the temperature limits are
      reached and the CPU is throttled. In fact, often the thermal design is
      not sufficient to cool the CPU at full load and limits can quickly be
      reached when a burst in load happens. This will even happen with
      technologies like RAPL limitting the long term power consumption of
      the package.
      
      Also, these limits are "softer", as Srinivas explains:
      
      "CPU temperature doesn't have to hit max(TjMax) to get these warnings.
      OEMs ha[ve] an ability to program a threshold where a thermal interrupt
      can be generated. In some systems the offset is 20C+ (Read only value).
      
      In recent systems, there is another offset on top of it which can be
      programmed by OS, once some agent can adjust power limits dynamically.
      By default this is set to low by the firmware, which I guess the
      prime motivation of Benjamin to submit the patch."
      
      So these messages do not usually indicate a hardware issue (e.g.
      insufficient cooling). Log them as warnings to avoid confusion about
      their severity.
      
       [ bp: Massage commit mesage. ]
      Signed-off-by: default avatarBenjamin Berg <bberg@redhat.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Tested-by: default avatarChristian Kellner <ckellner@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20191009155424.249277-1-bberg@redhat.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      8d492e4b
    • Song Liu's avatar
      bpf/stackmap: Fix deadlock with rq_lock in bpf_get_stack() · a7f4da87
      Song Liu authored
      [ Upstream commit eac9153f ]
      
      bpf stackmap with build-id lookup (BPF_F_STACK_BUILD_ID) can trigger A-A
      deadlock on rq_lock():
      
      rcu: INFO: rcu_sched detected stalls on CPUs/tasks:
      [...]
      Call Trace:
       try_to_wake_up+0x1ad/0x590
       wake_up_q+0x54/0x80
       rwsem_wake+0x8a/0xb0
       bpf_get_stack+0x13c/0x150
       bpf_prog_fbdaf42eded9fe46_on_event+0x5e3/0x1000
       bpf_overflow_handler+0x60/0x100
       __perf_event_overflow+0x4f/0xf0
       perf_swevent_overflow+0x99/0xc0
       ___perf_sw_event+0xe7/0x120
       __schedule+0x47d/0x620
       schedule+0x29/0x90
       futex_wait_queue_me+0xb9/0x110
       futex_wait+0x139/0x230
       do_futex+0x2ac/0xa50
       __x64_sys_futex+0x13c/0x180
       do_syscall_64+0x42/0x100
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      This can be reproduced by:
      1. Start a multi-thread program that does parallel mmap() and malloc();
      2. taskset the program to 2 CPUs;
      3. Attach bpf program to trace_sched_switch and gather stackmap with
         build-id, e.g. with trace.py from bcc tools:
         trace.py -U -p <pid> -s <some-bin,some-lib> t:sched:sched_switch
      
      A sample reproducer is attached at the end.
      
      This could also trigger deadlock with other locks that are nested with
      rq_lock.
      
      Fix this by checking whether irqs are disabled. Since rq_lock and all
      other nested locks are irq safe, it is safe to do up_read() when irqs are
      not disable. If the irqs are disabled, postpone up_read() in irq_work.
      
      Fixes: 615755a7 ("bpf: extend stackmap to save binary_build_id+offset instead of address")
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20191014171223.357174-1-songliubraving@fb.com
      
      Reproducer:
      ============================ 8< ============================
      
      char *filename;
      
      void *worker(void *p)
      {
              void *ptr;
              int fd;
              char *pptr;
      
              fd = open(filename, O_RDONLY);
              if (fd < 0)
                      return NULL;
              while (1) {
                      struct timespec ts = {0, 1000 + rand() % 2000};
      
                      ptr = mmap(NULL, 4096 * 64, PROT_READ, MAP_PRIVATE, fd, 0);
                      usleep(1);
                      if (ptr == MAP_FAILED) {
                              printf("failed to mmap\n");
                              break;
                      }
                      munmap(ptr, 4096 * 64);
                      usleep(1);
                      pptr = malloc(1);
                      usleep(1);
                      pptr[0] = 1;
                      usleep(1);
                      free(pptr);
                      usleep(1);
                      nanosleep(&ts, NULL);
              }
              close(fd);
              return NULL;
      }
      
      int main(int argc, char *argv[])
      {
              void *ptr;
              int i;
              pthread_t threads[THREAD_COUNT];
      
              if (argc < 2)
                      return 0;
      
              filename = argv[1];
      
              for (i = 0; i < THREAD_COUNT; i++) {
                      if (pthread_create(threads + i, NULL, worker, NULL)) {
                              fprintf(stderr, "Error creating thread\n");
                              return 0;
                      }
              }
      
              for (i = 0; i < THREAD_COUNT; i++)
                      pthread_join(threads[i], NULL);
              return 0;
      }
      ============================ 8< ============================
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7f4da87
    • Mattijs Korpershoek's avatar
      Bluetooth: hci_core: fix init for HCI_USER_CHANNEL · 512de42e
      Mattijs Korpershoek authored
      [ Upstream commit eb8c101e ]
      
      During the setup() stage, HCI device drivers expect the chip to
      acknowledge its setup() completion via vendor specific frames.
      
      If userspace opens() such HCI device in HCI_USER_CHANNEL [1] mode,
      the vendor specific frames are never tranmitted to the driver, as
      they are filtered in hci_rx_work().
      
      Allow HCI devices which operate in HCI_USER_CHANNEL mode to receive
      frames if the HCI device is is HCI_INIT state.
      
      [1] https://www.spinics.net/lists/linux-bluetooth/msg37345.html
      
      Fixes: 23500189 ("Bluetooth: Introduce new HCI socket channel for user operation")
      Signed-off-by: default avatarMattijs Korpershoek <mkorpershoek@baylibre.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      512de42e
    • Szymon Janc's avatar
      Bluetooth: Workaround directed advertising bug in Broadcom controllers · 71aaa813
      Szymon Janc authored
      [ Upstream commit 4c371bb9 ]
      
      It appears that some Broadcom controllers (eg BCM20702A0) reject LE Set
      Advertising Parameters command if advertising intervals provided are not
      within range for undirected and low duty directed advertising.
      
      Workaround this bug by populating min and max intervals with 'valid'
      values.
      
      < HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15
              Min advertising interval: 0.000 msec (0x0000)
              Max advertising interval: 0.000 msec (0x0000)
              Type: Connectable directed - ADV_DIRECT_IND (high duty cycle) (0x01)
              Own address type: Public (0x00)
              Direct address type: Random (0x01)
              Direct address: E2:F0:7B:9F:DC:F4 (Static)
              Channel map: 37, 38, 39 (0x07)
              Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
      > HCI Event: Command Complete (0x0e) plen 4
            LE Set Advertising Parameters (0x08|0x0006) ncmd 1
              Status: Invalid HCI Command Parameters (0x12)
      Signed-off-by: default avatarSzymon Janc <szymon.janc@codecoup.pl>
      Tested-by: default avatarSören Beye <linux@hypfer.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      71aaa813
    • Ben Dooks (Codethink)'s avatar
      Bluetooth: missed cpu_to_le16 conversion in hci_init4_req · 8829e883
      Ben Dooks (Codethink) authored
      [ Upstream commit 727ea61a ]
      
      It looks like in hci_init4_req() the request is being
      initialised from cpu-endian data but the packet is specified
      to be little-endian. This causes an warning from sparse due
      to __le16 to u16 conversion.
      
      Fix this by using cpu_to_le16() on the two fields in the packet.
      
      net/bluetooth/hci_core.c:845:27: warning: incorrect type in assignment (different base types)
      net/bluetooth/hci_core.c:845:27:    expected restricted __le16 [usertype] tx_len
      net/bluetooth/hci_core.c:845:27:    got unsigned short [usertype] le_max_tx_len
      net/bluetooth/hci_core.c:846:28: warning: incorrect type in assignment (different base types)
      net/bluetooth/hci_core.c:846:28:    expected restricted __le16 [usertype] tx_time
      net/bluetooth/hci_core.c:846:28:    got unsigned short [usertype] le_max_tx_time
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8829e883
    • Miquel Raynal's avatar
      iio: adc: max1027: Reset the device at probe time · eec8f08d
      Miquel Raynal authored
      [ Upstream commit db033831 ]
      
      All the registers are configured by the driver, let's reset the chip
      at probe time, avoiding any conflict with a possible earlier
      configuration.
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eec8f08d
    • Ingo Rohloff's avatar
      usb: usbfs: Suppress problematic bind and unbind uevents. · cba64672
      Ingo Rohloff authored
      [ Upstream commit abb0b3d9 ]
      
      commit 1455cf8d ("driver core: emit uevents when device is bound
      to a driver") added bind and unbind uevents when a driver is bound or
      unbound to a physical device.
      
      For USB devices which are handled via the generic usbfs layer (via
      libusb for example), this is problematic:
      Each time a user space program calls
         ioctl(usb_fd, USBDEVFS_CLAIMINTERFACE, &usb_intf_nr);
      and then later
         ioctl(usb_fd, USBDEVFS_RELEASEINTERFACE, &usb_intf_nr);
      The kernel will now produce a bind or unbind event, which does not
      really contain any useful information.
      
      This allows a user space program to run a DoS attack against programs
      which listen to uevents (in particular systemd/eudev/upowerd):
      A malicious user space program just has to call in a tight loop
      
         ioctl(usb_fd, USBDEVFS_CLAIMINTERFACE, &usb_intf_nr);
         ioctl(usb_fd, USBDEVFS_RELEASEINTERFACE, &usb_intf_nr);
      
      With this loop the malicious user space program floods the kernel and
      all programs listening to uevents with tons of bind and unbind
      events.
      
      This patch suppresses uevents for ioctls USBDEVFS_CLAIMINTERFACE and
      USBDEVFS_RELEASEINTERFACE.
      Signed-off-by: default avatarIngo Rohloff <ingo.rohloff@lauterbach.com>
      Link: https://lore.kernel.org/r/20191011115518.2801-1-ingo.rohloff@lauterbach.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cba64672
    • Jin Yao's avatar
      perf report: Add warning when libunwind not compiled in · 888d90b3
      Jin Yao authored
      [ Upstream commit 800d3f56 ]
      
      We received a user report that call-graph DWARF mode was enabled in
      'perf record' but 'perf report' didn't unwind the callstack correctly.
      The reason was, libunwind was not compiled in.
      
      We can use 'perf -vv' to check the compiled libraries but it would be
      valuable to report a warning to user directly (especially valuable for
      a perf newbie).
      
      The warning is:
      
      Warning:
      Please install libunwind development packages during the perf build.
      
      Both TUI and stdio are supported.
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20191011022122.26369-1-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      888d90b3