1. 10 11月, 2020 6 次提交
    • A
      firmware: xilinx: fix out-of-bounds access · f3217d6f
      Arnd Bergmann 提交于
      The zynqmp_pm_set_suspend_mode() and zynqmp_pm_get_trustzone_version()
      functions pass values as api_id into zynqmp_pm_invoke_fn
      that are beyond PM_API_MAX, resulting in an out-of-bounds access:
      
      drivers/firmware/xilinx/zynqmp.c: In function 'zynqmp_pm_set_suspend_mode':
      drivers/firmware/xilinx/zynqmp.c:150:24: warning: array subscript 2562 is above array bounds of 'u32[64]' {aka 'unsigned int[64]'} [-Warray-bounds]
        150 |  if (zynqmp_pm_features[api_id] != PM_FEATURE_UNCHECKED)
            |      ~~~~~~~~~~~~~~~~~~^~~~~~~~
      drivers/firmware/xilinx/zynqmp.c:28:12: note: while referencing 'zynqmp_pm_features'
         28 | static u32 zynqmp_pm_features[PM_API_MAX];
            |            ^~~~~~~~~~~~~~~~~~
      
      Replace the resulting undefined behavior with an error return.
      This may break some things that happen to work at the moment
      but seems better than randomly overwriting kernel data.
      
      I assume we need additional fixes for the two functions that now
      return an error.
      
      Fixes: 76582671 ("firmware: xilinx: Add Zynqmp firmware driver")
      Fixes: e178df31 ("firmware: xilinx: Implement ZynqMP power management APIs")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20201026155449.3703142-1-arnd@kernel.org
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3217d6f
    • A
      nitro_enclaves: Fixup type and simplify logic of the poll mask setup · d9109fe0
      Andra Paraschiv 提交于
      Update the assigned value of the poll result to be EPOLLHUP instead of
      POLLHUP to match the __poll_t type.
      
      While at it, simplify the logic of setting the mask result of the poll
      function.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Reviewed-by: NAlexander Graf <graf@amazon.com>
      Signed-off-by: NAndra Paraschiv <andraprs@amazon.com>
      Link: https://lore.kernel.org/r/20201102173622.32169-1-andraprs@amazon.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9109fe0
    • S
      speakup ttyio: Do not schedule() in ttyio_in_nowait · 3ed1cfb2
      Samuel Thibault 提交于
      With the ltlk and spkout drivers, the index read function, i.e.
      in_nowait, is getting called from the read_all_doc mechanism, from
      the timer softirq:
      
      Call Trace:
       <IRQ>
       dump_stack+0x71/0x98
       dequeue_task_idle+0x1f/0x28
       __schedule+0x167/0x5d6
       ? trace_hardirqs_on+0x2e/0x3a
       ? usleep_range+0x7f/0x7f
       schedule+0x8a/0xae
       schedule_timeout+0xb1/0xea
       ? del_timer_sync+0x31/0x31
       do_wait_for_common+0xba/0x12b
       ? wake_up_q+0x45/0x45
       wait_for_common+0x37/0x50
       ttyio_in+0x2a/0x6b
       spk_ttyio_in_nowait+0xc/0x13
       spk_get_index_count+0x20/0x93
       cursor_done+0x1c6/0x4c6
       ? read_all_doc+0xb1/0xb1
       call_timer_fn+0x89/0x140
       run_timer_softirq+0x164/0x1a5
       ? read_all_doc+0xb1/0xb1
       ? hrtimer_forward+0x7b/0x87
       ? timerqueue_add+0x62/0x68
       ? enqueue_hrtimer+0x95/0x9f
       __do_softirq+0x181/0x31f
       irq_exit+0x6a/0x86
      smp_apic_timer_interrupt+0x15e/0x183
       apic_timer_interrupt+0xf/0x20
       </IRQ>
      
      We thus should not schedule() at all, even with timeout == 0, this
      crashes the kernel.  We can however use try_wait_for_completion()
      instead of wait_for_completion_timeout(0).
      
      Cc: stable@vger.kernel.org
      Reported-by: NJohn Covici <covici@ccs.covici.com>
      Tested-by: NJohn Covici <covici@ccs.covici.com>
      Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
      Link: https://lore.kernel.org/r/20201108131233.tadycr73sxlvodgo@functionSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ed1cfb2
    • S
      speakup: Fix clearing selection in safe context · 640969a6
      Samuel Thibault 提交于
      speakup_cut() calls speakup_clear_selection() which calls console_lock.
      Problem is: speakup_cut() is called from a keyboard interrupt
      context. This would hang if speakup_cut is pressed while the console
      lock is unfortunately already held.
      
      We can however as well just defer calling clear_selection() until the
      already-deferred set_selection_kernel() call.
      
      This was spotted by the lock hardener:
      
       Possible unsafe locking scenario:\x0a
             CPU0
             ----
        lock(console_lock);
        <Interrupt>
          lock(console_lock);
      \x0a *** DEADLOCK ***\x0a
      [...]
      Call Trace:
       <IRQ>
       dump_stack+0xc2/0x11a
       print_usage_bug.cold+0x3e0/0x4b1
       mark_lock+0xd95/0x1390
       ? print_irq_inversion_bug+0xa0/0xa0
       __lock_acquire+0x21eb/0x5730
       ? __kasan_check_read+0x11/0x20
       ? check_chain_key+0x215/0x5e0
       ? register_lock_class+0x1580/0x1580
       ? lock_downgrade+0x7a0/0x7a0
       ? __rwlock_init+0x140/0x140
       lock_acquire+0x13f/0x370
       ? speakup_clear_selection+0xe/0x20 [speakup]
       console_lock+0x33/0x50
       ? speakup_clear_selection+0xe/0x20 [speakup]
       speakup_clear_selection+0xe/0x20 [speakup]
       speakup_cut+0x19e/0x4b0 [speakup]
       keyboard_notifier_call+0x1f04/0x4a40 [speakup]
       ? read_all_doc+0x240/0x240 [speakup]
       notifier_call_chain+0xbf/0x130
       __atomic_notifier_call_chain+0x80/0x130
       atomic_notifier_call_chain+0x16/0x20
       kbd_event+0x7d7/0x3b20
       ? k_pad+0x850/0x850
       ? sysrq_filter+0x450/0xd40
       input_to_handler+0x362/0x4b0
       ? rcu_read_lock_sched_held+0xe0/0xe0
       input_pass_values+0x408/0x5a0
       ? __rwlock_init+0x140/0x140
       ? lock_acquire+0x13f/0x370
       input_handle_event+0x70e/0x1380
       input_event+0x67/0x90
       atkbd_interrupt+0xe62/0x1d4e [atkbd]
       ? __kasan_check_write+0x14/0x20
       ? atkbd_event_work+0x130/0x130 [atkbd]
       ? _raw_spin_lock_irqsave+0x26/0x70
       serio_interrupt+0x93/0x120 [serio]
       i8042_interrupt+0x232/0x510 [i8042]
       ? rcu_read_lock_bh_held+0xd0/0xd0
       ? handle_irq_event+0xa5/0x13a
       ? i8042_remove+0x1f0/0x1f0 [i8042]
       __handle_irq_event_percpu+0xe6/0x6c0
       handle_irq_event_percpu+0x71/0x150
       ? __handle_irq_event_percpu+0x6c0/0x6c0
       ? __kasan_check_read+0x11/0x20
       ? do_raw_spin_unlock+0x5c/0x240
       handle_irq_event+0xad/0x13a
       handle_edge_irq+0x233/0xa90
       do_IRQ+0x10b/0x310
       common_interrupt+0xf/0xf
       </IRQ>
      
      Cc: stable@vger.kernel.org
      Reported-by: NJookia <contact@jookia.org>
      Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
      Link: https://lore.kernel.org/r/20201107233310.7iisvaozpiqj3yvy@functionSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      640969a6
    • S
      speakup: Fix var_id_t values and thus keymap · d7012df3
      Samuel Thibault 提交于
      commit d97a9d7a ("staging/speakup: Add inflection synth parameter")
      introduced a new "inflection" speakup parameter next to "pitch", but
      the values of the var_id_t enum are actually used by the keymap tables
      so we must not renumber them. The effect was that notably the volume
      control shortcut (speakup-1 or 2) was actually changing the inflection.
      
      This moves the INFLECTION value at the end of the var_id_t enum to
      fix back the enum values. This also adds a warning about it.
      
      Fixes: d97a9d7a ("staging/speakup: Add inflection synth parameter")
      Cc: stable@vger.kernel.org
      Reported-by: NKirk Reiser <kirk@reisers.ca>
      Reported-by: NGregory Nowak <greg@gregn.net>
      Tested-by: NGregory Nowak <greg@gregn.net>
      Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
      Link: https://lore.kernel.org/r/20201012160646.qmdo4eqtj24hpch4@functionSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7012df3
    • A
      virtio: virtio_console: fix DMA memory allocation for rproc serial · 9d516aa8
      Alexander Lobakin 提交于
      Since commit 086d0872 ("remoteproc: create vdev subdevice with
      specific dma memory pool"), every remoteproc has a DMA subdevice
      ("remoteprocX#vdevYbuffer") for each virtio device, which inherits
      DMA capabilities from the corresponding platform device. This allowed
      to associate different DMA pools with each vdev, and required from
      virtio drivers to perform DMA operations with the parent device
      (vdev->dev.parent) instead of grandparent (vdev->dev.parent->parent).
      
      virtio_rpmsg_bus was already changed in the same merge cycle with
      commit d999b622 ("rpmsg: virtio: allocate buffer from parent"),
      but virtio_console did not. In fact, operations using the grandparent
      worked fine while the grandparent was the platform device, but since
      commit c774ad01 ("remoteproc: Fix and restore the parenting
      hierarchy for vdev") this was changed, and now the grandparent device
      is the remoteproc device without any DMA capabilities.
      So, starting v5.8-rc1 the following warning is observed:
      
      [    2.483925] ------------[ cut here ]------------
      [    2.489148] WARNING: CPU: 3 PID: 101 at kernel/dma/mapping.c:427 0x80e7eee8
      [    2.489152] Modules linked in: virtio_console(+)
      [    2.503737]  virtio_rpmsg_bus rpmsg_core
      [    2.508903]
      [    2.528898] <Other modules, stack and call trace here>
      [    2.913043]
      [    2.914907] ---[ end trace 93ac8746beab612c ]---
      [    2.920102] virtio-ports vport1p0: Error allocating inbufs
      
      kernel/dma/mapping.c:427 is:
      
      WARN_ON_ONCE(!dev->coherent_dma_mask);
      
      obviously because the grandparent now is remoteproc dev without any
      DMA caps:
      
      [    3.104943] Parent: remoteproc0#vdev1buffer, grandparent: remoteproc0
      
      Fix this the same way as it was for virtio_rpmsg_bus, using just the
      parent device (vdev->dev.parent, "remoteprocX#vdevYbuffer") for DMA
      operations.
      This also allows now to reserve DMA pools/buffers for rproc serial
      via Device Tree.
      
      Fixes: c774ad01 ("remoteproc: Fix and restore the parenting hierarchy for vdev")
      Cc: stable@vger.kernel.org # 5.1+
      Reviewed-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Acked-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NAlexander Lobakin <alobakin@pm.me>
      Date: Thu, 5 Nov 2020 11:10:24 +0800
      Link: https://lore.kernel.org/r/AOKowLclCbOCKxyiJ71WeNyuAAj2q8EUtxrXbyky5E@cp7-web-042.plabs.chSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d516aa8
  2. 04 11月, 2020 3 次提交
  3. 03 11月, 2020 1 次提交
  4. 31 10月, 2020 3 次提交
  5. 30 10月, 2020 26 次提交
    • L
      vdpasim: allow to assign a MAC address · 0c86d774
      Laurent Vivier 提交于
      Add macaddr parameter to the module to set the MAC address to use
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Link: https://lore.kernel.org/r/20201029122050.776445-3-lvivier@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NJason Wang <jasowang@redhat.com>
      0c86d774
    • L
      vdpasim: fix MAC address configuration · 4a6a42db
      Laurent Vivier 提交于
      vdpa_sim generates a ramdom MAC address but it is never used by upper
      layers because the VIRTIO_NET_F_MAC bit is not set in the features list.
      
      Because of that, virtio-net always regenerates a random MAC address each
      time it is loaded whereas the address should only change on vdpa_sim
      load/unload.
      
      Fix that by adding VIRTIO_NET_F_MAC in the features list of vdpa_sim.
      
      Fixes: 2c53d0f6 ("vdpasim: vDPA device simulator")
      Cc: jasowang@redhat.com
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Link: https://lore.kernel.org/r/20201029122050.776445-2-lvivier@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NJason Wang <jasowang@redhat.com>
      4a6a42db
    • Z
      vdpa: handle irq bypass register failure case · e01afe36
      Zhu Lingshan 提交于
      LKP considered variable 'ret' in vhost_vdpa_setup_vq_irq() as
      a unused variable, so suggest we remove it. Actually it stores
      return value of irq_bypass_register_producer(), but we did not
      check it, we should handle the failure case.
      
      This commit will print a message if irq bypass register producer
      fail, in this case, vqs still remain functional.
      Signed-off-by: NZhu Lingshan <lingshan.zhu@intel.com>
      Reported-by: Nkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/r/20201023104046.404794-1-lingshan.zhu@intel.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NJason Wang <jasowang@redhat.com>
      e01afe36
    • L
      vdpa_sim: Fix DMA mask · 1eca16b2
      Laurent Vivier 提交于
      Since commit f959dcd6
      ("dma-direct: Fix potential NULL pointer dereference")
      an error is reported when we load vdpa_sim and virtio-vdpa:
      
      [  129.351207] net eth0: Unexpected TXQ (0) queue failure: -12
      
      It seems that dma_mask is not initialized.
      
      This patch initializes dma_mask() and calls dma_set_mask_and_coherent()
      to fix the problem.
      
      Full log:
      
      [  128.548628] ------------[ cut here ]------------
      [  128.553268] WARNING: CPU: 23 PID: 1105 at kernel/dma/mapping.c:149 dma_map_page_attrs+0x14c/0x1d0
      [  128.562139] Modules linked in: virtio_net net_failover failover virtio_vdpa vdpa_sim vringh vhost_iotlb vdpa xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_counter nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnetlink tun bridge stp llc iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi rfkill intel_rapl_msr intel_rapl_common isst_if_common sunrpc skx_edac nfit libnvdimm x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel ipmi_ssif kvm mgag200 i2c_algo_bit irqbypass drm_kms_helper crct10dif_pclmul crc32_pclmul syscopyarea ghash_clmulni_intel iTCO_wdt sysfillrect iTCO_vendor_support sysimgblt rapl fb_sys_fops dcdbas intel_cstate drm acpi_ipmi ipmi_si mei_me dell_smbios intel_uncore ipmi_devintf mei i2c_i801 dell_wmi_descriptor wmi_bmof pcspkr lpc_ich i2c_smbus ipmi_msghandler acpi_power_meter ip_tables xfs libcrc32c sd_mod t10_pi sg ahci libahci libata megaraid_sas tg3 crc32c_intel wmi dm_mirror dm_region_hash dm_log
      [  128.562188]  dm_mod
      [  128.651334] CPU: 23 PID: 1105 Comm: NetworkManager Tainted: G S        I       5.10.0-rc1+ #59
      [  128.659939] Hardware name: Dell Inc. PowerEdge R440/04JN2K, BIOS 2.8.1 06/30/2020
      [  128.667419] RIP: 0010:dma_map_page_attrs+0x14c/0x1d0
      [  128.672384] Code: 1c 25 28 00 00 00 0f 85 97 00 00 00 48 83 c4 10 5b 5d 41 5c 41 5d c3 4c 89 da eb d7 48 89 f2 48 2b 50 18 48 89 d0 eb 8d 0f 0b <0f> 0b 48 c7 c0 ff ff ff ff eb c3 48 89 d9 48 8b 40 40 e8 2d a0 aa
      [  128.691131] RSP: 0018:ffffae0f0151f3c8 EFLAGS: 00010246
      [  128.696357] RAX: ffffffffc06b7400 RBX: 00000000000005fa RCX: 0000000000000000
      [  128.703488] RDX: 0000000000000040 RSI: ffffcee3c7861200 RDI: ffff9e2bc16cd000
      [  128.710620] RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000000000
      [  128.717754] R10: 0000000000000002 R11: 0000000000000000 R12: ffff9e472cb291f8
      [  128.724886] R13: ffff9e2bc14da780 R14: ffff9e472bc20000 R15: ffff9e2bc1b14940
      [  128.732020] FS:  00007f887bae23c0(0000) GS:ffff9e4ac01c0000(0000) knlGS:0000000000000000
      [  128.740105] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  128.745852] CR2: 0000562bc09de998 CR3: 00000003c156c006 CR4: 00000000007706e0
      [  128.752982] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  128.760114] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  128.767247] PKRU: 55555554
      [  128.769961] Call Trace:
      [  128.772418]  virtqueue_add+0x81e/0xb00
      [  128.776176]  virtqueue_add_inbuf_ctx+0x26/0x30
      [  128.780625]  try_fill_recv+0x3a2/0x6e0 [virtio_net]
      [  128.785509]  virtnet_open+0xf9/0x180 [virtio_net]
      [  128.790217]  __dev_open+0xe8/0x180
      [  128.793620]  __dev_change_flags+0x1a7/0x210
      [  128.797808]  dev_change_flags+0x21/0x60
      [  128.801646]  do_setlink+0x328/0x10e0
      [  128.805227]  ? __nla_validate_parse+0x121/0x180
      [  128.809757]  ? __nla_parse+0x21/0x30
      [  128.813338]  ? inet6_validate_link_af+0x5c/0xf0
      [  128.817871]  ? cpumask_next+0x17/0x20
      [  128.821535]  ? __snmp6_fill_stats64.isra.54+0x6b/0x110
      [  128.826676]  ? __nla_validate_parse+0x47/0x180
      [  128.831120]  __rtnl_newlink+0x541/0x8e0
      [  128.834962]  ? __nla_reserve+0x38/0x50
      [  128.838713]  ? security_sock_rcv_skb+0x2a/0x40
      [  128.843158]  ? netlink_deliver_tap+0x2c/0x1e0
      [  128.847518]  ? netlink_attachskb+0x1d8/0x220
      [  128.851793]  ? skb_queue_tail+0x1b/0x50
      [  128.855641]  ? fib6_clean_node+0x43/0x170
      [  128.859652]  ? _cond_resched+0x15/0x30
      [  128.863406]  ? kmem_cache_alloc_trace+0x3a3/0x420
      [  128.868110]  rtnl_newlink+0x43/0x60
      [  128.871602]  rtnetlink_rcv_msg+0x12c/0x380
      [  128.875701]  ? rtnl_calcit.isra.39+0x110/0x110
      [  128.880147]  netlink_rcv_skb+0x50/0x100
      [  128.883987]  netlink_unicast+0x1a5/0x280
      [  128.887913]  netlink_sendmsg+0x23d/0x470
      [  128.891839]  sock_sendmsg+0x5b/0x60
      [  128.895331]  ____sys_sendmsg+0x1ef/0x260
      [  128.899255]  ? copy_msghdr_from_user+0x5c/0x90
      [  128.903702]  ___sys_sendmsg+0x7c/0xc0
      [  128.907369]  ? dev_forward_change+0x130/0x130
      [  128.911731]  ? sysctl_head_finish.part.29+0x24/0x40
      [  128.916616]  ? new_sync_write+0x11f/0x1b0
      [  128.920628]  ? mntput_no_expire+0x47/0x240
      [  128.924727]  __sys_sendmsg+0x57/0xa0
      [  128.928309]  do_syscall_64+0x33/0x40
      [  128.931887]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  128.936937] RIP: 0033:0x7f88792e3857
      [  128.940518] Code: c3 66 90 41 54 41 89 d4 55 48 89 f5 53 89 fb 48 83 ec 10 e8 0b ed ff ff 44 89 e2 48 89 ee 89 df 41 89 c0 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 48 89 44 24 08 e8 44 ed ff ff 48
      [  128.959263] RSP: 002b:00007ffdca60dea0 EFLAGS: 00000293 ORIG_RAX: 000000000000002e
      [  128.966827] RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007f88792e3857
      [  128.973960] RDX: 0000000000000000 RSI: 00007ffdca60def0 RDI: 000000000000000c
      [  128.981095] RBP: 00007ffdca60def0 R08: 0000000000000000 R09: 0000000000000000
      [  128.988224] R10: 0000000000000001 R11: 0000000000000293 R12: 0000000000000000
      [  128.995357] R13: 0000000000000000 R14: 00007ffdca60e0a8 R15: 00007ffdca60e09c
      [  129.002492] CPU: 23 PID: 1105 Comm: NetworkManager Tainted: G S        I       5.10.0-rc1+ #59
      [  129.011093] Hardware name: Dell Inc. PowerEdge R440/04JN2K, BIOS 2.8.1 06/30/2020
      [  129.018571] Call Trace:
      [  129.021027]  dump_stack+0x57/0x6a
      [  129.024346]  __warn.cold.14+0xe/0x3d
      [  129.027925]  ? dma_map_page_attrs+0x14c/0x1d0
      [  129.032283]  report_bug+0xbd/0xf0
      [  129.035602]  handle_bug+0x44/0x80
      [  129.038922]  exc_invalid_op+0x13/0x60
      [  129.042589]  asm_exc_invalid_op+0x12/0x20
      [  129.046602] RIP: 0010:dma_map_page_attrs+0x14c/0x1d0
      [  129.051566] Code: 1c 25 28 00 00 00 0f 85 97 00 00 00 48 83 c4 10 5b 5d 41 5c 41 5d c3 4c 89 da eb d7 48 89 f2 48 2b 50 18 48 89 d0 eb 8d 0f 0b <0f> 0b 48 c7 c0 ff ff ff ff eb c3 48 89 d9 48 8b 40 40 e8 2d a0 aa
      [  129.070311] RSP: 0018:ffffae0f0151f3c8 EFLAGS: 00010246
      [  129.075536] RAX: ffffffffc06b7400 RBX: 00000000000005fa RCX: 0000000000000000
      [  129.082669] RDX: 0000000000000040 RSI: ffffcee3c7861200 RDI: ffff9e2bc16cd000
      [  129.089803] RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000000000
      [  129.096936] R10: 0000000000000002 R11: 0000000000000000 R12: ffff9e472cb291f8
      [  129.104068] R13: ffff9e2bc14da780 R14: ffff9e472bc20000 R15: ffff9e2bc1b14940
      [  129.111200]  virtqueue_add+0x81e/0xb00
      [  129.114952]  virtqueue_add_inbuf_ctx+0x26/0x30
      [  129.119399]  try_fill_recv+0x3a2/0x6e0 [virtio_net]
      [  129.124280]  virtnet_open+0xf9/0x180 [virtio_net]
      [  129.128984]  __dev_open+0xe8/0x180
      [  129.132390]  __dev_change_flags+0x1a7/0x210
      [  129.136575]  dev_change_flags+0x21/0x60
      [  129.140415]  do_setlink+0x328/0x10e0
      [  129.143994]  ? __nla_validate_parse+0x121/0x180
      [  129.148528]  ? __nla_parse+0x21/0x30
      [  129.152107]  ? inet6_validate_link_af+0x5c/0xf0
      [  129.156639]  ? cpumask_next+0x17/0x20
      [  129.160306]  ? __snmp6_fill_stats64.isra.54+0x6b/0x110
      [  129.165443]  ? __nla_validate_parse+0x47/0x180
      [  129.169890]  __rtnl_newlink+0x541/0x8e0
      [  129.173731]  ? __nla_reserve+0x38/0x50
      [  129.177483]  ? security_sock_rcv_skb+0x2a/0x40
      [  129.181928]  ? netlink_deliver_tap+0x2c/0x1e0
      [  129.186286]  ? netlink_attachskb+0x1d8/0x220
      [  129.190560]  ? skb_queue_tail+0x1b/0x50
      [  129.194401]  ? fib6_clean_node+0x43/0x170
      [  129.198411]  ? _cond_resched+0x15/0x30
      [  129.202163]  ? kmem_cache_alloc_trace+0x3a3/0x420
      [  129.206869]  rtnl_newlink+0x43/0x60
      [  129.210361]  rtnetlink_rcv_msg+0x12c/0x380
      [  129.214462]  ? rtnl_calcit.isra.39+0x110/0x110
      [  129.218908]  netlink_rcv_skb+0x50/0x100
      [  129.222747]  netlink_unicast+0x1a5/0x280
      [  129.226672]  netlink_sendmsg+0x23d/0x470
      [  129.230599]  sock_sendmsg+0x5b/0x60
      [  129.234090]  ____sys_sendmsg+0x1ef/0x260
      [  129.238015]  ? copy_msghdr_from_user+0x5c/0x90
      [  129.242461]  ___sys_sendmsg+0x7c/0xc0
      [  129.246128]  ? dev_forward_change+0x130/0x130
      [  129.250487]  ? sysctl_head_finish.part.29+0x24/0x40
      [  129.255368]  ? new_sync_write+0x11f/0x1b0
      [  129.259381]  ? mntput_no_expire+0x47/0x240
      [  129.263478]  __sys_sendmsg+0x57/0xa0
      [  129.267058]  do_syscall_64+0x33/0x40
      [  129.270639]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  129.275689] RIP: 0033:0x7f88792e3857
      [  129.279268] Code: c3 66 90 41 54 41 89 d4 55 48 89 f5 53 89 fb 48 83 ec 10 e8 0b ed ff ff 44 89 e2 48 89 ee 89 df 41 89 c0 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 48 89 44 24 08 e8 44 ed ff ff 48
      [  129.298015] RSP: 002b:00007ffdca60dea0 EFLAGS: 00000293 ORIG_RAX: 000000000000002e
      [  129.305581] RAX: ffffffffffffffda RBX: 000000000000000c RCX: 00007f88792e3857
      [  129.312712] RDX: 0000000000000000 RSI: 00007ffdca60def0 RDI: 000000000000000c
      [  129.319846] RBP: 00007ffdca60def0 R08: 0000000000000000 R09: 0000000000000000
      [  129.326978] R10: 0000000000000001 R11: 0000000000000293 R12: 0000000000000000
      [  129.334109] R13: 0000000000000000 R14: 00007ffdca60e0a8 R15: 00007ffdca60e09c
      [  129.341249] ---[ end trace c551e8028fbaf59d ]---
      [  129.351207] net eth0: Unexpected TXQ (0) queue failure: -12
      [  129.360445] net eth0: Unexpected TXQ (0) queue failure: -12
      [  129.824428] net eth0: Unexpected TXQ (0) queue failure: -12
      
      Fixes: 2c53d0f6 ("vdpasim: vDPA device simulator")
      Signed-off-by: NLaurent Vivier <lvivier@redhat.com>
      Link: https://lore.kernel.org/r/20201027175914.689278-1-lvivier@redhat.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: stable@vger.kernel.org
      Acked-by: NJason Wang <jasowang@redhat.com>
      1eca16b2
    • M
      Revert "vhost-vdpa: fix page pinning leakage in error path" · 5e1a3149
      Michael S. Tsirkin 提交于
      This reverts commit 7ed9e3d9.
      
      The patch creates a DoS risk since it can result in a high order memory
      allocation.
      
      Fixes: 7ed9e3d9 ("vhost-vdpa: fix page pinning leakage in error path")
      Cc: stable@vger.kernel.org
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      5e1a3149
    • J
      vdpa/mlx5: Fix error return in map_direct_mr() · 7ba08e81
      Jing Xiangfeng 提交于
      Fix to return the variable "err" from the error handling case instead
      of "ret".
      
      Fixes: 94abbccd ("vdpa/mlx5: Add shared memory registration code")
      Signed-off-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
      Link: https://lore.kernel.org/r/20201026070637.164321-1-jingxiangfeng@huawei.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Acked-by: NEli Cohen <elic@nvidia.com>
      Cc: stable@vger.kernel.org
      Acked-by: NJason Wang <jasowang@redhat.com>
      7ba08e81
    • D
      vhost_vdpa: Return -EFAULT if copy_from_user() fails · 7922460e
      Dan Carpenter 提交于
      The copy_to/from_user() functions return the number of bytes which we
      weren't able to copy but the ioctl should return -EFAULT if they fail.
      
      Fixes: a127c5bb ("vhost-vdpa: fix backend feature ioctls")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20201023120853.GI282278@mwandaSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Cc: stable@vger.kernel.org
      Acked-by: NJason Wang <jasowang@redhat.com>
      7922460e
    • P
      usb: cdns3: gadget: own the lock wrongly at the suspend routine · e11d2bf2
      Peter Chen 提交于
      When the system goes to suspend, if the controller is at device mode with
      cable connecting to host, the call stack is: cdns3_suspend->
      cdns3_gadget_suspend -> cdns3_disconnect_gadget, after cdns3_disconnect_gadget
      is called, it owns lock wrongly, it causes the system being deadlock after
      resume due to at cdns3_device_thread_irq_handler, it tries to get the lock,
      but can't get it forever.
      
      To fix it, we delete the unlock-lock operations at cdns3_disconnect_gadget,
      and do it at the caller.
      
      Fixes: b1234e3b ("usb: cdns3: add runtime PM support")
      Acked-by: NPawel Laszczak <pawell@cadence.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      e11d2bf2
    • P
      usb: cdns3: Fix on-chip memory overflow issue · 52d39677
      Pawel Laszczak 提交于
      Patch fixes issue caused setting On-chip memory overflow bit in usb_sts
      register. The issue occurred because EP_CFG register was set twice
      before USB_STS.CFGSTS was set. Every write operation on EP_CFG.BUFFERING
      causes that controller increases internal counter holding the number
      of reserved on-chip buffers. First time this register was updated in
      function cdns3_ep_config before delegating SET_CONFIGURATION request
      to class driver and again it was updated when class wanted to enable
      endpoint.  This patch fixes this issue by configuring endpoints
      enabled by class driver in cdns3_gadget_ep_enable and others just
      before status stage.
      
      Cc: stable@vger.kernel.org#v5.8+
      Fixes: 7733f6c3 ("usb: cdns3: Add Cadence USB3 DRD Driver")
      Reported-and-tested-by: NPeter Chen <peter.chen@nxp.com>
      Signed-off-by: NPawel Laszczak <pawell@cadence.com>
      Signed-off-by: NPeter Chen <peter.chen@nxp.com>
      52d39677
    • L
      drm/nouveau/kms/nv50-: Fix clock checking algorithm in nv50_dp_mode_valid() · d7787cc0
      Lyude Paul 提交于
      While I thought I had this correct (since it actually did reject modes
      like I expected during testing), Ville Syrjala from Intel pointed out
      that the logic here isn't correct. max_clock refers to the max data rate
      supported by the DP encoder. So, limiting it to the output of ds_clock (which
      refers to the maximum dotclock of the downstream DP device) doesn't make any
      sense. Additionally, since we're using the connector's bpc as the canonical BPC
      we should use this in mode_valid until we support dynamically setting the bpp
      based on bandwidth constraints.
      
      https://lists.freedesktop.org/archives/dri-devel/2020-September/280276.html
      
      For more info.
      
      So, let's rewrite this using Ville's advice.
      
      v2:
      * Ville pointed out I mixed up the dotclock and the link rate. So fix that...
      * ...and also rename all the variables in this function to be more appropriately
        labeled so I stop mixing them up.
      * Reuse the bpp from the connector for now until we have dynamic bpp selection.
      * Use use DIV_ROUND_UP for calculating the mode rate like i915 does, which we
        should also have been doing from the start
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: 409d3813 ("drm/nouveau/kms/nv50-: Use downstream DP clock limits for mode validation")
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      d7787cc0
    • L
      drm/nouveau/kms/nv50-: Get rid of bogus nouveau_conn_mode_valid() · 2d831155
      Lyude Paul 提交于
      Ville also pointed out that I got a lot of the logic here wrong as well, whoops.
      While I don't think anyone's likely using 3D output with nouveau, the next patch
      will make nouveau_conn_mode_valid() make a lot less sense. So, let's just get
      rid of it and open-code it like before, while taking care to move the 3D frame
      packing calculations on the dot clock into the right place.
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: d6a9efec ("drm/nouveau/kms/nv50-: Share DP SST mode_valid() handling with MST")
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: <stable@vger.kernel.org> # v5.8+
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      2d831155
    • K
      drm/nouveau/device: fix changing endianess code to work on older GPUs · dcd292c1
      Karol Herbst 提交于
      With this we try to detect if the endianess switch works and assume LE if
      not. Suggested by Ben.
      
      Fixes: 51c05340 ("drm/nouveau/device: detect if changing endianness failed")
      Signed-off-by: NKarol Herbst <kherbst@redhat.com>
      Cc: <stable@vger.kernel.org> # v5.8+
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      dcd292c1
    • K
      drm/nouveau/gem: fix "refcount_t: underflow; use-after-free" · 92568145
      Karol Herbst 提交于
      we can't use nouveau_bo_ref here as no ttm object was allocated and
      nouveau_bo_ref mainly deals with that. Simply deallocate the object.
      Signed-off-by: NKarol Herbst <kherbst@redhat.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      92568145
    • L
      drm/nouveau/kms/nv50-: Program notifier offset before requesting disp caps · 24d9422e
      Lyude Paul 提交于
      Not entirely sure why this never came up when I originally tested this
      (maybe some BIOSes already have this setup?) but the ->caps_init vfunc
      appears to cause the display engine to throw an exception on driver
      init, at least on my ThinkPad P72:
      
      nouveau 0000:01:00.0: disp: chid 0 mthd 008c data 00000000 0000508c 0000102b
      
      This is magic nvidia speak for "You need to have the DMA notifier offset
      programmed before you can call NV507D_GET_CAPABILITIES." So, let's fix
      this by doing that, and also perform an update afterwards to prevent
      racing with the GPU when reading capabilities.
      
      v2:
      * Don't just program the DMA notifier offset, make sure to actually
        perform an update
      v3:
      * Don't call UPDATE()
      * Actually read the correct notifier fields, as apparently the
        CAPABILITIES_DONE field lives in a different location than the main
        NV_DISP_CORE_NOTIFIER_1 field. As well, 907d+ use a different
        CAPABILITIES_DONE field then pre-907d cards.
      v4:
      * Don't forget to check the return value of core507d_read_caps()
      v5:
      * Get rid of NV50_DISP_CAPS_NTFY[14], use NV50_DISP_CORE_NTFY
      * Disable notifier after calling GetCapabilities()
      Signed-off-by: NLyude Paul <lyude@redhat.com>
      Fixes: 4a2cb418 ("drm/nouveau/kms/nv50-: Probe SOR and PIOR caps for DP interlacing support")
      Cc: <stable@vger.kernel.org> # v5.8+
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      24d9422e
    • R
      drm/nouveau/nouveau: fix the start/end range for migration · cfa736f5
      Ralph Campbell 提交于
      The user level OpenCL code shouldn't have to align start and end
      addresses to a page boundary. That is better handled in the nouveau
      driver. The npages field is also redundant since it can be computed
      from the start and end addresses.
      Signed-off-by: NRalph Campbell <rcampbell@nvidia.com>
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      cfa736f5
    • G
      scsi: target: tcmu: Replace zero-length array with flexible-array member · 8fdaabe1
      Gustavo A. R. Silva 提交于
      There is a regular need in the kernel to provide a way to declare having a
      dynamically sized set of trailing elements in a structure. Kernel code should
      always use “flexible array members”[1] for these cases. The older style of
      one-element or zero-length arrays should no longer be used[2].
      
      [1] https://en.wikipedia.org/wiki/Flexible_array_member
      [2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arraysSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      8fdaabe1
    • G
      enetc: Replace zero-length array with flexible-array member · bfe124d1
      Gustavo A. R. Silva 提交于
      There is a regular need in the kernel to provide a way to declare having a
      dynamically sized set of trailing elements in a structure. Kernel code should
      always use “flexible array members”[1] for these cases. The older style of
      one-element or zero-length arrays should no longer be used[2].
      
      [1] https://en.wikipedia.org/wiki/Flexible_array_member
      [2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arraysSigned-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      bfe124d1
    • T
      soc: ti: ti_sci_pm_domains: check for proper args count in xlate · 3d696f42
      Tero Kristo 提交于
      K2G devices still only use single parameter for power-domains property,
      so check for this properly in the driver. Without this, every peripheral
      fails to probe resulting in boot failure.
      
      Link: https://lore.kernel.org/r/20201029093337.21170-1-t-kristo@ti.com
      Fixes: efa5c01c ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one")
      Reported-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NTero Kristo <t-kristo@ti.com>
      Acked-by: NNishanth Menon <nm@ti.com>
      Acked-by: NSantosh Shilimkar <ssantosh@kernel.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      3d696f42
    • S
      coresight: cti: Initialize dynamic sysfs attributes · 80624263
      Suzuki K Poulose 提交于
      With LOCKDEP enabled, CTI driver triggers the following splat due
      to uninitialized lock class for dynamically allocated attribute
      objects.
      
      [    5.372901] coresight etm0: CPU0: ETM v4.0 initialized
      [    5.376694] coresight etm1: CPU1: ETM v4.0 initialized
      [    5.380785] coresight etm2: CPU2: ETM v4.0 initialized
      [    5.385851] coresight etm3: CPU3: ETM v4.0 initialized
      [    5.389808] BUG: key ffff00000564a798 has not been registered!
      [    5.392456] ------------[ cut here ]------------
      [    5.398195] DEBUG_LOCKS_WARN_ON(1)
      [    5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260
      [    5.406149] Modules linked in:
      [    5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027 #51
      [    5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
      [    5.426453] Workqueue: events amba_deferred_retry_func
      [    5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
      [    5.438252] pc : lockdep_init_map_waits+0x14c/0x260
      [    5.444410] lr : lockdep_init_map_waits+0x14c/0x260
      [    5.449007] sp : ffff800012bbb720
      ...
      
      [    5.531561] Call trace:
      [    5.536847]  lockdep_init_map_waits+0x14c/0x260
      [    5.539027]  __kernfs_create_file+0xa8/0x1c8
      [    5.543539]  sysfs_add_file_mode_ns+0xd0/0x208
      [    5.548054]  internal_create_group+0x118/0x3c8
      [    5.552307]  internal_create_groups+0x58/0xb8
      [    5.556733]  sysfs_create_groups+0x2c/0x38
      [    5.561160]  device_add+0x2d8/0x768
      [    5.565148]  device_register+0x28/0x38
      [    5.568537]  coresight_register+0xf8/0x320
      [    5.572358]  cti_probe+0x1b0/0x3f0
      
      ...
      
      Fix this by initializing the attributes when they are allocated.
      
      Fixes: 3c5597e3 ("coresight: cti: Add connection information to sysfs")
      Reported-by: NLeo Yan <leo.yan@linaro.org>
      Tested-by: NLeo Yan <leo.yan@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Link: https://lore.kernel.org/r/20201029164559.1268531-2-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80624263
    • M
      coresight: Fix uninitialised pointer bug in etm_setup_aux() · 39a7661d
      Mike Leach 提交于
      Commit [bb1860ef] changed the sink handling code introducing an
      uninitialised pointer bug. This results in the default sink selection
      failing.
      
      Prior to commit:
      
      static void etm_setup_aux(...)
      
      <snip>
              struct coresight_device *sink;
      <snip>
      
              /* First get the selected sink from user space. */
              if (event->attr.config2) {
                      id = (u32)event->attr.config2;
                      sink = coresight_get_sink_by_id(id);
              } else {
                      sink = coresight_get_enabled_sink(true);
              }
      <ctd>
      
      *sink always initialised - possibly to NULL which triggers the
      automatic sink selection.
      
      After commit:
      
      static void etm_setup_aux(...)
      
      <snip>
              struct coresight_device *sink;
      <snip>
      
              /* First get the selected sink from user space. */
              if (event->attr.config2) {
                      id = (u32)event->attr.config2;
                      sink = coresight_get_sink_by_id(id);
              }
      <ctd>
      
      *sink pointer uninitialised when not providing a sink on the perf command
      line. This breaks later checks to enable automatic sink selection.
      
      Fixes: bb1860ef ("coresight: etm: perf: Sink selection using sysfs is deprecated")
      Signed-off-by: NMike Leach <mike.leach@linaro.org>
      Signed-off-by: NMathieu Poirier <mathieu.poirier@linaro.org>
      Link: https://lore.kernel.org/r/20201029164559.1268531-3-mathieu.poirier@linaro.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39a7661d
    • H
      r8169: fix issue with forced threading in combination with shared interrupts · 2734a24e
      Heiner Kallweit 提交于
      As reported by Serge flag IRQF_NO_THREAD causes an error if the
      interrupt is actually shared and the other driver(s) don't have this
      flag set. This situation can occur if a PCI(e) legacy interrupt is
      used in combination with forced threading.
      There's no good way to deal with this properly, therefore we have to
      remove flag IRQF_NO_THREAD. For fixing the original forced threading
      issue switch to napi_schedule().
      
      Fixes: 424a646e ("r8169: fix operation under forced interrupt threading")
      Link: https://www.spinics.net/lists/netdev/msg694960.htmlReported-by: NSerge Belyshev <belyshev@depni.sinp.msu.ru>
      Signed-off-by: NHeiner Kallweit <hkallweit1@gmail.com>
      Tested-by: NSerge Belyshev <belyshev@depni.sinp.msu.ru>
      Link: https://lore.kernel.org/r/b5b53bfe-35ac-3768-85bf-74d1290cf394@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      2734a24e
    • L
      ibmvnic: fix ibmvnic_set_mac · 8fc3672a
      Lijun Pan 提交于
      Jakub Kicinski brought up a concern in ibmvnic_set_mac().
      ibmvnic_set_mac() does this:
      
      	ether_addr_copy(adapter->mac_addr, addr->sa_data);
      	if (adapter->state != VNIC_PROBED)
      		rc = __ibmvnic_set_mac(netdev, addr->sa_data);
      
      So if state == VNIC_PROBED, the user can assign an invalid address to
      adapter->mac_addr, and ibmvnic_set_mac() will still return 0.
      
      The fix is to validate ethernet address at the beginning of
      ibmvnic_set_mac(), and move the ether_addr_copy to
      the case of "adapter->state != VNIC_PROBED".
      
      Fixes: c26eba03 ("ibmvnic: Update reset infrastructure to support tunable parameters")
      Signed-off-by: NLijun Pan <ljp@linux.ibm.com>
      Link: https://lore.kernel.org/r/20201027220456.71450-1-ljp@linux.ibm.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      8fc3672a
    • V
      drm/i915: Reject 90/270 degree rotated initial fbs · 61334ed2
      Ville Syrjälä 提交于
      We don't currently handle the initial fb readout correctly
      for 90/270 degree rotated scanout. Reject it.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201020194330.28568-1-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      (cherry picked from commit a40a8305)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      61334ed2
    • V
      drm/i915: Restore ILK-M RPS support · 5cbd7685
      Ville Syrjälä 提交于
      Restore RPS for ILK-M. We lost it when an extra HAS_RPS()
      check appeared in intel_rps_enable().
      
      Unfortunaltey this just makes the performance worse on my
      ILK because intel_ips insists on limiting the GPU freq to
      the minimum. If we don't do the RPS init then intel_ips will
      not limit the frequency for whatever reason. Either it can't
      get at some required information and thus makes wrong decisions,
      or we mess up some weights/etc. and cause it to make the wrong
      decisions when RPS init has been done, or the entire thing is
      just wrong. Would require a bunch of reverse engineering to
      figure out what's going on.
      
      Cc: stable@vger.kernel.org
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Fixes: 9c878557 ("drm/i915/gt: Use the RPM config register to determine clk frequencies")
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201021131443.25616-1-ville.syrjala@linux.intel.comReviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      (cherry picked from commit 2bf06370)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      5cbd7685
    • M
      drm/i915/region: fix max size calculation · 09a729b1
      Matthew Auld 提交于
      We are incorrectly limiting the max allocation size as per the mm
      max_order, which is effectively the largest power-of-two that we can fit
      in the region size. However, it's normal to setup the region or
      allocator with a non-power-of-two size(for example 3G), which we should
      already handle correctly, except it seems for the early too-big-check.
      
      v2: make sure we also exercise the I915_BO_ALLOC_CONTIGUOUS path, which
      is quite different, since for that we are actually limited by the
      largest power-of-two that we can fit within the region size. (Chris)
      
      Fixes: b908be54 ("drm/i915: support creating LMEM objects")
      Signed-off-by: NMatthew Auld <matthew.auld@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: CQ Tang <cq.tang@intel.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Link: https://patchwork.freedesktop.org/patch/msgid/20201021103606.241395-1-matthew.auld@intel.com
      (cherry picked from commit 83ebef47)
      Signed-off-by: NRodrigo Vivi <rodrigo.vivi@intel.com>
      09a729b1
    • M
      gtp: fix an use-before-init in gtp_newlink() · 51467431
      Masahiro Fujiwara 提交于
      *_pdp_find() from gtp_encap_recv() would trigger a crash when a peer
      sends GTP packets while creating new GTP device.
      
      RIP: 0010:gtp1_pdp_find.isra.0+0x68/0x90 [gtp]
      <SNIP>
      Call Trace:
       <IRQ>
       gtp_encap_recv+0xc2/0x2e0 [gtp]
       ? gtp1_pdp_find.isra.0+0x90/0x90 [gtp]
       udp_queue_rcv_one_skb+0x1fe/0x530
       udp_queue_rcv_skb+0x40/0x1b0
       udp_unicast_rcv_skb.isra.0+0x78/0x90
       __udp4_lib_rcv+0x5af/0xc70
       udp_rcv+0x1a/0x20
       ip_protocol_deliver_rcu+0xc5/0x1b0
       ip_local_deliver_finish+0x48/0x50
       ip_local_deliver+0xe5/0xf0
       ? ip_protocol_deliver_rcu+0x1b0/0x1b0
      
      gtp_encap_enable() should be called after gtp_hastable_new() otherwise
      *_pdp_find() will access the uninitialized hash table.
      
      Fixes: 1e3a3abd ("gtp: make GTP sockets in gtp_newlink optional")
      Signed-off-by: NMasahiro Fujiwara <fujiwara.masahiro@gmail.com>
      Link: https://lore.kernel.org/r/20201027114846.3924-1-fujiwara.masahiro@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      51467431
  6. 29 10月, 2020 1 次提交
    • G
      dma-mapping: fix 32-bit overflow with CONFIG_ARM_LPAE=n · 48ab6d5d
      Geert Uytterhoeven 提交于
      On r8a7791/koelsch and shmobile_defconfig, PCIe probing fails with:
      
          rcar-pcie fe000000.pcie: Adjusted size 0x0 invalid
          rcar-pcie: probe of fe000000.pcie failed with error -22
      
      of_dma_get_range() returns the following map:
      
          cpu_start 0x40000000 dma_start 0x40000000 size 0x080000000 offset 0
          cpu_start 0x00000000 dma_start 0x00000000 size 0x100000000 offset 0
      
      If CONFIG_ARM_LPAE=n, dma_addr_t is 32-bit.  Hence when assigning
      r->dma_start + r->size to dma_end, this value will be truncated to
      32-bit, yielding zero when processing the second table entry.
      Consequently, both dma_start and dma_end will be zero, leading to a zero
      size.
      
      Fix this by changing the dma_start and dma_end variables from dma_addr_t
      to u64.
      
      Fixes: e0d07278 ("dma-mapping: introduce DMA range map, supplanting dma_pfn_offset")
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      48ab6d5d