1. 05 12月, 2018 1 次提交
    • E
      Revert "mfd: cros_ec: Use devm_kzalloc for private data" · 48a2ca0e
      Enric Balletbo i Serra 提交于
      This reverts commit 3aa2177e.
      
      That commit triggered a new WARN when unloading the module (see at the
      end of the commit message). When a class_dev is embedded in a structure
      then that class_dev is the thing that controls the lifetime of that
      structure, for that reason device managed allocations can't be used here.
      See Documentation/kobject.txt.
      
      Revert the above patch, so the struct is allocated using kzalloc and we
      have a release function for it that frees the allocated memory, otherwise
      it is broken.
      
       ------------[ cut here ]------------
       Device 'cros_ec' does not have a release() function, it is broken and must be fixed.
       WARNING: CPU: 3 PID: 3675 at drivers/base/core.c:895 device_release+0x80/0x90
       Modules linked in: btusb btrtl btintel btbcm bluetooth ...
       CPU: 3 PID: 3675 Comm: rmmod Not tainted 4.20.0-rc4 #76
       Hardware name: Google Kevin (DT)
       pstate: 40000005 (nZcv daif -PAN -UAO)
       pc : device_release+0x80/0x90
       lr : device_release+0x80/0x90
       sp : ffff00000c47bc70
       x29: ffff00000c47bc70 x28: ffff8000e86b0d40
       x27: 0000000000000000 x26: 0000000000000000
       x25: 0000000056000000 x24: 0000000000000015
       x23: ffff8000f0bbf860 x22: ffff000000d320a0
       x21: ffff8000ee93e100 x20: ffff8000ed931428
       x19: ffff8000ed931418 x18: 0000000000000020
       x17: 0000000000000000 x16: 0000000000000000
       x15: 0000000000000400 x14: 0000000000000143
       x13: 0000000000000000 x12: 0000000000000400
       x11: 0000000000000157 x10: 0000000000000960
       x9 : ffff00000c47b9b0 x8 : ffff8000e86b1700
       x7 : 0000000000000000 x6 : ffff8000f7d520b8
       x5 : ffff8000f7d520b8 x4 : 0000000000000000
       x3 : ffff8000f7d58e68 x2 : ffff8000e86b0d40
       x1 : 37d859939c964800 x0 : 0000000000000000
       Call trace:
        device_release+0x80/0x90
        kobject_put+0x74/0xe8
        device_unregister+0x20/0x30
        ec_device_remove+0x34/0x48 [cros_ec_dev]
        platform_drv_remove+0x28/0x48
        device_release_driver_internal+0x1a8/0x240
        driver_detach+0x40/0x80
        bus_remove_driver+0x54/0xa8
        driver_unregister+0x2c/0x58
        platform_driver_unregister+0x10/0x18
        cros_ec_dev_exit+0x1c/0x2d8 [cros_ec_dev]
        __arm64_sys_delete_module+0x16c/0x1f8
        el0_svc_common+0x84/0xd8
        el0_svc_handler+0x2c/0x80
        el0_svc+0x8/0xc
       ---[ end trace a57c4625f3c60ae8 ]---
      
      Cc: stable@vger.kernel.org
      Fixes: 3aa2177e ("mfd: cros_ec: Use devm_kzalloc for private data")
      Signed-off-by: NEnric Balletbo i Serra <enric.balletbo@collabora.com>
      Reviewed-by: NGuenter Roeck <groeck@chromium.org>
      Reviewed-by: NDmitry Torokhov <dtor@chromium.org>
      Signed-off-by: NLee Jones <lee.jones@linaro.org>
      48a2ca0e
  2. 04 12月, 2018 7 次提交
  3. 03 12月, 2018 5 次提交
  4. 01 12月, 2018 5 次提交
  5. 30 11月, 2018 4 次提交
  6. 29 11月, 2018 18 次提交
    • R
      dmaengine: at_hdmac: fix module unloading · 77e75fda
      Richard Genoud 提交于
      of_dma_controller_free() was not called on module onloading.
      This lead to a soft lockup:
      watchdog: BUG: soft lockup - CPU#0 stuck for 23s!
      Modules linked in: at_hdmac [last unloaded: at_hdmac]
      when of_dma_request_slave_channel() tried to call ofdma->of_dma_xlate().
      
      Cc: stable@vger.kernel.org
      Fixes: bbe89c8e ("at_hdmac: move to generic DMA binding")
      Acked-by: NLudovic Desroches <ludovic.desroches@microchip.com>
      Signed-off-by: NRichard Genoud <richard.genoud@gmail.com>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      77e75fda
    • R
      dmaengine: at_hdmac: fix memory leak in at_dma_xlate() · 98f5f932
      Richard Genoud 提交于
      The leak was found when opening/closing a serial port a great number of
      time, increasing kmalloc-32 in slabinfo.
      
      Each time the port was opened, dma_request_slave_channel() was called.
      Then, in at_dma_xlate(), atslave was allocated with devm_kzalloc() and
      never freed. (Well, it was free at module unload, but that's not what we
      want).
      So, here, kzalloc is more suited for the job since it has to be freed in
      atc_free_chan_resources().
      
      Cc: stable@vger.kernel.org
      Fixes: bbe89c8e ("at_hdmac: move to generic DMA binding")
      Reported-by: NMario Forner <m.forner@be4energy.com>
      Suggested-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
      Acked-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
      Acked-by: NLudovic Desroches <ludovic.desroches@microchip.com>
      Signed-off-by: NRichard Genoud <richard.genoud@gmail.com>
      Signed-off-by: NVinod Koul <vkoul@kernel.org>
      98f5f932
    • D
      scsi: storvsc: Fix a race in sub-channel creation that can cause panic · c9675904
      Dexuan Cui 提交于
      We can concurrently try to open the same sub-channel from 2 paths:
      
      path #1: vmbus_onoffer() -> vmbus_process_offer() -> handle_sc_creation().
      path #2: storvsc_probe() -> storvsc_connect_to_vsp() ->
      	 -> storvsc_channel_init() -> handle_multichannel_storage() ->
      	 -> vmbus_are_subchannels_present() -> handle_sc_creation().
      
      They conflict with each other, but it was not an issue before the recent
      commit ae6935ed ("vmbus: split ring buffer allocation from open"),
      because at the beginning of vmbus_open() we checked newchannel->state so
      only one path could succeed, and the other would return with -EINVAL.
      
      After ae6935ed, the failing path frees the channel's ringbuffer by
      vmbus_free_ring(), and this causes a panic later.
      
      Commit ae6935ed itself is good, and it just reveals the longstanding
      race. We can resolve the issue by removing path #2, i.e. removing the
      second vmbus_are_subchannels_present() in handle_multichannel_storage().
      
      BTW, the comment "Check to see if sub-channels have already been created"
      in handle_multichannel_storage() is incorrect: when we unload the driver,
      we first close the sub-channel(s) and then close the primary channel, next
      the host sends rescind-offer message(s) so primary->sc_list will become
      empty. This means the first vmbus_are_subchannels_present() in
      handle_multichannel_storage() is never useful.
      
      Fixes: ae6935ed ("vmbus: split ring buffer allocation from open")
      Cc: stable@vger.kernel.org
      Cc: Long Li <longli@microsoft.com>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Signed-off-by: NK. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      c9675904
    • C
      scsi: vmw_pscsi: Rearrange code to avoid multiple calls to free_irq during unload · 02f425f8
      Cathy Avery 提交于
      Currently pvscsi_remove calls free_irq more than once as
      pvscsi_release_resources and __pvscsi_shutdown both call
      pvscsi_shutdown_intr. This results in a 'Trying to free already-free IRQ'
      warning and stack trace. To solve the problem pvscsi_shutdown_intr has been
      moved out of pvscsi_release_resources.
      Signed-off-by: NCathy Avery <cavery@redhat.com>
      Reviewed-by: NEwan D. Milne <emilne@redhat.com>
      Reviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      02f425f8
    • Y
      drm/ast: fixed reading monitor EDID not stable issue · 30062562
      Y.C. Chen 提交于
      v1: over-sample data to increase the stability with some specific monitors
      v2: refine to avoid infinite loop
      v3: remove un-necessary "volatile" declaration
      
      [airlied: fix two checkpatch warnings]
      Signed-off-by: NY.C. Chen <yc_chen@aspeedtech.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1542858988-1127-1-git-send-email-yc_chen@aspeedtech.com
      30062562
    • S
      drm/ast: Fix incorrect free on ioregs · dc25ab06
      Sam Bobroff 提交于
      If the platform has no IO space, ioregs is placed next to the already
      allocated regs. In this case, it should not be separately freed.
      
      This prevents a kernel warning from __vunmap "Trying to vfree()
      nonexistent vm area" when unloading the driver.
      
      Fixes: 0dd68309 ("drm/ast: Try to use MMIO registers when PIO isn't supported")
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      dc25ab06
    • F
      scsi: libiscsi: Fix NULL pointer dereference in iscsi_eh_session_reset · 5db6dd14
      Fred Herard 提交于
      This commit addresses NULL pointer dereference in iscsi_eh_session_reset.
      Reference should not be made to session->leadconn when session->state is
      set to ISCSI_STATE_TERMINATE.
      Signed-off-by: NFred Herard <fred.herard@oracle.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reviewed-by: NLee Duncan <lduncan@suse.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      5db6dd14
    • L
      Revert "drm/dp_mst: Skip validating ports during destruction, just ref" · 9765635b
      Lyude Paul 提交于
      This reverts commit:
      
      c54c7374 ("drm/dp_mst: Skip validating ports during destruction, just ref")
      
      ugh.
      
      In drm_dp_destroy_connector_work(), we have a pretty good chance of
      freeing the actual struct drm_dp_mst_port. However, after destroying
      things we send a hotplug through (*mgr->cbs->hotplug)(mgr) which is
      where the problems start.
      
      For i915, this calls all the way down to the fbcon probing helpers,
      which start trying to access the port in a modeset.
      
      [   45.062001] ==================================================================
      [   45.062112] BUG: KASAN: use-after-free in ex_handler_refcount+0x146/0x180
      [   45.062196] Write of size 4 at addr ffff8882b4b70968 by task kworker/3:1/53
      
      [   45.062325] CPU: 3 PID: 53 Comm: kworker/3:1 Kdump: loaded Tainted: G           O      4.20.0-rc4Lyude-Test+ #3
      [   45.062442] Hardware name: LENOVO 20BWS1KY00/20BWS1KY00, BIOS JBET71WW (1.35 ) 09/14/2018
      [   45.062554] Workqueue: events drm_dp_destroy_connector_work [drm_kms_helper]
      [   45.062641] Call Trace:
      [   45.062685]  dump_stack+0xbd/0x15a
      [   45.062735]  ? dump_stack_print_info.cold.0+0x1b/0x1b
      [   45.062801]  ? printk+0x9f/0xc5
      [   45.062847]  ? kmsg_dump_rewind_nolock+0xe4/0xe4
      [   45.062909]  ? ex_handler_refcount+0x146/0x180
      [   45.062970]  print_address_description+0x71/0x239
      [   45.063036]  ? ex_handler_refcount+0x146/0x180
      [   45.063095]  kasan_report.cold.5+0x242/0x30b
      [   45.063155]  __asan_report_store4_noabort+0x1c/0x20
      [   45.063313]  ex_handler_refcount+0x146/0x180
      [   45.063371]  ? ex_handler_clear_fs+0xb0/0xb0
      [   45.063428]  fixup_exception+0x98/0xd7
      [   45.063484]  ? raw_notifier_call_chain+0x20/0x20
      [   45.063548]  do_trap+0x6d/0x210
      [   45.063605]  ? _GLOBAL__sub_I_65535_1_drm_dp_aux_unregister_devnode+0x2f/0x1c6 [drm_kms_helper]
      [   45.063732]  do_error_trap+0xc0/0x170
      [   45.063802]  ? _GLOBAL__sub_I_65535_1_drm_dp_aux_unregister_devnode+0x2f/0x1c6 [drm_kms_helper]
      [   45.063929]  do_invalid_op+0x3b/0x50
      [   45.063997]  ? _GLOBAL__sub_I_65535_1_drm_dp_aux_unregister_devnode+0x2f/0x1c6 [drm_kms_helper]
      [   45.064103]  invalid_op+0x14/0x20
      [   45.064162] RIP: 0010:_GLOBAL__sub_I_65535_1_drm_dp_aux_unregister_devnode+0x2f/0x1c6 [drm_kms_helper]
      [   45.064274] Code: 00 48 c7 c7 80 fe 53 a0 48 89 e5 e8 5b 6f 26 e1 5d c3 48 8d 0e 0f 0b 48 8d 0b 0f 0b 48 8d 0f 0f 0b 48 8d 0f 0f 0b 49 8d 4d 00 <0f> 0b 49 8d 0e 0f 0b 48 8d 08 0f 0b 49 8d 4d 00 0f 0b 48 8d 0b 0f
      [   45.064569] RSP: 0018:ffff8882b789ee10 EFLAGS: 00010282
      [   45.064637] RAX: ffff8882af47ae70 RBX: ffff8882af47aa60 RCX: ffff8882b4b70968
      [   45.064723] RDX: ffff8882af47ae70 RSI: 0000000000000008 RDI: ffff8882b788bdb8
      [   45.064808] RBP: ffff8882b789ee28 R08: ffffed1056f13db4 R09: ffffed1056f13db3
      [   45.064894] R10: ffffed1056f13db3 R11: ffff8882b789ed9f R12: ffff8882af47ad28
      [   45.064980] R13: ffff8882b4b70968 R14: ffff8882acd86728 R15: ffff8882b4b75dc8
      [   45.065084]  drm_dp_mst_reset_vcpi_slots+0x12/0x80 [drm_kms_helper]
      [   45.065225]  intel_mst_disable_dp+0xda/0x180 [i915]
      [   45.065361]  intel_encoders_disable.isra.107+0x197/0x310 [i915]
      [   45.065498]  haswell_crtc_disable+0xbe/0x400 [i915]
      [   45.065622]  ? i9xx_disable_plane+0x1c0/0x3e0 [i915]
      [   45.065750]  intel_atomic_commit_tail+0x74e/0x3e60 [i915]
      [   45.065884]  ? intel_pre_plane_update+0xbc0/0xbc0 [i915]
      [   45.065968]  ? drm_atomic_helper_swap_state+0x88b/0x1d90 [drm_kms_helper]
      [   45.066054]  ? kasan_check_write+0x14/0x20
      [   45.066165]  ? i915_gem_track_fb+0x13a/0x330 [i915]
      [   45.066277]  ? i915_sw_fence_complete+0xe9/0x140 [i915]
      [   45.066406]  ? __i915_sw_fence_complete+0xc50/0xc50 [i915]
      [   45.066540]  intel_atomic_commit+0x72e/0xef0 [i915]
      [   45.066635]  ? drm_dev_dbg+0x200/0x200 [drm]
      [   45.066764]  ? intel_atomic_commit_tail+0x3e60/0x3e60 [i915]
      [   45.066898]  ? intel_atomic_commit_tail+0x3e60/0x3e60 [i915]
      [   45.067001]  drm_atomic_commit+0xc4/0xf0 [drm]
      [   45.067074]  restore_fbdev_mode_atomic+0x562/0x780 [drm_kms_helper]
      [   45.067166]  ? drm_fb_helper_debug_leave+0x690/0x690 [drm_kms_helper]
      [   45.067249]  ? kasan_check_read+0x11/0x20
      [   45.067324]  restore_fbdev_mode+0x127/0x4b0 [drm_kms_helper]
      [   45.067364]  ? kasan_check_read+0x11/0x20
      [   45.067406]  drm_fb_helper_restore_fbdev_mode_unlocked+0x164/0x200 [drm_kms_helper]
      [   45.067462]  ? drm_fb_helper_hotplug_event+0x30/0x30 [drm_kms_helper]
      [   45.067508]  ? kasan_check_write+0x14/0x20
      [   45.070360]  ? mutex_unlock+0x22/0x40
      [   45.073748]  drm_fb_helper_set_par+0xb2/0xf0 [drm_kms_helper]
      [   45.075846]  drm_fb_helper_hotplug_event.part.33+0x1cd/0x290 [drm_kms_helper]
      [   45.078088]  drm_fb_helper_hotplug_event+0x1c/0x30 [drm_kms_helper]
      [   45.082614]  intel_fbdev_output_poll_changed+0x9f/0x140 [i915]
      [   45.087069]  drm_kms_helper_hotplug_event+0x67/0x90 [drm_kms_helper]
      [   45.089319]  intel_dp_mst_hotplug+0x37/0x50 [i915]
      [   45.091496]  drm_dp_destroy_connector_work+0x510/0x6f0 [drm_kms_helper]
      [   45.093675]  ? drm_dp_update_payload_part1+0x1220/0x1220 [drm_kms_helper]
      [   45.095851]  ? kasan_check_write+0x14/0x20
      [   45.098473]  ? kasan_check_read+0x11/0x20
      [   45.101155]  ? strscpy+0x17c/0x530
      [   45.103808]  ? __switch_to_asm+0x34/0x70
      [   45.106456]  ? syscall_return_via_sysret+0xf/0x7f
      [   45.109711]  ? read_word_at_a_time+0x20/0x20
      [   45.113138]  ? __switch_to_asm+0x40/0x70
      [   45.116529]  ? __switch_to_asm+0x34/0x70
      [   45.119891]  ? __switch_to_asm+0x40/0x70
      [   45.123224]  ? __switch_to_asm+0x34/0x70
      [   45.126540]  ? __switch_to_asm+0x34/0x70
      [   45.129824]  process_one_work+0x88d/0x15d0
      [   45.133172]  ? pool_mayday_timeout+0x850/0x850
      [   45.136459]  ? pci_mmcfg_check_reserved+0x110/0x128
      [   45.139739]  ? wake_q_add+0xb0/0xb0
      [   45.143010]  ? check_preempt_wakeup+0x652/0x1050
      [   45.146304]  ? worker_enter_idle+0x29e/0x740
      [   45.149589]  ? __schedule+0x1ec0/0x1ec0
      [   45.152937]  ? kasan_check_read+0x11/0x20
      [   45.156179]  ? _raw_spin_lock_irq+0xa3/0x130
      [   45.159382]  ? _raw_read_unlock_irqrestore+0x30/0x30
      [   45.162542]  ? kasan_check_write+0x14/0x20
      [   45.165657]  worker_thread+0x1a5/0x1470
      [   45.168725]  ? set_load_weight+0x2e0/0x2e0
      [   45.171755]  ? process_one_work+0x15d0/0x15d0
      [   45.174806]  ? __switch_to_asm+0x34/0x70
      [   45.177645]  ? __switch_to_asm+0x40/0x70
      [   45.180323]  ? __switch_to_asm+0x34/0x70
      [   45.182936]  ? __switch_to_asm+0x40/0x70
      [   45.185539]  ? __switch_to_asm+0x34/0x70
      [   45.188100]  ? __switch_to_asm+0x40/0x70
      [   45.190628]  ? __schedule+0x7d4/0x1ec0
      [   45.193143]  ? save_stack+0xa9/0xd0
      [   45.195632]  ? kasan_check_write+0x10/0x20
      [   45.198162]  ? kasan_kmalloc+0xc4/0xe0
      [   45.200609]  ? kmem_cache_alloc_trace+0xdd/0x190
      [   45.203046]  ? kthread+0x9f/0x3b0
      [   45.205470]  ? ret_from_fork+0x35/0x40
      [   45.207876]  ? unwind_next_frame+0x43/0x50
      [   45.210273]  ? __save_stack_trace+0x82/0x100
      [   45.212658]  ? deactivate_slab.isra.67+0x3d4/0x580
      [   45.215026]  ? default_wake_function+0x35/0x50
      [   45.217399]  ? kasan_check_read+0x11/0x20
      [   45.219825]  ? _raw_spin_lock_irqsave+0xae/0x140
      [   45.222174]  ? __lock_text_start+0x8/0x8
      [   45.224521]  ? replenish_dl_entity.cold.62+0x4f/0x4f
      [   45.226868]  ? __kthread_parkme+0x87/0xf0
      [   45.229200]  kthread+0x2f7/0x3b0
      [   45.231557]  ? process_one_work+0x15d0/0x15d0
      [   45.233923]  ? kthread_park+0x120/0x120
      [   45.236249]  ret_from_fork+0x35/0x40
      
      [   45.240875] Allocated by task 242:
      [   45.243136]  save_stack+0x43/0xd0
      [   45.245385]  kasan_kmalloc+0xc4/0xe0
      [   45.247597]  kmem_cache_alloc_trace+0xdd/0x190
      [   45.249793]  drm_dp_add_port+0x1e0/0x2170 [drm_kms_helper]
      [   45.252000]  drm_dp_send_link_address+0x4a7/0x740 [drm_kms_helper]
      [   45.254389]  drm_dp_check_and_send_link_address+0x1a7/0x210 [drm_kms_helper]
      [   45.256803]  drm_dp_mst_link_probe_work+0x6f/0xb0 [drm_kms_helper]
      [   45.259200]  process_one_work+0x88d/0x15d0
      [   45.261597]  worker_thread+0x1a5/0x1470
      [   45.264038]  kthread+0x2f7/0x3b0
      [   45.266371]  ret_from_fork+0x35/0x40
      
      [   45.270937] Freed by task 53:
      [   45.273170]  save_stack+0x43/0xd0
      [   45.275382]  __kasan_slab_free+0x139/0x190
      [   45.277604]  kasan_slab_free+0xe/0x10
      [   45.279826]  kfree+0x99/0x1b0
      [   45.282044]  drm_dp_free_mst_port+0x4a/0x60 [drm_kms_helper]
      [   45.284330]  drm_dp_destroy_connector_work+0x43e/0x6f0 [drm_kms_helper]
      [   45.286660]  process_one_work+0x88d/0x15d0
      [   45.288934]  worker_thread+0x1a5/0x1470
      [   45.291231]  kthread+0x2f7/0x3b0
      [   45.293547]  ret_from_fork+0x35/0x40
      
      [   45.298206] The buggy address belongs to the object at ffff8882b4b70968
                      which belongs to the cache kmalloc-2k of size 2048
      [   45.303047] The buggy address is located 0 bytes inside of
                      2048-byte region [ffff8882b4b70968, ffff8882b4b71168)
      [   45.308010] The buggy address belongs to the page:
      [   45.310477] page:ffffea000ad2dc00 count:1 mapcount:0 mapping:ffff8882c080cf40 index:0x0 compound_mapcount: 0
      [   45.313051] flags: 0x8000000000010200(slab|head)
      [   45.315635] raw: 8000000000010200 ffffea000aac2808 ffffea000abe8608 ffff8882c080cf40
      [   45.318300] raw: 0000000000000000 00000000000d000d 00000001ffffffff 0000000000000000
      [   45.320966] page dumped because: kasan: bad access detected
      
      [   45.326312] Memory state around the buggy address:
      [   45.329085]  ffff8882b4b70800: fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   45.331845]  ffff8882b4b70880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   45.334584] >ffff8882b4b70900: fc fc fc fc fc fc fc fc fc fc fc fc fc fb fb fb
      [   45.337302]                                                           ^
      [   45.340061]  ffff8882b4b70980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [   45.342910]  ffff8882b4b70a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [   45.345748] ==================================================================
      
      So, this definitely isn't a fix that we want. This being said; there's
      no real easy fix for this problem because of some of the catch-22's of
      the MST helpers current design. For starters; we always need to validate
      a port with drm_dp_get_validated_port_ref(), but validation relies on
      the lifetime of the port in the actual topology. So once the port is
      gone, it can't be validated again.
      
      If we were to try to make the payload helpers not use port validation,
      then we'd cause another problem: if the port isn't validated, it could
      be freed and we'd just start causing more KASAN issues. There are
      already hacks that attempt to workaround this in
      drm_dp_mst_destroy_connector_work() by re-initializing the kref so that
      it can be used again and it's memory can be freed once the VCPI helpers
      finish removing the port's respective payloads. But none of these really
      do anything helpful since the port still can't be validated since it's
      gone from the topology. Also, that workaround is immensely confusing to
      read through.
      
      What really needs to be done in order to fix this is to teach DRM how to
      track the lifetime of the structs for MST ports and branch devices
      separately from their lifetime in the actual topology. Simply put; this
      means having two different krefs-one that removes the port/branch device
      from the topology, and one that finally calls kfree(). This would let us
      simplify things, since we'd now be able to keep ports around without
      having to keep them in the topology at the same time, which is exactly
      what we need in order to teach our VCPI helpers to only validate ports
      when it's actually necessary without running the risk of trying to use
      unallocated memory.
      
      Such a fix is on it's way, but for now let's play it safe and just
      revert this. If this bug has been around for well over a year, we can
      wait a little while to get an actual proper fix here.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: c54c7374 ("drm/dp_mst: Skip validating ports during destruction, just ref")
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Harry Wentland <Harry.Wentland@amd.com>
      Cc: stable@vger.kernel.org # v4.6+
      Acked-by: NSean Paul <sean@poorly.run>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181128210005.24434-1-lyude@redhat.com
      9765635b
    • S
      drm/amdgpu: Add delay after enable RLC ucode · ad97d9de
      shaoyunl 提交于
      Driver shouldn't try to access any GFX registers until RLC is idle.
      During the test, it took 12 seconds for RLC to clear the BUSY bit
      in RLC_GPM_STAT register which is un-acceptable for driver.
      As per RLC engineer, it would take RLC Ucode less than 10,000 GFXCLK
      cycles to finish its critical section. In a lowest 300M enginer clock
      setting(default from vbios), 50 us delay is enough.
      
      This commit fix the hang when RLC introduce the work around for XGMI
      which requires more cycles to setup more registers than normal
      Signed-off-by: Nshaoyunl <shaoyun.liu@amd.com>
      Acked-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      ad97d9de
    • F
      drm/amdgpu: Avoid endless loop in GPUVM fragment processing · 1954db15
      Felix Kuehling 提交于
      Don't bounce back to the root level for fragment processing, because
      huge pages are not supported at that level. This is unlikely to happen
      with the default VM size on Vega, but can be exposed by limiting the
      VM size with the amdgpu.vm_size module parameter.
      Signed-off-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      Reviewed-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      1954db15
    • F
      drm/amdgpu: Cast to uint64_t before left shift · 9ce2b991
      Felix Kuehling 提交于
      Avoid potential integer overflows with left shift in huge-page mapping
      code by casting the operand to uin64_t first.
      Signed-off-by: NFelix Kuehling <Felix.Kuehling@amd.com>
      Reviewed-by: NChristian König <christian.koenig@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      9ce2b991
    • J
      s390/qeth: fix length check in SNMP processing · 9a764c1e
      Julian Wiedmann 提交于
      The response for a SNMP request can consist of multiple parts, which
      the cmd callback stages into a kernel buffer until all parts have been
      received. If the callback detects that the staging buffer provides
      insufficient space, it bails out with error.
      This processing is buggy for the first part of the response - while it
      initially checks for a length of 'data_len', it later copies an
      additional amount of 'offsetof(struct qeth_snmp_cmd, data)' bytes.
      
      Fix the calculation of 'data_len' for the first part of the response.
      This also nicely cleans up the memcpy code.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NUrsula Braun <ubraun@linux.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9a764c1e
    • P
      net: hisilicon: remove unexpected free_netdev · c7589401
      Pan Bian 提交于
      The net device ndev is freed via free_netdev when failing to register
      the device. The control flow then jumps to the error handling code
      block. ndev is used and freed again. Resulting in a use-after-free bug.
      Signed-off-by: NPan Bian <bianpan2016@163.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7589401
    • P
      rapidio/rionet: do not free skb before reading its length · cfc43519
      Pan Bian 提交于
      skb is freed via dev_kfree_skb_any, however, skb->len is read then. This
      may result in a use-after-free bug.
      
      Fixes: e6161d64 ("rapidio/rionet: rework driver initialization and removal")
      Signed-off-by: NPan Bian <bianpan2016@163.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cfc43519
    • M
      scsi: lpfc: fix block guard enablement on SLI3 adapters · dfb75133
      Martin Wilck 提交于
      Since f44ac12f, BG enablement is tracked with the LPFC_SLI3_BG_ENABLED
      bit, which is set in lpfc_get_cfgparam before lpfc_sli_config_sli_port() is
      called. The bit shouldn't be cleared before checking the feature.  Based on
      problem analysis by David Bond.
      
      Fixes: f44ac12f "scsi: lpfc: Memory allocation error during driver start-up on power8"
      Tested-by: NDavid Bond <dbond@suse.com>
      Signed-off-by: NMartin Wilck <mwilck@suse.com>
      Cc: stable@vger.kernel.org # 4.17.x
      Cc: stable@vger.kernel.org # 4.18.x
      Cc: stable@vger.kernel.org # 4.19.x
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Acked-by: NJames Smart <jsmart2021@gmail.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      dfb75133
    • J
      i40e: fix kerneldoc for xsk methods · 529eb362
      Jan Sokolowski 提交于
      One method, xsk_umem_setup, had an incorrect kernel doc
      description, which has been corrected.
      
      Also fixes small typos found in the comments.
      Signed-off-by: NJan Sokolowski <jan.sokolowski@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      529eb362
    • J
      ixgbe: recognize 1000BaseLX SFP modules as 1Gbps · a8bf879a
      Josh Elsasser 提交于
      Add the two 1000BaseLX enum values to the X550's check for 1Gbps modules,
      allowing the core driver code to establish a link over this SFP type.
      
      This is done by the out-of-tree driver but the fix wasn't in mainline.
      
      Fixes: e23f3336 ("ixgbe: Fix 1G and 10G link stability for X550EM_x SFP+”)
      Fixes: 6a14ee0c ("ixgbe: Add X550 support function pointers")
      Signed-off-by: NJosh Elsasser <jelsasser@appneta.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      a8bf879a
    • L
      i40e: Fix deletion of MAC filters · eab077aa
      Lihong Yang 提交于
      In __i40e_del_filter function, the flag __I40E_MACVLAN_SYNC_PENDING for
      the PF state is wrongly set for the VSI. Deleting any of the MAC filters
      has caused the incorrect syncing for the PF. Fix it by setting this state
      flag to the intended PF.
      
      CC: stable <stable@vger.kernel.org>
      Signed-off-by: NLihong Yang <lihong.yang@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      eab077aa