1. 31 May, 2019 40 commits
    • Hans Verkuil's avatar
      media: gspca: do not resubmit URBs when streaming has stopped · 6d16d2e1
      Hans Verkuil authored
      [ Upstream commit e6f8bd59 ]
      
      When streaming is stopped all URBs are killed, but in fill_frame and in
      bulk_irq this results in an attempt to resubmit the killed URB. That is
      not what you want and causes spurious kernel messages.
      
      So check if streaming has stopped before resubmitting.
      
      Also check against gspca_dev->streaming rather than vb2_start_streaming_called()
      since vb2_start_streaming_called() will return true when in stop_streaming,
      but gspca_dev->streaming is set to false when stop_streaming is called.
      
      Fixes: 6992effe ("gspca: Kill all URBs before releasing any of them")
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6d16d2e1
    • Helen Fornazier's avatar
      media: vimc: stream: fix thread state before sleep · acf41fb8
      Helen Fornazier authored
      [ Upstream commit 2978a505 ]
      
      The state TASK_UNINTERRUPTIBLE should be set just before
      schedule_timeout() call, so it knows the sleep mode it should enter.
      There is no point in setting TASK_UNINTERRUPTIBLE at the initialization
      of the thread as schedule_timeout() will set the state back to
      TASK_RUNNING.
      
      This fixes a warning in __might_sleep() call, as it's expecting the
      task to be in TASK_RUNNING state just before changing the state to
      a sleeping state.
      Reported-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarHelen Koike <helen.koike@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      acf41fb8
    • Kangjie Lu's avatar
      scsi: ufs: fix a missing check of devm_reset_control_get · aeea8786
      Kangjie Lu authored
      [ Upstream commit 63a06181 ]
      
      devm_reset_control_get could fail, so the fix checks its return value and
      passes the error code upstream in case it fails.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Acked-by: default avatarAvri Altman <avri.altman@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aeea8786
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Set stream->mode_changed when connectors change · 62e79f4c
      Nicholas Kazlauskas authored
      [ Upstream commit b9952f93 ]
      
      [Why]
      The kms_plane@plane-position-covered-pipe-*-planes subtests can produce
      a sequence of atomic commits such that neither active_changed nor
      mode_changed but connectors_changed.
      
      When this happens we remove the old stream from the context and add
      a new stream but the new stream doesn't have mode_changed=true set.
      
      This incorrect programming sequence causes CRC mismatches to occur in
      the test.
      
      The stream->mode_changed value should be set whenever a new stream
      is created.
      
      [How]
      A new stream is created whenever drm_atomic_crtc_needs_modeset is true.
      We previously covered the active_changed and mode_changed conditions
      for the CRTC but connectors_changed is also checked within
      drm_atomic_crtc_needs_modeset.
      
      So just use drm_atomic_crtc_needs_modeset directly to determine the
      mode_changed flag.
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: default avatarSun peng Li <Sunpeng.Li@amd.com>
      Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      62e79f4c
    • Murton Liu's avatar
      drm/amd/display: Fix Divide by 0 in memory calculations · fc5293ab
      Murton Liu authored
      [ Upstream commit 59979bf8 ]
      
      Check if we get any values equal to 0, and set to 1 if so.
      Signed-off-by: default avatarMurton Liu <murton.liu@amd.com>
      Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
      Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
      Acked-by: default avatarSivapiriyan Kumarasamy <Sivapiriyan.Kumarasamy@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fc5293ab
    • Arnd Bergmann's avatar
      media: staging: davinci_vpfe: disallow building with COMPILE_TEST · 91435fce
      Arnd Bergmann authored
      [ Upstream commit 49dc762c ]
      
      The driver should really call dm365_isif_setup_pinmux() through a callback,
      but uses a hack to include a davinci specific machine header file when
      compile testing instead. This works almost everywhere, but not on the
      ARM omap1 platform, which has another header named mach/mux.h. This
      causes a build failure:
      
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:2: error: implicit declaration of function 'davinci_cfg_reg' [-Werror,-Wimplicit-function-declaration]
              davinci_cfg_reg(DM365_VIN_CAM_WEN);
              ^
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:2: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2028:18: error: use of undeclared identifier 'DM365_VIN_CAM_WEN'
              davinci_cfg_reg(DM365_VIN_CAM_WEN);
                              ^
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2029:18: error: use of undeclared identifier 'DM365_VIN_CAM_VD'
              davinci_cfg_reg(DM365_VIN_CAM_VD);
                              ^
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2030:18: error: use of undeclared identifier 'DM365_VIN_CAM_HD'
              davinci_cfg_reg(DM365_VIN_CAM_HD);
                              ^
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2031:18: error: use of undeclared identifier 'DM365_VIN_YIN4_7_EN'
              davinci_cfg_reg(DM365_VIN_YIN4_7_EN);
                              ^
      drivers/staging/media/davinci_vpfe/dm365_isif.c:2032:18: error: use of undeclared identifier 'DM365_VIN_YIN0_3_EN'
              davinci_cfg_reg(DM365_VIN_YIN0_3_EN);
                              ^
      7 errors generated.
      
      Exclude omap1 from compile-testing, under the assumption that all others
      still work.
      
      Fixes: 4907c73d ("media: staging: davinci_vpfe: allow building with COMPILE_TEST")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      91435fce
    • James Hutchinson's avatar
      media: m88ds3103: serialize reset messages in m88ds3103_set_frontend · f51db48c
      James Hutchinson authored
      [ Upstream commit 981fbe3d ]
      
      Ref: https://bugzilla.kernel.org/show_bug.cgi?id=199323
      
      Users are experiencing problems with the DVBSky S960/S960C USB devices
      since the following commit:
      
      9d659ae1: ("locking/mutex: Add lock handoff to avoid starvation")
      
      The device malfunctions after running for an indeterminable period of
      time, and the problem can only be cleared by rebooting the machine.
      
      It is possible to encourage the problem to surface by blocking the
      signal to the LNB.
      
      Further debugging revealed the cause of the problem.
      
      In the following capture:
      - thread #1325 is running m88ds3103_set_frontend
      - thread #42 is running ts2020_stat_work
      
      a> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 80
         [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 08
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 68 3f
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 08 ff
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 3d
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
      b> [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 07 00
         [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 21
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07
         [42] usb 1-1: dvb_usb_v2_generic_io: >>> 09 01 01 60 66
         [42] usb 1-1: dvb_usb_v2_generic_io: <<< 07 ff
         [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 68 02 03 11
         [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
         [1325] usb 1-1: dvb_usb_v2_generic_io: >>> 08 60 02 10 0b
         [1325] usb 1-1: dvb_usb_v2_generic_io: <<< 07
      
      Two i2c messages are sent to perform a reset in m88ds3103_set_frontend:
      
        a. 0x07, 0x80
        b. 0x07, 0x00
      
      However, as shown in the capture, the regmap mutex is being handed over
      to another thread (ts2020_stat_work) in between these two messages.
      
      >From here, the device responds to every i2c message with an 07 message,
      and will only return to normal operation following a power cycle.
      
      Use regmap_multi_reg_write to group the two reset messages, ensuring
      both are processed before the regmap mutex is unlocked.
      Signed-off-by: default avatarJames Hutchinson <jahutchinson99@googlemail.com>
      Reviewed-by: default avatarAntti Palosaari <crope@iki.fi>
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f51db48c
    • Stefan Brüns's avatar
      media: dvbsky: Avoid leaking dvb frontend · e9367705
      Stefan Brüns authored
      [ Upstream commit fdfa59cd ]
      
      Commit 14f4eaed ("media: dvbsky: fix driver unregister logic") fixed
      a use-after-free by removing the reference to the frontend after deleting
      the backing i2c device.
      
      This has the unfortunate side effect the frontend device is never freed
      in the dvb core leaving a dangling device, leading to errors when the
      dvb core tries to register the frontend after e.g. a replug as reported
      here: https://www.spinics.net/lists/linux-media/msg138181.html
      
      media: dvbsky: issues with DVBSky T680CI
      
      ===
      [  561.119145] sp2 8-0040: CIMaX SP2 successfully attached
      [  561.119161] usb 2-3: DVB: registering adapter 0 frontend 0 (Silicon Labs
      Si2168)...
      [  561.119174] sysfs: cannot create duplicate filename '/class/dvb/
      dvb0.frontend0'
      ===
      
      The use after free happened as dvb_usbv2_disconnect calls in this order:
      - dvb_usb_device::props->exit(...)
      - dvb_usbv2_adapter_frontend_exit(...)
        + if (fe) dvb_unregister_frontend(fe)
        + dvb_usb_device::props->frontend_detach(...)
      
      Moving the release of the i2c device from exit() to frontend_detach()
      avoids the dangling pointer access and allows the core to unregister
      the frontend.
      
      This was originally reported for a DVBSky T680CI, but it also affects
      the MyGica T230C. As all supported devices structure the registration/
      unregistration identically, apply the change for all device types.
      Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e9367705
    • Kangjie Lu's avatar
      media: si2165: fix a missing check of return value · ab934f0a
      Kangjie Lu authored
      [ Upstream commit 0ab34a08 ]
      
      si2165_readreg8() may fail. Looking into si2165_readreg8(), we will find
      that "val_tmp" will be an uninitialized value when regmap_read() fails.
      "val_tmp" is then assigned to "val". So if si2165_readreg8() fails,
      "val" will be a random value. Further use will lead to undefined
      behaviors. The fix checks if si2165_readreg8() fails, and if so, returns
      its error code upstream.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Reviewed-by: default avatarMatthias Schwarzott <zzam@gentoo.org>
      Tested-by: default avatarMatthias Schwarzott <zzam@gentoo.org>
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ab934f0a
    • Kai-Heng Feng's avatar
      igb: Exclude device from suspend direct complete optimization · 561bd561
      Kai-Heng Feng authored
      [ Upstream commit 5b6e1321 ]
      
      igb sets different WoL settings in system suspend callback and runtime
      suspend callback.
      
      The suspend direct complete optimization leaves igb in runtime suspended
      state with wrong WoL setting during system suspend.
      
      To fix this, we need to disable suspend direct complete optimization to
      let igb always use suspend callback to set correct WoL during system
      suspend.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      561bd561
    • Noralf Trønnes's avatar
      tinydrm/mipi-dbi: Use dma-safe buffers for all SPI transfers · b6bc2024
      Noralf Trønnes authored
      [ Upstream commit a89bfc5d ]
      
      Buffers passed to spi_sync() must be dma-safe even for tiny buffers since
      some SPI controllers use DMA for all transfers.
      
      Example splat with CONFIG_DMA_API_DEBUG enabled:
      
      [   23.750467] DMA-API: dw_dmac_pci 0000:00:15.0: device driver maps memory from stack [probable addr=000000001e49185d]
      [   23.750529] WARNING: CPU: 1 PID: 1296 at kernel/dma/debug.c:1161 check_for_stack+0xb7/0x190
      [   23.750533] Modules linked in: mmc_block(+) spi_pxa2xx_platform(+) pwm_lpss_pci pwm_lpss spi_pxa2xx_pci sdhci_pci cqhci intel_mrfld_pwrbtn extcon_intel_mrfld sdhci intel_mrfld_adc led_class mmc_core ili9341 mipi_dbi tinydrm backlight ti_ads7950 industrialio_triggered_buffer kfifo_buf intel_soc_pmic_mrfld hci_uart btbcm
      [   23.750599] CPU: 1 PID: 1296 Comm: modprobe Not tainted 5.0.0-rc7+ #236
      [   23.750605] Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
      [   23.750620] RIP: 0010:check_for_stack+0xb7/0x190
      [   23.750630] Code: 8b 6d 50 4d 85 ed 75 04 4c 8b 6d 10 48 89 ef e8 2f 8b 44 00 48 89 c6 4a 8d 0c 23 4c 89 ea 48 c7 c7 88 d0 82 b4 e8 40 7c f9 ff <0f> 0b 8b 05 79 00 4b 01 85 c0 74 07 5b 5d 41 5c 41 5d c3 8b 05 54
      [   23.750637] RSP: 0000:ffff97bbc0292fa0 EFLAGS: 00010286
      [   23.750646] RAX: 0000000000000000 RBX: ffff97bbc0290000 RCX: 0000000000000006
      [   23.750652] RDX: 0000000000000007 RSI: 0000000000000002 RDI: ffff94b33e115450
      [   23.750658] RBP: ffff94b33c8578b0 R08: 0000000000000002 R09: 00000000000201c0
      [   23.750664] R10: 00000006ecb0ccc6 R11: 0000000000034f38 R12: 000000000000316c
      [   23.750670] R13: ffff94b33c84b250 R14: ffff94b33dedd5a0 R15: 0000000000000001
      [   23.750679] FS:  0000000000000000(0000) GS:ffff94b33e100000(0063) knlGS:00000000f7faf690
      [   23.750686] CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
      [   23.750691] CR2: 00000000f7f54faf CR3: 000000000722c000 CR4: 00000000001006e0
      [   23.750696] Call Trace:
      [   23.750713]  debug_dma_map_sg+0x100/0x340
      [   23.750727]  ? dma_direct_map_sg+0x3b/0xb0
      [   23.750739]  spi_map_buf+0x25a/0x300
      [   23.750751]  __spi_pump_messages+0x2a4/0x680
      [   23.750762]  __spi_sync+0x1dd/0x1f0
      [   23.750773]  spi_sync+0x26/0x40
      [   23.750790]  mipi_dbi_typec3_command_read+0x14d/0x240 [mipi_dbi]
      [   23.750802]  ? spi_finalize_current_transfer+0x10/0x10
      [   23.750821]  mipi_dbi_typec3_command+0x1bc/0x1d0 [mipi_dbi]
      Reported-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Tested-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190222124329.23046-1-noralf@tronnes.orgSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      b6bc2024
    • Kai-Heng Feng's avatar
      e1000e: Disable runtime PM on CNP+ · 5ec9ba49
      Kai-Heng Feng authored
      [ Upstream commit 459d69c4 ]
      
      There are some new e1000e devices can only be woken up from D3 one time,
      by plugging Ethernet cable. Subsequent cable plugging does set PME bit
      correctly, but it still doesn't get woken up.
      
      Since e1000e connects to the root complex directly, we rely on ACPI to
      wake it up. In this case, the GPE from _PRW only works once and stops
      working after that. Though it appears to be a platform bug, e1000e
      maintainers confirmed that I219 does not support D3.
      
      So disable runtime PM on CNP+ chips. We may need to disable earlier
      generations if this bug also hit older platforms.
      
      Bugzilla: https://bugzilla.kernel.org/attachment.cgi?id=280819Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5ec9ba49
    • Kangjie Lu's avatar
      thunderbolt: property: Fix a NULL pointer dereference · 495e34e6
      Kangjie Lu authored
      [ Upstream commit 106204b5 ]
      
      In case kzalloc fails, the fix releases resources and returns
      -ENOMEM to avoid the NULL pointer dereference.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      495e34e6
    • Dmytro Laktyushkin's avatar
      drm/amd/display: fix releasing planes when exiting odm · 70611b1b
      Dmytro Laktyushkin authored
      [ Upstream commit bc219399 ]
      
      Releasing planes should not release the 2nd odm pipe right away,
      this change leaves us with 2 pipes with null planes and same stream
      when planes are released during odm.
      Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
      Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
      Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      70611b1b
    • Aditya Pakki's avatar
      thunderbolt: Fix to check for kmemdup failure · 988dab7f
      Aditya Pakki authored
      [ Upstream commit 2cc12751 ]
      
      Memory allocated via kmemdup might fail and return a NULL pointer.
      This patch adds a check on the return value of kmemdup and passes the
      error upstream.
      Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
      Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      988dab7f
    • Aditya Pakki's avatar
      thunderbolt: Fix to check return value of ida_simple_get · 877a202f
      Aditya Pakki authored
      [ Upstream commit 9aabb685 ]
      
      In enumerate_services, ida_simple_get on failure can return an error and
      leaks memory. The patch ensures that the dev_set_name is set on non
      failure cases, and releases memory during failure.
      Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      877a202f
    • Rouven Czerwinski's avatar
      hwrng: omap - Set default quality · b9291078
      Rouven Czerwinski authored
      [ Upstream commit 62f95ae8 ]
      
      Newer combinations of the glibc, kernel and openssh can result in long initial
      startup times on OMAP devices:
      
      [    6.671425] systemd-rc-once[102]: Creating ED25519 key; this may take some time ...
      [  142.652491] systemd-rc-once[102]: Creating ED25519 key; done.
      
      due to the blocking getrandom(2) system call:
      
      [  142.610335] random: crng init done
      
      Set the quality level for the omap hwrng driver allowing the kernel to use the
      hwrng as an entropy source at boot.
      Signed-off-by: default avatarRouven Czerwinski <r.czerwinski@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b9291078
    • Sameer Pujar's avatar
      dmaengine: tegra210-adma: use devm_clk_*() helpers · 6b2d1934
      Sameer Pujar authored
      [ Upstream commit f6ed6491 ]
      
      adma driver is using pm_clk_*() interface for managing clock resources.
      With this it is observed that clocks remain ON always. This happens on
      Tegra devices which use BPMP co-processor to manage clock resources,
      where clocks are enabled during prepare phase. This is necessary because
      clocks to BPMP are always blocking. When pm_clk_*() interface is used on
      such Tegra devices, clock prepare count is not balanced till remove call
      happens for the driver and hence clocks are seen ON always. Thus this
      patch replaces pm_clk_*() with devm_clk_*() framework.
      Suggested-by: default avatarMohan Kumar D <mkumard@nvidia.com>
      Reviewed-by: default avatarJonathan Hunter <jonathanh@nvidia.com>
      Signed-off-by: default avatarSameer Pujar <spujar@nvidia.com>
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6b2d1934
    • Linus Lüssing's avatar
      batman-adv: allow updating DAT entry timeouts on incoming ARP Replies · 25204fe6
      Linus Lüssing authored
      [ Upstream commit 099e6cc1 ]
      
      Currently incoming ARP Replies, for example via a DHT-PUT message, do
      not update the timeout for an already existing DAT entry. These ARP
      Replies are dropped instead.
      
      This however defeats the purpose of the DHCPACK snooping, for instance.
      Right now, a DAT entry in the DHT will be purged every five minutes,
      likely leading to a mesh-wide ARP Request broadcast after this timeout.
      Which then recreates the entry. The idea of the DHCPACK snooping is to
      be able to update an entry before a timeout happens, to avoid ARP Request
      flooding.
      
      This patch fixes this issue by updating a DAT entry on incoming
      ARP Replies even if a matching DAT entry already exists. While still
      filtering the ARP Reply towards the soft-interface, to avoid duplicate
      messages on the client device side.
      Signed-off-by: default avatarLinus Lüssing <linus.luessing@c0d3.blue>
      Acked-by: default avatarAntonio Quartulli <a@unstable.cc>
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarSimon Wunderlich <sw@simonwunderlich.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      25204fe6
    • Arnd Bergmann's avatar
      selinux: avoid uninitialized variable warning · a2ace9b2
      Arnd Bergmann authored
      [ Upstream commit 98bbbb76 ]
      
      clang correctly points out a code path that would lead
      to an uninitialized variable use:
      
      security/selinux/netlabel.c:310:6: error: variable 'addr' is used uninitialized whenever 'if' condition is false
            [-Werror,-Wsometimes-uninitialized]
              if (ip_hdr(skb)->version == 4) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
      security/selinux/netlabel.c:322:40: note: uninitialized use occurs here
              rc = netlbl_conn_setattr(ep->base.sk, addr, &secattr);
                                                    ^~~~
      security/selinux/netlabel.c:310:2: note: remove the 'if' if its condition is always true
              if (ip_hdr(skb)->version == 4) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      security/selinux/netlabel.c:291:23: note: initialize the variable 'addr' to silence this warning
              struct sockaddr *addr;
                                   ^
                                    = NULL
      
      This is probably harmless since we should not see ipv6 packets
      of CONFIG_IPV6 is disabled, but it's better to rearrange the code
      so this cannot happen.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      [PM: removed old patchwork link, fixed checkpatch.pl style errors]
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a2ace9b2
    • Arnd Bergmann's avatar
      scsi: lpfc: avoid uninitialized variable warning · c7595096
      Arnd Bergmann authored
      [ Upstream commit faf5a744 ]
      
      clang -Wuninitialized incorrectly sees a variable being used without
      initialization:
      
      drivers/scsi/lpfc/lpfc_nvme.c:2102:37: error: variable 'localport' is uninitialized when used here
            [-Werror,-Wuninitialized]
                      lport = (struct lpfc_nvme_lport *)localport->private;
                                                        ^~~~~~~~~
      drivers/scsi/lpfc/lpfc_nvme.c:2059:38: note: initialize the variable 'localport' to silence this warning
              struct nvme_fc_local_port *localport;
                                                  ^
                                                   = NULL
      1 error generated.
      
      This is clearly in dead code, as the condition leading up to it is always
      false when CONFIG_NVME_FC is disabled, and the variable is always
      initialized when nvme_fc_register_localport() got called successfully.
      
      Change the preprocessor conditional to the equivalent C construct, which
      makes the code more readable and gets rid of the warning.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c7595096
    • Arnd Bergmann's avatar
      scsi: qla4xxx: avoid freeing unallocated dma memory · ac9149bc
      Arnd Bergmann authored
      [ Upstream commit 608f729c ]
      
      Clang -Wuninitialized notices that on is_qla40XX we never allocate any DMA
      memory in get_fw_boot_info() but attempt to free it anyway:
      
      drivers/scsi/qla4xxx/ql4_os.c:5915:7: error: variable 'buf_dma' is used uninitialized whenever 'if' condition is false
            [-Werror,-Wsometimes-uninitialized]
                      if (!(val & 0x07)) {
                          ^~~~~~~~~~~~~
      drivers/scsi/qla4xxx/ql4_os.c:5985:47: note: uninitialized use occurs here
              dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma);
                                                           ^~~~~~~
      drivers/scsi/qla4xxx/ql4_os.c:5915:3: note: remove the 'if' if its condition is always true
                      if (!(val & 0x07)) {
                      ^~~~~~~~~~~~~~~~~~~
      drivers/scsi/qla4xxx/ql4_os.c:5885:20: note: initialize the variable 'buf_dma' to silence this warning
              dma_addr_t buf_dma;
                                ^
                                 = 0
      
      Skip the call to dma_free_coherent() here.
      
      Fixes: 2a991c21 ("[SCSI] qla4xxx: Boot from SAN support for open-iscsi")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ac9149bc
    • Tony Lindgren's avatar
      usb: core: Add PM runtime calls to usb_hcd_platform_shutdown · 239156e0
      Tony Lindgren authored
      [ Upstream commit 8ead7e81 ]
      
      If ohci-platform is runtime suspended, we can currently get an "imprecise
      external abort" on reboot with ohci-platform loaded when PM runtime
      is implemented for the SoC.
      
      Let's fix this by adding PM runtime support to usb_hcd_platform_shutdown.
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      239156e0
    • Paul E. McKenney's avatar
      rcuperf: Fix cleanup path for invalid perf_type strings · 506b28fb
      Paul E. McKenney authored
      [ Upstream commit ad092c02 ]
      
      If the specified rcuperf.perf_type is not in the rcu_perf_init()
      function's perf_ops[] array, rcuperf prints some console messages and
      then invokes rcu_perf_cleanup() to set state so that a future torture
      test can run.  However, rcu_perf_cleanup() also attempts to end the
      test that didn't actually start, and in doing so relies on the value
      of cur_ops, a value that is not particularly relevant in this case.
      This can result in confusing output or even follow-on failures due to
      attempts to use facilities that have not been properly initialized.
      
      This commit therefore sets the value of cur_ops to NULL in this case and
      inserts a check near the beginning of rcu_perf_cleanup(), thus avoiding
      relying on an irrelevant cur_ops value.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      506b28fb
    • Yazen Ghannam's avatar
      x86/mce: Handle varying MCA bank counts · 75a96196
      Yazen Ghannam authored
      [ Upstream commit 006c0770 ]
      
      Linux reads MCG_CAP[Count] to find the number of MCA banks visible to a
      CPU. Currently, this number is the same for all CPUs and a warning is
      shown if there is a difference. The number of banks is overwritten with
      the MCG_CAP[Count] value of each following CPU that boots.
      
      According to the Intel SDM and AMD APM, the MCG_CAP[Count] value gives
      the number of banks that are available to a "processor implementation".
      The AMD BKDGs/PPRs further clarify that this value is per core. This
      value has historically been the same for every core in the system, but
      that is not an architectural requirement.
      
      Future AMD systems may have different MCG_CAP[Count] values per core,
      so the assumption that all CPUs will have the same MCG_CAP[Count] value
      will no longer be valid.
      
      Also, the first CPU to boot will allocate the struct mce_banks[] array
      using the number of banks based on its MCG_CAP[Count] value. The machine
      check handler and other functions use the global number of banks to
      iterate and index into the mce_banks[] array. So it's possible to use an
      out-of-bounds index on an asymmetric system where a following CPU sees a
      MCG_CAP[Count] value greater than its predecessors.
      
      Thus, allocate the mce_banks[] array to the maximum number of banks.
      This will avoid the potential out-of-bounds index since the value of
      mca_cfg.banks is capped to MAX_NR_BANKS.
      
      Set the value of mca_cfg.banks equal to the max of the previous value
      and the value for the current CPU. This way mca_cfg.banks will always
      represent the max number of banks detected on any CPU in the system.
      
      This will ensure that all CPUs will access all the banks that are
      visible to them. A CPU that can access fewer than the max number of
      banks will find the registers of the extra banks to be read-as-zero.
      
      Furthermore, print the resulting number of MCA banks in use. Do this in
      mcheck_late_init() so that the final value is printed after all CPUs
      have been initialized.
      
      Finally, get bank count from target CPU when doing injection with mce-inject
      module.
      
       [ bp: Remove out-of-bounds example, passify and cleanup commit message. ]
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Cc: Pu Wen <puwen@hygon.cn>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Cc: x86-ml <x86@kernel.org>
      Link: https://lkml.kernel.org/r/20180727214009.78289-1-Yazen.Ghannam@amd.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      75a96196
    • Paul E. McKenney's avatar
      rcutorture: Fix cleanup path for invalid torture_type strings · aa7919e3
      Paul E. McKenney authored
      [ Upstream commit b813afae ]
      
      If the specified rcutorture.torture_type is not in the rcu_torture_init()
      function's torture_ops[] array, rcutorture prints some console messages
      and then invokes rcu_torture_cleanup() to set state so that a future
      torture test can run.  However, rcu_torture_cleanup() also attempts to
      end the test that didn't actually start, and in doing so relies on the
      value of cur_ops, a value that is not particularly relevant in this case.
      This can result in confusing output or even follow-on failures due to
      attempts to use facilities that have not been properly initialized.
      
      This commit therefore sets the value of cur_ops to NULL in this case
      and inserts a check near the beginning of rcu_torture_cleanup(),
      thus avoiding relying on an irrelevant cur_ops value.
      Reported-by: default avatarkernel test robot <rong.a.chen@intel.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aa7919e3
    • Tony Luck's avatar
      x86/mce: Fix machine_check_poll() tests for error types · 3d036cba
      Tony Luck authored
      [ Upstream commit f19501aa ]
      
      There has been a lurking "TBD" in the machine check poll routine ever
      since it was first split out from the machine check handler. The
      potential issue is that the poll routine may have just begun a read from
      the STATUS register in a machine check bank when the hardware logs an
      error in that bank and signals a machine check.
      
      That race used to be pretty small back when machine checks were
      broadcast, but the addition of local machine check means that the poll
      code could continue running and clear the error from the bank before the
      local machine check handler on another CPU gets around to reading it.
      
      Fix the code to be sure to only process errors that need to be processed
      in the poll code, leaving other logged errors alone for the machine
      check handler to find and process.
      
       [ bp: Massage a bit and flip the "== 0" check to the usual !(..) test. ]
      
      Fixes: b79109c3 ("x86, mce: separate correct machine check poller and fatal exception handler")
      Fixes: ed7290d0 ("x86, mce: implement new status bits")
      Reported-by: default avatarAshok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86-ml <x86@kernel.org>
      Cc: Yazen Ghannam <Yazen.Ghannam@amd.com>
      Link: https://lkml.kernel.org/r/20190312170938.GA23035@agluck-deskSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      3d036cba
    • Leon Romanovsky's avatar
      overflow: Fix -Wtype-limits compilation warnings · 3c2b1ae4
      Leon Romanovsky authored
      [ Upstream commit dc7fe518 ]
      
      Attempt to use check_shl_overflow() with inputs of unsigned type
      produces the following compilation warnings.
      
      drivers/infiniband/hw/mlx5/qp.c: In function _set_user_rq_size_:
      ./include/linux/overflow.h:230:6: warning: comparison of unsigned
      expression >= 0 is always true [-Wtype-limits]
         _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;  \
            ^~
      drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro _check_shl_overflow_
        if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift,
      &rwq->buf_size))
            ^~~~~~~~~~~~~~~~~~
      ./include/linux/overflow.h:232:26: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
        (_to_shift != _s || *_d < 0 || _a < 0 ||   \
                                ^
      drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro _check_shl_overflow_
        if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift, &rwq->buf_size))
            ^~~~~~~~~~~~~~~~~~
      ./include/linux/overflow.h:232:36: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
        (_to_shift != _s || *_d < 0 || _a < 0 ||   \
                                          ^
      drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro _check_shl_overflow_
        if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift,&rwq->buf_size))
            ^~~~~~~~~~~~~~~~~~
      
      Fixes: 0c668477 ("overflow.h: Add arithmetic shift helper")
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c2b1ae4
    • Kangjie Lu's avatar
      tty: ipwireless: fix missing checks for ioremap · 19ae270d
      Kangjie Lu authored
      [ Upstream commit 1bbb1c31 ]
      
      ipw->attr_memory and ipw->common_memory are assigned with the
      return value of ioremap. ioremap may fail, but no checks
      are enforced. The fix inserts the checks to avoid potential
      NULL pointer dereferences.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      19ae270d
    • Pankaj Gupta's avatar
      virtio_console: initialize vtermno value for ports · 3392cc5f
      Pankaj Gupta authored
      [ Upstream commit 4b0a2c5f ]
      
      For regular serial ports we do not initialize value of vtermno
      variable. A garbage value is assigned for non console ports.
      The value can be observed as a random integer with [1].
      
      [1] vim /sys/kernel/debug/virtio-ports/vport*p*
      
      This patch initialize the value of vtermno for console serial
      ports to '1' and regular serial ports are initiaized to '0'.
      
      Reported-by: siliu@redhat.com
      Signed-off-by: default avatarPankaj Gupta <pagupta@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3392cc5f
    • Chad Dupuis's avatar
      scsi: qedf: Add missing return in qedf_post_io_req() in the fcport offload check · e819d4a1
      Chad Dupuis authored
      [ Upstream commit c5e06ba2 ]
      
      Fixes the following crash as the return was missing from the check if an
      fcport is offloaded. If we hit this code we continue to try to post an
      invalid task which can lead to the crash:
      
      [30259.616411] [0000:61:00.3]:[qedf_post_io_req:989]:3: Session not offloaded yet.
      [30259.616413] [0000:61:00.3]:[qedf_upload_connection:1340]:3: Uploading connection port_id=490020.
      [30259.623769] BUG: unable to handle kernel NULL pointer dereference at 0000000000000198
      [30259.631645] IP: [<ffffffffc035b1ed>] qedf_init_task.isra.16+0x3d/0x450 [qedf]
      [30259.638816] PGD 0
      [30259.640841] Oops: 0000 [#1] SMP
      [30259.644098] Modules linked in: fuse xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun bridge stp llc ebtable_filter ebtables devlink ip6table_filter ip6_tables iptable_filter vfat fat ib_isert iscsi_target_mod ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib ib_ucm ib_umad dm_service_time skx_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel rpcrdma sunrpc rdma_ucm ib_uverbs lrw gf128mul ib_iser rdma_cm iw_cm ib_cm libiscsi scsi_transport_iscsi qedr(OE) glue_helper ablk_helper cryptd ib_core dm_round_robin joydev pcspkr ipmi_ssif ses enclosure ipmi_si ipmi_devintf ipmi_msghandler mei_me
      [30259.715529]  mei sg hpilo hpwdt shpchp wmi lpc_ich acpi_power_meter dm_multipath ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic uas usb_storage mgag200 qedf(OE) i2c_algo_bit libfcoe drm_kms_helper libfc syscopyarea sysfillrect scsi_transport_fc qede(OE) sysimgblt fb_sys_fops ptp ttm pps_core drm qed(OE) smartpqi crct10dif_pclmul crct10dif_common crc32c_intel i2c_core scsi_transport_sas scsi_tgt dm_mirror dm_region_hash dm_log dm_mod
      [30259.754237] CPU: 9 PID: 977 Comm: kdmwork-253:7 Kdump: loaded Tainted: G        W  OE  ------------   3.10.0-862.el7.x86_64 #1
      [30259.765664] Hardware name: HPE Synergy 480 Gen10/Synergy 480 Gen10 Compute Module, BIOS I42 04/04/2018
      [30259.775000] task: ffff8c801efd0000 ti: ffff8c801efd8000 task.ti: ffff8c801efd8000
      [30259.782505] RIP: 0010:[<ffffffffc035b1ed>]  [<ffffffffc035b1ed>] qedf_init_task.isra.16+0x3d/0x450 [qedf]
      [30259.792116] RSP: 0018:ffff8c801efdbbb0  EFLAGS: 00010046
      [30259.797444] RAX: 0000000000000000 RBX: ffffa7f1450948d8 RCX: ffff8c7fe5bc40c8
      [30259.804600] RDX: ffff8c800715b300 RSI: ffffa7f1450948d8 RDI: ffff8c80169c2480
      [30259.811755] RBP: ffff8c801efdbc30 R08: 00000000000000ae R09: ffff8c800a314540
      [30259.818911] R10: ffff8c7fe5bc40c8 R11: ffff8c801efdb8ae R12: 0000000000000000
      [30259.826068] R13: ffff8c800715b300 R14: ffff8c80169c2480 R15: ffff8c8005da28e0
      [30259.833223] FS:  0000000000000000(0000) GS:ffff8c803f840000(0000) knlGS:0000000000000000
      [30259.841338] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [30259.847100] CR2: 0000000000000198 CR3: 000000081242e000 CR4: 00000000007607e0
      [30259.854256] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [30259.861412] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [30259.868568] PKRU: 00000000
      [30259.871278] Call Trace:
      [30259.873737]  [<ffffffffc035c948>] qedf_post_io_req+0x148/0x680 [qedf]
      [30259.880201]  [<ffffffffc035d070>] qedf_queuecommand+0x1f0/0x240 [qedf]
      [30259.886749]  [<ffffffffa329b050>] scsi_dispatch_cmd+0xb0/0x240
      [30259.892600]  [<ffffffffa32a45bc>] scsi_request_fn+0x4cc/0x680
      [30259.898364]  [<ffffffffa3118ad9>] __blk_run_queue+0x39/0x50
      [30259.903954]  [<ffffffffa3114393>] __elv_add_request+0xd3/0x260
      [30259.909805]  [<ffffffffa311baf0>] blk_insert_cloned_request+0xf0/0x1b0
      [30259.916358]  [<ffffffffc010b622>] map_request+0x142/0x220 [dm_mod]
      [30259.922560]  [<ffffffffc010b716>] map_tio_request+0x16/0x40 [dm_mod]
      [30259.928932]  [<ffffffffa2ebb1f5>] kthread_worker_fn+0x85/0x180
      [30259.934782]  [<ffffffffa2ebb170>] ? kthread_stop+0xf0/0xf0
      [30259.940284]  [<ffffffffa2ebae31>] kthread+0xd1/0xe0
      [30259.945176]  [<ffffffffa2ebad60>] ? insert_kthread_work+0x40/0x40
      [30259.951290]  [<ffffffffa351f61d>] ret_from_fork_nospec_begin+0x7/0x21
      [30259.957750]  [<ffffffffa2ebad60>] ? insert_kthread_work+0x40/0x40
      [30259.963860] Code: fe 41 55 49 89 d5 41 54 53 48 89 f3 48 83 ec 58 4c 8b 67 28 4c 8b 4e 18 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 4c 8b 7e 58 <49> 8b 84 24 98 01 00 00 48 8b 00 f6 80 31 01 00 00 10 0f 85 0b
      [30259.983372] RIP  [<ffffffffc035b1ed>] qedf_init_task.isra.16+0x3d/0x450 [qedf]
      [30259.990630]  RSP <ffff8c801efdbbb0>
      [30259.994127] CR2: 0000000000000198
      Signed-off-by: default avatarChad Dupuis <cdupuis@marvell.com>
      Signed-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e819d4a1
    • Thomas Gleixner's avatar
      timekeeping: Force upper bound for setting CLOCK_REALTIME · dc0f37b7
      Thomas Gleixner authored
      [ Upstream commit 7a8e61f8 ]
      
      Several people reported testing failures after setting CLOCK_REALTIME close
      to the limits of the kernel internal representation in nanoseconds,
      i.e. year 2262.
      
      The failures are exposed in subsequent operations, i.e. when arming timers
      or when the advancing CLOCK_MONOTONIC makes the calculation of
      CLOCK_REALTIME overflow into negative space.
      
      Now people start to paper over the underlying problem by clamping
      calculations to the valid range, but that's just wrong because such
      workarounds will prevent detection of real issues as well.
      
      It is reasonable to force an upper bound for the various methods of setting
      CLOCK_REALTIME. Year 2262 is the absolute upper bound. Assume a maximum
      uptime of 30 years which is plenty enough even for esoteric embedded
      systems. That results in an upper bound of year 2232 for setting the time.
      
      Once that limit is reached in reality this limit is only a small part of
      the problem space. But until then this stops people from trying to paper
      over the problem at the wrong places.
      Reported-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reported-by: default avatarHongbo Yao <yaohongbo@huawei.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Stephen Boyd <sboyd@kernel.org>
      Cc: Miroslav Lichvar <mlichvar@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Richard Cochran <richardcochran@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1903231125480.2157@nanos.tec.linutronix.deSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      dc0f37b7
    • Aditya Pakki's avatar
      thunderbolt: Fix to check the return value of kmemdup · ee40c8a3
      Aditya Pakki authored
      [ Upstream commit fd21b79e ]
      
      uuid in add_switch is allocted via kmemdup which can fail. The patch
      logs the error and cleans up the allocated memory for switch.
      Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
      Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ee40c8a3
    • Kangjie Lu's avatar
      thunderbolt: property: Fix a missing check of kzalloc · c8eecd65
      Kangjie Lu authored
      [ Upstream commit 6183d5a5 ]
      
      No check is enforced for the return value of kzalloc,
      which may lead to NULL-pointer dereference.
      
      The patch fixes this issue.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c8eecd65
    • Ard Biesheuvel's avatar
      efifb: Omit memory map check on legacy boot · 1de8f965
      Ard Biesheuvel authored
      [ Upstream commit c2999c28 ]
      
      Since the following commit:
      
        38ac0287 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")
      
      efifb_probe() checks its memory range via efi_mem_desc_lookup(),
      and this leads to a spurious error message:
      
         EFI_MEMMAP is not enabled
      
      at every boot on KVM.  This is quite annoying since the error message
      appears even if you set "quiet" boot option.
      
      Since this happens on legacy boot, which strangely enough exposes
      a EFI framebuffer via screen_info, let's double check that we are
      doing an EFI boot before attempting to access the EFI memory map.
      Reported-by: default avatarTakashi Iwai <tiwai@suse.de>
      Tested-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20190328193429.21373-3-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1de8f965
    • Ezequiel Garcia's avatar
      media: gspca: Kill URBs on USB device disconnect · 356f05fd
      Ezequiel Garcia authored
      [ Upstream commit 9b9ea7c2 ]
      
      In order to prevent ISOC URBs from being infinitely resubmitted,
      the driver's USB disconnect handler must kill all the in-flight URBs.
      
      While here, change the URB packet status message to a debug level,
      to avoid spamming the console too much.
      
      This commit fixes a lockup caused by an interrupt storm coming
      from the URB completion handler.
      Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      356f05fd
    • Dan Carpenter's avatar
      media: wl128x: prevent two potential buffer overflows · 2a9331ce
      Dan Carpenter authored
      [ Upstream commit 9c2ccc32 ]
      
      Smatch marks skb->data as untrusted so it warns that "evt_hdr->dlen"
      can copy up to 255 bytes and we only have room for two bytes.  Even
      if this comes from the firmware and we trust it, the new policy
      generally is just to fix it as kernel hardenning.
      
      I can't test this code so I tried to be very conservative.  I considered
      not allowing "evt_hdr->dlen == 1" because it doesn't initialize the
      whole variable but in the end I decided to allow it and manually
      initialized "asic_id" and "asic_ver" to zero.
      
      Fixes: e8454ff7 ("[media] drivers:media:radio: wl128x: FM Driver Common sources")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2a9331ce
    • Kangjie Lu's avatar
      media: video-mux: fix null pointer dereferences · 6b5693f2
      Kangjie Lu authored
      [ Upstream commit aeb0d0f5 ]
      
      devm_kcalloc may fail and return a null pointer. The fix returns
      -ENOMEM upon failures to avoid null pointer dereferences.
      Signed-off-by: default avatarKangjie Lu <kjlu@umn.edu>
      Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6b5693f2
    • Tetsuo Handa's avatar
      kobject: Don't trigger kobject_uevent(KOBJ_REMOVE) twice. · bc75207a
      Tetsuo Handa authored
      [ Upstream commit c03a0fd0 ]
      
      syzbot is hitting use-after-free bug in uinput module [1]. This is because
      kobject_uevent(KOBJ_REMOVE) is called again due to commit 0f4dafc0
      ("Kobject: auto-cleanup on final unref") after memory allocation fault
      injection made kobject_uevent(KOBJ_REMOVE) from device_del() from
      input_unregister_device() fail, while uinput_destroy_device() is expecting
      that kobject_uevent(KOBJ_REMOVE) is not called after device_del() from
      input_unregister_device() completed.
      
      That commit intended to catch cases where nobody even attempted to send
      "remove" uevents. But there is no guarantee that an event will ultimately
      be sent. We are at the point of no return as far as the rest of the kernel
      is concerned; there are no repeats or do-overs.
      
      Also, it is not clear whether some subsystem depends on that commit.
      If no subsystem depends on that commit, it will be better to remove
      the state_{add,remove}_uevent_sent logic. But we don't want to risk
      a regression (in a patch which will be backported) by trying to remove
      that logic. Therefore, as a first step, let's avoid the use-after-free bug
      by making sure that kobject_uevent(KOBJ_REMOVE) won't be triggered twice.
      
      [1] https://syzkaller.appspot.com/bug?id=8b17c134fe938bbddd75a45afaa9e68af43a362dReported-by: default avatarsyzbot <syzbot+f648cfb7e0b52bf7ae32@syzkaller.appspotmail.com>
      Analyzed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Fixes: 0f4dafc0 ("Kobject: auto-cleanup on final unref")
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bc75207a
    • Sowjanya Komatineni's avatar
      spi: tegra114: reset controller on probe · ba906246
      Sowjanya Komatineni authored
      [ Upstream commit 01919493 ]
      
      Fixes: SPI driver can be built as module so perform SPI controller reset
      on probe to make sure it is in valid state before initiating transfer.
      Signed-off-by: default avatarSowjanya Komatineni <skomatineni@nvidia.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ba906246