1. 29 Sep, 2018 40 commits
    • Lyude Paul's avatar
      drm/nouveau/drm/nouveau: Fix bogus drm_kms_helper_poll_enable() placement · 409af02c
      Lyude Paul authored
      commit d77ef138 upstream.
      
      Turns out this part is my fault for not noticing when reviewing
      9a2eba33 ("drm/nouveau: Fix drm poll_helper handling"). Currently
      we call drm_kms_helper_poll_enable() from nouveau_display_hpd_work().
      This makes basically no sense however, because that means we're calling
      drm_kms_helper_poll_enable() every time we schedule the hotplug
      detection work. This is also against the advice mentioned in
      drm_kms_helper_poll_enable()'s documentation:
      
       Note that calls to enable and disable polling must be strictly ordered,
       which is automatically the case when they're only call from
       suspend/resume callbacks.
      
      Of course, hotplugs can't really be ordered. They could even happen
      immediately after we called drm_kms_helper_poll_disable() in
      nouveau_display_fini(), which can lead to all sorts of issues.
      
      Additionally; enabling polling /after/ we call
      drm_helper_hpd_irq_event() could also mean that we'd miss a hotplug
      event anyway, since drm_helper_hpd_irq_event() wouldn't bother trying to
      probe connectors so long as polling is disabled.
      
      So; simply move this back into nouveau_display_init() again. The race
      condition that both of these patches attempted to work around has
      already been fixed properly in
      
        d61a5c10 ("drm/nouveau: Fix deadlock on runtime suspend")
      
      Fixes: 9a2eba33 ("drm/nouveau: Fix drm poll_helper handling")
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Acked-by: default avatarKarol Herbst <kherbst@redhat.com>
      Acked-by: default avatarDaniel Vetter <daniel@ffwll.ch>
      Cc: Lukas Wunner <lukas@wunner.de>
      Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      409af02c
    • Lyude Paul's avatar
      drm/nouveau/drm/nouveau: Don't forget to cancel hpd_work on suspend/unload · 9ac837e0
      Lyude Paul authored
      commit 2f7ca781 upstream.
      
      Currently, there's nothing in nouveau that actually cancels this work
      struct. So, cancel it on suspend/unload. Otherwise, if we're unlucky
      enough hpd_work might try to keep running up until the system is
      suspended.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ac837e0
    • Lyude Paul's avatar
      drm/nouveau: Fix deadlocks in nouveau_connector_detect() · 42387d8e
      Lyude Paul authored
      commit 3e1a1275 upstream.
      
      When we disable hotplugging on the GPU, we need to be able to
      synchronize with each connector's hotplug interrupt handler before the
      interrupt is finally disabled. This can be a problem however, since
      nouveau_connector_detect() currently grabs a runtime power reference
      when handling connector probing. This will deadlock the runtime suspend
      handler like so:
      
      [  861.480896] INFO: task kworker/0:2:61 blocked for more than 120 seconds.
      [  861.483290]       Tainted: G           O      4.18.0-rc6Lyude-Test+ #1
      [  861.485158] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [  861.486332] kworker/0:2     D    0    61      2 0x80000000
      [  861.487044] Workqueue: events nouveau_display_hpd_work [nouveau]
      [  861.487737] Call Trace:
      [  861.488394]  __schedule+0x322/0xaf0
      [  861.489070]  schedule+0x33/0x90
      [  861.489744]  rpm_resume+0x19c/0x850
      [  861.490392]  ? finish_wait+0x90/0x90
      [  861.491068]  __pm_runtime_resume+0x4e/0x90
      [  861.491753]  nouveau_display_hpd_work+0x22/0x60 [nouveau]
      [  861.492416]  process_one_work+0x231/0x620
      [  861.493068]  worker_thread+0x44/0x3a0
      [  861.493722]  kthread+0x12b/0x150
      [  861.494342]  ? wq_pool_ids_show+0x140/0x140
      [  861.494991]  ? kthread_create_worker_on_cpu+0x70/0x70
      [  861.495648]  ret_from_fork+0x3a/0x50
      [  861.496304] INFO: task kworker/6:2:320 blocked for more than 120 seconds.
      [  861.496968]       Tainted: G           O      4.18.0-rc6Lyude-Test+ #1
      [  861.497654] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [  861.498341] kworker/6:2     D    0   320      2 0x80000080
      [  861.499045] Workqueue: pm pm_runtime_work
      [  861.499739] Call Trace:
      [  861.500428]  __schedule+0x322/0xaf0
      [  861.501134]  ? wait_for_completion+0x104/0x190
      [  861.501851]  schedule+0x33/0x90
      [  861.502564]  schedule_timeout+0x3a5/0x590
      [  861.503284]  ? mark_held_locks+0x58/0x80
      [  861.503988]  ? _raw_spin_unlock_irq+0x2c/0x40
      [  861.504710]  ? wait_for_completion+0x104/0x190
      [  861.505417]  ? trace_hardirqs_on_caller+0xf4/0x190
      [  861.506136]  ? wait_for_completion+0x104/0x190
      [  861.506845]  wait_for_completion+0x12c/0x190
      [  861.507555]  ? wake_up_q+0x80/0x80
      [  861.508268]  flush_work+0x1c9/0x280
      [  861.508990]  ? flush_workqueue_prep_pwqs+0x1b0/0x1b0
      [  861.509735]  nvif_notify_put+0xb1/0xc0 [nouveau]
      [  861.510482]  nouveau_display_fini+0xbd/0x170 [nouveau]
      [  861.511241]  nouveau_display_suspend+0x67/0x120 [nouveau]
      [  861.511969]  nouveau_do_suspend+0x5e/0x2d0 [nouveau]
      [  861.512715]  nouveau_pmops_runtime_suspend+0x47/0xb0 [nouveau]
      [  861.513435]  pci_pm_runtime_suspend+0x6b/0x180
      [  861.514165]  ? pci_has_legacy_pm_support+0x70/0x70
      [  861.514897]  __rpm_callback+0x7a/0x1d0
      [  861.515618]  ? pci_has_legacy_pm_support+0x70/0x70
      [  861.516313]  rpm_callback+0x24/0x80
      [  861.517027]  ? pci_has_legacy_pm_support+0x70/0x70
      [  861.517741]  rpm_suspend+0x142/0x6b0
      [  861.518449]  pm_runtime_work+0x97/0xc0
      [  861.519144]  process_one_work+0x231/0x620
      [  861.519831]  worker_thread+0x44/0x3a0
      [  861.520522]  kthread+0x12b/0x150
      [  861.521220]  ? wq_pool_ids_show+0x140/0x140
      [  861.521925]  ? kthread_create_worker_on_cpu+0x70/0x70
      [  861.522622]  ret_from_fork+0x3a/0x50
      [  861.523299] INFO: task kworker/6:0:1329 blocked for more than 120 seconds.
      [  861.523977]       Tainted: G           O      4.18.0-rc6Lyude-Test+ #1
      [  861.524644] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [  861.525349] kworker/6:0     D    0  1329      2 0x80000000
      [  861.526073] Workqueue: events nvif_notify_work [nouveau]
      [  861.526751] Call Trace:
      [  861.527411]  __schedule+0x322/0xaf0
      [  861.528089]  schedule+0x33/0x90
      [  861.528758]  rpm_resume+0x19c/0x850
      [  861.529399]  ? finish_wait+0x90/0x90
      [  861.530073]  __pm_runtime_resume+0x4e/0x90
      [  861.530798]  nouveau_connector_detect+0x7e/0x510 [nouveau]
      [  861.531459]  ? ww_mutex_lock+0x47/0x80
      [  861.532097]  ? ww_mutex_lock+0x47/0x80
      [  861.532819]  ? drm_modeset_lock+0x88/0x130 [drm]
      [  861.533481]  drm_helper_probe_detect_ctx+0xa0/0x100 [drm_kms_helper]
      [  861.534127]  drm_helper_hpd_irq_event+0xa4/0x120 [drm_kms_helper]
      [  861.534940]  nouveau_connector_hotplug+0x98/0x120 [nouveau]
      [  861.535556]  nvif_notify_work+0x2d/0xb0 [nouveau]
      [  861.536221]  process_one_work+0x231/0x620
      [  861.536994]  worker_thread+0x44/0x3a0
      [  861.537757]  kthread+0x12b/0x150
      [  861.538463]  ? wq_pool_ids_show+0x140/0x140
      [  861.539102]  ? kthread_create_worker_on_cpu+0x70/0x70
      [  861.539815]  ret_from_fork+0x3a/0x50
      [  861.540521]
                     Showing all locks held in the system:
      [  861.541696] 2 locks held by kworker/0:2/61:
      [  861.542406]  #0: 000000002dbf8af5 ((wq_completion)"events"){+.+.}, at: process_one_work+0x1b3/0x620
      [  861.543071]  #1: 0000000076868126 ((work_completion)(&drm->hpd_work)){+.+.}, at: process_one_work+0x1b3/0x620
      [  861.543814] 1 lock held by khungtaskd/64:
      [  861.544535]  #0: 0000000059db4b53 (rcu_read_lock){....}, at: debug_show_all_locks+0x23/0x185
      [  861.545160] 3 locks held by kworker/6:2/320:
      [  861.545896]  #0: 00000000d9e1bc59 ((wq_completion)"pm"){+.+.}, at: process_one_work+0x1b3/0x620
      [  861.546702]  #1: 00000000c9f92d84 ((work_completion)(&dev->power.work)){+.+.}, at: process_one_work+0x1b3/0x620
      [  861.547443]  #2: 000000004afc5de1 (drm_connector_list_iter){.+.+}, at: nouveau_display_fini+0x96/0x170 [nouveau]
      [  861.548146] 1 lock held by dmesg/983:
      [  861.548889] 2 locks held by zsh/1250:
      [  861.549605]  #0: 00000000348e3cf6 (&tty->ldisc_sem){++++}, at: ldsem_down_read+0x37/0x40
      [  861.550393]  #1: 000000007009a7a8 (&ldata->atomic_read_lock){+.+.}, at: n_tty_read+0xc1/0x870
      [  861.551122] 6 locks held by kworker/6:0/1329:
      [  861.551957]  #0: 000000002dbf8af5 ((wq_completion)"events"){+.+.}, at: process_one_work+0x1b3/0x620
      [  861.552765]  #1: 00000000ddb499ad ((work_completion)(&notify->work)#2){+.+.}, at: process_one_work+0x1b3/0x620
      [  861.553582]  #2: 000000006e013cbe (&dev->mode_config.mutex){+.+.}, at: drm_helper_hpd_irq_event+0x6c/0x120 [drm_kms_helper]
      [  861.554357]  #3: 000000004afc5de1 (drm_connector_list_iter){.+.+}, at: drm_helper_hpd_irq_event+0x78/0x120 [drm_kms_helper]
      [  861.555227]  #4: 0000000044f294d9 (crtc_ww_class_acquire){+.+.}, at: drm_helper_probe_detect_ctx+0x3d/0x100 [drm_kms_helper]
      [  861.556133]  #5: 00000000db193642 (crtc_ww_class_mutex){+.+.}, at: drm_modeset_lock+0x4b/0x130 [drm]
      
      [  861.557864] =============================================
      
      [  861.559507] NMI backtrace for cpu 2
      [  861.560363] CPU: 2 PID: 64 Comm: khungtaskd Tainted: G           O      4.18.0-rc6Lyude-Test+ #1
      [  861.561197] Hardware name: LENOVO 20EQS64N0B/20EQS64N0B, BIOS N1EET78W (1.51 ) 05/18/2018
      [  861.561948] Call Trace:
      [  861.562757]  dump_stack+0x8e/0xd3
      [  861.563516]  nmi_cpu_backtrace.cold.3+0x14/0x5a
      [  861.564269]  ? lapic_can_unplug_cpu.cold.27+0x42/0x42
      [  861.565029]  nmi_trigger_cpumask_backtrace+0xa1/0xae
      [  861.565789]  arch_trigger_cpumask_backtrace+0x19/0x20
      [  861.566558]  watchdog+0x316/0x580
      [  861.567355]  kthread+0x12b/0x150
      [  861.568114]  ? reset_hung_task_detector+0x20/0x20
      [  861.568863]  ? kthread_create_worker_on_cpu+0x70/0x70
      [  861.569598]  ret_from_fork+0x3a/0x50
      [  861.570370] Sending NMI from CPU 2 to CPUs 0-1,3-7:
      [  861.571426] NMI backtrace for cpu 6 skipped: idling at intel_idle+0x7f/0x120
      [  861.571429] NMI backtrace for cpu 7 skipped: idling at intel_idle+0x7f/0x120
      [  861.571432] NMI backtrace for cpu 3 skipped: idling at intel_idle+0x7f/0x120
      [  861.571464] NMI backtrace for cpu 5 skipped: idling at intel_idle+0x7f/0x120
      [  861.571467] NMI backtrace for cpu 0 skipped: idling at intel_idle+0x7f/0x120
      [  861.571469] NMI backtrace for cpu 4 skipped: idling at intel_idle+0x7f/0x120
      [  861.571472] NMI backtrace for cpu 1 skipped: idling at intel_idle+0x7f/0x120
      [  861.572428] Kernel panic - not syncing: hung_task: blocked tasks
      
      So: fix this by making it so that normal hotplug handling /only/ happens
      so long as the GPU is currently awake without any pending runtime PM
      requests. In the event that a hotplug occurs while the device is
      suspending or resuming, we can simply defer our response until the GPU
      is fully runtime resumed again.
      
      Changes since v4:
      - Use a new trick I came up with using pm_runtime_get() instead of the
        hackish junk we had before
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Acked-by: default avatarDaniel Vetter <daniel@ffwll.ch>
      Cc: stable@vger.kernel.org
      Cc: Lukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42387d8e
    • Junxiao Bi's avatar
      ocfs2: fix ocfs2 read block panic · 7c1ca8fb
      Junxiao Bi authored
      commit 234b69e3 upstream.
      
      While reading block, it is possible that io error return due to underlying
      storage issue, in this case, BH_NeedsValidate was left in the buffer head.
      Then when reading the very block next time, if it was already linked into
      journal, that will trigger the following panic.
      
      [203748.702517] kernel BUG at fs/ocfs2/buffer_head_io.c:342!
      [203748.702533] invalid opcode: 0000 [#1] SMP
      [203748.702561] Modules linked in: ocfs2 ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs sunrpc dm_switch dm_queue_length dm_multipath bonding be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i iw_cxgb4 cxgb4 cxgb3i libcxgbi iw_cxgb3 cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ipmi_devintf iTCO_wdt iTCO_vendor_support dcdbas ipmi_ssif i2c_core ipmi_si ipmi_msghandler acpi_pad pcspkr sb_edac edac_core lpc_ich mfd_core shpchp sg tg3 ptp pps_core ext4 jbd2 mbcache2 sr_mod cdrom sd_mod ahci libahci megaraid_sas wmi dm_mirror dm_region_hash dm_log dm_mod
      [203748.703024] CPU: 7 PID: 38369 Comm: touch Not tainted 4.1.12-124.18.6.el6uek.x86_64 #2
      [203748.703045] Hardware name: Dell Inc. PowerEdge R620/0PXXHP, BIOS 2.5.2 01/28/2015
      [203748.703067] task: ffff880768139c00 ti: ffff88006ff48000 task.ti: ffff88006ff48000
      [203748.703088] RIP: 0010:[<ffffffffa05e9f09>]  [<ffffffffa05e9f09>] ocfs2_read_blocks+0x669/0x7f0 [ocfs2]
      [203748.703130] RSP: 0018:ffff88006ff4b818  EFLAGS: 00010206
      [203748.703389] RAX: 0000000008620029 RBX: ffff88006ff4b910 RCX: 0000000000000000
      [203748.703885] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00000000023079fe
      [203748.704382] RBP: ffff88006ff4b8d8 R08: 0000000000000000 R09: ffff8807578c25b0
      [203748.704877] R10: 000000000f637376 R11: 000000003030322e R12: 0000000000000000
      [203748.705373] R13: ffff88006ff4b910 R14: ffff880732fe38f0 R15: 0000000000000000
      [203748.705871] FS:  00007f401992c700(0000) GS:ffff880bfebc0000(0000) knlGS:0000000000000000
      [203748.706370] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [203748.706627] CR2: 00007f4019252440 CR3: 00000000a621e000 CR4: 0000000000060670
      [203748.707124] Stack:
      [203748.707371]  ffff88006ff4b828 ffffffffa0609f52 ffff88006ff4b838 0000000000000001
      [203748.707885]  0000000000000000 0000000000000000 ffff880bf67c3800 ffffffffa05eca00
      [203748.708399]  00000000023079ff ffffffff81c58b80 0000000000000000 0000000000000000
      [203748.708915] Call Trace:
      [203748.709175]  [<ffffffffa0609f52>] ? ocfs2_inode_cache_io_unlock+0x12/0x20 [ocfs2]
      [203748.709680]  [<ffffffffa05eca00>] ? ocfs2_empty_dir_filldir+0x80/0x80 [ocfs2]
      [203748.710185]  [<ffffffffa05ec0cb>] ocfs2_read_dir_block_direct+0x3b/0x200 [ocfs2]
      [203748.710691]  [<ffffffffa05f0fbf>] ocfs2_prepare_dx_dir_for_insert.isra.57+0x19f/0xf60 [ocfs2]
      [203748.711204]  [<ffffffffa065660f>] ? ocfs2_metadata_cache_io_unlock+0x1f/0x30 [ocfs2]
      [203748.711716]  [<ffffffffa05f4f3a>] ocfs2_prepare_dir_for_insert+0x13a/0x890 [ocfs2]
      [203748.712227]  [<ffffffffa05f442e>] ? ocfs2_check_dir_for_entry+0x8e/0x140 [ocfs2]
      [203748.712737]  [<ffffffffa061b2f2>] ocfs2_mknod+0x4b2/0x1370 [ocfs2]
      [203748.713003]  [<ffffffffa061c385>] ocfs2_create+0x65/0x170 [ocfs2]
      [203748.713263]  [<ffffffff8121714b>] vfs_create+0xdb/0x150
      [203748.713518]  [<ffffffff8121b225>] do_last+0x815/0x1210
      [203748.713772]  [<ffffffff812192e9>] ? path_init+0xb9/0x450
      [203748.714123]  [<ffffffff8121bca0>] path_openat+0x80/0x600
      [203748.714378]  [<ffffffff811bcd45>] ? handle_pte_fault+0xd15/0x1620
      [203748.714634]  [<ffffffff8121d7ba>] do_filp_open+0x3a/0xb0
      [203748.714888]  [<ffffffff8122a767>] ? __alloc_fd+0xa7/0x130
      [203748.715143]  [<ffffffff81209ffc>] do_sys_open+0x12c/0x220
      [203748.715403]  [<ffffffff81026ddb>] ? syscall_trace_enter_phase1+0x11b/0x180
      [203748.715668]  [<ffffffff816f0c9f>] ? system_call_after_swapgs+0xe9/0x190
      [203748.715928]  [<ffffffff8120a10e>] SyS_open+0x1e/0x20
      [203748.716184]  [<ffffffff816f0d5e>] system_call_fastpath+0x18/0xd7
      [203748.716440] Code: 00 00 48 8b 7b 08 48 83 c3 10 45 89 f8 44 89 e1 44 89 f2 4c 89 ee e8 07 06 11 e1 48 8b 03 48 85 c0 75 df 8b 5d c8 e9 4d fa ff ff <0f> 0b 48 8b 7d a0 e8 dc c6 06 00 48 b8 00 00 00 00 00 00 00 10
      [203748.717505] RIP  [<ffffffffa05e9f09>] ocfs2_read_blocks+0x669/0x7f0 [ocfs2]
      [203748.717775]  RSP <ffff88006ff4b818>
      
      Joesph ever reported a similar panic.
      Link: https://oss.oracle.com/pipermail/ocfs2-devel/2013-May/008931.html
      
      Link: http://lkml.kernel.org/r/20180912063207.29484-1-junxiao.bi@oracle.comSigned-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Joseph Qi <jiangqi903@gmail.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Changwei Ge <ge.changwei@h3c.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c1ca8fb
    • Richard Weinberger's avatar
      Revert "ubifs: xattr: Don't operate on deleted inodes" · 1d7e23f9
      Richard Weinberger authored
      commit f061c1cc upstream.
      
      This reverts commit 11a6fc3d.
      UBIFS wants to assert that xattr operations are only issued on files
      with positive link count. The said patch made this operations return
      -ENOENT for unlinked files such that the asserts will no longer trigger.
      This was wrong since xattr operations are perfectly fine on unlinked
      files.
      Instead the assertions need to be fixed/removed.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 11a6fc3d ("ubifs: xattr: Don't operate on deleted inodes")
      Reported-by: default avatarKoen Vandeputte <koen.vandeputte@ncentric.com>
      Tested-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d7e23f9
    • Vincent Pelletier's avatar
    • Vincent Pelletier's avatar
      scsi: target: iscsi: Use hex2bin instead of a re-implementation · 755e45f3
      Vincent Pelletier authored
      commit 18164943 upstream.
      
      This change has the following effects, in order of descreasing importance:
      
      1) Prevent a stack buffer overflow
      
      2) Do not append an unnecessary NULL to an anyway binary buffer, which
         is writing one byte past client_digest when caller is:
         chap_string_to_hex(client_digest, chap_r, strlen(chap_r));
      
      The latter was found by KASAN (see below) when input value hes expected size
      (32 hex chars), and further analysis revealed a stack buffer overflow can
      happen when network-received value is longer, allowing an unauthenticated
      remote attacker to smash up to 17 bytes after destination buffer (16 bytes
      attacker-controlled and one null).  As switching to hex2bin requires
      specifying destination buffer length, and does not internally append any null,
      it solves both issues.
      
      This addresses CVE-2018-14633.
      
      Beyond this:
      
      - Validate received value length and check hex2bin accepted the input, to log
        this rejection reason instead of just failing authentication.
      
      - Only log received CHAP_R and CHAP_C values once they passed sanity checks.
      
      ==================================================================
      BUG: KASAN: stack-out-of-bounds in chap_string_to_hex+0x32/0x60 [iscsi_target_mod]
      Write of size 1 at addr ffff8801090ef7c8 by task kworker/0:0/1021
      
      CPU: 0 PID: 1021 Comm: kworker/0:0 Tainted: G           O      4.17.8kasan.sess.connops+ #2
      Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 05/19/2014
      Workqueue: events iscsi_target_do_login_rx [iscsi_target_mod]
      Call Trace:
       dump_stack+0x71/0xac
       print_address_description+0x65/0x22e
       ? chap_string_to_hex+0x32/0x60 [iscsi_target_mod]
       kasan_report.cold.6+0x241/0x2fd
       chap_string_to_hex+0x32/0x60 [iscsi_target_mod]
       chap_server_compute_md5.isra.2+0x2cb/0x860 [iscsi_target_mod]
       ? chap_binaryhex_to_asciihex.constprop.5+0x50/0x50 [iscsi_target_mod]
       ? ftrace_caller_op_ptr+0xe/0xe
       ? __orc_find+0x6f/0xc0
       ? unwind_next_frame+0x231/0x850
       ? kthread+0x1a0/0x1c0
       ? ret_from_fork+0x35/0x40
       ? ret_from_fork+0x35/0x40
       ? iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
       ? deref_stack_reg+0xd0/0xd0
       ? iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
       ? is_module_text_address+0xa/0x11
       ? kernel_text_address+0x4c/0x110
       ? __save_stack_trace+0x82/0x100
       ? ret_from_fork+0x35/0x40
       ? save_stack+0x8c/0xb0
       ? 0xffffffffc1660000
       ? iscsi_target_do_login+0x155/0x8d0 [iscsi_target_mod]
       ? iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
       ? process_one_work+0x35c/0x640
       ? worker_thread+0x66/0x5d0
       ? kthread+0x1a0/0x1c0
       ? ret_from_fork+0x35/0x40
       ? iscsi_update_param_value+0x80/0x80 [iscsi_target_mod]
       ? iscsit_release_cmd+0x170/0x170 [iscsi_target_mod]
       chap_main_loop+0x172/0x570 [iscsi_target_mod]
       ? chap_server_compute_md5.isra.2+0x860/0x860 [iscsi_target_mod]
       ? rx_data+0xd6/0x120 [iscsi_target_mod]
       ? iscsit_print_session_params+0xd0/0xd0 [iscsi_target_mod]
       ? cyc2ns_read_begin.part.2+0x90/0x90
       ? _raw_spin_lock_irqsave+0x25/0x50
       ? memcmp+0x45/0x70
       iscsi_target_do_login+0x875/0x8d0 [iscsi_target_mod]
       ? iscsi_target_check_first_request.isra.5+0x1a0/0x1a0 [iscsi_target_mod]
       ? del_timer+0xe0/0xe0
       ? memset+0x1f/0x40
       ? flush_sigqueue+0x29/0xd0
       iscsi_target_do_login_rx+0x3bc/0x4c0 [iscsi_target_mod]
       ? iscsi_target_nego_release+0x80/0x80 [iscsi_target_mod]
       ? iscsi_target_restore_sock_callbacks+0x130/0x130 [iscsi_target_mod]
       process_one_work+0x35c/0x640
       worker_thread+0x66/0x5d0
       ? flush_rcu_work+0x40/0x40
       kthread+0x1a0/0x1c0
       ? kthread_bind+0x30/0x30
       ret_from_fork+0x35/0x40
      
      The buggy address belongs to the page:
      page:ffffea0004243bc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
      flags: 0x17fffc000000000()
      raw: 017fffc000000000 0000000000000000 0000000000000000 00000000ffffffff
      raw: ffffea0004243c20 ffffea0004243ba0 0000000000000000 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8801090ef680: f2 f2 f2 f2 f2 f2 f2 01 f2 f2 f2 f2 f2 f2 f2 00
       ffff8801090ef700: f2 f2 f2 f2 f2 f2 f2 00 02 f2 f2 f2 f2 f2 f2 00
      >ffff8801090ef780: 00 f2 f2 f2 f2 f2 f2 00 00 f2 f2 f2 f2 f2 f2 00
                                                    ^
       ffff8801090ef800: 00 f2 f2 f2 f2 f2 f2 00 00 00 00 02 f2 f2 f2 f2
       ffff8801090ef880: f2 f2 f2 00 00 00 00 00 00 00 00 f2 f2 f2 f2 00
      ==================================================================
      Signed-off-by: default avatarVincent Pelletier <plr.vincent@gmail.com>
      Reviewed-by: default avatarMike Christie <mchristi@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      755e45f3
    • Lubomir Rintel's avatar
      Revert "uapi/linux/keyctl.h: don't use C++ reserved keyword as a struct member name" · 50ec69ed
      Lubomir Rintel authored
      commit 8c0f9f5b upstream.
      
      This changes UAPI, breaking iwd and libell:
      
        ell/key.c: In function 'kernel_dh_compute':
        ell/key.c:205:38: error: 'struct keyctl_dh_params' has no member named 'private'; did you mean 'dh_private'?
          struct keyctl_dh_params params = { .private = private,
                                              ^~~~~~~
                                              dh_private
      
      This reverts commit 8a2336e5.
      
      Fixes: 8a2336e5 ("uapi/linux/keyctl.h: don't use C++ reserved keyword as a struct member name")
      Signed-off-by: default avatarLubomir Rintel <lkundrak@v3.sk>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Randy Dunlap <rdunlap@infradead.org>
      cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
      cc: Stephan Mueller <smueller@chronox.de>
      cc: James Morris <jmorris@namei.org>
      cc: "Serge E. Hallyn" <serge@hallyn.com>
      cc: Mat Martineau <mathew.j.martineau@linux.intel.com>
      cc: Andrew Morton <akpm@linux-foundation.org>
      cc: Linus Torvalds <torvalds@linux-foundation.org>
      cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJames Morris <james.morris@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      50ec69ed
    • Greg Kroah-Hartman's avatar
      Revert "rpmsg: core: add support to power domains for devices" · 13d21616
      Greg Kroah-Hartman authored
      This reverts commit 1ed3a930 which is
      commit fe782aff upstream
      
      Rafael reports that this patch causes problems:
      	> -rc2 looks good. There is a problem on dragonboard during boot that was
      	> introduced in v4.14.71 that I didn't notice last week. We'll bisect it
      	> and report back later this week. dragonboard on the other branches (4.9,
      	> 4.18, mainline) looks fine.
      
      	As Dan pointed out, during validation, we have bisected this issue on
      	a dragonboard 410c (can't find root device) to the following commit
      	for v4.14:
      
      	[1ed3a930] rpmsg: core: add support to power domains for devices
      
      	There is an on-going discussion on "[PATCH] rpmsg: core: add support
      	to power domains for devices" about this patch having other
      	dependencies and breaking something else on v4.14 as well.
      
      so drop it.
      Reported-by: default avatarRafael Tinoco <rafael.tinoco@linaro.org>
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
      Cc: Sasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      13d21616
    • Joel Fernandes (Google)'s avatar
      mm: shmem.c: Correctly annotate new inodes for lockdep · 6447b34f
      Joel Fernandes (Google) authored
      commit b45d71fb upstream.
      
      Directories and inodes don't necessarily need to be in the same lockdep
      class.  For ex, hugetlbfs splits them out too to prevent false positives
      in lockdep.  Annotate correctly after new inode creation.  If its a
      directory inode, it will be put into a different class.
      
      This should fix a lockdep splat reported by syzbot:
      
      > ======================================================
      > WARNING: possible circular locking dependency detected
      > 4.18.0-rc8-next-20180810+ #36 Not tainted
      > ------------------------------------------------------
      > syz-executor900/4483 is trying to acquire lock:
      > 00000000d2bfc8fe (&sb->s_type->i_mutex_key#9){++++}, at: inode_lock
      > include/linux/fs.h:765 [inline]
      > 00000000d2bfc8fe (&sb->s_type->i_mutex_key#9){++++}, at:
      > shmem_fallocate+0x18b/0x12e0 mm/shmem.c:2602
      >
      > but task is already holding lock:
      > 0000000025208078 (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0xb4/0x630
      > drivers/staging/android/ashmem.c:448
      >
      > which lock already depends on the new lock.
      >
      > -> #2 (ashmem_mutex){+.+.}:
      >        __mutex_lock_common kernel/locking/mutex.c:925 [inline]
      >        __mutex_lock+0x171/0x1700 kernel/locking/mutex.c:1073
      >        mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088
      >        ashmem_mmap+0x55/0x520 drivers/staging/android/ashmem.c:361
      >        call_mmap include/linux/fs.h:1844 [inline]
      >        mmap_region+0xf27/0x1c50 mm/mmap.c:1762
      >        do_mmap+0xa10/0x1220 mm/mmap.c:1535
      >        do_mmap_pgoff include/linux/mm.h:2298 [inline]
      >        vm_mmap_pgoff+0x213/0x2c0 mm/util.c:357
      >        ksys_mmap_pgoff+0x4da/0x660 mm/mmap.c:1585
      >        __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline]
      >        __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline]
      >        __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91
      >        do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
      >        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      >
      > -> #1 (&mm->mmap_sem){++++}:
      >        __might_fault+0x155/0x1e0 mm/memory.c:4568
      >        _copy_to_user+0x30/0x110 lib/usercopy.c:25
      >        copy_to_user include/linux/uaccess.h:155 [inline]
      >        filldir+0x1ea/0x3a0 fs/readdir.c:196
      >        dir_emit_dot include/linux/fs.h:3464 [inline]
      >        dir_emit_dots include/linux/fs.h:3475 [inline]
      >        dcache_readdir+0x13a/0x620 fs/libfs.c:193
      >        iterate_dir+0x48b/0x5d0 fs/readdir.c:51
      >        __do_sys_getdents fs/readdir.c:231 [inline]
      >        __se_sys_getdents fs/readdir.c:212 [inline]
      >        __x64_sys_getdents+0x29f/0x510 fs/readdir.c:212
      >        do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
      >        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      >
      > -> #0 (&sb->s_type->i_mutex_key#9){++++}:
      >        lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924
      >        down_write+0x8f/0x130 kernel/locking/rwsem.c:70
      >        inode_lock include/linux/fs.h:765 [inline]
      >        shmem_fallocate+0x18b/0x12e0 mm/shmem.c:2602
      >        ashmem_shrink_scan+0x236/0x630 drivers/staging/android/ashmem.c:455
      >        ashmem_ioctl+0x3ae/0x13a0 drivers/staging/android/ashmem.c:797
      >        vfs_ioctl fs/ioctl.c:46 [inline]
      >        file_ioctl fs/ioctl.c:501 [inline]
      >        do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
      >        ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
      >        __do_sys_ioctl fs/ioctl.c:709 [inline]
      >        __se_sys_ioctl fs/ioctl.c:707 [inline]
      >        __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
      >        do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
      >        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      >
      > other info that might help us debug this:
      >
      > Chain exists of:
      >   &sb->s_type->i_mutex_key#9 --> &mm->mmap_sem --> ashmem_mutex
      >
      >  Possible unsafe locking scenario:
      >
      >        CPU0                    CPU1
      >        ----                    ----
      >   lock(ashmem_mutex);
      >                                lock(&mm->mmap_sem);
      >                                lock(ashmem_mutex);
      >   lock(&sb->s_type->i_mutex_key#9);
      >
      >  *** DEADLOCK ***
      >
      > 1 lock held by syz-executor900/4483:
      >  #0: 0000000025208078 (ashmem_mutex){+.+.}, at:
      > ashmem_shrink_scan+0xb4/0x630 drivers/staging/android/ashmem.c:448
      
      Link: http://lkml.kernel.org/r/20180821231835.166639-1-joel@joelfernandes.orgSigned-off-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reviewed-by: default avatarNeilBrown <neilb@suse.com>
      Suggested-by: default avatarNeilBrown <neilb@suse.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6447b34f
    • Vaibhav Nagarnaik's avatar
      ring-buffer: Allow for rescheduling when removing pages · 7eba38a3
      Vaibhav Nagarnaik authored
      commit 83f36555 upstream.
      
      When reducing ring buffer size, pages are removed by scheduling a work
      item on each CPU for the corresponding CPU ring buffer. After the pages
      are removed from ring buffer linked list, the pages are free()d in a
      tight loop. The loop does not give up CPU until all pages are removed.
      In a worst case behavior, when lot of pages are to be freed, it can
      cause system stall.
      
      After the pages are removed from the list, the free() can happen while
      the work is rescheduled. Call cond_resched() in the loop to prevent the
      system hangup.
      
      Link: http://lkml.kernel.org/r/20180907223129.71994-1-vnagarnaik@google.com
      
      Cc: stable@vger.kernel.org
      Fixes: 83f40318 ("ring-buffer: Make removal of ring buffer pages atomic")
      Reported-by: default avatarJason Behmer <jbehmer@google.com>
      Signed-off-by: default avatarVaibhav Nagarnaik <vnagarnaik@google.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7eba38a3
    • Mika Westerberg's avatar
      Revert "PCI: Add ACS quirk for Intel 300 series" · 0e5cdbac
      Mika Westerberg authored
      commit 50ca031b upstream.
      
      This reverts f154a718 ("PCI: Add ACS quirk for Intel 300 series").
      
      It turns out that erratum "PCH PCIe* Controller Root Port (ACSCTLR) Appear
      As Read Only" has been fixed in 300 series chipsets, even though the
      datasheet [1] claims otherwise.  To make ACS work properly on 300 series
      root ports, revert the faulty commit.
      
      [1] https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/300-series-c240-series-chipset-pch-spec-update.pdf
      
      Fixes: f154a718 ("PCI: Add ACS quirk for Intel 300 series")
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org	# v4.18+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e5cdbac
    • Kirill Kapranov's avatar
      spi: fix IDR collision on systems with both fixed and dynamic SPI bus numbers · f3765abb
      Kirill Kapranov authored
      commit 1a4327fb upstream.
      
      On systems where some controllers get a dynamic ID assigned and some have
      a fixed number (e.g. from ACPI tables), the current implementation might
      run into an IDR collision: in case of a fixed bus number is gotten by a
      driver (but not marked busy in IDR tree) and a driver with dynamic bus
      number gets the same ID and predictably fails.
      
      Fix this by means of checking-in fixed IDsin IDR as far as dynamic ones
      at the moment of the controller registration.
      
      Fixes: 9b61e302 (spi: Pick spi bus number from Linux idr or spi alias)
      Signed-off-by: default avatarKirill Kapranov <kirill.kapranov@compulab.co.il>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3765abb
    • Boris Ostrovsky's avatar
      xen/x86/vpmu: Zero struct pt_regs before calling into sample handling code · 5ca87a38
      Boris Ostrovsky authored
      commit 70513d58 upstream.
      
      Otherwise we may leak kernel stack for events that sample user
      registers.
      Reported-by: default avatarMark Rutland <mark.rutland@arm.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ca87a38
    • Juergen Gross's avatar
      xen/netfront: don't bug in case of too many frags · 7eced447
      Juergen Gross authored
      commit ad4f15dc upstream.
      
      Commit 57f230ab ("xen/netfront: raise max number of slots in
      xennet_get_responses()") raised the max number of allowed slots by one.
      This seems to be problematic in some configurations with netback using
      a larger MAX_SKB_FRAGS value (e.g. old Linux kernel with MAX_SKB_FRAGS
      defined as 18 instead of nowadays 17).
      
      Instead of BUG_ON() in this case just fall back to retransmission.
      
      Fixes: 57f230ab ("xen/netfront: raise max number of slots in xennet_get_responses()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7eced447
    • Mario Limonciello's avatar
      platform/x86: alienware-wmi: Correct a memory leak · e2d5285b
      Mario Limonciello authored
      commit ff0e9f26 upstream.
      
      An ACPI buffer that was allocated was not being freed after use.
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@dell.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2d5285b
    • Takashi Sakamoto's avatar
      ALSA: oxfw: fix memory leak of private data · ff680503
      Takashi Sakamoto authored
      commit 498fe23a upstream.
      
      Although private data of sound card instance is usually allocated in the
      tail of the instance, drivers in ALSA firewire stack allocate the private
      data before allocating the instance. In this case, the private data
      should be released explicitly at .private_free callback of the instance.
      
      This commit fixes memory leak following to the above design.
      
      Fixes: 6c29230e ('ALSA: oxfw: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff680503
    • Takashi Sakamoto's avatar
      ALSA: oxfw: fix memory leak of discovered stream formats at error path · 08f4f8b9
      Takashi Sakamoto authored
      commit 1064bc68 upstream.
      
      After finishing discover of stream formats, ALSA OXFW driver has memory
      leak of allocated memory object at error path.
      
      This commit releases the memory object at the error path.
      
      Fixes: 6c29230e ('ALSA: oxfw: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08f4f8b9
    • Takashi Sakamoto's avatar
      ALSA: oxfw: fix memory leak for model-dependent data at error path · 996899a9
      Takashi Sakamoto authored
      commit ce925f08 upstream.
      
      After allocating model-dependent data, ALSA OXFW driver has memory leak
      of the data at error path.
      
      This commit releases the data at the error path.
      
      Fixes: 6c29230e ('ALSA: oxfw: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      996899a9
    • Takashi Sakamoto's avatar
      ALSA: fireworks: fix memory leak of response buffer at error path · d9929097
      Takashi Sakamoto authored
      commit c3b55e2e upstream.
      
      After allocating memory object for response buffer, ALSA fireworks
      driver has leak of the memory object at error path.
      
      This commit releases the object at the error path.
      
      Fixes: 7d3c1d59('ALSA: fireworks: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9929097
    • Takashi Sakamoto's avatar
      ALSA: firewire-tascam: fix memory leak of private data · 40e2596f
      Takashi Sakamoto authored
      commit 8d28277c upstream.
      
      Although private data of sound card instance is usually allocated in the
      tail of the instance, drivers in ALSA firewire stack allocate the private
      data before allocating the instance. In this case, the private data
      should be released explicitly at .private_free callback of the instance.
      
      This commit fixes memory leak following to the above design.
      
      Fixes: b610386c ('ALSA: firewire-tascam: deleyed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40e2596f
    • Takashi Sakamoto's avatar
      ALSA: firewire-digi00x: fix memory leak of private data · 933f20a6
      Takashi Sakamoto authored
      commit a49a83ab upstream.
      
      Although private data of sound card instance is usually allocated in the
      tail of the instance, drivers in ALSA firewire stack allocate the private
      data before allocating the instance. In this case, the private data
      should be released explicitly at .private_free callback of the instance.
      
      This commit fixes memory leak following to the above design.
      
      Fixes: 86c8dd7f ('ALSA: firewire-digi00x: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      933f20a6
    • Takashi Sakamoto's avatar
      ALSA: fireface: fix memory leak in ff400_switch_fetching_mode() · 70165a44
      Takashi Sakamoto authored
      commit 36f3a6e0 upstream.
      
      An allocated memory forgets to be released.
      
      Fixes: 76fdb3a9 ('ALSA: fireface: add support for Fireface 400')
      Cc: <stable@vger.kernel.org> # 4.12+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70165a44
    • Willy Tarreau's avatar
      ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO · 352701c2
      Willy Tarreau authored
      commit 49434c6c upstream.
      
      snd_emu10k1_fx8010_ioctl(SNDRV_EMU10K1_IOCTL_INFO) allocates
      memory using kmalloc() and partially fills it by calling
      snd_emu10k1_fx8010_info() before returning the resulting
      structure to userspace, leaving uninitialized holes. Let's
      just use kzalloc() here.
      
      BugLink: http://blog.infosectcbr.com.au/2018/09/linux-kernel-infoleaks.htmlSigned-off-by: default avatarWilly Tarreau <w@1wt.eu>
      Cc: Jann Horn <jannh@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      352701c2
    • Takashi Sakamoto's avatar
      ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping · 7c4881d6
      Takashi Sakamoto authored
      commit 493626f2 upstream.
      
      When executing 'fw_run_transaction()' with 'TCODE_WRITE_BLOCK_REQUEST',
      an address of 'payload' argument is used for streaming DMA mapping by
      'firewire_ohci' module if 'size' argument is larger than 8 byte.
      Although in this case the address should not be on kernel stack, current
      implementation of ALSA bebob driver uses data in kernel stack for a cue
      to boot M-Audio devices. This often brings unexpected result, especially
      for a case of CONFIG_VMAP_STACK=y.
      
      This commit fixes the bug.
      
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=201021
      Reference: https://forum.manjaro.org/t/firewire-m-audio-410-driver-wont-load-firmware/51165
      Fixes: a2b2a779('ALSA: bebob: Send a cue to load firmware for M-Audio Firewire series')
      Cc: <stable@vger.kernel.org> # v3.16+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7c4881d6
    • Takashi Sakamoto's avatar
      ALSA: bebob: fix memory leak for M-Audio FW1814 and ProjectMix I/O at error path · 16b8c038
      Takashi Sakamoto authored
      commit b1fbebd4 upstream.
      
      After allocating model-dependent data for M-Audio FW1814 and ProjectMix
      I/O, ALSA bebob driver has memory leak at error path.
      
      This commit releases the allocated data at the error path.
      
      Fixes: 04a2c73c('ALSA: bebob: delayed registration of sound card')
      Cc: <stable@vger.kernel.org> # v4.7+
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      16b8c038
    • Jiada Wang's avatar
      ASoC: rsnd: fixup not to call clk_get/set under non-atomic · c7cf0304
      Jiada Wang authored
      commit 4d230d12 upstream.
      
      Clocking operations clk_get/set_rate, are non-atomic,
      they shouldn't be called in soc_pcm_trigger() which is atomic.
      
      Following issue was found due to execution of clk_get_rate() causes
      sleep in soc_pcm_trigger(), which shouldn't be blocked.
      
      We can reproduce this issue by following
      	> enable CONFIG_DEBUG_ATOMIC_SLEEP=y
      	> compile, and boot
      	> mount -t debugfs none /sys/kernel/debug
      	> while true; do cat /sys/kernel/debug/clk/clk_summary > /dev/null; done &
      	> while true; do aplay xxx; done
      
      This patch adds support to .prepare callback, and moves non-atomic
      clocking operations to it. As .prepare is non-atomic, it is always
      called before trigger_start/trigger_stop.
      
      	BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
      	in_atomic(): 1, irqs_disabled(): 128, pid: 2242, name: aplay
      	INFO: lockdep is turned off.
      	irq event stamp: 5964
      	hardirqs last enabled at (5963): [<ffff200008e59e40>] mutex_lock_nested+0x6e8/0x6f0
      	hardirqs last disabled at (5964): [<ffff200008e623f0>] _raw_spin_lock_irqsave+0x24/0x68
      	softirqs last enabled at (5502): [<ffff200008081838>] __do_softirq+0x560/0x10c0
      	softirqs last disabled at (5495): [<ffff2000080c2e78>] irq_exit+0x160/0x25c
      	Preemption disabled at:[ 62.904063] [<ffff200008be4d48>] snd_pcm_stream_lock+0xb4/0xc0
      	CPU: 2 PID: 2242 Comm: aplay Tainted: G B C 4.9.54+ #186
      	Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
      	Call trace:
      	[<ffff20000808fe48>] dump_backtrace+0x0/0x37c
      	[<ffff2000080901d8>] show_stack+0x14/0x1c
      	[<ffff2000086f4458>] dump_stack+0xfc/0x154
      	[<ffff2000081134a0>] ___might_sleep+0x57c/0x58c
      	[<ffff2000081136b8>] __might_sleep+0x208/0x21c
      	[<ffff200008e5980c>] mutex_lock_nested+0xb4/0x6f0
      	[<ffff2000087cac74>] clk_prepare_lock+0xb0/0x184
      	[<ffff2000087cb094>] clk_core_get_rate+0x14/0x54
      	[<ffff2000087cb0f4>] clk_get_rate+0x20/0x34
      	[<ffff20000113aa00>] rsnd_adg_ssi_clk_try_start+0x158/0x4f8 [snd_soc_rcar]
      	[<ffff20000113da00>] rsnd_ssi_init+0x668/0x7a0 [snd_soc_rcar]
      	[<ffff200001133ff4>] rsnd_soc_dai_trigger+0x4bc/0xcf8 [snd_soc_rcar]
      	[<ffff200008c1af24>] soc_pcm_trigger+0x2a4/0x2d4
      
      Fixes: e7d850dd ("ASoC: rsnd: use mod base common method on SSI-parent")
      Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
      Signed-off-by: default avatarTimo Wischer <twischer@de.adit-jv.com>
      [Kuninori: tidyup for upstream]
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Tested-by: default avatarHiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c7cf0304
    • Sébastien Szymanski's avatar
      ASoC: cs4265: fix MMTLR Data switch control · a388e6d7
      Sébastien Szymanski authored
      commit 90a3b7f8 upstream.
      
      The MMTLR bit is in the CS4265_SPDIF_CTL2 register at address 0x12 bit 0
      and not at address 0x0 bit 1. Fix this.
      Signed-off-by: default avatarSébastien Szymanski <sebastien.szymanski@armadeus.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a388e6d7
    • Suren Baghdasaryan's avatar
      NFC: Fix the number of pipes · 6ead7a8a
      Suren Baghdasaryan authored
      commit e285d5bf upstream.
      
      According to ETSI TS 102 622 specification chapter 4.4 pipe identifier
      is 7 bits long which allows for 128 unique pipe IDs. Because
      NFC_HCI_MAX_PIPES is used as the number of pipes supported and not
      as the max pipe ID, its value should be 128 instead of 127.
      
      nfc_hci_recv_from_llc extracts pipe ID from packet header using
      NFC_HCI_FRAGMENT(0x7F) mask which allows for pipe ID value of 127.
      Same happens when NCI_HCP_MSG_GET_PIPE() is being used. With
      pipes array having only 127 elements and pipe ID of 127 the OOB memory
      access will result.
      
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Allen Pais <allen.pais@oracle.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ead7a8a
    • Suren Baghdasaryan's avatar
      NFC: Fix possible memory corruption when handling SHDLC I-Frame commands · 4a16b3cd
      Suren Baghdasaryan authored
      commit 674d9de0 upstream.
      
      When handling SHDLC I-Frame commands "pipe" field used for indexing
      into an array should be checked before usage. If left unchecked it
      might access memory outside of the array of size NFC_HCI_MAX_PIPES(127).
      
      Malformed NFC HCI frames could be injected by a malicious NFC device
      communicating with the device being attacked (remote attack vector),
      or even by an attacker with physical access to the I2C bus such that
      they could influence the data transfers on that bus (local attack vector).
      skb->data is controlled by the attacker and has only been sanitized in
      the most trivial ways (CRC check), therefore we can consider the
      create_info struct and all of its members to tainted. 'create_info->pipe'
      with max value of 255 (uint8) is used to take an offset of the
      hdev->pipes array of 127 elements which can lead to OOB write.
      
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Allen Pais <allen.pais@oracle.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Suggested-by: default avatarKevin Deus <kdeus@google.com>
      Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a16b3cd
    • Sabrina Dubroca's avatar
      tls: clear key material from kernel memory when do_tls_setsockopt_conf fails · 18fef87e
      Sabrina Dubroca authored
      [ Upstream commit c844eb46 ]
      
      Fixes: 3c4d7559 ("tls: kernel TLS support")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18fef87e
    • Sabrina Dubroca's avatar
      tls: zero the crypto information from tls_context before freeing · 0c033429
      Sabrina Dubroca authored
      [ Upstream commit 86029d10 ]
      
      This contains key material in crypto_send_aes_gcm_128 and
      crypto_recv_aes_gcm_128.
      
      Introduce union tls_crypto_context, and replace the two identical
      unions directly embedded in struct tls_context with it. We can then
      use this union to clean up the memory in the new tls_ctx_free()
      function.
      
      Fixes: 3c4d7559 ("tls: kernel TLS support")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c033429
    • Sabrina Dubroca's avatar
      tls: don't copy the key out of tls12_crypto_info_aes_gcm_128 · 10cacaf1
      Sabrina Dubroca authored
      [ Upstream commit 7cba09c6 ]
      
      There's no need to copy the key to an on-stack buffer before calling
      crypto_aead_setkey().
      
      Fixes: 3c4d7559 ("tls: kernel TLS support")
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      10cacaf1
    • Davide Caratti's avatar
      net/sched: act_sample: fix NULL dereference in the data path · ee547ed7
      Davide Caratti authored
      [ Upstream commit 34043d25 ]
      
      Matteo reported the following splat, testing the datapath of TC 'sample':
      
       BUG: KASAN: null-ptr-deref in tcf_sample_act+0xc4/0x310
       Read of size 8 at addr 0000000000000000 by task nc/433
      
       CPU: 0 PID: 433 Comm: nc Not tainted 4.19.0-rc3-kvm #17
       Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS ?-20180531_142017-buildhw-08.phx2.fedoraproject.org-1.fc28 04/01/2014
       Call Trace:
        kasan_report.cold.6+0x6c/0x2fa
        tcf_sample_act+0xc4/0x310
        ? dev_hard_start_xmit+0x117/0x180
        tcf_action_exec+0xa3/0x160
        tcf_classify+0xdd/0x1d0
        htb_enqueue+0x18e/0x6b0
        ? deref_stack_reg+0x7a/0xb0
        ? htb_delete+0x4b0/0x4b0
        ? unwind_next_frame+0x819/0x8f0
        ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
        __dev_queue_xmit+0x722/0xca0
        ? unwind_get_return_address_ptr+0x50/0x50
        ? netdev_pick_tx+0xe0/0xe0
        ? save_stack+0x8c/0xb0
        ? kasan_kmalloc+0xbe/0xd0
        ? __kmalloc_track_caller+0xe4/0x1c0
        ? __kmalloc_reserve.isra.45+0x24/0x70
        ? __alloc_skb+0xdd/0x2e0
        ? sk_stream_alloc_skb+0x91/0x3b0
        ? tcp_sendmsg_locked+0x71b/0x15a0
        ? tcp_sendmsg+0x22/0x40
        ? __sys_sendto+0x1b0/0x250
        ? __x64_sys_sendto+0x6f/0x80
        ? do_syscall_64+0x5d/0x150
        ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
        ? __sys_sendto+0x1b0/0x250
        ? __x64_sys_sendto+0x6f/0x80
        ? do_syscall_64+0x5d/0x150
        ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
        ip_finish_output2+0x495/0x590
        ? ip_copy_metadata+0x2e0/0x2e0
        ? skb_gso_validate_network_len+0x6f/0x110
        ? ip_finish_output+0x174/0x280
        __tcp_transmit_skb+0xb17/0x12b0
        ? __tcp_select_window+0x380/0x380
        tcp_write_xmit+0x913/0x1de0
        ? __sk_mem_schedule+0x50/0x80
        tcp_sendmsg_locked+0x49d/0x15a0
        ? tcp_rcv_established+0x8da/0xa30
        ? tcp_set_state+0x220/0x220
        ? clear_user+0x1f/0x50
        ? iov_iter_zero+0x1ae/0x590
        ? __fget_light+0xa0/0xe0
        tcp_sendmsg+0x22/0x40
        __sys_sendto+0x1b0/0x250
        ? __ia32_sys_getpeername+0x40/0x40
        ? _copy_to_user+0x58/0x70
        ? poll_select_copy_remaining+0x176/0x200
        ? __pollwait+0x1c0/0x1c0
        ? ktime_get_ts64+0x11f/0x140
        ? kern_select+0x108/0x150
        ? core_sys_select+0x360/0x360
        ? vfs_read+0x127/0x150
        ? kernel_write+0x90/0x90
        __x64_sys_sendto+0x6f/0x80
        do_syscall_64+0x5d/0x150
        entry_SYSCALL_64_after_hwframe+0x44/0xa9
       RIP: 0033:0x7fefef2b129d
       Code: ff ff ff ff eb b6 0f 1f 80 00 00 00 00 48 8d 05 51 37 0c 00 41 89 ca 8b 00 85 c0 75 20 45 31 c9 45 31 c0 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 6b f3 c3 66 0f 1f 84 00 00 00 00 00 41 56 41
       RSP: 002b:00007fff2f5350c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
       RAX: ffffffffffffffda RBX: 000056118d60c120 RCX: 00007fefef2b129d
       RDX: 0000000000002000 RSI: 000056118d629320 RDI: 0000000000000003
       RBP: 000056118d530370 R08: 0000000000000000 R09: 0000000000000000
       R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000002000
       R13: 000056118d5c2a10 R14: 000056118d5c2a10 R15: 000056118d5303b8
      
      tcf_sample_act() tried to update its per-cpu stats, but tcf_sample_init()
      forgot to allocate them, because tcf_idr_create() was called with a wrong
      value of 'cpustats'. Setting it to true proved to fix the reported crash.
      Reported-by: default avatarMatteo Croce <mcroce@redhat.com>
      Fixes: 65a206c0 ("net/sched: Change act_api and act_xxx modules to use IDR")
      Fixes: 5c5670fa ("net/sched: Introduce sample tc action")
      Tested-by: default avatarMatteo Croce <mcroce@redhat.com>
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee547ed7
    • Paolo Abeni's avatar
      udp6: add missing checks on edumux packet processing · b13f721a
      Paolo Abeni authored
      [ Upstream commit eb63f296 ]
      
      Currently the UDPv6 early demux rx code path lacks some mandatory
      checks, already implemented into the normal RX code path - namely
      the checksum conversion and no_check6_rx check.
      
      Similar to the previous commit, we move the common processing to
      an UDPv6 specific helper and call it from both edemux code path
      and normal code path. In respect to the UDPv4, we need to add an
      explicit check for non zero csum according to no_check6_rx value.
      Reported-by: default avatarJianlin Shi <jishi@redhat.com>
      Suggested-by: default avatarXin Long <lucien.xin@gmail.com>
      Fixes: c9f2c1ae ("udp6: fix socket leak on early demux")
      Fixes: 2abb7cdc ("udp: Add support for doing checksum unnecessary conversion")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b13f721a
    • Vasily Khoruzhick's avatar
      neighbour: confirm neigh entries when ARP packet is received · ff64a1a2
      Vasily Khoruzhick authored
      [ Upstream commit f0e0d044 ]
      
      Update 'confirmed' timestamp when ARP packet is received. It shouldn't
      affect locktime logic and anyway entry can be confirmed by any higher-layer
      protocol. Thus it makes sense to confirm it when ARP packet is received.
      
      Fixes: 77d71233 ("neighbour: update neigh timestamps iff update is effective")
      Signed-off-by: default avatarVasily Khoruzhick <vasilykh@arista.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff64a1a2
    • Paolo Abeni's avatar
      udp4: fix IP_CMSG_CHECKSUM for connected sockets · 0f6f77f3
      Paolo Abeni authored
      [ Upstream commit 2b5a9217 ]
      
      commit 2abb7cdc ("udp: Add support for doing checksum
      unnecessary conversion") left out the early demux path for
      connected sockets. As a result IP_CMSG_CHECKSUM gives wrong
      values for such socket when GRO is not enabled/available.
      
      This change addresses the issue by moving the csum conversion to a
      common helper and using such helper in both the default and the
      early demux rx path.
      
      Fixes: 2abb7cdc ("udp: Add support for doing checksum unnecessary conversion")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f6f77f3
    • Bjørn Mork's avatar
      qmi_wwan: set DTR for modems in forced USB2 mode · 6f5ec16e
      Bjørn Mork authored
      [ Upstream commit 922005c7 ]
      
      Recent firmware revisions have added the ability to force
      these modems to USB2 mode, hiding their SuperSpeed
      capabilities from the host.  The driver has been using the
      SuperSpeed capability, as shown by the bcdUSB field of the
      device descriptor, to detect the need to enable the DTR
      quirk.  This method fails when the modems are forced to
      USB2 mode by the modem firmware.
      
      Fix by unconditionally enabling the DTR quirk for the
      affected device IDs.
      Reported-by: default avatarFred Veldini <fred.veldini@gmail.com>
      Reported-by: default avatarDeshu Wen <dwen@sierrawireless.com>
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Reported-by: default avatarFred Veldini <fred.veldini@gmail.com>
      Reported-by: default avatarDeshu Wen <dwen@sierrawireless.com>
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6f5ec16e
    • Guillaume Nault's avatar
      pppoe: fix reception of frames with no mac header · f3aa1f3a
      Guillaume Nault authored
      [ Upstream commit 8540827e ]
      
      pppoe_rcv() needs to look back at the Ethernet header in order to
      lookup the PPPoE session. Therefore we need to ensure that the mac
      header is big enough to contain an Ethernet header. Otherwise
      eth_hdr(skb)->h_source might access invalid data.
      
      ==================================================================
      BUG: KMSAN: uninit-value in __get_item drivers/net/ppp/pppoe.c:172 [inline]
      BUG: KMSAN: uninit-value in get_item drivers/net/ppp/pppoe.c:236 [inline]
      BUG: KMSAN: uninit-value in pppoe_rcv+0xcef/0x10e0 drivers/net/ppp/pppoe.c:450
      CPU: 0 PID: 4543 Comm: syz-executor355 Not tainted 4.16.0+ #87
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
      01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:17 [inline]
       dump_stack+0x185/0x1d0 lib/dump_stack.c:53
       kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
       __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683
       __get_item drivers/net/ppp/pppoe.c:172 [inline]
       get_item drivers/net/ppp/pppoe.c:236 [inline]
       pppoe_rcv+0xcef/0x10e0 drivers/net/ppp/pppoe.c:450
       __netif_receive_skb_core+0x47df/0x4a90 net/core/dev.c:4562
       __netif_receive_skb net/core/dev.c:4627 [inline]
       netif_receive_skb_internal+0x49d/0x630 net/core/dev.c:4701
       netif_receive_skb+0x230/0x240 net/core/dev.c:4725
       tun_rx_batched drivers/net/tun.c:1555 [inline]
       tun_get_user+0x740f/0x7c60 drivers/net/tun.c:1962
       tun_chr_write_iter+0x1d4/0x330 drivers/net/tun.c:1990
       call_write_iter include/linux/fs.h:1782 [inline]
       new_sync_write fs/read_write.c:469 [inline]
       __vfs_write+0x7fb/0x9f0 fs/read_write.c:482
       vfs_write+0x463/0x8d0 fs/read_write.c:544
       SYSC_write+0x172/0x360 fs/read_write.c:589
       SyS_write+0x55/0x80 fs/read_write.c:581
       do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      RIP: 0033:0x4447c9
      RSP: 002b:00007fff64c8fc28 EFLAGS: 00000297 ORIG_RAX: 0000000000000001
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004447c9
      RDX: 000000000000fd87 RSI: 0000000020000600 RDI: 0000000000000004
      RBP: 00000000006cf018 R08: 00007fff64c8fda8 R09: 00007fff00006bda
      R10: 0000000000005fe7 R11: 0000000000000297 R12: 00000000004020d0
      R13: 0000000000402160 R14: 0000000000000000 R15: 0000000000000000
      
      Uninit was created at:
       kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
       kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188
       kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314
       kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321
       slab_post_alloc_hook mm/slab.h:445 [inline]
       slab_alloc_node mm/slub.c:2737 [inline]
       __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369
       __kmalloc_reserve net/core/skbuff.c:138 [inline]
       __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206
       alloc_skb include/linux/skbuff.h:984 [inline]
       alloc_skb_with_frags+0x1d4/0xb20 net/core/skbuff.c:5234
       sock_alloc_send_pskb+0xb56/0x1190 net/core/sock.c:2085
       tun_alloc_skb drivers/net/tun.c:1532 [inline]
       tun_get_user+0x2242/0x7c60 drivers/net/tun.c:1829
       tun_chr_write_iter+0x1d4/0x330 drivers/net/tun.c:1990
       call_write_iter include/linux/fs.h:1782 [inline]
       new_sync_write fs/read_write.c:469 [inline]
       __vfs_write+0x7fb/0x9f0 fs/read_write.c:482
       vfs_write+0x463/0x8d0 fs/read_write.c:544
       SYSC_write+0x172/0x360 fs/read_write.c:589
       SyS_write+0x55/0x80 fs/read_write.c:581
       do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      ==================================================================
      
      Fixes: 224cf5ad ("ppp: Move the PPP drivers")
      Reported-by: syzbot+f5f6080811c849739212@syzkaller.appspotmail.com
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3aa1f3a
    • Colin Ian King's avatar
      net: hp100: fix always-true check for link up state · c0f2c063
      Colin Ian King authored
      [ Upstream commit a7f38002 ]
      
      The operation ~(p100_inb(VG_LAN_CFG_1) & HP100_LINK_UP) returns a value
      that is always non-zero and hence the wait for the link to drop always
      terminates prematurely.  Fix this by using a logical not operator instead
      of a bitwise complement.  This issue has been in the driver since
      pre-2.6.12-rc2.
      
      Detected by CoverityScan, CID#114157 ("Logical vs. bitwise operator")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c0f2c063