1. 26 Sep, 2018 40 commits
    • Oliver Neukum's avatar
      usb: uas: add support for more quirk flags · cdddc62b
      Oliver Neukum authored
      commit 42d1c6d4 upstream.
      
      The hope that UAS devices would be less broken than old style storage
      devices has turned out to be unfounded. Make UAS support more of the
      quirk flags of the old driver.
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cdddc62b
    • Tim Anderson's avatar
      USB: Add quirk to support DJI CineSSD · d1a18f6e
      Tim Anderson authored
      commit f45681f9 upstream.
      
      This device does not correctly handle the LPM operations.
      
      Also, the device cannot handle ATA pass-through commands
      and locks up when attempted while running in super speed.
      
      This patch adds the equivalent quirk logic as found in uas.
      Signed-off-by: default avatarTim Anderson <tsa@biglakesoftware.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1a18f6e
    • Alexander Usyskin's avatar
      mei: ignore not found client in the enumeration · 0737cf68
      Alexander Usyskin authored
      commit 8d2d8935 upstream.
      
      Some of the ME clients are available only for BIOS operation and are
      removed during hand off to an OS. However the removal is not instant.
      A client may be visible on the client list when the mei driver requests
      for enumeration, while the subsequent request for properties will be
      answered with client not found error value. The default behavior
      for an error is to perform client reset while this error is harmless and
      the link reset should be prevented. This issue started to be visible due to
      suspend/resume timing changes. Currently reported only on the Haswell
      based system.
      
      Fixes:
      [33.564957] mei_me 0000:00:16.0: hbm: properties response: wrong status = 1 CLIENT_NOT_FOUND
      [33.564978] mei_me 0000:00:16.0: mei_irq_read_handler ret = -71.
      [33.565270] mei_me 0000:00:16.0: unexpected reset: dev_state = INIT_CLIENTS fw status = 1E000255 60002306 00000200 00004401 00000000 00000010
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0737cf68
    • Mathias Nyman's avatar
      usb: Don't die twice if PCI xhci host is not responding in resume · 286a01c5
      Mathias Nyman authored
      commit f3dc41c5 upstream.
      
      usb_hc_died() should only be called once, and with the primary HCD
      as parameter. It will mark both primary and secondary hcd's dead.
      
      Remove the extra call to usb_cd_died with the shared hcd as parameter.
      
      Fixes: ff9d78b3 ("USB: Set usb_hcd->state and flags for shared roothubs")
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      286a01c5
    • Gustavo A. R. Silva's avatar
      misc: hmc6352: fix potential Spectre v1 · 76b61ead
      Gustavo A. R. Silva authored
      commit de916736 upstream.
      
      val is indirectly controlled by user-space, hence leading to a
      potential exploitation of the Spectre variant 1 vulnerability.
      
      This issue was detected with the help of Smatch:
      
      drivers/misc/hmc6352.c:54 compass_store() warn: potential spectre issue
      'map' [r]
      
      Fix this by sanitizing val before using it to index map
      
      Notice that given that speculation windows are large, the policy is
      to kill the speculation on the first load and not worry if it can be
      completed with a dependent load/store [1].
      
      [1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76b61ead
    • K. Y. Srinivasan's avatar
      Tools: hv: Fix a bug in the key delete code · 2516ead0
      K. Y. Srinivasan authored
      commit 86503bd3 upstream.
      
      Fix a bug in the key delete code - the num_records range
      from 0 to num_records-1.
      Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
      Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarMichael Kelley <mikelley@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2516ead0
    • Andreas Kemnade's avatar
      mmc: omap_hsmmc: fix wakeirq handling on removal · 590872d2
      Andreas Kemnade authored
      commit 3c398f3c upstream.
      
      after unbinding mmc I get things like this:
      [  185.294067] mmc1: card 0001 removed
      [  185.305206] omap_hsmmc 480b4000.mmc: wake IRQ with no resume: -13
      
      The wakeirq stays in /proc-interrupts
      
      rebinding shows this:
      [  289.795959] genirq: Flags mismatch irq 112. 0000200a (480b4000.mmc:wakeup) vs. 0000200a (480b4000.mmc:wakeup)
      [  289.808959] omap_hsmmc 480b4000.mmc: Unable to request wake IRQ
      [  289.815338] omap_hsmmc 480b4000.mmc: no SDIO IRQ support, falling back to polling
      
      That bug seems to be introduced by switching from devm_request_irq()
      to generic wakeirq handling.
      
      So let us cleanup at removal.
      Signed-off-by: default avatarAndreas Kemnade <andreas@kemnade.info>
      Fixes: 5b83b223 ("mmc: omap_hsmmc: Change wake-up interrupt to use generic wakeirq")
      Cc: stable@vger.kernel.org # v4.2+
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      590872d2
    • Aaron Knister's avatar
      IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler · 542d6faa
      Aaron Knister authored
      commit 816e846c upstream.
      
      Inside of start_xmit() the call to check if the connection is up and the
      queueing of the packets for later transmission is not atomic which leaves
      a window where cm_rep_handler can run, set the connection up, dequeue
      pending packets and leave the subsequently queued packets by start_xmit()
      sitting on neigh->queue until they're dropped when the connection is torn
      down. This only applies to connected mode. These dropped packets can
      really upset TCP, for example, and cause multi-minute delays in
      transmission for open connections.
      
      Here's the code in start_xmit where we check to see if the connection is
      up:
      
             if (ipoib_cm_get(neigh)) {
                     if (ipoib_cm_up(neigh)) {
                             ipoib_cm_send(dev, skb, ipoib_cm_get(neigh));
                             goto unref;
                     }
             }
      
      The race occurs if cm_rep_handler execution occurs after the above
      connection check (specifically if it gets to the point where it acquires
      priv->lock to dequeue pending skb's) but before the below code snippet in
      start_xmit where packets are queued.
      
             if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
                     push_pseudo_header(skb, phdr->hwaddr);
                     spin_lock_irqsave(&priv->lock, flags);
                     __skb_queue_tail(&neigh->queue, skb);
                     spin_unlock_irqrestore(&priv->lock, flags);
             } else {
                     ++dev->stats.tx_dropped;
                     dev_kfree_skb_any(skb);
             }
      
      The patch acquires the netif tx lock in cm_rep_handler for the section
      where it sets the connection up and dequeues and retransmits deferred
      skb's.
      
      Fixes: 839fcaba ("IPoIB: Connected mode experimental support")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAaron Knister <aaron.s.knister@nasa.gov>
      Tested-by: default avatarIra Weiny <ira.weiny@intel.com>
      Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      542d6faa
    • Juergen Gross's avatar
      xen/netfront: fix waiting for xenbus state change · 03ae5ff3
      Juergen Gross authored
      commit 8edfe2e9 upstream.
      
      Commit 822fb18a ("xen-netfront: wait xenbus state change when load
      module manually") added a new wait queue to wait on for a state change
      when the module is loaded manually. Unfortunately there is no wakeup
      anywhere to stop that waiting.
      
      Instead of introducing a new wait queue rename the existing
      module_unload_q to module_wq and use it for both purposes (loading and
      unloading).
      
      As any state change of the backend might be intended to stop waiting
      do the wake_up_all() in any case when netback_changed() is called.
      
      Fixes: 822fb18a ("xen-netfront: wait xenbus state change when load module manually")
      Cc: <stable@vger.kernel.org> #4.18
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03ae5ff3
    • Bin Yang's avatar
      pstore: Fix incorrect persistent ram buffer mapping · 7026e245
      Bin Yang authored
      commit 831b624d upstream.
      
      persistent_ram_vmap() returns the page start vaddr.
      persistent_ram_iomap() supports non-page-aligned mapping.
      
      persistent_ram_buffer_map() always adds offset-in-page to the vaddr
      returned from these two functions, which causes incorrect mapping of
      non-page-aligned persistent ram buffer.
      
      By default ftrace_size is 4096 and max_ftrace_cnt is nr_cpu_ids. Without
      this patch, the zone_sz in ramoops_init_przs() is 4096/nr_cpu_ids which
      might not be page aligned. If the offset-in-page > 2048, the vaddr will be
      in next page. If the next page is not mapped, it will cause kernel panic:
      
      [    0.074231] BUG: unable to handle kernel paging request at ffffa19e0081b000
      ...
      [    0.075000] RIP: 0010:persistent_ram_new+0x1f8/0x39f
      ...
      [    0.075000] Call Trace:
      [    0.075000]  ramoops_init_przs.part.10.constprop.15+0x105/0x260
      [    0.075000]  ramoops_probe+0x232/0x3a0
      [    0.075000]  platform_drv_probe+0x3e/0xa0
      [    0.075000]  driver_probe_device+0x2cd/0x400
      [    0.075000]  __driver_attach+0xe4/0x110
      [    0.075000]  ? driver_probe_device+0x400/0x400
      [    0.075000]  bus_for_each_dev+0x70/0xa0
      [    0.075000]  driver_attach+0x1e/0x20
      [    0.075000]  bus_add_driver+0x159/0x230
      [    0.075000]  ? do_early_param+0x95/0x95
      [    0.075000]  driver_register+0x70/0xc0
      [    0.075000]  ? init_pstore_fs+0x4d/0x4d
      [    0.075000]  __platform_driver_register+0x36/0x40
      [    0.075000]  ramoops_init+0x12f/0x131
      [    0.075000]  do_one_initcall+0x4d/0x12c
      [    0.075000]  ? do_early_param+0x95/0x95
      [    0.075000]  kernel_init_freeable+0x19b/0x222
      [    0.075000]  ? rest_init+0xbb/0xbb
      [    0.075000]  kernel_init+0xe/0xfc
      [    0.075000]  ret_from_fork+0x3a/0x50
      Signed-off-by: default avatarBin Yang <bin.yang@intel.com>
      [kees: add comments describing the mapping differences, updated commit log]
      Fixes: 24c3d2f3 ("staging: android: persistent_ram: Make it possible to use memory outside of bootmem")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7026e245
    • Parav Pandit's avatar
      RDMA/cma: Protect cma dev list with lock · 422013e4
      Parav Pandit authored
      commit 954a8e3a upstream.
      
      When AF_IB addresses are used during rdma_resolve_addr() a lock is not
      held. A cma device can get removed while list traversal is in progress
      which may lead to crash. ie
      
              CPU0                                     CPU1
              ====                                     ====
      rdma_resolve_addr()
       cma_resolve_ib_dev()
        list_for_each()                         cma_remove_one()
          cur_dev->device                        mutex_lock(&lock)
                                                  list_del();
                                                 mutex_unlock(&lock);
                                                 cma_process_remove();
      
      
      Therefore, hold a lock while traversing the list which avoids such
      situation.
      
      Cc: <stable@vger.kernel.org> # 3.10
      Fixes: f17df3b0 ("RDMA/cma: Add support for AF_IB to rdma_resolve_addr()")
      Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
      Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      422013e4
    • Xiao Liang's avatar
      xen-netfront: fix warn message as irq device name has '/' · 9d47d030
      Xiao Liang authored
      [ Upstream commit 21f2706b ]
      
      There is a call trace generated after commit 2d408c0d(
      xen-netfront: fix queue name setting). There is no 'device/vif/xx-q0-tx' file found
      under /proc/irq/xx/.
      
      This patch only picks up device type and id as its name.
      
      With the patch, now /proc/interrupts looks like below and the warning message gone:
       70:         21          0          0          0   xen-dyn    -event     vif0-q0-tx
       71:         15          0          0          0   xen-dyn    -event     vif0-q0-rx
       72:         14          0          0          0   xen-dyn    -event     vif0-q1-tx
       73:         33          0          0          0   xen-dyn    -event     vif0-q1-rx
       74:         12          0          0          0   xen-dyn    -event     vif0-q2-tx
       75:         24          0          0          0   xen-dyn    -event     vif0-q2-rx
       76:         19          0          0          0   xen-dyn    -event     vif0-q3-tx
       77:         21          0          0          0   xen-dyn    -event     vif0-q3-rx
      
      Below is call trace information without this patch:
      
      name 'device/vif/0-q0-tx'
      WARNING: CPU: 2 PID: 37 at fs/proc/generic.c:174 __xlate_proc_name+0x85/0xa0
      RIP: 0010:__xlate_proc_name+0x85/0xa0
      RSP: 0018:ffffb85c40473c18 EFLAGS: 00010286
      RAX: 0000000000000000 RBX: 0000000000000006 RCX: 0000000000000006
      RDX: 0000000000000007 RSI: 0000000000000096 RDI: ffff984c7f516930
      RBP: ffffb85c40473cb8 R08: 000000000000002c R09: 0000000000000229
      R10: 0000000000000000 R11: 0000000000000001 R12: ffffb85c40473c98
      R13: ffffb85c40473cb8 R14: ffffb85c40473c50 R15: 0000000000000000
      FS:  0000000000000000(0000) GS:ffff984c7f500000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f69b6899038 CR3: 000000001c20a006 CR4: 00000000001606e0
      Call Trace:
      __proc_create+0x45/0x230
      ? snprintf+0x49/0x60
      proc_mkdir_data+0x35/0x90
      register_handler_proc+0xef/0x110
      ? proc_register+0xfc/0x110
      ? proc_create_data+0x70/0xb0
      __setup_irq+0x39b/0x660
      ? request_threaded_irq+0xad/0x160
      request_threaded_irq+0xf5/0x160
      ? xennet_tx_buf_gc+0x1d0/0x1d0 [xen_netfront]
      bind_evtchn_to_irqhandler+0x3d/0x70
      ? xenbus_alloc_evtchn+0x41/0xa0
      netback_changed+0xa46/0xcda [xen_netfront]
      ? find_watch+0x40/0x40
      xenwatch_thread+0xc5/0x160
      ? finish_wait+0x80/0x80
      kthread+0x112/0x130
      ? kthread_create_worker_on_cpu+0x70/0x70
      ret_from_fork+0x35/0x40
      Code: 81 5c 00 48 85 c0 75 cc 5b 49 89 2e 31 c0 5d 4d 89 3c 24 41 5c 41 5d 41 5e 41 5f c3 4c 89 ee 48 c7 c7 40 4f 0e b4 e8 65 ea d8 ff <0f> 0b b8 fe ff ff ff 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 0f 1f
      ---[ end trace 650e5561b0caab3a ]---
      Signed-off-by: default avatarXiao Liang <xiliang@redhat.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d47d030
    • Michael Müller's avatar
      crypto: sharah - Unregister correct algorithms for SAHARA 3 · fd758513
      Michael Müller authored
      [ Upstream commit 0e7d4d93 ]
      
      This patch fixes two typos related to unregistering algorithms supported by
      SAHARAH 3. In sahara_register_algs the wrong algorithms are unregistered
      in case of an error. In sahara_unregister_algs the wrong array is used to
      determine the iteration count.
      Signed-off-by: default avatarMichael Müller <michael@fds-team.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fd758513
    • Hanna Hawa's avatar
      dmaengine: mv_xor_v2: kill the tasklets upon exit · 0c8706ef
      Hanna Hawa authored
      [ Upstream commit 8bbafed8 ]
      
      The mv_xor_v2 driver uses a tasklet, initialized during the probe()
      routine. However, it forgets to cleanup the tasklet using
      tasklet_kill() function during the remove() routine, which this patch
      fixes. This prevents the tasklet from potentially running after the
      module has been removed.
      
      Fixes: 19a340b1 ("dmaengine: mv_xor_v2: new driver")
      Signed-off-by: default avatarHanna Hawa <hannah@marvell.com>
      Reviewed-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c8706ef
    • Pingfan Liu's avatar
      drivers/base: stop new probing during shutdown · e6f55802
      Pingfan Liu authored
      [ Upstream commit 3297c8fc ]
      
      There is a race window in device_shutdown(), which may cause
      -1. parent device shut down before child or
      -2. no shutdown on a new probing device.
      
      For 1st, taking the following scenario:
               device_shutdown                        new plugin device
        list_del_init(parent_dev);
        spin_unlock(list_lock);
                                                        device_add(child)
                                                        probe child
        shutdown parent_dev
             --> now child is on the tail of devices_kset
      
      For 2nd, taking the following scenario:
               device_shutdown                        new plugin device
                                                        device_add(dev)
        device_lock(dev);
        ...
        device_unlock(dev);
                                                        probe dev
             --> now, the new occurred dev has no opportunity to shutdown
      
      To fix this race issue, just prevent the new probing request. With this
      logic, device_shutdown() is more similar to dpm_prepare().
      Signed-off-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Reviewed-by: default avatarRafael J. Wysocki <rafael@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e6f55802
    • Christoffer Dall's avatar
      KVM: arm/arm64: Fix vgic init race · 0a10ce96
      Christoffer Dall authored
      [ Upstream commit 1d47191d ]
      
      The vgic_init function can race with kvm_arch_vcpu_create() which does
      not hold kvm_lock() and we therefore have no synchronization primitives
      to ensure we're doing the right thing.
      
      As the user is trying to initialize or run the VM while at the same time
      creating more VCPUs, we just have to refuse to initialize the VGIC in
      this case rather than silently failing with a broken VCPU.
      Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
      Signed-off-by: default avatarChristoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a10ce96
    • Randy Dunlap's avatar
      platform/x86: toshiba_acpi: Fix defined but not used build warnings · f51c3457
      Randy Dunlap authored
      [ Upstream commit c2e2a618 ]
      
      Fix a build warning in toshiba_acpi.c when CONFIG_PROC_FS is not enabled
      by marking the unused function as __maybe_unused.
      
      ../drivers/platform/x86/toshiba_acpi.c:1685:12: warning: 'version_proc_show' defined but not used [-Wunused-function]
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Azael Avalos <coproscefalo@gmail.com>
      Cc: platform-driver-x86@vger.kernel.org
      Cc: Andy Shevchenko <andy@infradead.org>
      Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f51c3457
    • Julian Wiedmann's avatar
      s390/qeth: reset layer2 attribute on layer switch · d3638df9
      Julian Wiedmann authored
      [ Upstream commit 70551dc4 ]
      
      After the subdriver's remove() routine has completed, the card's layer
      mode is undetermined again. Reflect this in the layer2 field.
      
      If qeth_dev_layer2_store() hits an error after remove() was called, the
      card _always_ requires a setup(), even if the previous layer mode is
      requested again.
      But qeth_dev_layer2_store() bails out early if the requested layer mode
      still matches the current one. So unless we reset the layer2 field,
      re-probing the card back to its previous mode is currently not possible.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d3638df9
    • Julian Wiedmann's avatar
      s390/qeth: fix race in used-buffer accounting · 09d5c141
      Julian Wiedmann authored
      [ Upstream commit a702349a ]
      
      By updating q->used_buffers only _after_ do_QDIO() has completed, there
      is a potential race against the buffer's TX completion. In the unlikely
      case that the TX completion path wins, qeth_qdio_output_handler() would
      decrement the counter before qeth_flush_buffers() even incremented it.
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      09d5c141
    • Bhushan Shah's avatar
      ARM: dts: qcom: msm8974-hammerhead: increase load on l20 for sdhci · ededee86
      Bhushan Shah authored
      [ Upstream commit 03864e57 ]
      
      The kernel would not boot on the hammerhead hardware due to the
      following error:
      
      mmc0: Timeout waiting for hardware interrupt.
      mmc0: sdhci: ============ SDHCI REGISTER DUMP ===========
      mmc0: sdhci: Sys addr:  0x00000200 | Version:  0x00003802
      mmc0: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000200
      mmc0: sdhci: Argument:  0x00000000 | Trn mode: 0x00000023
      mmc0: sdhci: Present:   0x03e80000 | Host ctl: 0x00000034
      mmc0: sdhci: Power:     0x00000001 | Blk gap:  0x00000000
      mmc0: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
      mmc0: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
      mmc0: sdhci: Int enab:  0x02ff900b | Sig enab: 0x02ff100b
      mmc0: sdhci: AC12 err:  0x00000000 | Slot int: 0x00000000
      mmc0: sdhci: Caps:      0x642dc8b2 | Caps_1:   0x00008007
      mmc0: sdhci: Cmd:       0x00000c1b | Max curr: 0x00000000
      mmc0: sdhci: Resp[0]:   0x00000c00 | Resp[1]:  0x00000000
      mmc0: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
      mmc0: sdhci: Host ctl2: 0x00000008
      mmc0: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x70040220
      mmc0: sdhci: ============================================
      mmc0: Card stuck in wrong state! mmcblk0 card_busy_detect status: 0xe00
      mmc0: cache flush error -110
      mmc0: Reset 0x1 never completed.
      
      This patch increases the load on l20 to 0.2 amps for the sdhci
      and allows the device to boot normally.
      Signed-off-by: default avatarBhushan Shah <bshah@kde.org>
      Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
      Suggested-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Tested-by: default avatarBrian Masney <masneyb@onstation.org>
      Signed-off-by: default avatarAndy Gross <andy.gross@linaro.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ededee86
    • Loic Poulain's avatar
      arm64: dts: qcom: db410c: Fix Bluetooth LED trigger · 68bfa6eb
      Loic Poulain authored
      [ Upstream commit e53db018 ]
      
      Current LED trigger, 'bt', is not known/used by any existing driver.
      Fix this by renaming it to 'bluetooth-power' trigger which is
      controlled by the Bluetooth subsystem.
      
      Fixes: 9943230c ("arm64: dts: qcom: Add apq8016-sbc board LED's related device nodes")
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarAndy Gross <andy.gross@linaro.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68bfa6eb
    • Vitaly Kuznetsov's avatar
      xen-netfront: fix queue name setting · 21fa7488
      Vitaly Kuznetsov authored
      [ Upstream commit 2d408c0d ]
      
      Commit f599c64f ("xen-netfront: Fix race between device setup and
      open") changed the initialization order: xennet_create_queues() now
      happens before we do register_netdev() so using netdev->name in
      xennet_init_queue() is incorrect, we end up with the following in
      /proc/interrupts:
      
       60:        139          0   xen-dyn    -event     eth%d-q0-tx
       61:        265          0   xen-dyn    -event     eth%d-q0-rx
       62:        234          0   xen-dyn    -event     eth%d-q1-tx
       63:          1          0   xen-dyn    -event     eth%d-q1-rx
      
      and this looks ugly. Actually, using early netdev name (even when it's
      already set) is also not ideal: nowadays we tend to rename eth devices
      and queue name may end up not corresponding to the netdev name.
      
      Use nodename from xenbus device for queue naming: this can't change in VM's
      lifetime. Now /proc/interrupts looks like
      
       62:        202          0   xen-dyn    -event     device/vif/0-q0-tx
       63:        317          0   xen-dyn    -event     device/vif/0-q0-rx
       64:        262          0   xen-dyn    -event     device/vif/0-q1-tx
       65:         17          0   xen-dyn    -event     device/vif/0-q1-rx
      
      Fixes: f599c64f ("xen-netfront: Fix race between device setup and open")
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Reviewed-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21fa7488
    • Jakub Kicinski's avatar
      nfp: avoid buffer leak when FW communication fails · 8e824a3c
      Jakub Kicinski authored
      [ Upstream commit 07300f77 ]
      
      After device is stopped we reset the rings by moving all free buffers
      to positions [0, cnt - 2], and clear the position cnt - 1 in the ring.
      We then proceed to clear the read/write pointers.  This means that if
      we try to reset the ring again the code will assume that the next to
      fill buffer is at position 0 and swap it with cnt - 1.  Since we
      previously cleared position cnt - 1 it will lead to leaking the first
      buffer and leaving ring in a bad state.
      
      This scenario can only happen if FW communication fails, in which case
      the ring will never be used again, so the fact it's in a bad state will
      not be noticed.  Buffer leak is the only problem.  Don't try to move
      buffers in the ring if the read/write pointers indicate the ring was
      never used or have already been reset.
      
      nfp_net_clear_config_and_disable() is now fully idempotent.
      
      Found by code inspection, FW communication failures are very rare,
      and reconfiguring a live device is not common either, so it's unlikely
      anyone has ever noticed the leak.
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e824a3c
    • Ard Biesheuvel's avatar
      efi/arm: preserve early mapping of UEFI memory map longer for BGRT · be2338f3
      Ard Biesheuvel authored
      [ Upstream commit 3ea86495 ]
      
      The BGRT code validates the contents of the table against the UEFI
      memory map, and so it expects it to be mapped when the code runs.
      
      On ARM, this is currently not the case, since we tear down the early
      mapping after efi_init() completes, and only create the permanent
      mapping in arm_enable_runtime_services(), which executes as an early
      initcall, but still leaves a window where the UEFI memory map is not
      mapped.
      
      So move the call to efi_memmap_unmap() from efi_init() to
      arm_enable_runtime_services().
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      [will: fold in EFI_MEMMAP attribute check from Ard]
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be2338f3
    • YueHaibing's avatar
      wan/fsl_ucc_hdlc: use IS_ERR_VALUE() to check return value of qe_muram_alloc · f42caead
      YueHaibing authored
      [ Upstream commit fd800f64 ]
      
      qe_muram_alloc return a unsigned long integer,which should not
      compared with zero. check it using IS_ERR_VALUE() to fix this.
      
      Fixes: c19b6d24 ("drivers/net: support hdlc function for QE-UCC")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f42caead
    • Piotr Sawicki's avatar
      Smack: Fix handling of IPv4 traffic received by PF_INET6 sockets · a64fa273
      Piotr Sawicki authored
      [ Upstream commit 129a9989 ]
      
      A socket which has sk_family set to PF_INET6 is able to receive not
      only IPv6 but also IPv4 traffic (IPv4-mapped IPv6 addresses).
      
      Prior to this patch, the smk_skb_to_addr_ipv6() could have been
      called for socket buffers containing IPv4 packets, in result such
      traffic was allowed.
      Signed-off-by: default avatarPiotr Sawicki <p.sawicki2@partner.samsung.com>
      Signed-off-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a64fa273
    • Manikanta Pubbisetty's avatar
      mac80211: restrict delayed tailroom needed decrement · 03758ba7
      Manikanta Pubbisetty authored
      [ Upstream commit 133bf90d ]
      
      As explained in ieee80211_delayed_tailroom_dec(), during roam,
      keys of the old AP will be destroyed and new keys will be
      installed. Deletion of the old key causes
      crypto_tx_tailroom_needed_cnt to go from 1 to 0 and the new key
      installation causes a transition from 0 to 1.
      
      Whenever crypto_tx_tailroom_needed_cnt transitions from 0 to 1,
      we invoke synchronize_net(); the reason for doing this is to avoid
      a race in the TX path as explained in increment_tailroom_need_count().
      This synchronize_net() operation can be slow and can affect the station
      roam time. To avoid this, decrementing the crypto_tx_tailroom_needed_cnt
      is delayed for a while so that upon installation of new key the
      transition would be from 1 to 2 instead of 0 to 1 and thereby
      improving the roam time.
      
      This is all correct for a STA iftype, but deferring the tailroom_needed
      decrement for other iftypes may be unnecessary.
      
      For example, let's consider the case of a 4-addr client connecting to
      an AP for which AP_VLAN interface is also created, let the initial
      value for tailroom_needed on the AP be 1.
      
      * 4-addr client connects to the AP (AP: tailroom_needed = 1)
      * AP will clear old keys, delay decrement of tailroom_needed count
      * AP_VLAN is created, it takes the tailroom count from master
        (AP_VLAN: tailroom_needed = 1, AP: tailroom_needed = 1)
      * Install new key for the station, assume key is plumbed in the HW,
        there won't be any change in tailroom_needed count on AP iface
      * Delayed decrement of tailroom_needed count on AP
        (AP: tailroom_needed = 0, AP_VLAN: tailroom_needed = 1)
      
      Because of the delayed decrement on AP iface, tailroom_needed count goes
      out of sync between AP(master iface) and AP_VLAN(slave iface) and
      there would be unnecessary tailroom created for the packets going
      through AP_VLAN iface.
      
      Also, WARN_ONs were observed while trying to bring down the AP_VLAN
      interface:
      (warn_slowpath_common) (warn_slowpath_null+0x18/0x20)
      (warn_slowpath_null) (ieee80211_free_keys+0x114/0x1e4)
      (ieee80211_free_keys) (ieee80211_del_virtual_monitor+0x51c/0x850)
      (ieee80211_del_virtual_monitor) (ieee80211_stop+0x30/0x3c)
      (ieee80211_stop) (__dev_close_many+0x94/0xb8)
      (__dev_close_many) (dev_close_many+0x5c/0xc8)
      
      Restricting delayed decrement to station interface alone fixes the problem
      and it makes sense to do so because delayed decrement is done to improve
      roam time which is applicable only for client devices.
      Signed-off-by: default avatarManikanta Pubbisetty <mpubbise@codeaurora.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03758ba7
    • Paul Cercueil's avatar
      MIPS: jz4740: Bump zload address · f3f1e438
      Paul Cercueil authored
      [ Upstream commit c6ea7e97 ]
      
      Having the zload address at 0x8060.0000 means the size of the
      uncompressed kernel cannot be bigger than around 6 MiB, as it is
      deflated at address 0x8001.0000.
      
      This limit is too small; a kernel with some built-in drivers and things
      like debugfs enabled will already be over 6 MiB in size, and so will
      fail to extract properly.
      
      To fix this, we bump the zload address from 0x8060.0000 to 0x8100.0000.
      
      This is fine, as all the boards featuring Ingenic JZ SoCs have at least
      32 MiB of RAM, and use u-boot or compatible bootloaders which won't
      hardcode the load address but read it from the uImage's header.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19787/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3f1e438
    • Nicholas Piggin's avatar
      powerpc/powernv: opal_put_chars partial write fix · e15407a2
      Nicholas Piggin authored
      [ Upstream commit bd90284c ]
      
      The intention here is to consume and discard the remaining buffer
      upon error. This works if there has not been a previous partial write.
      If there has been, then total_len is no longer total number of bytes
      to copy. total_len is always "bytes left to copy", so it should be
      added to written bytes.
      
      This code may not be exercised any more if partial writes will not be
      hit, but this is a small bugfix before a larger change.
      Reviewed-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e15407a2
    • Sandipan Das's avatar
      perf powerpc: Fix callchain ip filtering · 24dc2f57
      Sandipan Das authored
      [ Upstream commit c715fcfd ]
      
      For powerpc64, redundant entries in the callchain are filtered out by
      determining the state of the return address and the stack frame using
      DWARF debug information.
      
      For making these filtering decisions we must analyze the debug
      information for the location corresponding to the program counter value,
      i.e. the first entry in the callchain, and not the LR value; otherwise,
      perf may filter out either the second or the third entry in the
      callchain incorrectly.
      
      This can be observed on a powerpc64le system running Fedora 27 as shown
      below.
      
      Case 1 - Attaching a probe at inet_pton+0x8 (binary offset 0x15af28).
               Return address is still in LR and a new stack frame is not yet
               allocated. The LR value, i.e. the second entry, should not be
      	 filtered out.
      
        # objdump -d /usr/lib64/libc-2.26.so | less
        ...
        000000000010eb10 <gaih_inet.constprop.7>:
        ...
          10fa48:       78 bb e4 7e     mr      r4,r23
          10fa4c:       0a 00 60 38     li      r3,10
          10fa50:       d9 b4 04 48     bl      15af28 <inet_pton+0x8>
          10fa54:       00 00 00 60     nop
          10fa58:       ac f4 ff 4b     b       10ef04 <gaih_inet.constprop.7+0x3f4>
        ...
        0000000000110450 <getaddrinfo>:
        ...
          1105a8:       54 00 ff 38     addi    r7,r31,84
          1105ac:       58 00 df 38     addi    r6,r31,88
          1105b0:       69 e5 ff 4b     bl      10eb18 <gaih_inet.constprop.7+0x8>
          1105b4:       78 1b 71 7c     mr      r17,r3
          1105b8:       50 01 7f e8     ld      r3,336(r31)
        ...
        000000000015af20 <inet_pton>:
          15af20:       0b 00 4c 3c     addis   r2,r12,11
          15af24:       e0 c1 42 38     addi    r2,r2,-15904
          15af28:       a6 02 08 7c     mflr    r0
          15af2c:       f0 ff c1 fb     std     r30,-16(r1)
          15af30:       f8 ff e1 fb     std     r31,-8(r1)
        ...
      
        # perf probe -x /usr/lib64/libc-2.26.so -a inet_pton+0x8
        # perf record -e probe_libc:inet_pton -g ping -6 -c 1 ::1
        # perf script
      
      Before:
      
        ping  4507 [002] 514985.546540: probe_libc:inet_pton: (7fffa7dbaf28)
                    7fffa7dbaf28 __GI___inet_pton+0x8 (/usr/lib64/libc-2.26.so)
                    7fffa7d705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
                       13fb52d70 _init+0xbfc (/usr/bin/ping)
                    7fffa7c836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fffa7c83898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
      
      After:
      
        ping  4507 [002] 514985.546540: probe_libc:inet_pton: (7fffa7dbaf28)
                    7fffa7dbaf28 __GI___inet_pton+0x8 (/usr/lib64/libc-2.26.so)
                    7fffa7d6fa54 gaih_inet.constprop.7+0xf44 (/usr/lib64/libc-2.26.so)
                    7fffa7d705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
                       13fb52d70 _init+0xbfc (/usr/bin/ping)
                    7fffa7c836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fffa7c83898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
      
      Case 2 - Attaching a probe at _int_malloc+0x180 (binary offset 0x9cf10).
               Return address in still in LR and a new stack frame has already
               been allocated but not used. The caller's caller, i.e. the third
      	 entry, is invalid and should be filtered out and not the second
      	 one.
      
        # objdump -d /usr/lib64/libc-2.26.so | less
        ...
        000000000009cd90 <_int_malloc>:
           9cd90:       17 00 4c 3c     addis   r2,r12,23
           9cd94:       70 a3 42 38     addi    r2,r2,-23696
           9cd98:       26 00 80 7d     mfcr    r12
           9cd9c:       f8 ff e1 fb     std     r31,-8(r1)
           9cda0:       17 00 e4 3b     addi    r31,r4,23
           9cda4:       d8 ff 61 fb     std     r27,-40(r1)
           9cda8:       78 23 9b 7c     mr      r27,r4
           9cdac:       1f 00 bf 2b     cmpldi  cr7,r31,31
           9cdb0:       f0 ff c1 fb     std     r30,-16(r1)
           9cdb4:       b0 ff c1 fa     std     r22,-80(r1)
           9cdb8:       78 1b 7e 7c     mr      r30,r3
           9cdbc:       08 00 81 91     stw     r12,8(r1)
           9cdc0:       11 ff 21 f8     stdu    r1,-240(r1)
           9cdc4:       4c 01 9d 41     bgt     cr7,9cf10 <_int_malloc+0x180>
           9cdc8:       20 00 a4 2b     cmpldi  cr7,r4,32
        ...
           9cf08:       00 00 00 60     nop
           9cf0c:       00 00 42 60     ori     r2,r2,0
           9cf10:       e4 06 ff 7b     rldicr  r31,r31,0,59
           9cf14:       40 f8 a4 7f     cmpld   cr7,r4,r31
           9cf18:       68 05 9d 41     bgt     cr7,9d480 <_int_malloc+0x6f0>
        ...
        000000000009e3c0 <tcache_init.part.4>:
        ...
           9e420:       40 02 80 38     li      r4,576
           9e424:       78 fb e3 7f     mr      r3,r31
           9e428:       71 e9 ff 4b     bl      9cd98 <_int_malloc+0x8>
           9e42c:       00 00 a3 2f     cmpdi   cr7,r3,0
           9e430:       78 1b 7e 7c     mr      r30,r3
        ...
        000000000009f7a0 <__libc_malloc>:
        ...
           9f8f8:       00 00 89 2f     cmpwi   cr7,r9,0
           9f8fc:       1c ff 9e 40     bne     cr7,9f818 <__libc_malloc+0x78>
           9f900:       c9 ea ff 4b     bl      9e3c8 <tcache_init.part.4+0x8>
           9f904:       00 00 00 60     nop
           9f908:       e8 90 22 e9     ld      r9,-28440(r2)
        ...
      
        # perf probe -x /usr/lib64/libc-2.26.so -a _int_malloc+0x180
        # perf record -e probe_libc:_int_malloc -g ./test-malloc
        # perf script
      
      Before:
      
        test-malloc  6554 [009] 515975.797403: probe_libc:_int_malloc: (7fffa6e6cf10)
                    7fffa6e6cf10 _int_malloc+0x180 (/usr/lib64/libc-2.26.so)
                    7fffa6dd0000 [unknown] (/usr/lib64/libc-2.26.so)
                    7fffa6e6f904 malloc+0x164 (/usr/lib64/libc-2.26.so)
                    7fffa6e6f9fc malloc+0x25c (/usr/lib64/libc-2.26.so)
                        100006b4 main+0x38 (/home/testuser/test-malloc)
                    7fffa6df36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fffa6df3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
      
      After:
      
        test-malloc  6554 [009] 515975.797403: probe_libc:_int_malloc: (7fffa6e6cf10)
                    7fffa6e6cf10 _int_malloc+0x180 (/usr/lib64/libc-2.26.so)
                    7fffa6e6e42c tcache_init.part.4+0x6c (/usr/lib64/libc-2.26.so)
                    7fffa6e6f904 malloc+0x164 (/usr/lib64/libc-2.26.so)
                    7fffa6e6f9fc malloc+0x25c (/usr/lib64/libc-2.26.so)
                        100006b4 main+0x38 (/home/sandipan/test-malloc)
                    7fffa6df36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fffa6df3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
      Signed-off-by: default avatarSandipan Das <sandipan@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Maynard Johnson <maynard@us.ibm.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Fixes: a60335ba ("perf tools powerpc: Adjust callchain based on DWARF debug info")
      Link: http://lkml.kernel.org/r/24bb726d91ed173aebc972ec3f41a2ef2249434e.1530724939.git.sandipan@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24dc2f57
    • Krzysztof Kozlowski's avatar
      ARM: exynos: Clear global variable on init error path · 7aea78a5
      Krzysztof Kozlowski authored
      [ Upstream commit cd480691 ]
      
      For most of Exynos SoCs, Power Management Unit (PMU) address space is
      mapped into global variable 'pmu_base_addr' very early when initializing
      PMU interrupt controller.  A lot of other machine code depends on it so
      when doing iounmap() on this address, clear the global as well to avoid
      usage of invalid value (pointing to unmapped memory region).
      
      Properly mapped PMU address space is a requirement for all other machine
      code so this fix is purely theoretical.  Boot will fail immediately in
      many other places after following this error path.
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7aea78a5
    • Fredrik Noring's avatar
      fbdev: Distinguish between interlaced and progressive modes · 6431fb7b
      Fredrik Noring authored
      [ Upstream commit 1ba0a59c ]
      
      I discovered the problem when developing a frame buffer driver for the
      PlayStation 2 (not yet merged), using the following video modes for the
      PlayStation 3 in drivers/video/fbdev/ps3fb.c:
      
          }, {
              /* 1080if */
              "1080if", 50, 1920, 1080, 13468, 148, 484, 36, 4, 88, 5,
              FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
          }, {
              /* 1080pf */
              "1080pf", 50, 1920, 1080, 6734, 148, 484, 36, 4, 88, 5,
              FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
          },
      
      In ps3fb_probe, the mode_option module parameter is used with fb_find_mode
      but it can only select the interlaced variant of 1920x1080 since the loop
      matching the modes does not take the difference between interlaced and
      progressive modes into account.
      
      In short, without the patch, progressive 1920x1080 cannot be chosen as a
      mode_option parameter since fb_find_mode (falsely) thinks interlace is a
      perfect match.
      Signed-off-by: default avatarFredrik Noring <noring@nocrew.org>
      Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
      [b.zolnierkie: updated patch description]
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6431fb7b
    • Daniel Mack's avatar
      video: fbdev: pxafb: clear allocated memory for video modes · 1e5d820b
      Daniel Mack authored
      [ Upstream commit b951d80a ]
      
      When parsing the video modes from DT properties, make sure to zero out
      memory before using it. This is important because not all fields in the mode
      struct are explicitly initialized, even though they are used later on.
      
      Fixes: 420a4882 ("video: fbdev: pxafb: initial devicetree conversion")
      Reviewed-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e5d820b
    • Sandipan Das's avatar
      perf powerpc: Fix callchain ip filtering when return address is in a register · 14f3d651
      Sandipan Das authored
      [ Upstream commit 9068533e ]
      
      For powerpc64, perf will filter out the second entry in the callchain,
      i.e. the LR value, if the return address of the function corresponding
      to the probed location has already been saved on its caller's stack.
      
      The state of the return address is determined using debug information.
      At any point within a function, if the return address is already saved
      somewhere, a DWARF expression can tell us about its location. If the
      return address in still in LR only, no DWARF expression would exist.
      
      Typically, the instructions in a function's prologue first copy the LR
      value to R0 and then pushes R0 on to the stack. If LR has already been
      copied to R0 but R0 is yet to be pushed to the stack, we can still get a
      DWARF expression that says that the return address is in R0. This is
      indicating that getting a DWARF expression for the return address does
      not guarantee the fact that it has already been saved on the stack.
      
      This can be observed on a powerpc64le system running Fedora 27 as shown
      below.
      
        # objdump -d /usr/lib64/libc-2.26.so | less
        ...
        000000000015af20 <inet_pton>:
          15af20:       0b 00 4c 3c     addis   r2,r12,11
          15af24:       e0 c1 42 38     addi    r2,r2,-15904
          15af28:       a6 02 08 7c     mflr    r0
          15af2c:       f0 ff c1 fb     std     r30,-16(r1)
          15af30:       f8 ff e1 fb     std     r31,-8(r1)
          15af34:       78 1b 7f 7c     mr      r31,r3
          15af38:       78 23 83 7c     mr      r3,r4
          15af3c:       78 2b be 7c     mr      r30,r5
          15af40:       10 00 01 f8     std     r0,16(r1)
          15af44:       c1 ff 21 f8     stdu    r1,-64(r1)
          15af48:       28 00 81 f8     std     r4,40(r1)
        ...
      
        # readelf --debug-dump=frames-interp /usr/lib64/libc-2.26.so | less
        ...
        00027024 0000000000000024 00027028 FDE cie=00000000 pc=000000000015af20..000000000015af88
           LOC           CFA      r30   r31   ra
        000000000015af20 r1+0     u     u     u
        000000000015af34 r1+0     c-16  c-8   r0
        000000000015af48 r1+64    c-16  c-8   c+16
        000000000015af5c r1+0     c-16  c-8   c+16
        000000000015af78 r1+0     u     u
        ...
      
        # perf probe -x /usr/lib64/libc-2.26.so -a inet_pton+0x18
        # perf record -e probe_libc:inet_pton -g ping -6 -c 1 ::1
        # perf script
      
      Before:
      
        ping  2829 [005] 512917.460174: probe_libc:inet_pton: (7fff7e2baf38)
                    7fff7e2baf38 __GI___inet_pton+0x18 (/usr/lib64/libc-2.26.so)
                    7fff7e2705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
                       12f152d70 _init+0xbfc (/usr/bin/ping)
                    7fff7e1836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fff7e183898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
      
      After:
      
        ping  2829 [005] 512917.460174: probe_libc:inet_pton: (7fff7e2baf38)
                    7fff7e2baf38 __GI___inet_pton+0x18 (/usr/lib64/libc-2.26.so)
                    7fff7e26fa54 gaih_inet.constprop.7+0xf44 (/usr/lib64/libc-2.26.so)
                    7fff7e2705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
                       12f152d70 _init+0xbfc (/usr/bin/ping)
                    7fff7e1836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
                    7fff7e183898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
                               0 [unknown] ([unknown])
      Reported-by: default avatarRavi Bangoria <ravi.bangoria@linux.ibm.com>
      Signed-off-by: default avatarSandipan Das <sandipan@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Maynard Johnson <maynard@us.ibm.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/66e848a7bdf2d43b39210a705ff6d828a0865661.1530724939.git.sandipan@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      14f3d651
    • Randy Dunlap's avatar
      fbdev/via: fix defined but not used warning · e97220e2
      Randy Dunlap authored
      [ Upstream commit b6566b47 ]
      
      Fix a build warning in viafbdev.c when CONFIG_PROC_FS is not enabled
      by marking the unused function as __maybe_unused.
      
      ../drivers/video/fbdev/via/viafbdev.c:1471:12: warning: 'viafb_sup_odev_proc_show' defined but not used [-Wunused-function]
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e97220e2
    • Anton Vasilyev's avatar
      video: goldfishfb: fix memory leak on driver remove · d9f6ae2f
      Anton Vasilyev authored
      [ Upstream commit 5958fde7 ]
      
      goldfish_fb_probe() allocates memory for fb, but goldfish_fb_remove() does
      not have deallocation of fb, which leads to memory leak on probe/remove.
      
      The patch adds deallocation into goldfish_fb_remove().
      
      Found by Linux Driver Verification project (linuxtesting.org).
      Signed-off-by: default avatarAnton Vasilyev <vasilyev@ispras.ru>
      Cc: Aleksandar Markovic <aleksandar.markovic@mips.com>
      Cc: Miodrag Dinic <miodrag.dinic@mips.com>
      Cc: Goran Ferenc <goran.ferenc@mips.com>
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d9f6ae2f
    • Dan Carpenter's avatar
      fbdev: omapfb: off by one in omapfb_register_client() · 85d6635b
      Dan Carpenter authored
      [ Upstream commit 5ec1ec35 ]
      
      The omapfb_register_client[] array has OMAPFB_PLANE_NUM elements so the
      > should be >= or we are one element beyond the end of the array.
      
      Fixes: 8b08cf2b ("OMAP: add TI OMAP framebuffer driver")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Imre Deak <imre.deak@solidboot.com>
      Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85d6635b
    • Bob Peterson's avatar
      gfs2: Don't reject a supposedly full bitmap if we have blocks reserved · ddeb9cb4
      Bob Peterson authored
      [ Upstream commit e79e0e14 ]
      
      Before this patch, you could get into situations like this:
      
      1. Process 1 searches for X free blocks, finds them, makes a reservation
      2. Process 2 searches for free blocks in the same rgrp, but now the
         bitmap is full because process 1's reservation is skipped over.
         So it marks the bitmap as GBF_FULL.
      3. Process 1 tries to allocate blocks from its own reservation, but
         since the GBF_FULL bit is set, it skips over the rgrp and searches
         elsewhere, thus not using its own reservation.
      
      This patch adds an additional check to allow processes to use their
      own reservations.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ddeb9cb4
    • Thomas Richter's avatar
      perf test: Fix subtest number when showing results · 48c37aa3
      Thomas Richter authored
      [ Upstream commit 9ef01124 ]
      
      Perf test 40 for example has several subtests numbered 1-4 when
      displaying the start of the subtest. When the subtest results
      are displayed the subtests are numbered 0-3.
      
      Use this command to generate trace output:
      
        [root@s35lp76 perf]# ./perf test -Fv 40 2>/tmp/bpf1
      
      Fix this by adjusting the subtest number when show the
      subtest result.
      
      Output before:
      
        [root@s35lp76 perf]# egrep '(^40\.[0-4]| subtest [0-4]:)' /tmp/bpf1
        40.1: Basic BPF filtering                                 :
        BPF filter subtest 0: Ok
        40.2: BPF pinning                                         :
        BPF filter subtest 1: Ok
        40.3: BPF prologue generation                             :
        BPF filter subtest 2: Ok
        40.4: BPF relocation checker                              :
        BPF filter subtest 3: Ok
        [root@s35lp76 perf]#
      
      Output after:
      
        root@s35lp76 ~]# egrep '(^40\.[0-4]| subtest [0-4]:)' /tmp/bpf1
        40.1: Basic BPF filtering                                 :
        BPF filter subtest 1: Ok
        40.2: BPF pinning                                         :
        BPF filter subtest 2: Ok
        40.3: BPF prologue generation                             :
        BPF filter subtest 3: Ok
        40.4: BPF relocation checker                              :
        BPF filter subtest 4: Ok
        [root@s35lp76 ~]#
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: default avatarHendrik Brueckner <brueckner@linux.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20180724134858.100644-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      48c37aa3
    • Randy Dunlap's avatar
      mtd/maps: fix solutionengine.c printk format warnings · 4223d4b9
      Randy Dunlap authored
      [ Upstream commit 1d25e3ee ]
      
      Fix 2 printk format warnings (this driver is currently only used by
      arch/sh/) by using "%pap" instead of "%lx".
      
      Fixes these build warnings:
      
      ../drivers/mtd/maps/solutionengine.c: In function 'init_soleng_maps':
      ../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
      ../drivers/mtd/maps/solutionengine.c:62:54: note: format string is defined here
        printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
                                                        ~~~~^
                                                        %08x
      ../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
      ../drivers/mtd/maps/solutionengine.c:62:72: note: format string is defined here
        printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
                                                                          ~~~~^
                                                                          %08x
      
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Boris Brezillon <boris.brezillon@bootlin.com>
      Cc: Marek Vasut <marek.vasut@gmail.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: linux-mtd@lists.infradead.org
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: linux-sh@vger.kernel.org
      Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
      Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4223d4b9