1. 24 Apr, 2020 40 commits
    • Maurizio Lombardi's avatar
      scsi: target: fix hang when multiple threads try to destroy the same iscsi session · 5fadf303
      Maurizio Lombardi authored
      [ Upstream commit 57c46e9f ]
      
      A number of hangs have been reported against the target driver; they are
      due to the fact that multiple threads may try to destroy the iscsi session
      at the same time. This may be reproduced for example when a "targetcli
      iscsi/iqn.../tpg1 disable" command is executed while a logout operation is
      underway.
      
      When this happens, two or more threads may end up sleeping and waiting for
      iscsit_close_connection() to execute "complete(session_wait_comp)".  Only
      one of the threads will wake up and proceed to destroy the session
      structure, the remaining threads will hang forever.
      
      Note that if the blocked threads are somehow forced to wake up with
      complete_all(), they will try to free the same iscsi session structure
      destroyed by the first thread, causing double frees, memory corruptions
      etc...
      
      With this patch, the threads that want to destroy the iscsi session will
      increase the session refcount and will set the "session_close" flag to 1;
      then they wait for the driver to close the remaining active connections.
      When the last connection is closed, iscsit_close_connection() will wake up
      all the threads and will wait for the session's refcount to reach zero;
      when this happens, iscsit_close_connection() will destroy the session
      structure because no one is referencing it anymore.
      
       INFO: task targetcli:5971 blocked for more than 120 seconds.
             Tainted: P           OE    4.15.0-72-generic #81~16.04.1
       "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
       targetcli       D    0  5971      1 0x00000080
       Call Trace:
        __schedule+0x3d6/0x8b0
        ? vprintk_func+0x44/0xe0
        schedule+0x36/0x80
        schedule_timeout+0x1db/0x370
        ? __dynamic_pr_debug+0x8a/0xb0
        wait_for_completion+0xb4/0x140
        ? wake_up_q+0x70/0x70
        iscsit_free_session+0x13d/0x1a0 [iscsi_target_mod]
        iscsit_release_sessions_for_tpg+0x16b/0x1e0 [iscsi_target_mod]
        iscsit_tpg_disable_portal_group+0xca/0x1c0 [iscsi_target_mod]
        lio_target_tpg_enable_store+0x66/0xe0 [iscsi_target_mod]
        configfs_write_file+0xb9/0x120
        __vfs_write+0x1b/0x40
        vfs_write+0xb8/0x1b0
        SyS_write+0x5c/0xe0
        do_syscall_64+0x73/0x130
        entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      
      Link: https://lore.kernel.org/r/20200313170656.9716-3-mlombard@redhat.comReported-by: default avatarMatt Coleman <mcoleman@datto.com>
      Tested-by: default avatarMatt Coleman <mcoleman@datto.com>
      Tested-by: default avatarRahul Kundu <rahul.kundu@chelsio.com>
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5fadf303
    • Maurizio Lombardi's avatar
      scsi: target: remove boilerplate code · e8347176
      Maurizio Lombardi authored
      [ Upstream commit e49a7d99 ]
      
      iscsit_free_session() is equivalent to iscsit_stop_session() followed by a
      call to iscsit_close_session().
      
      Link: https://lore.kernel.org/r/20200313170656.9716-2-mlombard@redhat.comTested-by: default avatarRahul Kundu <rahul.kundu@chelsio.com>
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e8347176
    • Jim Mattson's avatar
      kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD · 0c49195c
      Jim Mattson authored
      commit 396d2e87 upstream.
      
      The host reports support for the synthetic feature X86_FEATURE_SSBD
      when any of the three following hardware features are set:
        CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31]
        CPUID.80000008H:EBX.AMD_SSBD[bit 24]
        CPUID.80000008H:EBX.VIRT_SSBD[bit 25]
      
      Either of the first two hardware features implies the existence of the
      IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does
      not. Therefore, CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] should only be
      set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or
      CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host.
      
      Fixes: 0c54914d ("KVM: x86: use Intel speculation bugs and features as derived in generic x86 code")
      Signed-off-by: default avatarJim Mattson <jmattson@google.com>
      Reviewed-by: default avatarJacob Xu <jacobhxu@google.com>
      Reviewed-by: default avatarPeter Shier <pshier@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Reported-by: default avatarEric Biggers <ebiggers@kernel.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      [bwh: Backported to 4.x: adjust indentation]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0c49195c
    • Goldwyn Rodrigues's avatar
      dm flakey: check for null arg_name in parse_features() · e0a272f8
      Goldwyn Rodrigues authored
      [ Upstream commit 7690e253 ]
      
      One can crash dm-flakey by specifying more feature arguments than the
      number of features supplied.  Checking for null in arg_name avoids
      this.
      
      dmsetup create flakey-test --table "0 66076080 flakey /dev/sdb9 0 0 180 2 drop_writes"
      Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e0a272f8
    • Jan Kara's avatar
      ext4: do not zeroout extents beyond i_disksize · 40a88da4
      Jan Kara authored
      commit 801674f3 upstream.
      
      We do not want to create initialized extents beyond end of file because
      for e2fsck it is impossible to distinguish them from a case of corrupted
      file size / extent tree and so it complains like:
      
      Inode 12, i_size is 147456, should be 163840.  Fix? no
      
      Code in ext4_ext_convert_to_initialized() and
      ext4_split_convert_extents() try to make sure it does not create
      initialized extents beyond inode size however they check against
      inode->i_size which is wrong. They should instead check against
      EXT4_I(inode)->i_disksize which is the current inode size on disk.
      That's what e2fsck is going to see in case of crash before all dirty
      data is written. This bug manifests as generic/456 test failure (with
      recent enough fstests where fsx got fixed to properly pass
      FALLOC_KEEP_SIZE_FL flags to the kernel) when run with dioread_lock
      mount option.
      
      CC: stable@vger.kernel.org
      Fixes: 21ca087a ("ext4: Do not zero out uninitialized extents beyond i_size")
      Reviewed-by: default avatarLukas Czerner <lczerner@redhat.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Link: https://lore.kernel.org/r/20200331105016.8674-1-jack@suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40a88da4
    • Tuomas Tynkkynen's avatar
      mac80211_hwsim: Use kstrndup() in place of kasprintf() · 89033955
      Tuomas Tynkkynen authored
      commit 7ea86204 upstream.
      
      syzbot reports a warning:
      
      precision 33020 too large
      WARNING: CPU: 0 PID: 9618 at lib/vsprintf.c:2471 set_precision+0x150/0x180 lib/vsprintf.c:2471
       vsnprintf+0xa7b/0x19a0 lib/vsprintf.c:2547
       kvasprintf+0xb2/0x170 lib/kasprintf.c:22
       kasprintf+0xbb/0xf0 lib/kasprintf.c:59
       hwsim_del_radio_nl+0x63a/0x7e0 drivers/net/wireless/mac80211_hwsim.c:3625
       genl_family_rcv_msg_doit net/netlink/genetlink.c:672 [inline]
       ...
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Thus it seems that kasprintf() with "%.*s" format can not be used for
      duplicating a string with arbitrary length. Replace it with kstrndup().
      
      Note that later this string is limited to NL80211_WIPHY_NAME_MAXLEN == 64,
      but the code is simpler this way.
      
      Reported-by: syzbot+6693adf1698864d21734@syzkaller.appspotmail.com
      Reported-by: syzbot+a4aee3f42d7584d76761@syzkaller.appspotmail.com
      Cc: stable@kernel.org
      Signed-off-by: default avatarTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
      Link: https://lore.kernel.org/r/20200410123257.14559-1-tuomas.tynkkynen@iki.fi
      [johannes: add note about length limit]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89033955
    • Josef Bacik's avatar
      btrfs: check commit root generation in should_ignore_root · 32bb4ca9
      Josef Bacik authored
      commit 4d4225fc upstream.
      
      Previously we would set the reloc root's last snapshot to transid - 1.
      However there was a problem with doing this, and we changed it to
      setting the last snapshot to the generation of the commit node of the fs
      root.
      
      This however broke should_ignore_root().  The assumption is that if we
      are in a generation newer than when the reloc root was created, then we
      would find the reloc root through normal backref lookups, and thus can
      ignore any fs roots we find with an old enough reloc root.
      
      Now that the last snapshot could be considerably further in the past
      than before, we'd end up incorrectly ignoring an fs root.  Thus we'd
      find no nodes for the bytenr we were searching for, and we'd fail to
      relocate anything.  We'd loop through the relocate code again and see
      that there were still used space in that block group, attempt to
      relocate those bytenr's again, fail in the same way, and just loop like
      this forever.  This is tricky in that we have to not modify the fs root
      at all during this time, so we need to have a block group that has data
      in this fs root that is not shared by any other root, which is why this
      has been difficult to reproduce.
      
      Fixes: 054570a1 ("Btrfs: fix relocation incorrectly dropping data references")
      CC: stable@vger.kernel.org # 4.9+
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32bb4ca9
    • Takashi Iwai's avatar
      ALSA: usb-audio: Don't override ignore_ctl_error value from the map · 5078ff4d
      Takashi Iwai authored
      commit 3507245b upstream.
      
      The mapping table may contain also ignore_ctl_error flag for devices
      that are known to behave wild.  Since this flag always writes the
      card's own ignore_ctl_error flag, it overrides the value already set
      by the module option, so it doesn't follow user's expectation.
      Let's fix the code not to clear the flag that has been set by user.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206873
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200412081331.4742-3-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5078ff4d
    • Colin Ian King's avatar
      ASoC: Intel: mrfld: return error codes when an error occurs · a1a86e30
      Colin Ian King authored
      commit 3025571e upstream.
      
      Currently function sst_platform_get_resources always returns zero and
      error return codes set by the function are never returned. Fix this
      by returning the error return code in variable ret rather than the
      hard coded zero.
      
      Addresses-Coverity: ("Unused value")
      Fixes: f533a035 ("ASoC: Intel: mrfld - create separate module for pci part")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Link: https://lore.kernel.org/r/20200208220720.36657-1-colin.king@canonical.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1a86e30
    • Colin Ian King's avatar
      ASoC: Intel: mrfld: fix incorrect check on p->sink · 5bd70be6
      Colin Ian King authored
      commit f5e056e1 upstream.
      
      The check on p->sink looks bogus, I believe it should be p->source
      since the following code blocks are related to p->source. Fix
      this by replacing p->sink with p->source.
      
      Fixes: 24c8d141 ("ASoC: Intel: mrfld: add DSP core controls")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Addresses-Coverity: ("Copy-paste error")
      Link: https://lore.kernel.org/r/20191119113640.166940-1-colin.king@canonical.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5bd70be6
    • Josh Triplett's avatar
      ext4: fix incorrect inodes per group in error message · b845d41f
      Josh Triplett authored
      commit b9c538da upstream.
      
      If ext4_fill_super detects an invalid number of inodes per group, the
      resulting error message printed the number of blocks per group, rather
      than the number of inodes per group. Fix it to print the correct value.
      
      Fixes: cd6bb35b ("ext4: use more strict checks for inodes_per_block on mount")
      Link: https://lore.kernel.org/r/8be03355983a08e5d4eed480944613454d7e2550.1585434649.git.josh@joshtriplett.orgReviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
      Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b845d41f
    • Josh Triplett's avatar
      ext4: fix incorrect group count in ext4_fill_super error message · 536d20c0
      Josh Triplett authored
      commit df41460a upstream.
      
      ext4_fill_super doublechecks the number of groups before mounting; if
      that check fails, the resulting error message prints the group count
      from the ext4_sb_info sbi, which hasn't been set yet. Print the freshly
      computed group count instead (which at that point has just been computed
      in "blocks_count").
      Signed-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
      Fixes: 4ec11028 ("ext4: Add sanity checks for the superblock before mounting the filesystem")
      Link: https://lore.kernel.org/r/8b957cd1513fcc4550fe675c10bcce2175c33a49.1585431964.git.josh@joshtriplett.orgSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      536d20c0
    • zhangyi (F)'s avatar
      jbd2: improve comments about freeing data buffers whose page mapping is NULL · 0064b0f1
      zhangyi (F) authored
      commit 780f66e5 upstream.
      
      Improve comments in jbd2_journal_commit_transaction() to describe why
      we don't need to clear the buffer_mapped bit for freeing file mapping
      buffers whose page mapping is NULL.
      
      Link: https://lore.kernel.org/r/20200217112706.20085-1-yi.zhang@huawei.com
      Fixes: c96dceea ("jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer")
      Suggested-by: default avatarJan Kara <jack@suse.cz>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0064b0f1
    • Can Guo's avatar
      scsi: ufs: Fix ufshcd_hold() caused scheduling while atomic · db1b2190
      Can Guo authored
      commit c63d6099 upstream.
      
      The async version of ufshcd_hold(async == true), which is only called in
      queuecommand path as for now, is expected to work in atomic context, thus
      it should not sleep or schedule out. When it runs into the condition that
      clocks are ON but link is still in hibern8 state, it should bail out
      without flushing the clock ungate work.
      
      Fixes: f2a785ac ("scsi: ufshcd: Fix race between clk scaling and ungate work")
      Link: https://lore.kernel.org/r/1581392451-28743-6-git-send-email-cang@codeaurora.orgReviewed-by: default avatarHongwu Su <hongwus@codeaurora.org>
      Reviewed-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
      Reviewed-by: default avatarBean Huo <beanhuo@micron.com>
      Reviewed-by: default avatarStanley Chu <stanley.chu@mediatek.com>
      Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db1b2190
    • Tim Stallard's avatar
      net: ipv6: do not consider routes via gateways for anycast address check · a6047aaf
      Tim Stallard authored
      [ Upstream commit 03e2a984 ]
      
      The behaviour for what is considered an anycast address changed in
      commit 45e4fd26 ("ipv6: Only create RTF_CACHE routes after
      encountering pmtu exception"). This now considers the first
      address in a subnet where there is a route via a gateway
      to be an anycast address.
      
      This breaks path MTU discovery and traceroutes when a host in a
      remote network uses the address at the start of a prefix
      (eg 2600:: advertised as 2600::/48 in the DFZ) as ICMP errors
      will not be sent to anycast addresses.
      
      This patch excludes any routes with a gateway, or via point to
      point links, like the behaviour previously from
      rt6_is_gw_or_nonexthop in net/ipv6/route.c.
      
      This can be tested with:
      ip link add v1 type veth peer name v2
      ip netns add test
      ip netns exec test ip link set lo up
      ip link set v2 netns test
      ip link set v1 up
      ip netns exec test ip link set v2 up
      ip addr add 2001:db8::1/64 dev v1 nodad
      ip addr add 2001:db8:100:: dev lo nodad
      ip netns exec test ip addr add 2001:db8::2/64 dev v2 nodad
      ip netns exec test ip route add unreachable 2001:db8:1::1
      ip netns exec test ip route add 2001:db8:100::/64 via 2001:db8::1
      ip netns exec test sysctl net.ipv6.conf.all.forwarding=1
      ip route add 2001:db8:1::1 via 2001:db8::2
      ping -I 2001:db8::1 2001:db8:1::1 -c1
      ping -I 2001:db8:100:: 2001:db8:1::1 -c1
      ip addr delete 2001:db8:100:: dev lo
      ip netns delete test
      
      Currently the first ping will get back a destination unreachable ICMP
      error, but the second will never get a response, with "icmp6_send:
      acast source" logged. After this patch, both get destination
      unreachable ICMP replies.
      
      Fixes: 45e4fd26 ("ipv6: Only create RTF_CACHE routes after encountering pmtu exception")
      Signed-off-by: default avatarTim Stallard <code@timstallard.me.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a6047aaf
    • Wang Wenhu's avatar
      net: qrtr: send msgs from local of same id as broadcast · 0f838a40
      Wang Wenhu authored
      [ Upstream commit 6dbf02ac ]
      
      If the local node id(qrtr_local_nid) is not modified after its
      initialization, it equals to the broadcast node id(QRTR_NODE_BCAST).
      So the messages from local node should not be taken as broadcast
      and keep the process going to send them out anyway.
      
      The definitions are as follow:
      static unsigned int qrtr_local_nid = NUMA_NO_NODE;
      
      Fixes: fdf5fd39 ("net: qrtr: Broadcast messages only from control port")
      Signed-off-by: default avatarWang Wenhu <wenhu.wang@vivo.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f838a40
    • Taras Chornyi's avatar
      net: ipv4: devinet: Fix crash when add/del multicast IP with autojoin · 1cd63ccd
      Taras Chornyi authored
      [ Upstream commit 690cc863 ]
      
      When CONFIG_IP_MULTICAST is not set and multicast ip is added to the device
      with autojoin flag or when multicast ip is deleted kernel will crash.
      
      steps to reproduce:
      
      ip addr add 224.0.0.0/32 dev eth0
      ip addr del 224.0.0.0/32 dev eth0
      
      or
      
      ip addr add 224.0.0.0/32 dev eth0 autojoin
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000088
       pc : _raw_write_lock_irqsave+0x1e0/0x2ac
       lr : lock_sock_nested+0x1c/0x60
       Call trace:
        _raw_write_lock_irqsave+0x1e0/0x2ac
        lock_sock_nested+0x1c/0x60
        ip_mc_config.isra.28+0x50/0xe0
        inet_rtm_deladdr+0x1a8/0x1f0
        rtnetlink_rcv_msg+0x120/0x350
        netlink_rcv_skb+0x58/0x120
        rtnetlink_rcv+0x14/0x20
        netlink_unicast+0x1b8/0x270
        netlink_sendmsg+0x1a0/0x3b0
        ____sys_sendmsg+0x248/0x290
        ___sys_sendmsg+0x80/0xc0
        __sys_sendmsg+0x68/0xc0
        __arm64_sys_sendmsg+0x20/0x30
        el0_svc_common.constprop.2+0x88/0x150
        do_el0_svc+0x20/0x80
       el0_sync_handler+0x118/0x190
        el0_sync+0x140/0x180
      
      Fixes: 93a714d6 ("multicast: Extend ip address command to enable multicast group join/leave on")
      Signed-off-by: default avatarTaras Chornyi <taras.chornyi@plvision.eu>
      Signed-off-by: default avatarVadym Kochan <vadym.kochan@plvision.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1cd63ccd
    • Taehee Yoo's avatar
      hsr: check protocol version in hsr_newlink() · c72ef9ff
      Taehee Yoo authored
      [ Upstream commit 4faab8c4 ]
      
      In the current hsr code, only 0 and 1 protocol versions are valid.
      But current hsr code doesn't check the version, which is received by
      userspace.
      
      Test commands:
          ip link add dummy0 type dummy
          ip link add dummy1 type dummy
          ip link add hsr0 type hsr slave1 dummy0 slave2 dummy1 version 4
      
      In the test commands, version 4 is invalid.
      So, the command should be failed.
      
      After this patch, following error will occur.
      "Error: hsr: Only versions 0..1 are supported."
      
      Fixes: ee1c2797 ("net/hsr: Added support for HSR v1")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c72ef9ff
    • Andy Shevchenko's avatar
      mfd: dln2: Fix sanity checking for endpoints · ac703de1
      Andy Shevchenko authored
      [ Upstream commit fb945c95 ]
      
      While the commit 2b8bd606 ("mfd: dln2: More sanity checking for endpoints")
      tries to harden the sanity checks it made at the same time a regression,
      i.e.  mixed in and out endpoints. Obviously it should have been not tested on
      real hardware at that time, but unluckily it didn't happen.
      
      So, fix above mentioned typo and make device being enumerated again.
      
      While here, introduce an enumerator for magic values to prevent similar issue
      to happen in the future.
      
      Fixes: 2b8bd606 ("mfd: dln2: More sanity checking for endpoints")
      Cc: Oliver Neukum <oneukum@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ac703de1
    • Nathan Chancellor's avatar
      misc: echo: Remove unnecessary parentheses and simplify check for zero · 5d304d98
      Nathan Chancellor authored
      [ Upstream commit 85dc2c65 ]
      
      Clang warns when multiple pairs of parentheses are used for a single
      conditional statement.
      
      drivers/misc/echo/echo.c:384:27: warning: equality comparison with
      extraneous parentheses [-Wparentheses-equality]
              if ((ec->nonupdate_dwell == 0)) {
                   ~~~~~~~~~~~~~~~~~~~~^~~~
      drivers/misc/echo/echo.c:384:27: note: remove extraneous parentheses
      around the comparison to silence this warning
              if ((ec->nonupdate_dwell == 0)) {
                  ~                    ^   ~
      drivers/misc/echo/echo.c:384:27: note: use '=' to turn this equality
      comparison into an assignment
              if ((ec->nonupdate_dwell == 0)) {
                                       ^~
                                       =
      1 warning generated.
      
      Remove them and while we're at it, simplify the zero check as '!var' is
      used more than 'var == 0'.
      Reported-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d304d98
    • Laurentiu Tudor's avatar
      powerpc/fsl_booke: Avoid creating duplicate tlb1 entry · f3c266a9
      Laurentiu Tudor authored
      [ Upstream commit aa411334 ]
      
      In the current implementation, the call to loadcam_multi() is wrapped
      between switch_to_as1() and restore_to_as0() calls so, when it tries
      to create its own temporary AS=1 TLB1 entry, it ends up duplicating
      the existing one created by switch_to_as1(). Add a check to skip
      creating the temporary entry if already running in AS=1.
      
      Fixes: d9e1831a ("powerpc/85xx: Load all early TLB entries at once")
      Cc: stable@vger.kernel.org # v4.4+
      Signed-off-by: default avatarLaurentiu Tudor <laurentiu.tudor@nxp.com>
      Acked-by: default avatarScott Wood <oss@buserror.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200123111914.2565-1-laurentiu.tudor@nxp.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      f3c266a9
    • Wen Yang's avatar
      ipmi: fix hung processes in __get_guid() · 62cd9aa3
      Wen Yang authored
      [ Upstream commit 32830a05 ]
      
      The wait_event() function is used to detect command completion.
      When send_guid_cmd() returns an error, smi_send() has not been
      called to send data. Therefore, wait_event() should not be used
      on the error path, otherwise it will cause the following warning:
      
      [ 1361.588808] systemd-udevd   D    0  1501   1436 0x00000004
      [ 1361.588813]  ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40
      [ 1361.677952]  ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010
      [ 1361.767077]  00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000
      [ 1361.856199] Call Trace:
      [ 1361.885578]  [<ffffffff8173ca3b>] ? __schedule+0x23b/0x780
      [ 1361.951406]  [<ffffffff8173cfb6>] schedule+0x36/0x80
      [ 1362.010979]  [<ffffffffa071f178>] get_guid+0x118/0x150 [ipmi_msghandler]
      [ 1362.091281]  [<ffffffff810d5350>] ? prepare_to_wait_event+0x100/0x100
      [ 1362.168533]  [<ffffffffa071f755>] ipmi_register_smi+0x405/0x940 [ipmi_msghandler]
      [ 1362.258337]  [<ffffffffa0230ae9>] try_smi_init+0x529/0x950 [ipmi_si]
      [ 1362.334521]  [<ffffffffa022f350>] ? std_irq_setup+0xd0/0xd0 [ipmi_si]
      [ 1362.411701]  [<ffffffffa0232bd2>] init_ipmi_si+0x492/0x9e0 [ipmi_si]
      [ 1362.487917]  [<ffffffffa0232740>] ? ipmi_pci_probe+0x280/0x280 [ipmi_si]
      [ 1362.568219]  [<ffffffff810021a0>] do_one_initcall+0x50/0x180
      [ 1362.636109]  [<ffffffff812231b2>] ? kmem_cache_alloc_trace+0x142/0x190
      [ 1362.714330]  [<ffffffff811b2ae1>] do_init_module+0x5f/0x200
      [ 1362.781208]  [<ffffffff81123ca8>] load_module+0x1898/0x1de0
      [ 1362.848069]  [<ffffffff811202e0>] ? __symbol_put+0x60/0x60
      [ 1362.913886]  [<ffffffff8130696b>] ? security_kernel_post_read_file+0x6b/0x80
      [ 1362.998514]  [<ffffffff81124465>] SYSC_finit_module+0xe5/0x120
      [ 1363.068463]  [<ffffffff81124465>] ? SYSC_finit_module+0xe5/0x120
      [ 1363.140513]  [<ffffffff811244be>] SyS_finit_module+0xe/0x10
      [ 1363.207364]  [<ffffffff81003c04>] do_syscall_64+0x74/0x180
      
      Fixes: 50c812b2 ("[PATCH] ipmi: add full sysfs support")
      Signed-off-by: default avatarWen Yang <wenyang@linux.alibaba.com>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: openipmi-developer@lists.sourceforge.net
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # 2.6.17-
      Message-Id: <20200403090408.58745-1-wenyang@linux.alibaba.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      62cd9aa3
    • Chris Wilson's avatar
      drm: Remove PageReserved manipulation from drm_pci_alloc · 9abfa51e
      Chris Wilson authored
      [ Upstream commit ea36ec86 ]
      
      drm_pci_alloc/drm_pci_free are very thin wrappers around the core dma
      facilities, and we have no special reason within the drm layer to behave
      differently. In particular, since
      
      commit de09d31d
      Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Date:   Fri Jan 15 16:51:42 2016 -0800
      
          page-flags: define PG_reserved behavior on compound pages
      
          As far as I can see there's no users of PG_reserved on compound pages.
          Let's use PF_NO_COMPOUND here.
      
      it has been illegal to combine GFP_COMP with SetPageReserved, so lets
      stop doing both and leave the dma layer to its own devices.
      
      Reported-by: Taketo Kabe
      Bug: https://gitlab.freedesktop.org/drm/intel/issues/1027
      Fixes: de09d31d ("page-flags: define PG_reserved behavior on compound pages")
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: <stable@vger.kernel.org> # v4.5+
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200202171635.4039044-1-chris@chris-wilson.co.ukSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      9abfa51e
    • Lyude Paul's avatar
      drm/dp_mst: Fix clearing payload state on topology disable · 80e21c3e
      Lyude Paul authored
      [ Upstream commit 8732fe46 ]
      
      The issues caused by:
      
      commit 64e62bdf ("drm/dp_mst: Remove VCPI while disabling topology
      mgr")
      
      Prompted me to take a closer look at how we clear the payload state in
      general when disabling the topology, and it turns out there's actually
      two subtle issues here.
      
      The first is that we're not grabbing &mgr.payload_lock when clearing the
      payloads in drm_dp_mst_topology_mgr_set_mst(). Seeing as the canonical
      lock order is &mgr.payload_lock -> &mgr.lock (because we always want
      &mgr.lock to be the inner-most lock so topology validation always
      works), this makes perfect sense. It also means that -technically- there
      could be racing between someone calling
      drm_dp_mst_topology_mgr_set_mst() to disable the topology, along with a
      modeset occurring that's modifying the payload state at the same time.
      
      The second is the more obvious issue that Wayne Lin discovered, that
      we're not clearing proposed_payloads when disabling the topology.
      
      I actually can't see any obvious places where the racing caused by the
      first issue would break something, and it could be that some of our
      higher-level locks already prevent this by happenstance, but better safe
      then sorry. So, let's make it so that drm_dp_mst_topology_mgr_set_mst()
      first grabs &mgr.payload_lock followed by &mgr.lock so that we never
      race when modifying the payload state. Then, we also clear
      proposed_payloads to fix the original issue of enabling a new topology
      with a dirty payload state. This doesn't clear any of the drm_dp_vcpi
      structures, but those are getting destroyed along with the ports anyway.
      
      Changes since v1:
      * Use sizeof(mgr->payloads[0])/sizeof(mgr->proposed_vcpis[0]) instead -
        vsyrjala
      
      Cc: Sean Paul <sean@poorly.run>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: stable@vger.kernel.org # v4.4+
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200122194321.14953-1-lyude@redhat.comSigned-off-by: default avatarSasha Levin <sashal@kernel.org>
      80e21c3e
    • Filipe Manana's avatar
      Btrfs: fix crash during unmount due to race with delayed inode workers · 68a417b5
      Filipe Manana authored
      [ Upstream commit f0cc2cd7 ]
      
      During unmount we can have a job from the delayed inode items work queue
      still running, that can lead to at least two bad things:
      
      1) A crash, because the worker can try to create a transaction just
         after the fs roots were freed;
      
      2) A transaction leak, because the worker can create a transaction
         before the fs roots are freed and just after we committed the last
         transaction and after we stopped the transaction kthread.
      
      A stack trace example of the crash:
      
       [79011.691214] kernel BUG at lib/radix-tree.c:982!
       [79011.692056] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI
       [79011.693180] CPU: 3 PID: 1394 Comm: kworker/u8:2 Tainted: G        W         5.6.0-rc2-btrfs-next-54 #2
       (...)
       [79011.696789] Workqueue: btrfs-delayed-meta btrfs_work_helper [btrfs]
       [79011.697904] RIP: 0010:radix_tree_tag_set+0xe7/0x170
       (...)
       [79011.702014] RSP: 0018:ffffb3c84a317ca0 EFLAGS: 00010293
       [79011.702949] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
       [79011.704202] RDX: ffffb3c84a317cb0 RSI: ffffb3c84a317ca8 RDI: ffff8db3931340a0
       [79011.705463] RBP: 0000000000000005 R08: 0000000000000005 R09: ffffffff974629d0
       [79011.706756] R10: ffffb3c84a317bc0 R11: 0000000000000001 R12: ffff8db393134000
       [79011.708010] R13: ffff8db3931340a0 R14: ffff8db393134068 R15: 0000000000000001
       [79011.709270] FS:  0000000000000000(0000) GS:ffff8db3b6a00000(0000) knlGS:0000000000000000
       [79011.710699] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       [79011.711710] CR2: 00007f22c2a0a000 CR3: 0000000232ad4005 CR4: 00000000003606e0
       [79011.712958] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       [79011.714205] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       [79011.715448] Call Trace:
       [79011.715925]  record_root_in_trans+0x72/0xf0 [btrfs]
       [79011.716819]  btrfs_record_root_in_trans+0x4b/0x70 [btrfs]
       [79011.717925]  start_transaction+0xdd/0x5c0 [btrfs]
       [79011.718829]  btrfs_async_run_delayed_root+0x17e/0x2b0 [btrfs]
       [79011.719915]  btrfs_work_helper+0xaa/0x720 [btrfs]
       [79011.720773]  process_one_work+0x26d/0x6a0
       [79011.721497]  worker_thread+0x4f/0x3e0
       [79011.722153]  ? process_one_work+0x6a0/0x6a0
       [79011.722901]  kthread+0x103/0x140
       [79011.723481]  ? kthread_create_worker_on_cpu+0x70/0x70
       [79011.724379]  ret_from_fork+0x3a/0x50
       (...)
      
      The following diagram shows a sequence of steps that lead to the crash
      during ummount of the filesystem:
      
              CPU 1                                             CPU 2                                CPU 3
      
       btrfs_punch_hole()
         btrfs_btree_balance_dirty()
           btrfs_balance_delayed_items()
             --> sees
                 fs_info->delayed_root->items
                 with value 200, which is greater
                 than
                 BTRFS_DELAYED_BACKGROUND (128)
                 and smaller than
                 BTRFS_DELAYED_WRITEBACK (512)
             btrfs_wq_run_delayed_node()
               --> queues a job for
                   fs_info->delayed_workers to run
                   btrfs_async_run_delayed_root()
      
                                                                                                  btrfs_async_run_delayed_root()
                                                                                                    --> job queued by CPU 1
      
                                                                                                    --> starts picking and running
                                                                                                        delayed nodes from the
                                                                                                        prepare_list list
      
                                                       close_ctree()
      
                                                         btrfs_delete_unused_bgs()
      
                                                         btrfs_commit_super()
      
                                                           btrfs_join_transaction()
                                                             --> gets transaction N
      
                                                           btrfs_commit_transaction(N)
                                                             --> set transaction state
                                                              to TRANTS_STATE_COMMIT_START
      
                                                                                                   btrfs_first_prepared_delayed_node()
                                                                                                     --> picks delayed node X through
                                                                                                         the prepared_list list
      
                                                             btrfs_run_delayed_items()
      
                                                               btrfs_first_delayed_node()
                                                                 --> also picks delayed node X
                                                                     but through the node_list
                                                                     list
      
                                                               __btrfs_commit_inode_delayed_items()
                                                                  --> runs all delayed items from
                                                                      this node and drops the
                                                                      node's item count to 0
                                                                      through call to
                                                                      btrfs_release_delayed_inode()
      
                                                               --> finishes running any remaining
                                                                   delayed nodes
      
                                                             --> finishes transaction commit
      
                                                         --> stops cleaner and transaction threads
      
                                                         btrfs_free_fs_roots()
                                                           --> frees all roots and removes them
                                                               from the radix tree
                                                               fs_info->fs_roots_radix
      
                                                                                                   btrfs_join_transaction()
                                                                                                     start_transaction()
                                                                                                       btrfs_record_root_in_trans()
                                                                                                         record_root_in_trans()
                                                                                                           radix_tree_tag_set()
                                                                                                             --> crashes because
                                                                                                                 the root is not in
                                                                                                                 the radix tree
                                                                                                                 anymore
      
      If the worker is able to call btrfs_join_transaction() before the unmount
      task frees the fs roots, we end up leaking a transaction and all its
      resources, since after the call to btrfs_commit_super() and stopping the
      transaction kthread, we don't expect to have any transaction open anymore.
      
      When this situation happens the worker has a delayed node that has no
      more items to run, since the task calling btrfs_run_delayed_items(),
      which is doing a transaction commit, picks the same node and runs all
      its items first.
      
      We can not wait for the worker to complete when running delayed items
      through btrfs_run_delayed_items(), because we call that function in
      several phases of a transaction commit, and that could cause a deadlock
      because the worker calls btrfs_join_transaction() and the task doing the
      transaction commit may have already set the transaction state to
      TRANS_STATE_COMMIT_DOING.
      
      Also it's not possible to get into a situation where only some of the
      items of a delayed node are added to the fs/subvolume tree in the current
      transaction and the remaining ones in the next transaction, because when
      running the items of a delayed inode we lock its mutex, effectively
      waiting for the worker if the worker is running the items of the delayed
      node already.
      
      Since this can only cause issues when unmounting a filesystem, fix it in
      a simple way by waiting for any jobs on the delayed workers queue before
      calling btrfs_commit_supper() at close_ctree(). This works because at this
      point no one can call btrfs_btree_balance_dirty() or
      btrfs_balance_delayed_items(), and if we end up waiting for any worker to
      complete, btrfs_commit_super() will commit the transaction created by the
      worker.
      
      CC: stable@vger.kernel.org # 4.4+
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.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>
      68a417b5
    • Michael Ellerman's avatar
      powerpc/64/tm: Don't let userspace set regs->trap via sigreturn · 71064eba
      Michael Ellerman authored
      commit c7def7fb upstream.
      
      In restore_tm_sigcontexts() we take the trap value directly from the
      user sigcontext with no checking:
      
      	err |= __get_user(regs->trap, &sc->gp_regs[PT_TRAP]);
      
      This means we can be in the kernel with an arbitrary regs->trap value.
      
      Although that's not immediately problematic, there is a risk we could
      trigger one of the uses of CHECK_FULL_REGS():
      
      	#define CHECK_FULL_REGS(regs)	BUG_ON(regs->trap & 1)
      
      It can also cause us to unnecessarily save non-volatile GPRs again in
      save_nvgprs(), which shouldn't be problematic but is still wrong.
      
      It's also possible it could trick the syscall restart machinery, which
      relies on regs->trap not being == 0xc00 (see 9a81c16b ("powerpc:
      fix double syscall restarts")), though I haven't been able to make
      that happen.
      
      Finally it doesn't match the behaviour of the non-TM case, in
      restore_sigcontext() which zeroes regs->trap.
      
      So change restore_tm_sigcontexts() to zero regs->trap.
      
      This was discovered while testing Nick's upcoming rewrite of the
      syscall entry path. In that series the call to save_nvgprs() prior to
      signal handling (do_notify_resume()) is removed, which leaves the
      low-bit of regs->trap uncleared which can then trigger the FULL_REGS()
      WARNs in setup_tm_sigcontexts().
      
      Fixes: 2b0a576d ("powerpc: Add new transactional memory state to the signal context")
      Cc: stable@vger.kernel.org # v3.9+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200401023836.3286664-1-mpe@ellerman.id.auSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71064eba
    • Kai-Heng Feng's avatar
      libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set · 4b8a7404
      Kai-Heng Feng authored
      commit 8305f72f upstream.
      
      During system resume from suspend, this can be observed on ASM1062 PMP
      controller:
      
      ata10.01: SATA link down (SStatus 0 SControl 330)
      ata10.02: hard resetting link
      ata10.02: SATA link down (SStatus 0 SControl 330)
      ata10.00: configured for UDMA/133
      Kernel panic - not syncing: stack-protector: Kernel
       in: sata_pmp_eh_recover+0xa2b/0xa40
      
      CPU: 2 PID: 230 Comm: scsi_eh_9 Tainted: P OE
      #49-Ubuntu
      Hardware name: System manufacturer System Product
       1001 12/10/2017
      Call Trace:
      dump_stack+0x63/0x8b
      panic+0xe4/0x244
      ? sata_pmp_eh_recover+0xa2b/0xa40
      __stack_chk_fail+0x19/0x20
      sata_pmp_eh_recover+0xa2b/0xa40
      ? ahci_do_softreset+0x260/0x260 [libahci]
      ? ahci_do_hardreset+0x140/0x140 [libahci]
      ? ata_phys_link_offline+0x60/0x60
      ? ahci_stop_engine+0xc0/0xc0 [libahci]
      sata_pmp_error_handler+0x22/0x30
      ahci_error_handler+0x45/0x80 [libahci]
      ata_scsi_port_error_handler+0x29b/0x770
      ? ata_scsi_cmd_error_handler+0x101/0x140
      ata_scsi_error+0x95/0xd0
      ? scsi_try_target_reset+0x90/0x90
      scsi_error_handler+0xd0/0x5b0
      kthread+0x121/0x140
      ? scsi_eh_get_sense+0x200/0x200
      ? kthread_create_worker_on_cpu+0x70/0x70
      ret_from_fork+0x22/0x40
      Kernel Offset: 0xcc00000 from 0xffffffff81000000
      (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
      
      Since sata_pmp_eh_recover_pmp() doens't set rc when ATA_DFLAG_DETACH is
      set, sata_pmp_eh_recover() continues to run. During retry it triggers
      the stack protector.
      
      Set correct rc in sata_pmp_eh_recover_pmp() to let sata_pmp_eh_recover()
      jump to pmp_fail directly.
      
      BugLink: https://bugs.launchpad.net/bugs/1821434
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b8a7404
    • Simon Gander's avatar
      hfsplus: fix crash and filesystem corruption when deleting files · ffdfcd87
      Simon Gander authored
      commit 25efb2ff upstream.
      
      When removing files containing extended attributes, the hfsplus driver may
      remove the wrong entries from the attributes b-tree, causing major
      filesystem damage and in some cases even kernel crashes.
      
      To remove a file, all its extended attributes have to be removed as well.
      The driver does this by looking up all keys in the attributes b-tree with
      the cnid of the file.  Each of these entries then gets deleted using the
      key used for searching, which doesn't contain the attribute's name when it
      should.  Since the key doesn't contain the name, the deletion routine will
      not find the correct entry and instead remove the one in front of it.  If
      parent nodes have to be modified, these become corrupt as well.  This
      causes invalid links and unsorted entries that not even macOS's fsck_hfs
      is able to fix.
      
      To fix this, modify the search key before an entry is deleted from the
      attributes b-tree by copying the found entry's key into the search key,
      therefore ensuring that the correct entry gets removed from the tree.
      Signed-off-by: default avatarSimon Gander <simon@tuxera.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarAnton Altaparmakov <anton@tuxera.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200327155541.1521-1-simon@tuxera.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffdfcd87
    • Oliver O'Halloran's avatar
      cpufreq: powernv: Fix use-after-free · 88a8e3c5
      Oliver O'Halloran authored
      commit d0a72efa upstream.
      
      The cpufreq driver has a use-after-free that we can hit if:
      
      a) There's an OCC message pending when the notifier is registered, and
      b) The cpufreq driver fails to register with the core.
      
      When a) occurs the notifier schedules a workqueue item to handle the
      message. The backing work_struct is located on chips[].throttle and
      when b) happens we clean up by freeing the array. Once we get to
      the (now free) queued item and the kernel crashes.
      
      Fixes: c5e29ea7 ("cpufreq: powernv: Fix bugs in powernv_cpufreq_{init/exit}")
      Cc: stable@vger.kernel.org # v4.6+
      Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
      Reviewed-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200206062622.28235-1-oohall@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88a8e3c5
    • Eric Biggers's avatar
      kmod: make request_module() return an error when autoloading is disabled · f5fbbb67
      Eric Biggers authored
      commit d7d27cfc upstream.
      
      Patch series "module autoloading fixes and cleanups", v5.
      
      This series fixes a bug where request_module() was reporting success to
      kernel code when module autoloading had been completely disabled via
      'echo > /proc/sys/kernel/modprobe'.
      
      It also addresses the issues raised on the original thread
      (https://lkml.kernel.org/lkml/20200310223731.126894-1-ebiggers@kernel.org/T/#u)
      bydocumenting the modprobe sysctl, adding a self-test for the empty path
      case, and downgrading a user-reachable WARN_ONCE().
      
      This patch (of 4):
      
      It's long been possible to disable kernel module autoloading completely
      (while still allowing manual module insertion) by setting
      /proc/sys/kernel/modprobe to the empty string.
      
      This can be preferable to setting it to a nonexistent file since it
      avoids the overhead of an attempted execve(), avoids potential
      deadlocks, and avoids the call to security_kernel_module_request() and
      thus on SELinux-based systems eliminates the need to write SELinux rules
      to dontaudit module_request.
      
      However, when module autoloading is disabled in this way,
      request_module() returns 0.  This is broken because callers expect 0 to
      mean that the module was successfully loaded.
      
      Apparently this was never noticed because this method of disabling
      module autoloading isn't used much, and also most callers don't use the
      return value of request_module() since it's always necessary to check
      whether the module registered its functionality or not anyway.
      
      But improperly returning 0 can indeed confuse a few callers, for example
      get_fs_type() in fs/filesystems.c where it causes a WARNING to be hit:
      
      	if (!fs && (request_module("fs-%.*s", len, name) == 0)) {
      		fs = __get_fs_type(name, len);
      		WARN_ONCE(!fs, "request_module fs-%.*s succeeded, but still no fs?\n", len, name);
      	}
      
      This is easily reproduced with:
      
      	echo > /proc/sys/kernel/modprobe
      	mount -t NONEXISTENT none /
      
      It causes:
      
      	request_module fs-NONEXISTENT succeeded, but still no fs?
      	WARNING: CPU: 1 PID: 1106 at fs/filesystems.c:275 get_fs_type+0xd6/0xf0
      	[...]
      
      This should actually use pr_warn_once() rather than WARN_ONCE(), since
      it's also user-reachable if userspace immediately unloads the module.
      Regardless, request_module() should correctly return an error when it
      fails.  So let's make it return -ENOENT, which matches the error when
      the modprobe binary doesn't exist.
      
      I've also sent patches to document and test this case.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarJessica Yu <jeyu@kernel.org>
      Acked-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jeff Vander Stoep <jeffv@google.com>
      Cc: Ben Hutchings <benh@debian.org>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200310223731.126894-1-ebiggers@kernel.org
      Link: http://lkml.kernel.org/r/20200312202552.241885-1-ebiggers@kernel.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5fbbb67
    • Hans de Goede's avatar
      Input: i8042 - add Acer Aspire 5738z to nomux list · 21d22884
      Hans de Goede authored
      commit ebc68ced upstream.
      
      The Acer Aspire 5738z has a button to disable (and re-enable) the
      touchpad next to the touchpad.
      
      When this button is pressed a LED underneath indicates that the touchpad
      is disabled (and an event is send to userspace and GNOME shows its
      touchpad enabled / disable OSD thingie).
      
      So far so good, but after re-enabling the touchpad it no longer works.
      
      The laptop does not have an external ps2 port, so mux mode is not needed
      and disabling mux mode fixes the touchpad no longer working after toggling
      it off and back on again, so lets add this laptop model to the nomux list.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20200331123947.318908-1-hdegoede@redhat.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21d22884
    • Michael Mueller's avatar
      s390/diag: fix display of diagnose call statistics · 1ad66322
      Michael Mueller authored
      commit 6c7c851f upstream.
      
      Show the full diag statistic table and not just parts of it.
      
      The issue surfaced in a KVM guest with a number of vcpus
      defined smaller than NR_DIAG_STAT.
      
      Fixes: 1ec2772e ("s390/diag: add a statistic for diagnose calls")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichael Mueller <mimu@linux.ibm.com>
      Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ad66322
    • Changwei Ge's avatar
      ocfs2: no need try to truncate file beyond i_size · 75ace9f0
      Changwei Ge authored
      commit 783fda85 upstream.
      
      Linux fallocate(2) with FALLOC_FL_PUNCH_HOLE mode set, its offset can
      exceed the inode size.  Ocfs2 now doesn't allow that offset beyond inode
      size.  This restriction is not necessary and violates fallocate(2)
      semantics.
      
      If fallocate(2) offset is beyond inode size, just return success and do
      nothing further.
      
      Otherwise, ocfs2 will crash the kernel.
      
        kernel BUG at fs/ocfs2//alloc.c:7264!
         ocfs2_truncate_inline+0x20f/0x360 [ocfs2]
         ocfs2_remove_inode_range+0x23c/0xcb0 [ocfs2]
         __ocfs2_change_file_space+0x4a5/0x650 [ocfs2]
         ocfs2_fallocate+0x83/0xa0 [ocfs2]
         vfs_fallocate+0x148/0x230
         SyS_fallocate+0x48/0x80
         do_syscall_64+0x79/0x170
      Signed-off-by: default avatarChangwei Ge <chge@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <stable@vger.kernel.org>
      Link: http://lkml.kernel.org/r/20200407082754.17565-1-chge@linux.alibaba.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75ace9f0
    • Qian Cai's avatar
      ext4: fix a data race at inode->i_blocks · 9945c406
      Qian Cai authored
      commit 28936b62 upstream.
      
      inode->i_blocks could be accessed concurrently as noticed by KCSAN,
      
       BUG: KCSAN: data-race in ext4_do_update_inode [ext4] / inode_add_bytes
      
       write to 0xffff9a00d4b982d0 of 8 bytes by task 22100 on cpu 118:
        inode_add_bytes+0x65/0xf0
        __inode_add_bytes at fs/stat.c:689
        (inlined by) inode_add_bytes at fs/stat.c:702
        ext4_mb_new_blocks+0x418/0xca0 [ext4]
        ext4_ext_map_blocks+0x1a6b/0x27b0 [ext4]
        ext4_map_blocks+0x1a9/0x950 [ext4]
        _ext4_get_block+0xfc/0x270 [ext4]
        ext4_get_block_unwritten+0x33/0x50 [ext4]
        __block_write_begin_int+0x22e/0xae0
        __block_write_begin+0x39/0x50
        ext4_write_begin+0x388/0xb50 [ext4]
        ext4_da_write_begin+0x35f/0x8f0 [ext4]
        generic_perform_write+0x15d/0x290
        ext4_buffered_write_iter+0x11f/0x210 [ext4]
        ext4_file_write_iter+0xce/0x9e0 [ext4]
        new_sync_write+0x29c/0x3b0
        __vfs_write+0x92/0xa0
        vfs_write+0x103/0x260
        ksys_write+0x9d/0x130
        __x64_sys_write+0x4c/0x60
        do_syscall_64+0x91/0xb05
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       read to 0xffff9a00d4b982d0 of 8 bytes by task 8 on cpu 65:
        ext4_do_update_inode+0x4a0/0xf60 [ext4]
        ext4_inode_blocks_set at fs/ext4/inode.c:4815
        ext4_mark_iloc_dirty+0xaf/0x160 [ext4]
        ext4_mark_inode_dirty+0x129/0x3e0 [ext4]
        ext4_convert_unwritten_extents+0x253/0x2d0 [ext4]
        ext4_convert_unwritten_io_end_vec+0xc5/0x150 [ext4]
        ext4_end_io_rsv_work+0x22c/0x350 [ext4]
        process_one_work+0x54f/0xb90
        worker_thread+0x80/0x5f0
        kthread+0x1cd/0x1f0
        ret_from_fork+0x27/0x50
      
       4 locks held by kworker/u256:0/8:
        #0: ffff9a025abc4328 ((wq_completion)ext4-rsv-conversion){+.+.}, at: process_one_work+0x443/0xb90
        #1: ffffab5a862dbe20 ((work_completion)(&ei->i_rsv_conversion_work)){+.+.}, at: process_one_work+0x443/0xb90
        #2: ffff9a025a9d0f58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
        #3: ffff9a00d4b985d8 (&(&ei->i_raw_lock)->rlock){+.+.}, at: ext4_do_update_inode+0xaa/0xf60 [ext4]
       irq event stamp: 3009267
       hardirqs last  enabled at (3009267): [<ffffffff980da9b7>] __find_get_block+0x107/0x790
       hardirqs last disabled at (3009266): [<ffffffff980da8f9>] __find_get_block+0x49/0x790
       softirqs last  enabled at (3009230): [<ffffffff98a0034c>] __do_softirq+0x34c/0x57c
       softirqs last disabled at (3009223): [<ffffffff97cc67a2>] irq_exit+0xa2/0xc0
      
       Reported by Kernel Concurrency Sanitizer on:
       CPU: 65 PID: 8 Comm: kworker/u256:0 Tainted: G L 5.6.0-rc2-next-20200221+ #7
       Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019
       Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work [ext4]
      
      The plain read is outside of inode->i_lock critical section which
      results in a data race. Fix it by adding READ_ONCE() there.
      
      Link: https://lore.kernel.org/r/20200222043258.2279-1-cai@lca.pwSigned-off-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9945c406
    • Nathan Chancellor's avatar
      rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH · b580a800
      Nathan Chancellor authored
      commit c5015652 upstream.
      
      Clang warns when one enumerated type is implicitly converted to another:
      
      drivers/rtc/rtc-omap.c:574:21: warning: implicit conversion from
      enumeration type 'enum rtc_pin_config_param' to different enumeration
      type 'enum pin_config_param' [-Wenum-conversion]
              {"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0},
              ~                  ^~~~~~~~~~~~~~~~~~~~~~
      drivers/rtc/rtc-omap.c:579:12: warning: implicit conversion from
      enumeration type 'enum rtc_pin_config_param' to different enumeration
      type 'enum pin_config_param' [-Wenum-conversion]
              PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false),
              ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/linux/pinctrl/pinconf-generic.h:163:11: note: expanded from
      macro 'PCONFDUMP'
              .param = a, .display = b, .format = c, .has_arg = d     \
                       ^
      2 warnings generated.
      
      It is expected that pinctrl drivers can extend pin_config_param because
      of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion
      isn't an issue. Most drivers that take advantage of this define the
      PIN_CONFIG variables as constants, rather than enumerated values. Do the
      same thing here so that Clang no longer warns.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/144Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b580a800
    • Fredrik Strupe's avatar
      arm64: armv8_deprecated: Fix undef_hook mask for thumb setend · 3e2dadfe
      Fredrik Strupe authored
      commit fc226601 upstream.
      
      For thumb instructions, call_undef_hook() in traps.c first reads a u16,
      and if the u16 indicates a T32 instruction (u16 >= 0xe800), a second
      u16 is read, which then makes up the the lower half-word of a T32
      instruction. For T16 instructions, the second u16 is not read,
      which makes the resulting u32 opcode always have the upper half set to
      0.
      
      However, having the upper half of instr_mask in the undef_hook set to 0
      masks out the upper half of all thumb instructions - both T16 and T32.
      This results in trapped T32 instructions with the lower half-word equal
      to the T16 encoding of setend (b650) being matched, even though the upper
      half-word is not 0000 and thus indicates a T32 opcode.
      
      An example of such a T32 instruction is eaa0b650, which should raise a
      SIGILL since T32 instructions with an eaa prefix are unallocated as per
      Arm ARM, but instead works as a SETEND because the second half-word is set
      to b650.
      
      This patch fixes the issue by extending instr_mask to include the
      upper u32 half, which will still match T16 instructions where the upper
      half is 0, but not T32 instructions.
      
      Fixes: 2d888f48 ("arm64: Emulate SETEND for AArch32 tasks")
      Cc: <stable@vger.kernel.org> # 4.0.x-
      Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarFredrik Strupe <fredrik@strupe.net>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e2dadfe
    • Steffen Maier's avatar
      scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point · 42246805
      Steffen Maier authored
      commit 819732be upstream.
      
      v2.6.27 commit cc8c2829 ("[SCSI] zfcp: Automatically attach remote
      ports") introduced zfcp automatic port scan.
      
      Before that, the user had to use the sysfs attribute "port_add" of an FCP
      device (adapter) to add and open remote (target) ports, even for the remote
      peer port in point-to-point topology. That code path did a proper port open
      recovery trigger taking the erp_lock.
      
      Since above commit, a new helper function zfcp_erp_open_ptp_port()
      performed an UNlocked port open recovery trigger. This can race with other
      parallel recovery triggers. In zfcp_erp_action_enqueue() this could corrupt
      e.g. adapter->erp_total_count or adapter->erp_ready_head.
      
      As already found for fabric topology in v4.17 commit fa89adba ("scsi:
      zfcp: fix infinite iteration on ERP ready list"), there was an endless loop
      during tracing of rport (un)block.  A subsequent v4.18 commit 9e156c54
      ("scsi: zfcp: assert that the ERP lock is held when tracing a recovery
      trigger") introduced a lockdep assertion for that case.
      
      As a side effect, that lockdep assertion now uncovered the unlocked code
      path for PtP. It is from within an adapter ERP action:
      
      zfcp_erp_strategy[1479]  intentionally DROPs erp lock around
                               zfcp_erp_strategy_do_action()
      zfcp_erp_strategy_do_action[1441]      NO erp lock
      zfcp_erp_adapter_strategy[876]         NO erp lock
      zfcp_erp_adapter_strategy_open[855]    NO erp lock
      zfcp_erp_adapter_strategy_open_fsf[806]NO erp lock
      zfcp_erp_adapter_strat_fsf_xconf[772]  erp lock only around
                                             zfcp_erp_action_to_running(),
                                             BUT *_not_* around
                                             zfcp_erp_enqueue_ptp_port()
      zfcp_erp_enqueue_ptp_port[728]         BUG: *_not_* taking erp lock
      _zfcp_erp_port_reopen[432]             assumes to be called with erp lock
      zfcp_erp_action_enqueue[314]           assumes to be called with erp lock
      zfcp_dbf_rec_trig[288]                 _checks_ to be called with erp lock:
      	lockdep_assert_held(&adapter->erp_lock);
      
      It causes the following lockdep warning:
      
      WARNING: CPU: 2 PID: 775 at drivers/s390/scsi/zfcp_dbf.c:288
                                  zfcp_dbf_rec_trig+0x16a/0x188
      no locks held by zfcperp0.0.17c0/775.
      
      Fix this by using the proper locked recovery trigger helper function.
      
      Link: https://lore.kernel.org/r/20200312174505.51294-2-maier@linux.ibm.com
      Fixes: cc8c2829 ("[SCSI] zfcp: Automatically attach remote ports")
      Cc: <stable@vger.kernel.org> #v2.6.27+
      Reviewed-by: default avatarJens Remus <jremus@linux.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42246805
    • Shetty, Harshini X (EXT-Sony Mobile)'s avatar
      dm verity fec: fix memory leak in verity_fec_dtr · 4c02b23a
      Shetty, Harshini X (EXT-Sony Mobile) authored
      commit 75fa6019 upstream.
      
      Fix below kmemleak detected in verity_fec_ctr. output_pool is
      allocated for each dm-verity-fec device. But it is not freed when
      dm-table for the verity target is removed. Hence free the output
      mempool in destructor function verity_fec_dtr.
      
      unreferenced object 0xffffffffa574d000 (size 4096):
        comm "init", pid 1667, jiffies 4294894890 (age 307.168s)
        hex dump (first 32 bytes):
          8e 36 00 98 66 a8 0b 9b 00 00 00 00 00 00 00 00  .6..f...........
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<0000000060e82407>] __kmalloc+0x2b4/0x340
          [<00000000dd99488f>] mempool_kmalloc+0x18/0x20
          [<000000002560172b>] mempool_init_node+0x98/0x118
          [<000000006c3574d2>] mempool_init+0x14/0x20
          [<0000000008cb266e>] verity_fec_ctr+0x388/0x3b0
          [<000000000887261b>] verity_ctr+0x87c/0x8d0
          [<000000002b1e1c62>] dm_table_add_target+0x174/0x348
          [<000000002ad89eda>] table_load+0xe4/0x328
          [<000000001f06f5e9>] dm_ctl_ioctl+0x3b4/0x5a0
          [<00000000bee5fbb7>] do_vfs_ioctl+0x5dc/0x928
          [<00000000b475b8f5>] __arm64_sys_ioctl+0x70/0x98
          [<000000005361e2e8>] el0_svc_common+0xa0/0x158
          [<000000001374818f>] el0_svc_handler+0x6c/0x88
          [<000000003364e9f4>] el0_svc+0x8/0xc
          [<000000009d84cec9>] 0xffffffffffffffff
      
      Fixes: a739ff3f ("dm verity: add support for forward error correction")
      Depends-on: 6f1c819c ("dm: convert to bioset_init()/mempool_init()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHarshini Shetty <harshini.x.shetty@sony.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c02b23a
    • Alexander Duyck's avatar
      mm: Use fixed constant in page_frag_alloc instead of size + 1 · b59a2e0a
      Alexander Duyck authored
      commit 86447726 upstream.
      
      This patch replaces the size + 1 value introduced with the recent fix for 1
      byte allocs with a constant value.
      
      The idea here is to reduce code overhead as the previous logic would have
      to read size into a register, then increment it, and write it back to
      whatever field was being used. By using a constant we can avoid those
      memory reads and arithmetic operations in favor of just encoding the
      maximum value into the operation itself.
      
      Fixes: 2c2ade81 ("mm: page_alloc: fix ref bias in page_frag_alloc() for 1-byte allocs")
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b59a2e0a
    • Anssi Hannula's avatar
      tools: gpio: Fix out-of-tree build regression · bd075802
      Anssi Hannula authored
      commit 82f04bfe upstream.
      
      Commit 0161a94e ("tools: gpio: Correctly add make dependencies for
      gpio_utils") added a make rule for gpio-utils-in.o but used $(output)
      instead of the correct $(OUTPUT) for the output directory, breaking
      out-of-tree build (O=xx) with the following error:
      
        No rule to make target 'out/tools/gpio/gpio-utils-in.o', needed by 'out/tools/gpio/lsgpio-in.o'.  Stop.
      
      Fix that.
      
      Fixes: 0161a94e ("tools: gpio: Correctly add make dependencies for gpio_utils")
      Cc: <stable@vger.kernel.org>
      Cc: Laura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarAnssi Hannula <anssi.hannula@bitwise.fi>
      Link: https://lore.kernel.org/r/20200325103154.32235-1-anssi.hannula@bitwise.fiReviewed-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd075802