1. 04 Jan, 2020 40 commits
    • James Smart's avatar
      scsi: lpfc: Fix SLI3 hba in loop mode not discovering devices · 81dd848f
      James Smart authored
      [ Upstream commit feff8b3d ]
      
      When operating in private loop mode, PLOGI exchanges are racing and the
      driver tries to abort it's PLOGI. But the PLOGI abort ends up terminating
      the login with the other end causing the other end to abort its PLOGI as
      well. Discovery never fully completes.
      
      Fix by disabling the PLOGI abort when private loop and letting the state
      machine play out.
      
      Link: https://lore.kernel.org/r/20191018211832.7917-5-jsmart2021@gmail.comSigned-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      81dd848f
    • David Disseldorp's avatar
      scsi: target: compare full CHAP_A Algorithm strings · 718ff848
      David Disseldorp authored
      [ Upstream commit 9cef2a79 ]
      
      RFC 2307 states:
      
        For CHAP [RFC1994], in the first step, the initiator MUST send:
      
            CHAP_A=<A1,A2...>
      
         Where A1,A2... are proposed algorithms, in order of preference.
      ...
         For the Algorithm, as stated in [RFC1994], one value is required to
         be implemented:
      
             5     (CHAP with MD5)
      
      LIO currently checks for this value by only comparing a single byte in
      the tokenized Algorithm string, which means that any value starting with
      a '5' (e.g. "55") is interpreted as "CHAP with MD5". Fix this by
      comparing the entire tokenized string.
      Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
      Reviewed-by: default avatarMike Christie <mchristi@redhat.com>
      Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Link: https://lore.kernel.org/r/20190912095547.22427-2-ddiss@suse.deSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      718ff848
    • Thierry Reding's avatar
      iommu/tegra-smmu: Fix page tables in > 4 GiB memory · e5fb4e72
      Thierry Reding authored
      [ Upstream commit 96d3ab80 ]
      
      Page tables that reside in physical memory beyond the 4 GiB boundary are
      currently not working properly. The reason is that when the physical
      address for page directory entries is read, it gets truncated at 32 bits
      and can cause crashes when passing that address to the DMA API.
      
      Fix this by first casting the PDE value to a dma_addr_t and then using
      the page frame number mask for the SMMU instance to mask out the invalid
      bits, which are typically used for mapping attributes, etc.
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e5fb4e72
    • Evan Green's avatar
      Input: atmel_mxt_ts - disable IRQ across suspend · d1eafbbb
      Evan Green authored
      [ Upstream commit 463fa44e ]
      
      Across suspend and resume, we are seeing error messages like the following:
      
      atmel_mxt_ts i2c-PRP0001:00: __mxt_read_reg: i2c transfer failed (-121)
      atmel_mxt_ts i2c-PRP0001:00: Failed to read T44 and T5 (-121)
      
      This occurs because the driver leaves its IRQ enabled. Upon resume, there
      is an IRQ pending, but the interrupt is serviced before both the driver and
      the underlying I2C bus have been resumed. This causes EREMOTEIO errors.
      
      Disable the IRQ in suspend, and re-enable it on resume. If there are cases
      where the driver enters suspend with interrupts disabled, that's a bug we
      should fix separately.
      Signed-off-by: default avatarEvan Green <evgreen@chromium.org>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1eafbbb
    • James Smart's avatar
      scsi: lpfc: Fix locking on mailbox command completion · 3a2c8a4a
      James Smart authored
      [ Upstream commit 07b85824 ]
      
      Symptoms were seen of the driver not having valid data for mailbox
      commands. After debugging, the following sequence was found:
      
      The driver maintains a port-wide pointer of the mailbox command that is
      currently in execution. Once finished, the port-wide pointer is cleared
      (done in lpfc_sli4_mq_release()). The next mailbox command issued will set
      the next pointer and so on.
      
      The mailbox response data is only copied if there is a valid port-wide
      pointer.
      
      In the failing case, it was seen that a new mailbox command was being
      attempted in parallel with the completion.  The parallel path was seeing
      the mailbox no long in use (flag check under lock) and thus set the port
      pointer.  The completion path had cleared the active flag under lock, but
      had not touched the port pointer.  The port pointer is cleared after the
      lock is released. In this case, the completion path cleared the just-set
      value by the parallel path.
      
      Fix by making the calls that clear mbox state/port pointer while under
      lock.  Also slightly cleaned up the error path.
      
      Link: https://lore.kernel.org/r/20190922035906.10977-8-jsmart2021@gmail.comSigned-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
      Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a2c8a4a
    • Sreekanth Reddy's avatar
      scsi: mpt3sas: Fix clear pending bit in ioctl status · c0f7d6db
      Sreekanth Reddy authored
      [ Upstream commit 782b2818 ]
      
      When user issues diag register command from application with required size,
      and if driver unable to allocate the memory, then it will fail the register
      command. While failing the register command, driver is not currently
      clearing MPT3_CMD_PENDING bit in ctl_cmds.status variable which was set
      before trying to allocate the memory. As this bit is set, subsequent
      register command will be failed with BUSY status even when user wants to
      register the trace buffer will less memory.
      
      Clear MPT3_CMD_PENDING bit in ctl_cmds.status before returning the diag
      register command with no memory status.
      
      Link: https://lore.kernel.org/r/1568379890-18347-4-git-send-email-sreekanth.reddy@broadcom.comSigned-off-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0f7d6db
    • Masami Hiramatsu's avatar
      perf probe: Fix to show function entry line as probe-able · 71514271
      Masami Hiramatsu authored
      commit 91e2f539 upstream.
      
      Fix die_walk_lines() to list the function entry line correctly.  Since
      the dwarf_entrypc() does not return the entry pc if the DIE has only
      range attribute, __die_walk_funclines() fails to list the declaration
      line (entry line) in that case.
      
      To solve this issue, this introduces die_entrypc() which correctly
      returns the entry PC (the first address range) even if the DIE has only
      range attribute. With this fix die_walk_lines() shows the function entry
      line is able to probe correctly.
      
      Fixes: 4cc9cec6 ("perf probe: Introduce lines walker interface")
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lore.kernel.org/lkml/157190837419.1859.4619125803596816752.stgit@devnote2Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Backlund <tmb@mageia.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71514271
    • Yangbo Lu's avatar
      mmc: sdhci-of-esdhc: fix P2020 errata handling · 77ab88e3
      Yangbo Lu authored
      commit fe0acab4 upstream.
      
      Two previous patches introduced below quirks for P2020 platforms.
      - SDHCI_QUIRK_RESET_AFTER_REQUEST
      - SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
      
      The patches made a mistake to add them in quirks2 of sdhci_host
      structure, while they were defined for quirks.
      	host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
      	host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
      
      This patch is to fix them.
      	host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST;
      	host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
      
      Fixes: 05cb6b2a ("mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support")
      Fixes: a46e4271 ("mmc: sdhci-of-esdhc: add erratum eSDHC5 support")
      Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20191216031842.40068-1-yangbo.lu@nxp.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77ab88e3
    • Christophe Leroy's avatar
      powerpc/irq: fix stack overflow verification · 22c53f0c
      Christophe Leroy authored
      commit 099bc481 upstream.
      
      Before commit 0366a1c7 ("powerpc/irq: Run softirqs off the top of
      the irq stack"), check_stack_overflow() was called by do_IRQ(), before
      switching to the irq stack.
      In that commit, do_IRQ() was renamed __do_irq(), and is now executing
      on the irq stack, so check_stack_overflow() has just become almost
      useless.
      
      Move check_stack_overflow() call in do_IRQ() to do the check while
      still on the current stack.
      
      Fixes: 0366a1c7 ("powerpc/irq: Run softirqs off the top of the irq stack")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/e033aa8116ab12b7ca9a9c75189ad0741e3b9b5f.1575872340.git.christophe.leroy@c-s.frSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22c53f0c
    • Jan Kara's avatar
      ext4: check for directory entries too close to block end · ed7c2c1c
      Jan Kara authored
      commit 109ba779 upstream.
      
      ext4_check_dir_entry() currently does not catch a case when a directory
      entry ends so close to the block end that the header of the next
      directory entry would not fit in the remaining space. This can lead to
      directory iteration code trying to access address beyond end of current
      buffer head leading to oops.
      
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20191202170213.4761-3-jack@suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed7c2c1c
    • Jan Kara's avatar
      ext4: fix ext4_empty_dir() for directories with holes · dfcbd407
      Jan Kara authored
      commit 64d4ce89 upstream.
      
      Function ext4_empty_dir() doesn't correctly handle directories with
      holes and crashes on bh->b_data dereference when bh is NULL. Reorganize
      the loop to use 'offset' variable all the times instead of comparing
      pointers to current direntry with bh->b_data pointer. Also add more
      strict checking of '.' and '..' directory entries to avoid entering loop
      in possibly invalid state on corrupted filesystems.
      
      References: CVE-2019-19037
      CC: stable@vger.kernel.org
      Fixes: 4e19d6b6 ("ext4: allow directory holes")
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20191202170213.4761-2-jack@suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dfcbd407
    • Ian Abbott's avatar
      staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value · 1b891ce7
      Ian Abbott authored
      commit ab42b48f upstream.
      
      The "auto-attach" handler function `gsc_hpdi_auto_attach()` calls
      `dma_alloc_coherent()` in a loop to allocate some DMA data buffers, and
      also calls it to allocate a buffer for a DMA descriptor chain.  However,
      it does not check the return value of any of these calls.  Change
      `gsc_hpdi_auto_attach()` to return `-ENOMEM` if any of these
      `dma_alloc_coherent()` calls fail.  This will result in the comedi core
      calling the "detach" handler `gsc_hpdi_detach()` as part of the
      clean-up, which will call `gsc_hpdi_free_dma()` to free any allocated
      DMA coherent memory buffers.
      
      Cc: <stable@vger.kernel.org> #4.6+
      Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
      Link: https://lore.kernel.org/r/20191216110823.216237-1-abbotti@mev.co.ukSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1b891ce7
    • Hans de Goede's avatar
      platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes · 6bffefad
      Hans de Goede authored
      commit 133b2ace upstream.
      
      At least on the HP Envy x360 15-cp0xxx model the WMI interface
      for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes,
      otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS):
      
      Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5
      
      We do not care about the contents of the buffer, we just want to know
      if the HPWMI_FEATURE2_QUERY command is supported.
      
      This commits bumps the buffer size, fixing the error.
      
      Fixes: 8a1513b4 ("hp-wmi: limit hotkey enable")
      Cc: stable@vger.kernel.org
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6bffefad
    • Erkka Talvitie's avatar
      USB: EHCI: Do not return -EPIPE when hub is disconnected · b195c3ff
      Erkka Talvitie authored
      commit 64cc3f12 upstream.
      
      When disconnecting a USB hub that has some child device(s) connected to it
      (such as a USB mouse), then the stack tries to clear halt and
      reset device(s) which are _already_ physically disconnected.
      
      The issue has been reproduced with:
      
      CPU: IMX6D5EYM10AD or MCIMX6D5EYM10AE.
      SW: U-Boot 2019.07 and kernel 4.19.40.
      
      CPU: HP Proliant Microserver Gen8.
      SW: Linux version 4.2.3-300.fc23.x86_64
      
      In this situation there will be error bit for MMF active yet the
      CERR equals EHCI_TUNE_CERR + halt. Existing implementation
      interprets this as a stall [1] (chapter 8.4.5).
      
      The possible conditions when the MMF will be active + halt
      can be found from [2] (Table 4-13).
      
      Fix for the issue is to check whether MMF is active and PID Code is
      IN before checking for the stall. If these conditions are true then
      it is not a stall.
      
      What happens after the fix is that when disconnecting a hub with
      attached device(s) the situation is not interpret as a stall.
      
      [1] [https://www.usb.org/document-library/usb-20-specification, usb_20.pdf]
      [2] [https://www.intel.com/content/dam/www/public/us/en/documents/
           technical-specifications/ehci-specification-for-usb.pdf]
      Signed-off-by: default avatarErkka Talvitie <erkka.talvitie@vincit.fi>
      Reviewed-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/ef70941d5f349767f19c0ed26b0dd9eed8ad81bb.1576050523.git.erkka.talvitie@vincit.fiSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b195c3ff
    • Suwan Kim's avatar
      usbip: Fix error path of vhci_recv_ret_submit() · 9640bcac
      Suwan Kim authored
      commit aabb5b83 upstream.
      
      If a transaction error happens in vhci_recv_ret_submit(), event
      handler closes connection and changes port status to kick hub_event.
      Then hub tries to flush the endpoint URBs, but that causes infinite
      loop between usb_hub_flush_endpoint() and vhci_urb_dequeue() because
      "vhci_priv" in vhci_urb_dequeue() was already released by
      vhci_recv_ret_submit() before a transmission error occurred. Thus,
      vhci_urb_dequeue() terminates early and usb_hub_flush_endpoint()
      continuously calls vhci_urb_dequeue().
      
      The root cause of this issue is that vhci_recv_ret_submit()
      terminates early without giving back URB when transaction error
      occurs in vhci_recv_ret_submit(). That causes the error URB to still
      be linked at endpoint list without “vhci_priv".
      
      So, in the case of transaction error in vhci_recv_ret_submit(),
      unlink URB from the endpoint, insert proper error code in
      urb->status and give back URB.
      Reported-by: default avatarMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      Tested-by: default avatarMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
      Signed-off-by: default avatarSuwan Kim <suwan.kim027@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Link: https://lore.kernel.org/r/20191213023055.19933-3-suwan.kim027@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9640bcac
    • Geert Uytterhoeven's avatar
      net: dst: Force 4-byte alignment of dst_metrics · 3420bd51
      Geert Uytterhoeven authored
      [ Upstream commit 258a980d ]
      
      When storing a pointer to a dst_metrics structure in dst_entry._metrics,
      two flags are added in the least significant bits of the pointer value.
      Hence this assumes all pointers to dst_metrics structures have at least
      4-byte alignment.
      
      However, on m68k, the minimum alignment of 32-bit values is 2 bytes, not
      4 bytes.  Hence in some kernel builds, dst_default_metrics may be only
      2-byte aligned, leading to obscure boot warnings like:
      
          WARNING: CPU: 0 PID: 7 at lib/refcount.c:28 refcount_warn_saturate+0x44/0x9a
          refcount_t: underflow; use-after-free.
          Modules linked in:
          CPU: 0 PID: 7 Comm: ksoftirqd/0 Tainted: G        W         5.5.0-rc2-atari-01448-g114a1a1038af891d-dirty #261
          Stack from 10835e6c:
      	    10835e6c 0038134f 00023fa6 00394b0f 0000001c 00000009 00321560 00023fea
      	    00394b0f 0000001c 001a70f8 00000009 00000000 10835eb4 00000001 00000000
      	    04208040 0000000a 00394b4a 10835ed4 00043aa8 001a70f8 00394b0f 0000001c
      	    00000009 00394b4a 0026aba8 003215a4 00000003 00000000 0026d5a8 00000001
      	    003215a4 003a4361 003238d6 000001f0 00000000 003215a4 10aa3b00 00025e84
      	    003ddb00 10834000 002416a8 10aa3b00 00000000 00000080 000aa038 0004854a
          Call Trace: [<00023fa6>] __warn+0xb2/0xb4
           [<00023fea>] warn_slowpath_fmt+0x42/0x64
           [<001a70f8>] refcount_warn_saturate+0x44/0x9a
           [<00043aa8>] printk+0x0/0x18
           [<001a70f8>] refcount_warn_saturate+0x44/0x9a
           [<0026aba8>] refcount_sub_and_test.constprop.73+0x38/0x3e
           [<0026d5a8>] ipv4_dst_destroy+0x5e/0x7e
           [<00025e84>] __local_bh_enable_ip+0x0/0x8e
           [<002416a8>] dst_destroy+0x40/0xae
      
      Fix this by forcing 4-byte alignment of all dst_metrics structures.
      
      Fixes: e5fd387a ("ipv6: do not overwrite inetpeer metrics prematurely")
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3420bd51
    • Xin Long's avatar
      sctp: fully initialize v4 addr in some functions · 751653ce
      Xin Long authored
      [ Upstream commit b6f3320b ]
      
      Syzbot found a crash:
      
        BUG: KMSAN: uninit-value in crc32_body lib/crc32.c:112 [inline]
        BUG: KMSAN: uninit-value in crc32_le_generic lib/crc32.c:179 [inline]
        BUG: KMSAN: uninit-value in __crc32c_le_base+0x4fa/0xd30 lib/crc32.c:202
        Call Trace:
          crc32_body lib/crc32.c:112 [inline]
          crc32_le_generic lib/crc32.c:179 [inline]
          __crc32c_le_base+0x4fa/0xd30 lib/crc32.c:202
          chksum_update+0xb2/0x110 crypto/crc32c_generic.c:90
          crypto_shash_update+0x4c5/0x530 crypto/shash.c:107
          crc32c+0x150/0x220 lib/libcrc32c.c:47
          sctp_csum_update+0x89/0xa0 include/net/sctp/checksum.h:36
          __skb_checksum+0x1297/0x12a0 net/core/skbuff.c:2640
          sctp_compute_cksum include/net/sctp/checksum.h:59 [inline]
          sctp_packet_pack net/sctp/output.c:528 [inline]
          sctp_packet_transmit+0x40fb/0x4250 net/sctp/output.c:597
          sctp_outq_flush_transports net/sctp/outqueue.c:1146 [inline]
          sctp_outq_flush+0x1823/0x5d80 net/sctp/outqueue.c:1194
          sctp_outq_uncork+0xd0/0xf0 net/sctp/outqueue.c:757
          sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1781 [inline]
          sctp_side_effects net/sctp/sm_sideeffect.c:1184 [inline]
          sctp_do_sm+0x8fe1/0x9720 net/sctp/sm_sideeffect.c:1155
          sctp_primitive_REQUESTHEARTBEAT+0x175/0x1a0 net/sctp/primitive.c:185
          sctp_apply_peer_addr_params+0x212/0x1d40 net/sctp/socket.c:2433
          sctp_setsockopt_peer_addr_params net/sctp/socket.c:2686 [inline]
          sctp_setsockopt+0x189bb/0x19090 net/sctp/socket.c:4672
      
      The issue was caused by transport->ipaddr set with uninit addr param, which
      was passed by:
      
        sctp_transport_init net/sctp/transport.c:47 [inline]
        sctp_transport_new+0x248/0xa00 net/sctp/transport.c:100
        sctp_assoc_add_peer+0x5ba/0x2030 net/sctp/associola.c:611
        sctp_process_param net/sctp/sm_make_chunk.c:2524 [inline]
      
      where 'addr' is set by sctp_v4_from_addr_param(), and it doesn't initialize
      the padding of addr->v4.
      
      Later when calling sctp_make_heartbeat(), hbinfo.daddr(=transport->ipaddr)
      will become the part of skb, and the issue occurs.
      
      This patch is to fix it by initializing the padding of addr->v4 in
      sctp_v4_from_addr_param(), as well as other functions that do the similar
      thing, and these functions shouldn't trust that the caller initializes the
      memory, as Marcelo suggested.
      
      Reported-by: syzbot+6dcbfea81cd3d4dd0b02@syzkaller.appspotmail.com
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      751653ce
    • Cristian Birsan's avatar
      net: usb: lan78xx: Fix suspend/resume PHY register access error · 6a18a67a
      Cristian Birsan authored
      [ Upstream commit 20032b63 ]
      
      Lan78xx driver accesses the PHY registers through MDIO bus over USB
      connection. When performing a suspend/resume, the PHY registers can be
      accessed before the USB connection is resumed. This will generate an
      error and will prevent the device to resume correctly.
      This patch adds the dependency between the MDIO bus and USB device to
      allow correct handling of suspend/resume.
      
      Fixes: ce85e13a ("lan78xx: Update to use phylib instead of mii_if_info.")
      Signed-off-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6a18a67a
    • Ben Hutchings's avatar
      net: qlogic: Fix error paths in ql_alloc_large_buffers() · e5bcc3b9
      Ben Hutchings authored
      [ Upstream commit cad46039 ]
      
      ql_alloc_large_buffers() has the usual RX buffer allocation
      loop where it allocates skbs and maps them for DMA.  It also
      treats failure as a fatal error.
      
      There are (at least) three bugs in the error paths:
      
      1. ql_free_large_buffers() assumes that the lrg_buf[] entry for the
      first buffer that couldn't be allocated will have .skb == NULL.
      But the qla_buf[] array is not zero-initialised.
      
      2. ql_free_large_buffers() DMA-unmaps all skbs in lrg_buf[].  This is
      incorrect for the last allocated skb, if DMA mapping failed.
      
      3. Commit 1acb8f2a ("net: qlogic: Fix memory leak in
      ql_alloc_large_buffers") added a direct call to dev_kfree_skb_any()
      after the skb is recorded in lrg_buf[], so ql_free_large_buffers()
      will double-free it.
      
      The bugs are somewhat inter-twined, so fix them all at once:
      
      * Clear each entry in qla_buf[] before attempting to allocate
        an skb for it.  This goes half-way to fixing bug 1.
      * Set the .skb field only after the skb is DMA-mapped.  This
        fixes the rest.
      
      Fixes: 1357bfcf ("qla3xxx: Dynamically size the rx buffer queue ...")
      Fixes: 0f8ab89e ("qla3xxx: Check return code from pci_map_single() ...")
      Fixes: 1acb8f2a ("net: qlogic: Fix memory leak in ql_alloc_large_buffers")
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e5bcc3b9
    • Jia-Ju Bai's avatar
      net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive() · 8674b26c
      Jia-Ju Bai authored
      [ Upstream commit b7ac8936 ]
      
      The kernel may sleep while holding a spinlock.
      The function call path (from bottom to top) in Linux 4.19 is:
      
      net/nfc/nci/uart.c, 349:
      	nci_skb_alloc in nci_uart_default_recv_buf
      net/nfc/nci/uart.c, 255:
      	(FUNC_PTR)nci_uart_default_recv_buf in nci_uart_tty_receive
      net/nfc/nci/uart.c, 254:
      	spin_lock in nci_uart_tty_receive
      
      nci_skb_alloc(GFP_KERNEL) can sleep at runtime.
      (FUNC_PTR) means a function pointer is called.
      
      To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC for
      nci_skb_alloc().
      
      This bug is found by a static analysis tool STCheck written by myself.
      Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8674b26c
    • Jiangfeng Xiao's avatar
      net: hisilicon: Fix a BUG trigered by wrong bytes_compl · 0d8373f4
      Jiangfeng Xiao authored
      [ Upstream commit 90b3b339 ]
      
      When doing stress test, we get the following trace:
      kernel BUG at lib/dynamic_queue_limits.c:26!
      Internal error: Oops - BUG: 0 [#1] SMP ARM
      Modules linked in: hip04_eth
      CPU: 0 PID: 2003 Comm: tDblStackPcap0 Tainted: G           O L  4.4.197 #1
      Hardware name: Hisilicon A15
      task: c3637668 task.stack: de3bc000
      PC is at dql_completed+0x18/0x154
      LR is at hip04_tx_reclaim+0x110/0x174 [hip04_eth]
      pc : [<c041abfc>]    lr : [<bf0003a8>]    psr: 800f0313
      sp : de3bdc2c  ip : 00000000  fp : c020fb10
      r10: 00000000  r9 : c39b4224  r8 : 00000001
      r7 : 00000046  r6 : c39b4000  r5 : 0078f392  r4 : 0078f392
      r3 : 00000047  r2 : 00000000  r1 : 00000046  r0 : df5d5c80
      Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 32c5387d  Table: 1e189b80  DAC: 55555555
      Process tDblStackPcap0 (pid: 2003, stack limit = 0xde3bc190)
      Stack: (0xde3bdc2c to 0xde3be000)
      [<c041abfc>] (dql_completed) from [<bf0003a8>] (hip04_tx_reclaim+0x110/0x174 [hip04_eth])
      [<bf0003a8>] (hip04_tx_reclaim [hip04_eth]) from [<bf0012c0>] (hip04_rx_poll+0x20/0x388 [hip04_eth])
      [<bf0012c0>] (hip04_rx_poll [hip04_eth]) from [<c04c8d9c>] (net_rx_action+0x120/0x374)
      [<c04c8d9c>] (net_rx_action) from [<c021eaf4>] (__do_softirq+0x218/0x318)
      [<c021eaf4>] (__do_softirq) from [<c021eea0>] (irq_exit+0x88/0xac)
      [<c021eea0>] (irq_exit) from [<c0240130>] (msa_irq_exit+0x11c/0x1d4)
      [<c0240130>] (msa_irq_exit) from [<c0267ba8>] (__handle_domain_irq+0x110/0x148)
      [<c0267ba8>] (__handle_domain_irq) from [<c0201588>] (gic_handle_irq+0xd4/0x118)
      [<c0201588>] (gic_handle_irq) from [<c0558360>] (__irq_svc+0x40/0x58)
      Exception stack(0xde3bdde0 to 0xde3bde28)
      dde0: 00000000 00008001 c3637668 00000000 00000000 a00f0213 dd3627a0 c0af6380
      de00: c086d380 a00f0213 c0a22a50 de3bde6c 00000002 de3bde30 c0558138 c055813c
      de20: 600f0213 ffffffff
      [<c0558360>] (__irq_svc) from [<c055813c>] (_raw_spin_unlock_irqrestore+0x44/0x54)
      Kernel panic - not syncing: Fatal exception in interrupt
      
      Pre-modification code:
      int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
      {
      [...]
      [1]	priv->tx_head = TX_NEXT(tx_head);
      [2]	count++;
      [3]	netdev_sent_queue(ndev, skb->len);
      [...]
      }
      An rx interrupt occurs if hip04_mac_start_xmit just executes to the line 2,
      tx_head has been updated, but corresponding 'skb->len' has not been
      added to dql_queue.
      
      And then
      hip04_mac_interrupt->__napi_schedule->hip04_rx_poll->hip04_tx_reclaim
      
      In hip04_tx_reclaim, because tx_head has been updated,
      bytes_compl will plus an additional "skb-> len"
      which has not been added to dql_queue. And then
      trigger the BUG_ON(bytes_compl > num_queued - dql->num_completed).
      
      To solve the problem described above, we put
      "netdev_sent_queue(ndev, skb->len);"
      before
      "priv->tx_head = TX_NEXT(tx_head);"
      
      Fixes: a41ea46a ("net: hisilicon: new hip04 ethernet driver")
      Signed-off-by: default avatarJiangfeng Xiao <xiaojiangfeng@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0d8373f4
    • Russell King's avatar
      mod_devicetable: fix PHY module format · 5cf2e755
      Russell King authored
      [ Upstream commit d2ed49cf ]
      
      When a PHY is probed, if the top bit is set, we end up requesting a
      module with the string "mdio:-10101110000000100101000101010001" -
      the top bit is printed to a signed -1 value. This leads to the module
      not being loaded.
      
      Fix the module format string and the macro generating the values for
      it to ensure that we only print unsigned types and the top bit is
      always 0/1. We correctly end up with
      "mdio:10101110000000100101000101010001".
      
      Fixes: 8626d3b4 ("phylib: Support phy module autoloading")
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5cf2e755
    • Chuhong Yuan's avatar
      fjes: fix missed check in fjes_acpi_add · 3eb84bcf
      Chuhong Yuan authored
      [ Upstream commit a288f105 ]
      
      fjes_acpi_add() misses a check for platform_device_register_simple().
      Add a check to fix it.
      
      Fixes: 658d439b ("fjes: Introduce FUJITSU Extended Socket Network Device driver")
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3eb84bcf
    • Mao Wenan's avatar
      af_packet: set defaule value for tmo · 43c0e119
      Mao Wenan authored
      [ Upstream commit b43d1f9f ]
      
      There is softlockup when using TPACKET_V3:
      ...
      NMI watchdog: BUG: soft lockup - CPU#2 stuck for 60010ms!
      (__irq_svc) from [<c0558a0c>] (_raw_spin_unlock_irqrestore+0x44/0x54)
      (_raw_spin_unlock_irqrestore) from [<c027b7e8>] (mod_timer+0x210/0x25c)
      (mod_timer) from [<c0549c30>]
      (prb_retire_rx_blk_timer_expired+0x68/0x11c)
      (prb_retire_rx_blk_timer_expired) from [<c027a7ac>]
      (call_timer_fn+0x90/0x17c)
      (call_timer_fn) from [<c027ab6c>] (run_timer_softirq+0x2d4/0x2fc)
      (run_timer_softirq) from [<c021eaf4>] (__do_softirq+0x218/0x318)
      (__do_softirq) from [<c021eea0>] (irq_exit+0x88/0xac)
      (irq_exit) from [<c0240130>] (msa_irq_exit+0x11c/0x1d4)
      (msa_irq_exit) from [<c0209cf0>] (handle_IPI+0x650/0x7f4)
      (handle_IPI) from [<c02015bc>] (gic_handle_irq+0x108/0x118)
      (gic_handle_irq) from [<c0558ee4>] (__irq_usr+0x44/0x5c)
      ...
      
      If __ethtool_get_link_ksettings() is failed in
      prb_calc_retire_blk_tmo(), msec and tmo will be zero, so tov_in_jiffies
      is zero and the timer expire for retire_blk_timer is turn to
      mod_timer(&pkc->retire_blk_timer, jiffies + 0),
      which will trigger cpu usage of softirq is 100%.
      
      Fixes: f6fb8f10 ("af-packet: TPACKET_V3 flexible buffer implementation.")
      Tested-by: default avatarXiao Jiangfeng <xiaojiangfeng@huawei.com>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      43c0e119
    • Filipe Manana's avatar
      Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues · be9a42ba
      Filipe Manana authored
      [ Upstream commit 6609fee8 ]
      
      When a tree mod log user no longer needs to use the tree it calls
      btrfs_put_tree_mod_seq() to remove itself from the list of users and
      delete all no longer used elements of the tree's red black tree, which
      should be all elements with a sequence number less then our equals to
      the caller's sequence number. However the logic is broken because it
      can delete and free elements from the red black tree that have a
      sequence number greater then the caller's sequence number:
      
      1) At a point in time we have sequence numbers 1, 2, 3 and 4 in the
         tree mod log;
      
      2) The task which got assigned the sequence number 1 calls
         btrfs_put_tree_mod_seq();
      
      3) Sequence number 1 is deleted from the list of sequence numbers;
      
      4) The current minimum sequence number is computed to be the sequence
         number 2;
      
      5) A task using sequence number 2 is at tree_mod_log_rewind() and gets
         a pointer to one of its elements from the red black tree through
         a call to tree_mod_log_search();
      
      6) The task with sequence number 1 iterates the red black tree of tree
         modification elements and deletes (and frees) all elements with a
         sequence number less then or equals to 2 (the computed minimum sequence
         number) - it ends up only leaving elements with sequence numbers of 3
         and 4;
      
      7) The task with sequence number 2 now uses the pointer to its element,
         already freed by the other task, at __tree_mod_log_rewind(), resulting
         in a use-after-free issue. When CONFIG_DEBUG_PAGEALLOC=y it produces
         a trace like the following:
      
        [16804.546854] general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI
        [16804.547451] CPU: 0 PID: 28257 Comm: pool Tainted: G        W         5.4.0-rc8-btrfs-next-51 #1
        [16804.548059] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014
        [16804.548666] RIP: 0010:rb_next+0x16/0x50
        (...)
        [16804.550581] RSP: 0018:ffffb948418ef9b0 EFLAGS: 00010202
        [16804.551227] RAX: 6b6b6b6b6b6b6b6b RBX: ffff90e0247f6600 RCX: 6b6b6b6b6b6b6b6b
        [16804.551873] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff90e0247f6600
        [16804.552504] RBP: ffff90dffe0d4688 R08: 0000000000000001 R09: 0000000000000000
        [16804.553136] R10: ffff90dffa4a0040 R11: 0000000000000000 R12: 000000000000002e
        [16804.553768] R13: ffff90e0247f6600 R14: 0000000000001663 R15: ffff90dff77862b8
        [16804.554399] FS:  00007f4b197ae700(0000) GS:ffff90e036a00000(0000) knlGS:0000000000000000
        [16804.555039] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        [16804.555683] CR2: 00007f4b10022000 CR3: 00000002060e2004 CR4: 00000000003606f0
        [16804.556336] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        [16804.556968] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        [16804.557583] Call Trace:
        [16804.558207]  __tree_mod_log_rewind+0xbf/0x280 [btrfs]
        [16804.558835]  btrfs_search_old_slot+0x105/0xd00 [btrfs]
        [16804.559468]  resolve_indirect_refs+0x1eb/0xc70 [btrfs]
        [16804.560087]  ? free_extent_buffer.part.19+0x5a/0xc0 [btrfs]
        [16804.560700]  find_parent_nodes+0x388/0x1120 [btrfs]
        [16804.561310]  btrfs_check_shared+0x115/0x1c0 [btrfs]
        [16804.561916]  ? extent_fiemap+0x59d/0x6d0 [btrfs]
        [16804.562518]  extent_fiemap+0x59d/0x6d0 [btrfs]
        [16804.563112]  ? __might_fault+0x11/0x90
        [16804.563706]  do_vfs_ioctl+0x45a/0x700
        [16804.564299]  ksys_ioctl+0x70/0x80
        [16804.564885]  ? trace_hardirqs_off_thunk+0x1a/0x20
        [16804.565461]  __x64_sys_ioctl+0x16/0x20
        [16804.566020]  do_syscall_64+0x5c/0x250
        [16804.566580]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
        [16804.567153] RIP: 0033:0x7f4b1ba2add7
        (...)
        [16804.568907] RSP: 002b:00007f4b197adc88 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
        [16804.569513] RAX: ffffffffffffffda RBX: 00007f4b100210d8 RCX: 00007f4b1ba2add7
        [16804.570133] RDX: 00007f4b100210d8 RSI: 00000000c020660b RDI: 0000000000000003
        [16804.570726] RBP: 000055de05a6cfe0 R08: 0000000000000000 R09: 00007f4b197add44
        [16804.571314] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f4b197add48
        [16804.571905] R13: 00007f4b197add40 R14: 00007f4b100210d0 R15: 00007f4b197add50
        (...)
        [16804.575623] ---[ end trace 87317359aad4ba50 ]---
      
      Fix this by making btrfs_put_tree_mod_seq() skip deletion of elements that
      have a sequence number equals to the computed minimum sequence number, and
      not just elements with a sequence number greater then that minimum.
      
      Fixes: bd989ba3 ("Btrfs: add tree modification log functions")
      CC: stable@vger.kernel.org # 4.4+
      Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      be9a42ba
    • Josef Bacik's avatar
      btrfs: abort transaction after failed inode updates in create_subvol · e8da91ee
      Josef Bacik authored
      [ Upstream commit c7e54b51 ]
      
      We can just abort the transaction here, and in fact do that for every
      other failure in this function except these two cases.
      
      CC: stable@vger.kernel.org # 4.4+
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e8da91ee
    • Dan Carpenter's avatar
      btrfs: return error pointer from alloc_test_extent_buffer · fecbec3b
      Dan Carpenter authored
      [ Upstream commit b6293c82 ]
      
      Callers of alloc_test_extent_buffer have not correctly interpreted the
      return value as error pointer, as alloc_test_extent_buffer should behave
      as alloc_extent_buffer. The self-tests were unaffected but
      btrfs_find_create_tree_block could call both functions and that would
      cause problems up in the call chain.
      
      Fixes: faa2dbf0 ("Btrfs: add sanity tests for new qgroup accounting code")
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fecbec3b
    • Josef Bacik's avatar
      btrfs: do not call synchronize_srcu() in inode_tree_del · 863153c1
      Josef Bacik authored
      [ Upstream commit f72ff01d ]
      
      Testing with the new fsstress uncovered a pretty nasty deadlock with
      lookup and snapshot deletion.
      
      Process A
      unlink
       -> final iput
         -> inode_tree_del
           -> synchronize_srcu(subvol_srcu)
      
      Process B
      btrfs_lookup  <- srcu_read_lock() acquired here
        -> btrfs_iget
          -> find inode that has I_FREEING set
            -> __wait_on_freeing_inode()
      
      We're holding the srcu_read_lock() while doing the iget in order to make
      sure our fs root doesn't go away, and then we are waiting for the inode
      to finish freeing.  However because the free'ing process is doing a
      synchronize_srcu() we deadlock.
      
      Fix this by dropping the synchronize_srcu() in inode_tree_del().  We
      don't need people to stop accessing the fs root at this point, we're
      only adding our empty root to the dead roots list.
      
      A larger much more invasive fix is forthcoming to address how we deal
      with fs roots, but this fixes the immediate problem.
      
      Fixes: 76dda93c ("Btrfs: add snapshot/subvolume destroy ioctl")
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      863153c1
    • Josef Bacik's avatar
      btrfs: don't double lock the subvol_sem for rename exchange · 85562d8a
      Josef Bacik authored
      [ Upstream commit 943eb3bf ]
      
      If we're rename exchanging two subvols we'll try to lock this lock
      twice, which is bad.  Just lock once if either of the ino's are subvols.
      
      Fixes: cdd1fedf ("btrfs: add support for RENAME_EXCHANGE and RENAME_WHITEOUT")
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      85562d8a
    • Guenter Roeck's avatar
      usb: xhci: Fix build warning seen with CONFIG_PM=n · 795b4ef8
      Guenter Roeck authored
      [ Upstream commit 6056a0f8 ]
      
      The following build warning is seen if CONFIG_PM is disabled.
      
      drivers/usb/host/xhci-pci.c:498:13: warning:
      	unused function 'xhci_pci_shutdown'
      
      Fixes: f2c710f7 ("usb: xhci: only set D3hot for pci device")
      Cc: Henry Lin <henryl@nvidia.com>
      Cc: stable@vger.kernel.org	# all stable releases with f2c710f7Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20191218011911.6907-1-linux@roeck-us.netSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      795b4ef8
    • Faiz Abbas's avatar
      Revert "mmc: sdhci: Fix incorrect switch to HS mode" · 69f225a5
      Faiz Abbas authored
      commit 07bcc411 upstream.
      
      This reverts commit c894e33d.
      
      This commit aims to treat SD High speed and SDR25 as the same while
      setting UHS Timings in HOST_CONTROL2 which leads to failures with some
      SD cards in AM65x. Revert this commit.
      
      The issue this commit was trying to fix can be implemented in a platform
      specific callback instead of common sdhci code.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarFaiz Abbas <faiz_abbas@ti.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Link: https://lore.kernel.org/r/20191128110422.25917-1-faiz_abbas@ti.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69f225a5
    • Omar Sandoval's avatar
      btrfs: don't prematurely free work in reada_start_machine_worker() · c3c7c0cc
      Omar Sandoval authored
      [ Upstream commit e732fe95 ]
      
      Currently, reada_start_machine_worker() frees the reada_machine_work and
      then calls __reada_start_machine() to do readahead. This is another
      potential instance of the bug in "btrfs: don't prematurely free work in
      run_ordered_work()".
      
      There _might_ already be a deadlock here: reada_start_machine_worker()
      can depend on itself through stacked filesystems (__read_start_machine()
      -> reada_start_machine_dev() -> reada_tree_block_flagged() ->
      read_extent_buffer_pages() -> submit_one_bio() ->
      btree_submit_bio_hook() -> btrfs_map_bio() -> submit_stripe_bio() ->
      submit_bio() onto a loop device can trigger readahead on the lower
      filesystem).
      
      Either way, let's fix it by freeing the work at the end.
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c3c7c0cc
    • Russell King's avatar
      net: phy: initialise phydev speed and duplex sanely · 5baa2f38
      Russell King authored
      [ Upstream commit a5d66f81 ]
      
      When a phydev is created, the speed and duplex are set to zero and
      -1 respectively, rather than using the predefined SPEED_UNKNOWN and
      DUPLEX_UNKNOWN constants.
      
      There is a window at initialisation time where we may report link
      down using the 0/-1 values.  Tidy this up and use the predefined
      constants, so debug doesn't complain with:
      
      "Unsupported (update phy-core.c)/Unsupported (update phy-core.c)"
      
      when the speed and duplex settings are printed.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5baa2f38
    • Hewenliang's avatar
      libtraceevent: Fix memory leakage in copy_filter_type · 9d47b11b
      Hewenliang authored
      [ Upstream commit 10992af6 ]
      
      It is necessary to free the memory that we have allocated when error occurs.
      
      Fixes: ef3072cd ("tools lib traceevent: Get rid of die in add_filter_type()")
      Signed-off-by: default avatarHewenliang <hewenliang4@huawei.com>
      Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
      Link: http://lore.kernel.org/lkml/20191119014415.57210-1-hewenliang4@huawei.comSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d47b11b
    • Michael Ellerman's avatar
      crypto: vmx - Avoid weird build failures · c07956c4
      Michael Ellerman authored
      [ Upstream commit 4ee812f6 ]
      
      In the vmx crypto Makefile we assign to a variable called TARGET and
      pass that to the aesp8-ppc.pl and ghashp8-ppc.pl scripts.
      
      The variable is meant to describe what flavour of powerpc we're
      building for, eg. either 32 or 64-bit, and big or little endian.
      
      Unfortunately TARGET is a fairly common name for a make variable, and
      if it happens that TARGET is specified as a command line parameter to
      make, the value specified on the command line will override our value.
      
      In particular this can happen if the kernel Makefile is driven by an
      external Makefile that uses TARGET for something.
      
      This leads to weird build failures, eg:
        nonsense  at /build/linux/drivers/crypto/vmx/ghashp8-ppc.pl line 45.
        /linux/drivers/crypto/vmx/Makefile:20: recipe for target 'drivers/crypto/vmx/ghashp8-ppc.S' failed
      
      Which shows that we passed an empty value for $(TARGET) to the perl
      script, confirmed with make V=1:
      
        perl /linux/drivers/crypto/vmx/ghashp8-ppc.pl  > drivers/crypto/vmx/ghashp8-ppc.S
      
      We can avoid this confusion by using override, to tell make that we
      don't want anything to override our variable, even a value specified
      on the command line. We can also use a less common name, given the
      script calls it "flavour", let's use that.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c07956c4
    • Corentin Labbe's avatar
      crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c · ab4180b2
      Corentin Labbe authored
      [ Upstream commit a7126603 ]
      
      If you try to compile this driver on a 64-bit platform then you
      will get warnings because it mixes size_t with unsigned int which
      only works on 32-bit.
      
      This patch fixes all of the warnings on sun4i-ss-hash.c.
      Signed-off-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ab4180b2
    • Andy Shevchenko's avatar
      fbtft: Make sure string is NULL terminated · 0ef977d8
      Andy Shevchenko authored
      [ Upstream commit 21f58548 ]
      
      New GCC warns about inappropriate use of strncpy():
      
      drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_framebuffer_alloc’:
      drivers/staging/fbtft/fbtft-core.c:665:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
        665 |  strncpy(info->fix.id, dev->driver->name, 16);
            |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Later on the copy is being used with the assumption to be NULL terminated.
      Make sure string is NULL terminated by switching to snprintf().
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20191120095716.26628-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0ef977d8
    • Johannes Berg's avatar
      iwlwifi: check kasprintf() return value · f0a38523
      Johannes Berg authored
      [ Upstream commit 5974fbb5 ]
      
      kasprintf() can fail, we should check the return value.
      
      Fixes: 5ed540ae ("iwlwifi: use mac80211 throughput trigger")
      Fixes: 8ca151b5 ("iwlwifi: add the MVM driver")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f0a38523
    • Adrian Hunter's avatar
      x86/insn: Add some Intel instructions to the opcode map · 0421b439
      Adrian Hunter authored
      [ Upstream commit b980be18 ]
      
      Add to the opcode map the following instructions:
              cldemote
              tpause
              umonitor
              umwait
              movdiri
              movdir64b
              enqcmd
              enqcmds
              encls
              enclu
              enclv
              pconfig
              wbnoinvd
      
      For information about the instructions, refer Intel SDM May 2019
      (325462-070US) and Intel Architecture Instruction Set Extensions
      May 2019 (319433-037).
      
      The instruction decoding can be tested using the perf tools'
      "x86 instruction decoder - new instructions" test as folllows:
      
        $ perf test -v "new " 2>&1 | grep -i cldemote
        Decoded ok: 0f 1c 00                    cldemote (%eax)
        Decoded ok: 0f 1c 05 78 56 34 12        cldemote 0x12345678
        Decoded ok: 0f 1c 84 c8 78 56 34 12     cldemote 0x12345678(%eax,%ecx,8)
        Decoded ok: 0f 1c 00                    cldemote (%rax)
        Decoded ok: 41 0f 1c 00                 cldemote (%r8)
        Decoded ok: 0f 1c 04 25 78 56 34 12     cldemote 0x12345678
        Decoded ok: 0f 1c 84 c8 78 56 34 12     cldemote 0x12345678(%rax,%rcx,8)
        Decoded ok: 41 0f 1c 84 c8 78 56 34 12  cldemote 0x12345678(%r8,%rcx,8)
        $ perf test -v "new " 2>&1 | grep -i tpause
        Decoded ok: 66 0f ae f3                 tpause %ebx
        Decoded ok: 66 0f ae f3                 tpause %ebx
        Decoded ok: 66 41 0f ae f0              tpause %r8d
        $ perf test -v "new " 2>&1 | grep -i umonitor
        Decoded ok: 67 f3 0f ae f0              umonitor %ax
        Decoded ok: f3 0f ae f0                 umonitor %eax
        Decoded ok: 67 f3 0f ae f0              umonitor %eax
        Decoded ok: f3 0f ae f0                 umonitor %rax
        Decoded ok: 67 f3 41 0f ae f0           umonitor %r8d
        $ perf test -v "new " 2>&1 | grep -i umwait
        Decoded ok: f2 0f ae f0                 umwait %eax
        Decoded ok: f2 0f ae f0                 umwait %eax
        Decoded ok: f2 41 0f ae f0              umwait %r8d
        $ perf test -v "new " 2>&1 | grep -i movdiri
        Decoded ok: 0f 38 f9 03                 movdiri %eax,(%ebx)
        Decoded ok: 0f 38 f9 88 78 56 34 12     movdiri %ecx,0x12345678(%eax)
        Decoded ok: 48 0f 38 f9 03              movdiri %rax,(%rbx)
        Decoded ok: 48 0f 38 f9 88 78 56 34 12  movdiri %rcx,0x12345678(%rax)
        $ perf test -v "new " 2>&1 | grep -i movdir64b
        Decoded ok: 66 0f 38 f8 18              movdir64b (%eax),%ebx
        Decoded ok: 66 0f 38 f8 88 78 56 34 12  movdir64b 0x12345678(%eax),%ecx
        Decoded ok: 67 66 0f 38 f8 1c           movdir64b (%si),%bx
        Decoded ok: 67 66 0f 38 f8 8c 34 12     movdir64b 0x1234(%si),%cx
        Decoded ok: 66 0f 38 f8 18              movdir64b (%rax),%rbx
        Decoded ok: 66 0f 38 f8 88 78 56 34 12  movdir64b 0x12345678(%rax),%rcx
        Decoded ok: 67 66 0f 38 f8 18           movdir64b (%eax),%ebx
        Decoded ok: 67 66 0f 38 f8 88 78 56 34 12       movdir64b 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i enqcmd
        Decoded ok: f2 0f 38 f8 18              enqcmd (%eax),%ebx
        Decoded ok: f2 0f 38 f8 88 78 56 34 12  enqcmd 0x12345678(%eax),%ecx
        Decoded ok: 67 f2 0f 38 f8 1c           enqcmd (%si),%bx
        Decoded ok: 67 f2 0f 38 f8 8c 34 12     enqcmd 0x1234(%si),%cx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%eax),%ebx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%eax),%ecx
        Decoded ok: 67 f3 0f 38 f8 1c           enqcmds (%si),%bx
        Decoded ok: 67 f3 0f 38 f8 8c 34 12     enqcmds 0x1234(%si),%cx
        Decoded ok: f2 0f 38 f8 18              enqcmd (%rax),%rbx
        Decoded ok: f2 0f 38 f8 88 78 56 34 12  enqcmd 0x12345678(%rax),%rcx
        Decoded ok: 67 f2 0f 38 f8 18           enqcmd (%eax),%ebx
        Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12       enqcmd 0x12345678(%eax),%ecx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%rax),%rbx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%rax),%rcx
        Decoded ok: 67 f3 0f 38 f8 18           enqcmds (%eax),%ebx
        Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12       enqcmds 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i enqcmds
        Decoded ok: f3 0f 38 f8 18              enqcmds (%eax),%ebx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%eax),%ecx
        Decoded ok: 67 f3 0f 38 f8 1c           enqcmds (%si),%bx
        Decoded ok: 67 f3 0f 38 f8 8c 34 12     enqcmds 0x1234(%si),%cx
        Decoded ok: f3 0f 38 f8 18              enqcmds (%rax),%rbx
        Decoded ok: f3 0f 38 f8 88 78 56 34 12  enqcmds 0x12345678(%rax),%rcx
        Decoded ok: 67 f3 0f 38 f8 18           enqcmds (%eax),%ebx
        Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12       enqcmds 0x12345678(%eax),%ecx
        $ perf test -v "new " 2>&1 | grep -i encls
        Decoded ok: 0f 01 cf                    encls
        Decoded ok: 0f 01 cf                    encls
        $ perf test -v "new " 2>&1 | grep -i enclu
        Decoded ok: 0f 01 d7                    enclu
        Decoded ok: 0f 01 d7                    enclu
        $ perf test -v "new " 2>&1 | grep -i enclv
        Decoded ok: 0f 01 c0                    enclv
        Decoded ok: 0f 01 c0                    enclv
        $ perf test -v "new " 2>&1 | grep -i pconfig
        Decoded ok: 0f 01 c5                    pconfig
        Decoded ok: 0f 01 c5                    pconfig
        $ perf test -v "new " 2>&1 | grep -i wbnoinvd
        Decoded ok: f3 0f 09                    wbnoinvd
        Decoded ok: f3 0f 09                    wbnoinvd
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Link: http://lore.kernel.org/lkml/20191115135447.6519-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0421b439
    • Chuhong Yuan's avatar
      spi: st-ssc4: add missed pm_runtime_disable · b14731b9
      Chuhong Yuan authored
      [ Upstream commit cd050abe ]
      
      The driver forgets to call pm_runtime_disable in probe failure
      and remove.
      Add the missed calls to fix it.
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191118024848.21645-1-hslester96@gmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b14731b9