1. 25 Jun, 2020 25 commits
    • Qian Cai's avatar
      vfio/pci: fix memory leaks in alloc_perm_bits() · 78914f16
      Qian Cai authored
      [ Upstream commit 3e63b94b ]
      
      vfio_pci_disable() calls vfio_config_free() but forgets to call
      free_perm_bits() resulting in memory leaks,
      
      unreferenced object 0xc000000c4db2dee0 (size 16):
        comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
        hex dump (first 16 bytes):
          00 00 ff 00 ff ff ff ff ff ff ff ff ff ff 00 00  ................
        backtrace:
          [<00000000a6a4552d>] alloc_perm_bits+0x58/0xe0 [vfio_pci]
          [<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
          init_pci_cap_msi_perm at drivers/vfio/pci/vfio_pci_config.c:1125
          (inlined by) vfio_msi_cap_len at drivers/vfio/pci/vfio_pci_config.c:1180
          (inlined by) vfio_cap_len at drivers/vfio/pci/vfio_pci_config.c:1241
          (inlined by) vfio_cap_init at drivers/vfio/pci/vfio_pci_config.c:1468
          (inlined by) vfio_config_init at drivers/vfio/pci/vfio_pci_config.c:1707
          [<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
          [<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
          [<000000009e34c54f>] ksys_ioctl+0xd8/0x130
          [<000000006577923d>] sys_ioctl+0x28/0x40
          [<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
          [<0000000008ea7dd5>] system_call_common+0xf0/0x278
      unreferenced object 0xc000000c4db2e330 (size 16):
        comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
        hex dump (first 16 bytes):
          00 ff ff 00 ff ff ff ff ff ff ff ff ff ff 00 00  ................
        backtrace:
          [<000000004c71914f>] alloc_perm_bits+0x44/0xe0 [vfio_pci]
          [<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
          [<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
          [<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
          [<000000009e34c54f>] ksys_ioctl+0xd8/0x130
          [<000000006577923d>] sys_ioctl+0x28/0x40
          [<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
          [<0000000008ea7dd5>] system_call_common+0xf0/0x278
      
      Fixes: 89e1f7d4 ("vfio: Add PCI device driver")
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      [aw: rolled in follow-up patch]
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      78914f16
    • Emmanuel Nicolet's avatar
      ps3disk: use the default segment boundary · 302f0c5e
      Emmanuel Nicolet authored
      [ Upstream commit 720bc316 ]
      
      Since commit dcebd755 ("block: use bio_for_each_bvec() to compute
      multi-page bvec count"), the kernel will bug_on on the PS3 because
      bio_split() is called with sectors == 0:
      
        kernel BUG at block/bio.c:1853!
        Oops: Exception in kernel mode, sig: 5 [#1]
        BE PAGE_SIZE=4K MMU=Hash PREEMPT SMP NR_CPUS=8 NUMA PS3
        Modules linked in: firewire_sbp2 rtc_ps3(+) soundcore ps3_gelic(+) \
        ps3rom(+) firewire_core ps3vram(+) usb_common crc_itu_t
        CPU: 0 PID: 97 Comm: blkid Not tainted 5.3.0-rc4 #1
        NIP:  c00000000027d0d0 LR: c00000000027d0b0 CTR: 0000000000000000
        REGS: c00000000135ae90 TRAP: 0700   Not tainted  (5.3.0-rc4)
        MSR:  8000000000028032 <SF,EE,IR,DR,RI>  CR: 44008240  XER: 20000000
        IRQMASK: 0
        GPR00: c000000000289368 c00000000135b120 c00000000084a500 c000000004ff8300
        GPR04: 0000000000000c00 c000000004c905e0 c000000004c905e0 000000000000ffff
        GPR08: 0000000000000000 0000000000000001 0000000000000000 000000000000ffff
        GPR12: 0000000000000000 c0000000008ef000 000000000000003e 0000000000080001
        GPR16: 0000000000000100 000000000000ffff 0000000000000000 0000000000000004
        GPR20: c00000000062fd7e 0000000000000001 000000000000ffff 0000000000000080
        GPR24: c000000000781788 c00000000135b350 0000000000000080 c000000004c905e0
        GPR28: c00000000135b348 c000000004ff8300 0000000000000000 c000000004c90000
        NIP [c00000000027d0d0] .bio_split+0x28/0xac
        LR [c00000000027d0b0] .bio_split+0x8/0xac
        Call Trace:
        [c00000000135b120] [c00000000027d130] .bio_split+0x88/0xac (unreliable)
        [c00000000135b1b0] [c000000000289368] .__blk_queue_split+0x11c/0x53c
        [c00000000135b2d0] [c00000000028f614] .blk_mq_make_request+0x80/0x7d4
        [c00000000135b3d0] [c000000000283a8c] .generic_make_request+0x118/0x294
        [c00000000135b4b0] [c000000000283d34] .submit_bio+0x12c/0x174
        [c00000000135b580] [c000000000205a44] .mpage_bio_submit+0x3c/0x4c
        [c00000000135b600] [c000000000206184] .mpage_readpages+0xa4/0x184
        [c00000000135b750] [c0000000001ff8fc] .blkdev_readpages+0x24/0x38
        [c00000000135b7c0] [c0000000001589f0] .read_pages+0x6c/0x1a8
        [c00000000135b8b0] [c000000000158c74] .__do_page_cache_readahead+0x118/0x184
        [c00000000135b9b0] [c0000000001591a8] .force_page_cache_readahead+0xe4/0xe8
        [c00000000135ba50] [c00000000014fc24] .generic_file_read_iter+0x1d8/0x830
        [c00000000135bb50] [c0000000001ffadc] .blkdev_read_iter+0x40/0x5c
        [c00000000135bbc0] [c0000000001b9e00] .new_sync_read+0x144/0x1a0
        [c00000000135bcd0] [c0000000001bc454] .vfs_read+0xa0/0x124
        [c00000000135bd70] [c0000000001bc7a4] .ksys_read+0x70/0xd8
        [c00000000135be20] [c00000000000a524] system_call+0x5c/0x70
        Instruction dump:
        7fe3fb78 482e30dc 7c0802a6 482e3085 7c9e2378 f821ff71 7ca42b78 7d3e00d0
        7c7d1b78 79290fe0 7cc53378 69290001 <0b090000> 81230028 7bca0020 7929ba62
        [ end trace 313fec760f30aa1f ]---
      
      The problem originates from setting the segment boundary of the
      request queue to -1UL. This makes get_max_segment_size() return zero
      when offset is zero, whatever the max segment size. The test with
      BLK_SEG_BOUNDARY_MASK fails and 'mask - (mask & offset) + 1' overflows
      to zero in the return statement.
      
      Not setting the segment boundary and using the default
      value (BLK_SEG_BOUNDARY_MASK) fixes the problem.
      Signed-off-by: default avatarEmmanuel Nicolet <emmanuel.nicolet@gmail.com>
      Signed-off-by: default avatarGeoff Levand <geoff@infradead.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/060a416c43138f45105c0540eff1a45539f7e2fc.1589049250.git.geoff@infradead.orgSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      302f0c5e
    • Pali Rohár's avatar
      PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register · bee54028
      Pali Rohár authored
      [ Upstream commit 90c6cb4a ]
      
      Trying to change Link Status register does not have any effect as this
      is a read-only register. Trying to overwrite bits for Negotiated Link
      Width does not make sense.
      
      In future proper change of link width can be done via Lane Count Select
      bits in PCIe Control 0 register.
      
      Trying to unconditionally enable ASPM L0s via ASPM Control bits in Link
      Control register is wrong. There should be at least some detection if
      endpoint supports L0s as isn't mandatory.
      
      Moreover ASPM Control bits in Link Control register are controlled by
      pcie/aspm.c code which sets it according to system ASPM settings,
      immediately after aardvark driver probes. So setting these bits by
      aardvark driver has no long running effect.
      
      Remove code which touches ASPM L0s bits from this driver and let
      kernel's ASPM implementation to set ASPM state properly.
      
      Some users are reporting issues that this code is problematic for some
      Intel wifi cards and removing it fixes them, see e.g.:
      https://bugzilla.kernel.org/show_bug.cgi?id=196339
      
      If problems with Intel wifi cards occur even after this commit, then
      pcie/aspm.c code could be modified / hooked to not enable ASPM L0s state
      for affected problematic cards.
      
      Link: https://lore.kernel.org/r/20200430080625.26070-3-pali@kernel.orgTested-by: default avatarTomasz Maciej Nowak <tmn505@gmail.com>
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Acked-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bee54028
    • Martin Wilck's avatar
      dm mpath: switch paths in dm_blk_ioctl() code path · 49306a3e
      Martin Wilck authored
      [ Upstream commit 2361ae59 ]
      
      SCSI LUN passthrough code such as qemu's "scsi-block" device model
      pass every IO to the host via SG_IO ioctls. Currently, dm-multipath
      calls choose_pgpath() only in the block IO code path, not in the ioctl
      code path (unless current_pgpath is NULL). This has the effect that no
      path switching and thus no load balancing is done for SCSI-passthrough
      IO, unless the active path fails.
      
      Fix this by using the same logic in multipath_prepare_ioctl() as in
      multipath_clone_and_map().
      
      Note: The allegedly best path selection algorithm, service-time,
      still wouldn't work perfectly, because the io size of the current
      request is always set to 0. Changing that for the IO passthrough
      case would require the ioctl cmd and arg to be passed to dm's
      prepare_ioctl() method.
      Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      49306a3e
    • Serge Semin's avatar
      serial: 8250: Fix max baud limit in generic 8250 port · 0eeaf629
      Serge Semin authored
      [ Upstream commit 7b668c06 ]
      
      Standard 8250 UART ports are designed in a way so they can communicate
      with baud rates up to 1/16 of a reference frequency. It's expected from
      most of the currently supported UART controllers. That's why the former
      version of serial8250_get_baud_rate() method called uart_get_baud_rate()
      with min and max baud rates passed as (port->uartclk / 16 / UART_DIV_MAX)
      and ((port->uartclk + tolerance) / 16) respectively. Doing otherwise, like
      it was suggested in commit ("serial: 8250_mtk: support big baud rate."),
      caused acceptance of bauds, which was higher than the normal UART
      controllers actually supported. As a result if some user-space program
      requested to set a baud greater than (uartclk / 16) it would have been
      permitted without truncation, but then serial8250_get_divisor(baud)
      (which calls uart_get_divisor() to get the reference clock divisor) would
      have returned a zero divisor. Setting zero divisor will cause an
      unpredictable effect varying from chip to chip. In case of DW APB UART the
      communications just stop.
      
      Lets fix this problem by getting back the limitation of (uartclk +
      tolerance) / 16 maximum baud supported by the generic 8250 port. Mediatek
      8250 UART ports driver developer shouldn't have touched it in the first
      place  notably seeing he already provided a custom version of set_termios()
      callback in that glue-driver which took into account the extended baud
      rate values and accordingly updated the standard and vendor-specific
      divisor latch registers anyway.
      
      Fixes: 81bb549f ("serial: 8250_mtk: support big baud rate.")
      Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
      Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Paul Burton <paulburton@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Long Cheng <long.cheng@mediatek.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mediatek@lists.infradead.org
      Link: https://lore.kernel.org/r/20200506233136.11842-2-Sergey.Semin@baikalelectronics.ruSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0eeaf629
    • Oliver Neukum's avatar
      usblp: poison URBs upon disconnect · 04519854
      Oliver Neukum authored
      [ Upstream commit 296a193b ]
      
      syzkaller reported an URB that should have been killed to be active.
      We do not understand it, but this should fix the issue if it is real.
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Reported-by: syzbot+be5b5f86a162a6c281e6@syzkaller.appspotmail.com
      Link: https://lore.kernel.org/r/20200507085806.5793-1-oneukum@suse.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      04519854
    • Marek Szyprowski's avatar
      clk: samsung: Mark top ISP and CAM clocks on Exynos542x as critical · aba4a507
      Marek Szyprowski authored
      [ Upstream commit e47bd937 ]
      
      The TOP 'aclk*_isp', 'aclk550_cam', 'gscl_wa' and 'gscl_wb' clocks must
      be kept enabled all the time to allow proper access to power management
      control for the ISP and CAM power domains. The last two clocks, although
      related to GScaler device and GSCL power domain, provides also the
      I_WRAP_CLK signal to MIPI CSIS0/1 devices, which are a part of CAM power
      domain and are needed for proper power on/off sequence.
      
      Currently there are no drivers for the devices, which are part of CAM and
      ISP power domains yet. This patch only fixes the race between disabling
      the unused power domains and disabling unused clocks, which randomly
      resulted in the following error during boot:
      
      Power domain CAM disable failed
      Power domain ISP disable failed
      
      Fixes: 318fa46c ("clk/samsung: exynos542x: mark some clocks as critical")
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Acked-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aba4a507
    • Russell King's avatar
      i2c: pxa: clear all master action bits in i2c_pxa_stop_message() · 3018d81c
      Russell King authored
      [ Upstream commit e81c979f ]
      
      If we timeout during a message transfer, the control register may
      contain bits that cause an action to be set. Read-modify-writing the
      register leaving these bits set may trigger the hardware to attempt
      one of these actions unintentionally.
      
      Always clear these bits when cleaning up after a message or after
      a timeout.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3018d81c
    • Konstantin Khlebnikov's avatar
      f2fs: report delalloc reserve as non-free in statfs for project quota · 9ecdbfee
      Konstantin Khlebnikov authored
      [ Upstream commit baaa7ebf ]
      
      This reserved space isn't committed yet but cannot be used for
      allocations. For userspace it has no difference from used space.
      
      See the same fix in ext4 commit f06925c7 ("ext4: report delalloc
      reserve as non-free in statfs for project quota").
      
      Fixes: ddc34e32 ("f2fs: introduce f2fs_statfs_project")
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
      Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9ecdbfee
    • Andreas Klinger's avatar
      iio: bmp280: fix compensation of humidity · 89d3d21b
      Andreas Klinger authored
      [ Upstream commit dee2dabc ]
      
      Limit the output of humidity compensation to the range between 0 and 100
      percent.
      
      Depending on the calibration parameters of the individual sensor it
      happens, that a humidity above 100 percent or below 0 percent is
      calculated, which don't make sense in terms of relative humidity.
      
      Add a clamp to the compensation formula as described in the datasheet of
      the sensor in chapter 4.2.3.
      
      Although this clamp is documented, it was never in the driver of the
      kernel.
      
      It depends on the circumstances (calibration parameters, temperature,
      humidity) if one can see a value above 100 percent without the clamp.
      The writer of this patch was working with this type of sensor without
      noting this error. So it seems to be a rare event when this bug occures.
      Signed-off-by: default avatarAndreas Klinger <ak@it-klinger.de>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      89d3d21b
    • Viacheslav Dubeyko's avatar
      scsi: qla2xxx: Fix issue with adapter's stopping state · 63ec23f6
      Viacheslav Dubeyko authored
      [ Upstream commit 803e4555 ]
      
      The goal of the following command sequence is to restart the adapter.
      However, the tgt_stop flag remains set, indicating that the adapter is
      still in stopping state even after re-enabling it.
      
      echo 0x7fffffff > /sys/module/qla2xxx/parameters/logging
      modprobe target_core_mod
      modprobe tcm_qla2xxx
      mkdir /sys/kernel/config/target/qla2xxx
      mkdir /sys/kernel/config/target/qla2xxx/<port-name>
      mkdir /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1
      echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
      echo 0 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
      echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
      
      kernel: PID 1396:qla_target.c:1555 qlt_stop_phase1(): tgt_stop 0x0, tgt_stopped 0x0
      kernel: qla2xxx [0001:00:02.0]-e803:1: PID 1396:qla_target.c:1567: Stopping target for host 1(c0000000033557e8)
      kernel: PID 1396:qla_target.c:1579 qlt_stop_phase1(): tgt_stop 0x1, tgt_stopped 0x0
      kernel: PID 1396:qla_target.c:1266 qlt_schedule_sess_for_deletion(): tgt_stop 0x1, tgt_stopped 0x0
      kernel: qla2xxx [0001:00:02.0]-e801:1: PID 1396:qla_target.c:1316: Scheduling sess c00000002d5cd800 for deletion 21:00:00:24:ff:7f:35:c7
      <skipped>
      kernel: qla2xxx [0001:00:02.0]-290a:1: PID 340:qla_target.c:1187: qlt_unreg_sess sess c00000002d5cd800 for deletion 21:00:00:24:ff:7f:35:c7
      <skipped>
      kernel: qla2xxx [0001:00:02.0]-f801:1: PID 340:qla_target.c:1145: Unregistration of sess c00000002d5cd800 21:00:00:24:ff:7f:35:c7 finished fcp_cnt 0
      kernel: PID 340:qla_target.c:1155 qlt_free_session_done(): tgt_stop 0x1, tgt_stopped 0x0
      kernel: qla2xxx [0001:00:02.0]-4807:1: PID 346:qla_os.c:6329: ISP abort scheduled.
      <skipped>
      kernel: qla2xxx [0001:00:02.0]-28f1:1: PID 346:qla_os.c:3956: Mark all dev lost
      kernel: PID 346:qla_target.c:1266 qlt_schedule_sess_for_deletion(): tgt_stop 0x1, tgt_stopped 0x0
      kernel: qla2xxx [0001:00:02.0]-4808:1: PID 346:qla_os.c:6338: ISP abort end.
      <skipped>
      kernel: PID 1396:qla_target.c:6812 qlt_enable_vha(): tgt_stop 0x1, tgt_stopped 0x0
      <skipped>
      kernel: qla2xxx [0001:00:02.0]-4807:1: PID 346:qla_os.c:6329: ISP abort scheduled.
      <skipped>
      kernel: qla2xxx [0001:00:02.0]-4808:1: PID 346:qla_os.c:6338: ISP abort end.
      
      qlt_handle_cmd_for_atio() rejects the request to send commands because the
      adapter is in the stopping state:
      
      kernel: PID 0:qla_target.c:4442 qlt_handle_cmd_for_atio(): tgt_stop 0x1, tgt_stopped 0x0
      kernel: qla2xxx [0001:00:02.0]-3861:1: PID 0:qla_target.c:4447: New command while device c000000005314600 is shutting down
      kernel: qla2xxx [0001:00:02.0]-e85f:1: PID 0:qla_target.c:5728: qla_target: Unable to send command to target
      
      This patch calls qla_stop_phase2() in addition to qlt_stop_phase1() in
      tcm_qla2xxx_tpg_enable_store() and tcm_qla2xxx_npiv_tpg_enable_store(). The
      qlt_stop_phase1() marks adapter as stopping (tgt_stop == 0x1, tgt_stopped
      == 0x0) but qlt_stop_phase2() marks adapter as stopped (tgt_stop == 0x0,
      tgt_stopped == 0x1).
      
      Link: https://lore.kernel.org/r/52be1e8a3537f6c5407eae3edd4c8e08a9545ea5.camel@yadro.comReviewed-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarViacheslav Dubeyko <v.dubeiko@yadro.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      63ec23f6
    • Ard Biesheuvel's avatar
      PCI: Allow pci_resize_resource() for devices on root bus · f7ec6056
      Ard Biesheuvel authored
      [ Upstream commit d09ddd81 ]
      
      When resizing a BAR, pci_reassign_bridge_resources() is invoked to bring
      the bridge windows of parent bridges in line with the new BAR assignment.
      
      This assumes the device whose BAR is being resized lives on a subordinate
      bus, but this is not necessarily the case. A device may live on the root
      bus, in which case dev->bus->self is NULL, and passing a NULL pci_dev
      pointer to pci_reassign_bridge_resources() will cause it to crash.
      
      So let's make the call to pci_reassign_bridge_resources() conditional on
      whether dev->bus->self is non-NULL in the first place.
      
      Fixes: 8bb705e3 ("PCI: Add pci_resize_resource() for resizing BARs")
      Link: https://lore.kernel.org/r/20200421162256.26887-1-ardb@kernel.orgSigned-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f7ec6056
    • Dan Carpenter's avatar
      ALSA: isa/wavefront: prevent out of bounds write in ioctl · f2ad530b
      Dan Carpenter authored
      [ Upstream commit 7f0d5053 ]
      
      The "header->number" comes from the ioctl and it needs to be clamped to
      prevent out of bounds writes.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20200501094011.GA960082@mwandaSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f2ad530b
    • Kai-Heng Feng's avatar
      ALSA: hda/realtek - Introduce polarity for micmute LED GPIO · c33ee0a0
      Kai-Heng Feng authored
      [ Upstream commit dbd13179 ]
      
      Currently mute LED and micmute LED share the same GPIO polarity.
      
      So split the polarity for mute and micmute, in case they have different
      polarities.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Link: https://lore.kernel.org/r/20200430083255.5093-1-kai.heng.feng@canonical.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c33ee0a0
    • Dan Carpenter's avatar
      scsi: qedi: Check for buffer overflow in qedi_set_path() · 84ef0da8
      Dan Carpenter authored
      [ Upstream commit 4a4c0cfb ]
      
      Smatch complains that the "path_data->handle" variable is user controlled.
      It comes from iscsi_set_path() so that seems possible.  It's harmless to
      add a limit check.
      
      The qedi->ep_tbl[] array has qedi->max_active_conns elements (which is
      always ISCSI_MAX_SESS_PER_HBA (4096) elements).  The array is allocated in
      the qedi_cm_alloc_mem() function.
      
      Link: https://lore.kernel.org/r/20200428131939.GA696531@mwanda
      Fixes: ace7f46b ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
      Acked-by: default avatarManish Rangankar <mrangankar@marvell.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      84ef0da8
    • Linus Walleij's avatar
      ARM: integrator: Add some Kconfig selections · b9e3114f
      Linus Walleij authored
      [ Upstream commit d2854bbe ]
      
      The CMA and DMA_CMA Kconfig options need to be selected
      by the Integrator in order to produce boot console on some
      Integrator systems.
      
      The REGULATOR and REGULATOR_FIXED_VOLTAGE need to be
      selected in order to boot the system from an external
      MMC card when using MMCI/PL181 from the device tree
      probe path.
      
      Select these things directly from the Kconfig so we are
      sure to be able to bring the systems up with console
      from any device tree.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b9e3114f
    • Xiyu Yang's avatar
      ASoC: davinci-mcasp: Fix dma_chan refcnt leak when getting dma type · 49aa5538
      Xiyu Yang authored
      [ Upstream commit a697ae6e ]
      
      davinci_mcasp_get_dma_type() invokes dma_request_chan(), which returns a
      reference of the specified dma_chan object to "chan" with increased
      refcnt.
      
      When davinci_mcasp_get_dma_type() returns, local variable "chan" becomes
      invalid, so the refcount should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one exception handling path of
      davinci_mcasp_get_dma_type(). When chan device is NULL, the function
      forgets to decrease the refcnt increased by dma_request_chan(), causing
      a refcnt leak.
      
      Fix this issue by calling dma_release_channel() when chan device is
      NULL.
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Link: https://lore.kernel.org/r/1587818916-38730-1-git-send-email-xiyuyang19@fudan.edu.cnSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      49aa5538
    • Jon Hunter's avatar
      backlight: lp855x: Ensure regulators are disabled on probe failure · 5970f0c9
      Jon Hunter authored
      [ Upstream commit d8207c15 ]
      
      If probing the LP885x backlight fails after the regulators have been
      enabled, then the following warning is seen when releasing the
      regulators ...
      
       WARNING: CPU: 1 PID: 289 at drivers/regulator/core.c:2051 _regulator_put.part.28+0x158/0x160
       Modules linked in: tegra_xudc lp855x_bl(+) host1x pwm_tegra ip_tables x_tables ipv6 nf_defrag_ipv6
       CPU: 1 PID: 289 Comm: systemd-udevd Not tainted 5.6.0-rc2-next-20200224 #1
       Hardware name: NVIDIA Jetson TX1 Developer Kit (DT)
      
       ...
      
       Call trace:
        _regulator_put.part.28+0x158/0x160
        regulator_put+0x34/0x50
        devm_regulator_release+0x10/0x18
        release_nodes+0x12c/0x230
        devres_release_all+0x34/0x50
        really_probe+0x1c0/0x370
        driver_probe_device+0x58/0x100
        device_driver_attach+0x6c/0x78
        __driver_attach+0xb0/0xf0
        bus_for_each_dev+0x68/0xc8
        driver_attach+0x20/0x28
        bus_add_driver+0x160/0x1f0
        driver_register+0x60/0x110
        i2c_register_driver+0x40/0x80
        lp855x_driver_init+0x20/0x1000 [lp855x_bl]
        do_one_initcall+0x58/0x1a0
        do_init_module+0x54/0x1d0
        load_module+0x1d80/0x21c8
        __do_sys_finit_module+0xe8/0x100
        __arm64_sys_finit_module+0x18/0x20
        el0_svc_common.constprop.3+0xb0/0x168
        do_el0_svc+0x20/0x98
        el0_sync_handler+0xf4/0x1b0
        el0_sync+0x140/0x180
      
      Fix this by ensuring that the regulators are disabled, if enabled, on
      probe failure.
      
      Finally, ensure that the vddio regulator is disabled in the driver
      remove handler.
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5970f0c9
    • Bryan O'Donoghue's avatar
      clk: qcom: msm8916: Fix the address location of pll->config_reg · 4dfedcd4
      Bryan O'Donoghue authored
      [ Upstream commit f47ab3c2 ]
      
      During the process of debugging a processor derived from the msm8916 which
      we found the new processor was not starting one of its PLLs.
      
      After tracing the addresses and writes that downstream was doing and
      comparing to upstream it became obvious that we were writing to a different
      register location than downstream when trying to configure the PLL.
      
      This error is also present in upstream msm8916.
      
      As an example clk-pll.c::clk_pll_recalc_rate wants to write to
      pll->config_reg updating the bit-field POST_DIV_RATIO. That bit-field is
      defined in PLL_USER_CTL not in PLL_CONFIG_CTL. Taking the BIMC PLL as an
      example
      
      lm80-p0436-13_c_qc_snapdragon_410_processor_hrd.pdf
      
      0x01823010 GCC_BIMC_PLL_USER_CTL
      0x01823014 GCC_BIMC_PLL_CONFIG_CTL
      
      This pattern is repeated for gpll0, gpll1, gpll2 and bimc_pll.
      
      This error is likely not apparent since the bootloader will already have
      initialized these PLLs.
      
      This patch corrects the location of config_reg from PLL_CONFIG_CTL to
      PLL_USER_CTL for all relevant PLLs on msm8916.
      
      Fixes commit 3966fab8 ("clk: qcom: Add MSM8916 Global Clock Controller support")
      
      Cc: Georgi Djakov <georgi.djakov@linaro.org>
      Cc: Andy Gross <agross@kernel.org>
      Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
      Cc: Michael Turquette <mturquette@baylibre.com>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
      Link: https://lkml.kernel.org/r/20200329124116.4185447-1-bryan.odonoghue@linaro.orgSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4dfedcd4
    • Alex Elder's avatar
      remoteproc: Fix IDR initialisation in rproc_alloc() · ef3b1056
      Alex Elder authored
      [ Upstream commit 6442df49 ]
      
      If ida_simple_get() returns an error when called in rproc_alloc(),
      put_device() is called to clean things up.  By this time the rproc
      device type has been assigned, with rproc_type_release() as the
      release function.
      
      The first thing rproc_type_release() does is call:
          idr_destroy(&rproc->notifyids);
      
      But at the time the ida_simple_get() call is made, the notifyids
      field in the remoteproc structure has not been initialized.
      
      I'm not actually sure this case causes an observable problem, but
      it's incorrect.  Fix this by initializing the notifyids field before
      calling ida_simple_get() in rproc_alloc().
      
      Fixes: b5ab5e24 ("remoteproc: maintain a generic child device for each rproc")
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Reviewed-by: default avatarSuman Anna <s-anna@ti.com>
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Link: https://lore.kernel.org/r/20200415204858.2448-2-mathieu.poirier@linaro.orgSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ef3b1056
    • Andy Shevchenko's avatar
      iio: pressure: bmp280: Tolerate IRQ before registering · c4f970c1
      Andy Shevchenko authored
      [ Upstream commit 97b31a6f ]
      
      With DEBUG_SHIRQ enabled we have a kernel crash
      
      [  116.482696] BUG: kernel NULL pointer dereference, address: 0000000000000000
      
      ...
      
      [  116.606571] Call Trace:
      [  116.609023]  <IRQ>
      [  116.611047]  complete+0x34/0x50
      [  116.614206]  bmp085_eoc_irq+0x9/0x10 [bmp280]
      
      because DEBUG_SHIRQ mechanism fires an IRQ before registration and drivers
      ought to be able to handle an interrupt happening before request_irq() returns.
      
      Fixes: aae95394 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c4f970c1
    • Adam Honse's avatar
      i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets · 75add7b2
      Adam Honse authored
      [ Upstream commit f27237c1 ]
      
      The AMD X370 and other AM4 chipsets (A/B/X 3/4/5 parts) and Threadripper
      equivalents have a secondary SMBus controller at I/O port address
      0x0B20.  This bus is used by several manufacturers to control
      motherboard RGB lighting via embedded controllers.  I have been using
      this bus in my OpenRGB project to control the Aura RGB on many
      motherboards and ASRock also uses this bus for their Polychrome RGB
      controller.
      
      I am not aware of any CZ-compatible platforms which do not have the
      second SMBus channel.  All of AMD's AM4- and Threadripper- series
      chipsets that OpenRGB users have tested appear to have this secondary
      bus.  I also noticed this secondary bus is present on older AMD
      platforms including my FM1 home server.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202587Signed-off-by: default avatarAdam Honse <calcprogrammer1@gmail.com>
      Reviewed-by: default avatarJean Delvare <jdelvare@suse.de>
      Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      75add7b2
    • Dmitry Osipenko's avatar
      ASoC: tegra: tegra_wm8903: Support nvidia, headset property · 02c96cc7
      Dmitry Osipenko authored
      [ Upstream commit 3ef9d507 ]
      
      The microphone-jack state needs to be masked in a case of a 4-pin jack
      when microphone and ground pins are shorted. Presence of nvidia,headset
      tells that WM8903 CODEC driver should mask microphone's status if short
      circuit is detected, i.e headphones are inserted.
      Signed-off-by: default avatarDmitry Osipenko <digetx@gmail.com>
      Link: https://lore.kernel.org/r/20200330204011.18465-3-digetx@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      02c96cc7
    • Rikard Falkeborn's avatar
      clk: sunxi: Fix incorrect usage of round_down() · 613e2436
      Rikard Falkeborn authored
      [ Upstream commit ee25d974 ]
      
      round_down() can only round to powers of 2. If round_down() is asked
      to round to something that is not a power of 2, incorrect results are
      produced. The incorrect results can be both too large and too small.
      
      Instead, use rounddown() which can round to any number.
      
      Fixes: 6a721db1 ("clk: sunxi: Add A31 clocks support")
      Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      613e2436
    • Enric Balletbo i Serra's avatar
      power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select · 62e015da
      Enric Balletbo i Serra authored
      [ Upstream commit 87c3d579 ]
      
      regmap is a library function that gets selected by drivers that need
      it. No driver modules should depend on it. Depending on REGMAP_I2C makes
      this driver only build if another driver already selected REGMAP_I2C,
      as the symbol can't be selected through the menu kernel configuration.
      
      Fixes: 2219a935 ("power_supply: Add TI BQ24257 charger driver")
      Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      62e015da
  2. 22 Jun, 2020 15 commits