Skip to content
  1. Feb 10, 2021
    • Russell King's avatar
      ARM: footbridge: fix dc21285 PCI configuration accessors · e06c6b69
      Russell King authored
      commit 39d3454c
      
       upstream.
      
      Building with gcc 4.9.2 reveals a latent bug in the PCI accessors
      for Footbridge platforms, which causes a fatal alignment fault
      while accessing IO memory. Fix this by making the assembly volatile.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e06c6b69
    • Sean Christopherson's avatar
      KVM: SVM: Treat SVM as unsupported when running as an SEV guest · d7a349a4
      Sean Christopherson authored
      commit ccd85d90
      
       upstream.
      
      Don't let KVM load when running as an SEV guest, regardless of what
      CPUID says.  Memory is encrypted with a key that is not accessible to
      the host (L0), thus it's impossible for L0 to emulate SVM, e.g. it'll
      see garbage when reading the VMCB.
      
      Technically, KVM could decrypt all memory that needs to be accessible to
      the L0 and use shadow paging so that L0 does not need to shadow NPT, but
      exposing such information to L0 largely defeats the purpose of running as
      an SEV guest.  This can always be revisited if someone comes up with a
      use case for running VMs inside SEV guests.
      
      Note, VMLOAD, VMRUN, etc... will also #GP on GPAs with C-bit set, i.e. KVM
      is doomed even if the SEV guest is debuggable and the hypervisor is willing
      to decrypt the VMCB.  This may or may not be fixed on CPUs that have the
      SVME_ADDR_CHK fix.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20210202212017.2486595-1-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7a349a4
    • Thorsten Leemhuis's avatar
      nvme-pci: avoid the deepest sleep state on Kingston A2000 SSDs · 5d71e4a6
      Thorsten Leemhuis authored
      commit 538e4a8c
      
       upstream.
      
      Some Kingston A2000 NVMe SSDs sooner or later get confused and stop
      working when they use the deepest APST sleep while running Linux. The
      system then crashes and one has to cold boot it to get the SSD working
      again.
      
      Kingston seems to known about this since at least mid-September 2020:
      https://bbs.archlinux.org/viewtopic.php?pid=1926994#p1926994
      
      Someone working for a German company representing Kingston to the German
      press confirmed to me Kingston engineering is aware of the issue and
      investigating; the person stated that to their current knowledge only
      the deepest APST sleep state causes trouble. Therefore, make Linux avoid
      it for now by applying the NVME_QUIRK_NO_DEEPEST_PS to this SSD.
      
      I have two such SSDs, but it seems the problem doesn't occur with them.
      I hence couldn't verify if this patch really fixes the problem, but all
      the data in front of me suggests it should.
      
      This patch can easily be reverted or improved upon if a better solution
      surfaces.
      
      FWIW, there are many reports about the issue scattered around the web;
      most of the users disabled APST completely to make things work, some
      just made Linux avoid the deepest sleep state:
      
      https://bugzilla.kernel.org/show_bug.cgi?id=195039#c65
      https://bugzilla.kernel.org/show_bug.cgi?id=195039#c73
      https://bugzilla.kernel.org/show_bug.cgi?id=195039#c74
      https://bugzilla.kernel.org/show_bug.cgi?id=195039#c78
      https://bugzilla.kernel.org/show_bug.cgi?id=195039#c79
      https://bugzilla.kernel.org/show_bug.cgi?id=195039#c80
      https://askubuntu.com/questions/1222049/nvmekingston-a2000-sometimes-stops-giving-response-in-ubuntu-18-04dell-inspir
      https://community.acer.com/en/discussion/604326/m-2-nvme-ssd-aspire-517-51g-issue-compatibility-kingston-a2000-linux-ubuntu
      
      For the record, some data from 'nvme id-ctrl /dev/nvme0'
      
      NVME Identify Controller:
      vid       : 0x2646
      ssvid     : 0x2646
      mn        : KINGSTON SA2000M81000G
      fr        : S5Z42105
      [...]
      ps    0 : mp:9.00W operational enlat:0 exlat:0 rrt:0 rrl:0
                rwt:0 rwl:0 idle_power:- active_power:-
      ps    1 : mp:4.60W operational enlat:0 exlat:0 rrt:1 rrl:1
                rwt:1 rwl:1 idle_power:- active_power:-
      ps    2 : mp:3.80W operational enlat:0 exlat:0 rrt:2 rrl:2
                rwt:2 rwl:2 idle_power:- active_power:-
      ps    3 : mp:0.0450W non-operational enlat:2000 exlat:2000 rrt:3 rrl:3
                rwt:3 rwl:3 idle_power:- active_power:-
      ps    4 : mp:0.0040W non-operational enlat:15000 exlat:15000 rrt:4 rrl:4
                rwt:4 rwl:4 idle_power:- active_power:-
      
      Cc: stable@vger.kernel.org # 4.14+
      Signed-off-by: default avatarThorsten Leemhuis <linux@leemhuis.info>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d71e4a6
    • Fengnan Chang's avatar
      mmc: core: Limit retries when analyse of SDIO tuples fails · 366e0872
      Fengnan Chang authored
      commit f92e04f7
      
       upstream.
      
      When analysing tuples fails we may loop indefinitely to retry. Let's avoid
      this by using a 10s timeout and bail if not completed earlier.
      
      Signed-off-by: default avatarFengnan Chang <fengnanchang@gmail.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210123033230.36442-1-fengnanchang@gmail.com
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      366e0872
    • Gustavo A. R. Silva's avatar
      smb3: Fix out-of-bounds bug in SMB2_negotiate() · 8c323163
      Gustavo A. R. Silva authored
      commit 8d8d1dbe upstream.
      
      While addressing some warnings generated by -Warray-bounds, I found this
      bug that was introduced back in 2017:
      
        CC [M]  fs/cifs/smb2pdu.o
      fs/cifs/smb2pdu.c: In function ‘SMB2_negotiate’:
      fs/cifs/smb2pdu.c:822:16: warning: array subscript 1 is above array bounds
      of ‘__le16[1]’ {aka ‘short unsigned int[1]’} [-Warray-bounds]
        822 |   req->Dialects[1] = cpu_to_le16(SMB30_PROT_ID);
            |   ~~~~~~~~~~~~~^~~
      fs/cifs/smb2pdu.c:823:16: warning: array subscript 2 is above array bounds
      of ‘__le16[1]’ {aka ‘short unsigned int[1]’} [-Warray-bounds]
        823 |   req->Dialects[2] = cpu_to_le16(SMB302_PROT_ID);
            |   ~~~~~~~~~~~~~^~~
      fs/cifs/smb2pdu.c:824:16: warning: array subscript 3 is above array bounds
      of ‘__le16[1]’ {aka ‘short unsigned int[1]’} [-Warray-bounds]
        824 |   req->Dialects[3] = cpu_to_le16(SMB311_PROT_ID);
            |   ~~~~~~~~~~~~~^~~
      fs/cifs/smb2pdu.c:816:16: warning: array subscript 1 is above array bounds
      of ‘__le16[1]’ {aka ‘short unsigned int[1]’} [-Warray-bounds]
        816 |   req->Dialects[1] = cpu_to_le16(SMB302_PROT_ID);
            |   ~~~~~~~~~~~~~^~~
      
      At the time, the size of array _Dialects_ was changed from 1 to 3 in struct
      validate_negotiate_info_req, and then in 2019 it was changed from 3 to 4,
      but those changes were never made in struct smb2_negotiate_req, which has
      led to a 3 and a half years old out-of-bounds bug in function
      SMB2_negotiate() (fs/cifs/smb2pdu.c).
      
      Fix this by increasing the size of array _Dialects_ in struct
      smb2_negotiate_req to 4.
      
      Fixes: 9764c02f ("SMB3: Add support for multidialect negotiate (SMB2.1 and later)")
      Fixes: d5c7076b
      
       ("smb3: add smb3.1.1 to default dialect list")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c323163
    • Aurelien Aptel's avatar
      cifs: report error instead of invalid when revalidating a dentry fails · 613fa1fb
      Aurelien Aptel authored
      commit 21b200d0
      
       upstream.
      
      Assuming
      - //HOST/a is mounted on /mnt
      - //HOST/b is mounted on /mnt/b
      
      On a slow connection, running 'df' and killing it while it's
      processing /mnt/b can make cifs_get_inode_info() returns -ERESTARTSYS.
      
      This triggers the following chain of events:
      => the dentry revalidation fail
      => dentry is put and released
      => superblock associated with the dentry is put
      => /mnt/b is unmounted
      
      This patch makes cifs_d_revalidate() return the error instead of 0
      (invalid) when cifs_revalidate_dentry() fails, except for ENOENT (file
      deleted) and ESTALE (file recreated).
      
      Signed-off-by: default avatarAurelien Aptel <aaptel@suse.com>
      Suggested-by: default avatarShyam Prasad N <nspmangalore@gmail.com>
      Reviewed-by: default avatarShyam Prasad N <nspmangalore@gmail.com>
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      613fa1fb
    • Mathias Nyman's avatar
      xhci: fix bounce buffer usage for non-sg list case · b521088e
      Mathias Nyman authored
      commit d4a61063 upstream.
      
      xhci driver may in some special cases need to copy small amounts
      of payload data to a bounce buffer in order to meet the boundary
      and alignment restrictions set by the xHCI specification.
      
      In the majority of these cases the data is in a sg list, and
      driver incorrectly assumed data is always in urb->sg when using
      the bounce buffer.
      
      If data instead is contiguous, and in urb->transfer_buffer, we may still
      need to bounce buffer a small part if data starts very close (less than
      packet size) to a 64k boundary.
      
      Check if sg list is used before copying data to/from it.
      
      Fixes: f9c589e1
      
       ("xhci: TD-fragment, align the unsplittable case with a bounce buffer")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarAndreas Hartmann <andihartmann@01019freenet.de>
      Tested-by: default avatarAndreas Hartmann <andihartmann@01019freenet.de>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Link: https://lore.kernel.org/r/20210203113702.436762-2-mathias.nyman@linux.intel.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b521088e
    • Marc Zyngier's avatar
      genirq/msi: Activate Multi-MSI early when MSI_FLAG_ACTIVATE_EARLY is set · 2bc9ccf2
      Marc Zyngier authored
      commit 4c457e8c upstream.
      
      When MSI_FLAG_ACTIVATE_EARLY is set (which is the case for PCI),
      __msi_domain_alloc_irqs() performs the activation of the interrupt (which
      in the case of PCI results in the endpoint being programmed) as soon as the
      interrupt is allocated.
      
      But it appears that this is only done for the first vector, introducing an
      inconsistent behaviour for PCI Multi-MSI.
      
      Fix it by iterating over the number of vectors allocated to each MSI
      descriptor. This is easily achieved by introducing a new
      "for_each_msi_vector" iterator, together with a tiny bit of refactoring.
      
      Fixes: f3b0946d
      
       ("genirq/msi: Make sure PCI MSIs are activated early")
      Reported-by: default avatarShameer Kolothum <shameerali.kolothum.thodi@huawei.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Tested-by: default avatarShameer Kolothum <shameerali.kolothum.thodi@huawei.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210123122759.1781359-1-maz@kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2bc9ccf2
    • Wang ShaoBo's avatar
      kretprobe: Avoid re-registration of the same kretprobe earlier · e0d7f2f9
      Wang ShaoBo authored
      commit 0188b878 upstream.
      
      Our system encountered a re-init error when re-registering same kretprobe,
      where the kretprobe_instance in rp->free_instances is illegally accessed
      after re-init.
      
      Implementation to avoid re-registration has been introduced for kprobe
      before, but lags for register_kretprobe(). We must check if kprobe has
      been re-registered before re-initializing kretprobe, otherwise it will
      destroy the data struct of kretprobe registered, which can lead to memory
      leak, system crash, also some unexpected behaviors.
      
      We use check_kprobe_rereg() to check if kprobe has been re-registered
      before running register_kretprobe()'s body, for giving a warning message
      and terminate registration process.
      
      Link: https://lkml.kernel.org/r/20210128124427.2031088-1-bobo.shaobowang@huawei.com
      
      Cc: stable@vger.kernel.org
      Fixes: 1f0ab409
      
       ("kprobes: Prevent re-registration of the same kprobe")
      [ The above commit should have been done for kretprobes too ]
      Acked-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: default avatarAnanth N Mavinakayanahalli <ananth@linux.ibm.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
      Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0d7f2f9
    • Felix Fietkau's avatar
      mac80211: fix station rate table updates on assoc · 1d3a84f9
      Felix Fietkau authored
      commit 18fe0fae
      
       upstream.
      
      If the driver uses .sta_add, station entries are only uploaded after the sta
      is in assoc state. Fix early station rate table updates by deferring them
      until the sta has been uploaded.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Link: https://lore.kernel.org/r/20210201083324.3134-1-nbd@nbd.name
      [use rcu_access_pointer() instead since we won't dereference here]
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d3a84f9
    • Liangyan's avatar
      ovl: fix dentry leak in ovl_get_redirect · 307aa802
      Liangyan authored
      commit e04527fe upstream.
      
      We need to lock d_parent->d_lock before dget_dlock, or this may
      have d_lockref updated parallelly like calltrace below which will
      cause dentry->d_lockref leak and risk a crash.
      
           CPU 0                                CPU 1
      ovl_set_redirect                       lookup_fast
        ovl_get_redirect                       __d_lookup
          dget_dlock
            //no lock protection here            spin_lock(&dentry->d_lock)
            dentry->d_lockref.count++            dentry->d_lockref.count++
      
      [   49.799059] PGD 800000061fed7067 P4D 800000061fed7067 PUD 61fec5067 PMD 0
      [   49.799689] Oops: 0002 [#1] SMP PTI
      [   49.800019] CPU: 2 PID: 2332 Comm: node Not tainted 4.19.24-7.20.al7.x86_64 #1
      [   49.800678] Hardware name: Alibaba Cloud Alibaba Cloud ECS, BIOS 8a46cfe 04/01/2014
      [   49.801380] RIP: 0010:_raw_spin_lock+0xc/0x20
      [   49.803470] RSP: 0018:ffffac6fc5417e98 EFLAGS: 00010246
      [   49.803949] RAX: 0000000000000000 RBX: ffff93b8da3446c0 RCX: 0000000a00000000
      [   49.804600] RDX: 0000000000000001 RSI: 000000000000000a RDI: 0000000000000088
      [   49.805252] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff993cf040
      [   49.805898] R10: ffff93b92292e580 R11: ffffd27f188a4b80 R12: 0000000000000000
      [   49.806548] R13: 00000000ffffff9c R14: 00000000fffffffe R15: ffff93b8da3446c0
      [   49.807200] FS:  00007ffbedffb700(0000) GS:ffff93b927880000(0000) knlGS:0000000000000000
      [   49.807935] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   49.808461] CR2: 0000000000000088 CR3: 00000005e3f74006 CR4: 00000000003606a0
      [   49.809113] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   49.809758] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   49.810410] Call Trace:
      [   49.810653]  d_delete+0x2c/0xb0
      [   49.810951]  vfs_rmdir+0xfd/0x120
      [   49.811264]  do_rmdir+0x14f/0x1a0
      [   49.811573]  do_syscall_64+0x5b/0x190
      [   49.811917]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   49.812385] RIP: 0033:0x7ffbf505ffd7
      [   49.814404] RSP: 002b:00007ffbedffada8 EFLAGS: 00000297 ORIG_RAX: 0000000000000054
      [   49.815098] RAX: ffffffffffffffda RBX: 00007ffbedffb640 RCX: 00007ffbf505ffd7
      [   49.815744] RDX: 0000000004449700 RSI: 0000000000000000 RDI: 0000000006c8cd50
      [   49.816394] RBP: 00007ffbedffaea0 R08: 0000000000000000 R09: 0000000000017d0b
      [   49.817038] R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000012
      [   49.817687] R13: 00000000072823d8 R14: 00007ffbedffb700 R15: 00000000072823d8
      [   49.818338] Modules linked in: pvpanic cirrusfb button qemu_fw_cfg atkbd libps2 i8042
      [   49.819052] CR2: 0000000000000088
      [   49.819368] ---[ end trace 4e652b8aa299aa2d ]---
      [   49.819796] RIP: 0010:_raw_spin_lock+0xc/0x20
      [   49.821880] RSP: 0018:ffffac6fc5417e98 EFLAGS: 00010246
      [   49.822363] RAX: 0000000000000000 RBX: ffff93b8da3446c0 RCX: 0000000a00000000
      [   49.823008] RDX: 0000000000000001 RSI: 000000000000000a RDI: 0000000000000088
      [   49.823658] RBP: 0000000000000000 R08: 0000000000000000 R09: ffffffff993cf040
      [   49.825404] R10: ffff93b92292e580 R11: ffffd27f188a4b80 R12: 0000000000000000
      [   49.827147] R13: 00000000ffffff9c R14: 00000000fffffffe R15: ffff93b8da3446c0
      [   49.828890] FS:  00007ffbedffb700(0000) GS:ffff93b927880000(0000) knlGS:0000000000000000
      [   49.830725] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   49.832359] CR2: 0000000000000088 CR3: 00000005e3f74006 CR4: 00000000003606a0
      [   49.834085] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   49.835792] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      
      Cc: <stable@vger.kernel.org>
      Fixes: a6c60655
      
       ("ovl: redirect on rename-dir")
      Signed-off-by: default avatarLiangyan <liangyan.peng@linux.alibaba.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Suggested-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      307aa802
    • Gary Bisson's avatar
      usb: dwc3: fix clock issue during resume in OTG mode · 0bd7046e
      Gary Bisson authored
      commit 0e5a3c82 upstream.
      
      Commit fe8abf33 ("usb: dwc3: support clocks and resets for DWC3
      core") introduced clock support and a new function named
      dwc3_core_init_for_resume() which enables the clock before calling
      dwc3_core_init() during resume as clocks get disabled during suspend.
      
      Unfortunately in this commit the DWC3_GCTL_PRTCAP_OTG case was forgotten
      and therefore during resume, a platform could call dwc3_core_init()
      without re-enabling the clocks first, preventing to resume properly.
      
      So update the resume path to call dwc3_core_init_for_resume() as it
      should.
      
      Fixes: fe8abf33
      
       ("usb: dwc3: support clocks and resets for DWC3 core")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGary Bisson <gary.bisson@boundarydevices.com>
      Link: https://lore.kernel.org/r/20210125161934.527820-1-gary.bisson@boundarydevices.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0bd7046e
    • Heiko Stuebner's avatar
      usb: dwc2: Fix endpoint direction check in ep_from_windex · e5fc959f
      Heiko Stuebner authored
      commit f670e9f9 upstream.
      
      dwc2_hsotg_process_req_status uses ep_from_windex() to retrieve
      the endpoint for the index provided in the wIndex request param.
      
      In a test-case with a rndis gadget running and sending a malformed
      packet to it like:
          dev.ctrl_transfer(
              0x82,      # bmRequestType
              0x00,       # bRequest
              0x0000,     # wValue
              0x0001,     # wIndex
              0x00       # wLength
          )
      it is possible to cause a crash:
      
      [  217.533022] dwc2 ff300000.usb: dwc2_hsotg_process_req_status: USB_REQ_GET_STATUS
      [  217.559003] Unable to handle kernel read from unreadable memory at virtual address 0000000000000088
      ...
      [  218.313189] Call trace:
      [  218.330217]  ep_from_windex+0x3c/0x54
      [  218.348565]  usb_gadget_giveback_request+0x10/0x20
      [  218.368056]  dwc2_hsotg_complete_request+0x144/0x184
      
      This happens because ep_from_windex wants to compare the endpoint
      direction even if index_to_ep() didn't return an endpoint due to
      the direction not matching.
      
      The fix is easy insofar that the actual direction check is already
      happening when calling index_to_ep() which will return NULL if there
      is no endpoint for the targeted direction, so the offending check
      can go away completely.
      
      Fixes: c6f5c050
      
       ("usb: dwc2: gadget: add bi-directional endpoint support")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarGerhard Klostermeier <gerhard.klostermeier@syss.de>
      Signed-off-by: default avatarHeiko Stuebner <heiko.stuebner@theobroma-systems.com>
      Link: https://lore.kernel.org/r/20210127103919.58215-1-heiko@sntech.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e5fc959f
    • Yoshihiro Shimoda's avatar
      usb: renesas_usbhs: Clear pipe running flag in usbhs_pkt_pop() · a028b7c0
      Yoshihiro Shimoda authored
      commit 9917f0e3 upstream.
      
      Should clear the pipe running flag in usbhs_pkt_pop(). Otherwise,
      we cannot use this pipe after dequeue was called while the pipe was
      running.
      
      Fixes: 8355b2b3
      
       ("usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle")
      Reported-by: default avatarTho Vu <tho.vu.wh@renesas.com>
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Link: https://lore.kernel.org/r/1612183640-8898-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a028b7c0
    • Jeremy Figgins's avatar
      USB: usblp: don't call usb_set_interface if there's a single alt · 7048a23f
      Jeremy Figgins authored
      commit d8c6edfa
      
       upstream.
      
      Some devices, such as the Winbond Electronics Corp. Virtual Com Port
      (Vendor=0416, ProdId=5011), lockup when usb_set_interface() or
      usb_clear_halt() are called. This device has only a single
      altsetting, so it should not be necessary to call usb_set_interface().
      
      Acked-by: default avatarPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarJeremy Figgins <kernel@jeremyfiggins.com>
      Link: https://lore.kernel.org/r/YAy9kJhM/rG8EQXC@watson
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7048a23f
    • Dan Carpenter's avatar
      USB: gadget: legacy: fix an error code in eth_bind() · 94bf4b88
      Dan Carpenter authored
      commit 3e1f4a2e upstream.
      
      This code should return -ENOMEM if the allocation fails but it currently
      returns success.
      
      Fixes: 9b95236e
      
       ("usb: gadget: ether: allocate and init otg descriptor by otg capabilities")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/YBKE9rqVuJEOUWpW@mwanda
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94bf4b88
    • Roman Gushchin's avatar
      memblock: do not start bottom-up allocations with kernel_end · 50b21810
      Roman Gushchin authored
      [ Upstream commit 2dcb3964 ]
      
      With kaslr the kernel image is placed at a random place, so starting the
      bottom-up allocation with the kernel_end can result in an allocation
      failure and a warning like this one:
      
        hugetlb_cma: reserve 2048 MiB, up to 2048 MiB per node
        ------------[ cut here ]------------
        memblock: bottom-up allocation failed, memory hotremove may be affected
        WARNING: CPU: 0 PID: 0 at mm/memblock.c:332 memblock_find_in_range_node+0x178/0x25a
        Modules linked in:
        CPU: 0 PID: 0 Comm: swapper Not tainted 5.10.0+ #1169
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014
        RIP: 0010:memblock_find_in_range_node+0x178/0x25a
        Code: e9 6d ff ff ff 48 85 c0 0f 85 da 00 00 00 80 3d 9b 35 df 00 00 75 15 48 c7 c7 c0 75 59 88 c6 05 8b 35 df 00 01 e8 25 8a fa ff <0f> 0b 48 c7 44 24 20 ff ff ff ff 44 89 e6 44 89 ea 48 c7 c1 70 5c
        RSP: 0000:ffffffff88803d18 EFLAGS: 00010086 ORIG_RAX: 0000000000000000
        RAX: 0000000000000000 RBX: 0000000240000000 RCX: 00000000ffffdfff
        RDX: 00000000ffffdfff RSI: 00000000ffffffea RDI: 0000000000000046
        RBP: 0000000100000000 R08: ffffffff88922788 R09: 0000000000009ffb
        R10: 00000000ffffe000 R11: 3fffffffffffffff R12: 0000000000000000
        R13: 0000000000000000 R14: 0000000080000000 R15: 00000001fb42c000
        FS:  0000000000000000(0000) GS:ffffffff88f71000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: ffffa080fb401000 CR3: 00000001fa80a000 CR4: 00000000000406b0
        Call Trace:
          memblock_alloc_range_nid+0x8d/0x11e
          cma_declare_contiguous_nid+0x2c4/0x38c
          hugetlb_cma_reserve+0xdc/0x128
          flush_tlb_one_kernel+0xc/0x20
          native_set_fixmap+0x82/0xd0
          flat_get_apic_id+0x5/0x10
          register_lapic_address+0x8e/0x97
          setup_arch+0x8a5/0xc3f
          start_kernel+0x66/0x547
          load_ucode_bsp+0x4c/0xcd
          secondary_startup_64_no_verify+0xb0/0xbb
        random: get_random_bytes called from __warn+0xab/0x110 with crng_init=0
        ---[ end trace f151227d0b39be70 ]---
      
      At the same time, the kernel image is protected with memblock_reserve(),
      so we can just start searching at PAGE_SIZE.  In this case the bottom-up
      allocation has the same chances to success as a top-down allocation, so
      there is no reason to fallback in the case of a failure.  All together it
      simplifies the logic.
      
      Link: https://lkml.kernel.org/r/20201217201214.3414100-2-guro@fb.com
      Fixes: 8fabc623
      
       ("powerpc: Ensure that swiotlb buffer is allocated from low memory")
      Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
      Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Wonhyuk Yang <vvghjk1234@gmail.com>
      Cc: Thiago Jung Bauermann <bauerman@linux.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      50b21810
    • Stefan Chulski's avatar
      net: mvpp2: TCAM entry enable should be written after SRAM data · 86d05ee5
      Stefan Chulski authored
      [ Upstream commit 43f4a20a ]
      
      Last TCAM data contains TCAM enable bit.
      It should be written after SRAM data before entry enabled.
      
      Fixes: 3f518509
      
       ("ethernet: Add new driver for Marvell Armada 375 network unit")
      Signed-off-by: default avatarStefan Chulski <stefanc@marvell.com>
      Link: https://lore.kernel.org/r/1612172139-28343-1-git-send-email-stefanc@marvell.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      86d05ee5
    • Xie He's avatar
      net: lapb: Copy the skb before sending a packet · 8b8e0d0b
      Xie He authored
      [ Upstream commit 88c7a9fd ]
      
      When sending a packet, we will prepend it with an LAPB header.
      This modifies the shared parts of a cloned skb, so we should copy the
      skb rather than just clone it, before we prepend the header.
      
      In "Documentation/networking/driver.rst" (the 2nd point), it states
      that drivers shouldn't modify the shared parts of a cloned skb when
      transmitting.
      
      The "dev_queue_xmit_nit" function in "net/core/dev.c", which is called
      when an skb is being sent, clones the skb and sents the clone to
      AF_PACKET sockets. Because the LAPB drivers first remove a 1-byte
      pseudo-header before handing over the skb to us, if we don't copy the
      skb before prepending the LAPB header, the first byte of the packets
      received on AF_PACKET sockets can be corrupted.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarXie He <xie.he.0141@gmail.com>
      Acked-by: default avatarMartin Schiller <ms@dev.tdt.de>
      Link: https://lore.kernel.org/r/20210201055706.415842-1-xie.he.0141@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8b8e0d0b
    • Zyta Szpak's avatar
      arm64: dts: ls1046a: fix dcfg address range · 37605bb2
      Zyta Szpak authored
      [ Upstream commit aa880c6f
      
       ]
      
      Dcfg was overlapping with clockgen address space which resulted
      in failure in memory allocation for dcfg. According regs description
      dcfg size should not be bigger than 4KB.
      
      Signed-off-by: default avatarZyta Szpak <zr@semihalf.com>
      Fixes: 8126d881
      
       ("arm64: dts: add QorIQ LS1046A SoC support")
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37605bb2
    • David Howells's avatar
      rxrpc: Fix deadlock around release of dst cached on udp tunnel · d1542519
      David Howells authored
      [ Upstream commit 5399d522
      
       ]
      
      AF_RXRPC sockets use UDP ports in encap mode.  This causes socket and dst
      from an incoming packet to get stolen and attached to the UDP socket from
      whence it is leaked when that socket is closed.
      
      When a network namespace is removed, the wait for dst records to be cleaned
      up happens before the cleanup of the rxrpc and UDP socket, meaning that the
      wait never finishes.
      
      Fix this by moving the rxrpc (and, by dependence, the afs) private
      per-network namespace registrations to the device group rather than subsys
      group.  This allows cached rxrpc local endpoints to be cleared and their
      UDP sockets closed before we try waiting for the dst records.
      
      The symptom is that lines looking like the following:
      
      	unregister_netdevice: waiting for lo to become free
      
      get emitted at regular intervals after running something like the
      referenced syzbot test.
      
      Thanks to Vadim for tracking this down and work out the fix.
      
      Reported-by: default avatar <syzbot+df400f2f24a1677cd7e0@syzkaller.appspotmail.com>
      Reported-by: default avatarVadim Fedorenko <vfedorenko@novek.ru>
      Fixes: 5271953c
      
       ("rxrpc: Use the UDP encap_rcv hook")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarVadim Fedorenko <vfedorenko@novek.ru>
      Link: https://lore.kernel.org/r/161196443016.3868642.5577440140646403533.stgit@warthog.procyon.org.uk
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d1542519
    • Alexey Dobriyan's avatar
      Input: i8042 - unbreak Pegatron C15B · e923e82d
      Alexey Dobriyan authored
      [ Upstream commit a3a9060e ]
      
      g++ reports
      
      	drivers/input/serio/i8042-x86ia64io.h:225:3: error: ‘.matches’ designator used multiple times in the same initializer list
      
      C99 semantics is that last duplicated initialiser wins,
      so DMI entry gets overwritten.
      
      Fixes: a48491c6
      
       ("Input: i8042 - add ByteSpeed touchpad to noloop table")
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Acked-by: default avatarPo-Hsu Lin <po-hsu.lin@canonical.com>
      Link: https://lore.kernel.org/r/20201228072335.GA27766@localhost.localdomain
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e923e82d
    • Arnd Bergmann's avatar
      elfcore: fix building with clang · 2a6e9df1
      Arnd Bergmann authored
      commit 6e7b64b9
      
       upstream.
      
      kernel/elfcore.c only contains weak symbols, which triggers a bug with
      clang in combination with recordmcount:
      
        Cannot find symbol for section 2: .text.
        kernel/elfcore.o: failed
      
      Move the empty stubs into linux/elfcore.h as inline functions.  As only
      two architectures use these, just use the architecture specific Kconfig
      symbols to key off the declaration.
      
      Link: https://lkml.kernel.org/r/20201204165742.3815221-2-arnd@kernel.org
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Nathan Chancellor <natechancellor@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Barret Rhoden <brho@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a6e9df1
    • Christoph Schemmel's avatar
      USB: serial: option: Adding support for Cinterion MV31 · ae9aff4a
      Christoph Schemmel authored
      commit e478d602
      
       upstream.
      
      Adding support for Cinterion device MV31 for enumeration with
      PID 0x00B3 and 0x00B7.
      
      usb-devices output for 0x00B3
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00b3 Rev=04.14
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00B3 USB Mobile Broadband
      S:  SerialNumber=b3246eed
      C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
      I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=cdc_wdm
      I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      usb-devices output for 0x00B7
      T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
      P:  Vendor=1e2d ProdID=00b7 Rev=04.14
      S:  Manufacturer=Cinterion
      S:  Product=Cinterion PID 0x00B3 USB Mobile Broadband
      S:  SerialNumber=b3246eed
      C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=896mA
      I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
      I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      
      Signed-off-by: default avatarChristoph Schemmel <christoph.schemmel@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae9aff4a
    • Chenxin Jin's avatar
      USB: serial: cp210x: add new VID/PID for supporting Teraoka AD2000 · e2e37943
      Chenxin Jin authored
      commit 43377df7
      
       upstream.
      
      Teraoka AD2000 uses the CP210x driver, but the chip VID/PID is
      customized with 0988/0578. We need the driver to support the new
      VID/PID.
      
      Signed-off-by: default avatarChenxin Jin <bg4akv@hotmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2e37943
    • Pho Tran's avatar
      USB: serial: cp210x: add pid/vid for WSDA-200-USB · f8609939
      Pho Tran authored
      commit 3c4f6ecd
      
       upstream.
      
      Information pid/vid of WSDA-200-USB, Lord corporation company:
      vid: 199b
      pid: ba30
      
      Signed-off-by: default avatarPho Tran <pho.tran@silabs.com>
      [ johan: amend comment with product name ]
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8609939
  2. Feb 07, 2021
    • Greg Kroah-Hartman's avatar
      Linux 4.19.174 · b6032ab6
      Greg Kroah-Hartman authored
      
      
      Tested-by: default avatarPavel Machek (CIP) <pavel@denx.de>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Link: https://lore.kernel.org/r/20210205140649.825180779@linuxfoundation.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      v4.19.174
      b6032ab6
    • Peter Zijlstra's avatar
      workqueue: Restrict affinity change to rescuer · 1746d1dc
      Peter Zijlstra authored
      [ Upstream commit 640f17c8
      
       ]
      
      create_worker() will already set the right affinity using
      kthread_bind_mask(), this means only the rescuer will need to change
      it's affinity.
      
      Howveer, while in cpu-hot-unplug a regular task is not allowed to run
      on online&&!active as it would be pushed away quite agressively. We
      need KTHREAD_IS_PER_CPU to survive in that environment.
      
      Therefore set the affinity after getting that magic flag.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Tested-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Link: https://lkml.kernel.org/r/20210121103506.826629830@infradead.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1746d1dc
    • Peter Zijlstra's avatar
      kthread: Extract KTHREAD_IS_PER_CPU · fbad3218
      Peter Zijlstra authored
      [ Upstream commit ac687e6e
      
       ]
      
      There is a need to distinguish geniune per-cpu kthreads from kthreads
      that happen to have a single CPU affinity.
      
      Geniune per-cpu kthreads are kthreads that are CPU affine for
      correctness, these will obviously have PF_KTHREAD set, but must also
      have PF_NO_SETAFFINITY set, lest userspace modify their affinity and
      ruins things.
      
      However, these two things are not sufficient, PF_NO_SETAFFINITY is
      also set on other tasks that have their affinities controlled through
      other means, like for instance workqueues.
      
      Therefore another bit is needed; it turns out kthread_create_per_cpu()
      already has such a bit: KTHREAD_IS_PER_CPU, which is used to make
      kthread_park()/kthread_unpark() work correctly.
      
      Expose this flag and remove the implicit setting of it from
      kthread_create_on_cpu(); the io_uring usage of it seems dubious at
      best.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Tested-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Link: https://lkml.kernel.org/r/20210121103506.557620262@infradead.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fbad3218
    • Josh Poimboeuf's avatar
      objtool: Don't fail on missing symbol table · 52b4c58b
      Josh Poimboeuf authored
      [ Upstream commit 1d489151
      
       ]
      
      Thanks to a recent binutils change which doesn't generate unused
      symbols, it's now possible for thunk_64.o be completely empty without
      CONFIG_PREEMPTION: no text, no data, no symbols.
      
      We could edit the Makefile to only build that file when
      CONFIG_PREEMPTION is enabled, but that will likely create confusion
      if/when the thunks end up getting used by some other code again.
      
      Just ignore it and move on.
      
      Reported-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
      Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Link: https://github.com/ClangBuiltLinux/linux/issues/1254
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      52b4c58b
    • Michael Ellerman's avatar
      selftests/powerpc: Only test lwm/stmw on big endian · 10365001
      Michael Ellerman authored
      [ Upstream commit dd3a44c0
      
       ]
      
      Newer binutils (>= 2.36) refuse to assemble lmw/stmw when building in
      little endian mode. That breaks compilation of our alignment handler
      test:
      
        /tmp/cco4l14N.s: Assembler messages:
        /tmp/cco4l14N.s:1440: Error: `lmw' invalid when little-endian
        /tmp/cco4l14N.s:1814: Error: `stmw' invalid when little-endian
        make[2]: *** [../../lib.mk:139: /output/kselftest/powerpc/alignment/alignment_handler] Error 1
      
      These tests do pass on little endian machines, as the kernel will
      still emulate those instructions even when running little
      endian (which is arguably a kernel bug).
      
      But we don't really need to test that case, so ifdef those
      instructions out to get the alignment test building again.
      
      Reported-by: default avatarLibor Pechacek <lpechacek@suse.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Tested-by: default avatarLibor Pechacek <lpechacek@suse.com>
      Link: https://lore.kernel.org/r/20210119041800.3093047-1-mpe@ellerman.id.au
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      10365001
    • Brian King's avatar
      scsi: ibmvfc: Set default timeout to avoid crash during migration · a7a479e1
      Brian King authored
      [ Upstream commit 76490729
      
       ]
      
      While testing live partition mobility, we have observed occasional crashes
      of the Linux partition. What we've seen is that during the live migration,
      for specific configurations with large amounts of memory, slow network
      links, and workloads that are changing memory a lot, the partition can end
      up being suspended for 30 seconds or longer. This resulted in the following
      scenario:
      
      CPU 0                          CPU 1
      -------------------------------  ----------------------------------
      scsi_queue_rq                    migration_store
       -> blk_mq_start_request          -> rtas_ibm_suspend_me
        -> blk_add_timer                 -> on_each_cpu(rtas_percpu_suspend_me
                    _______________________________________V
                   |
                   V
          -> IPI from CPU 1
           -> rtas_percpu_suspend_me
                                           -> __rtas_suspend_last_cpu
      
      -- Linux partition suspended for > 30 seconds --
                                            -> for_each_online_cpu(cpu)
                                                 plpar_hcall_norets(H_PROD
       -> scsi_dispatch_cmd
                                            -> scsi_times_out
                                             -> scsi_abort_command
                                              -> queue_delayed_work
        -> ibmvfc_queuecommand_lck
         -> ibmvfc_send_event
          -> ibmvfc_send_crq
           - returns H_CLOSED
         <- returns SCSI_MLQUEUE_HOST_BUSY
      -> __blk_mq_requeue_request
      
                                            -> scmd_eh_abort_handler
                                             -> scsi_try_to_abort_cmd
                                               - returns SUCCESS
                                             -> scsi_queue_insert
      
      Normally, the SCMD_STATE_COMPLETE bit would protect against the command
      completion and the timeout, but that doesn't work here, since we don't
      check that at all in the SCSI_MLQUEUE_HOST_BUSY path.
      
      In this case we end up calling scsi_queue_insert on a request that has
      already been queued, or possibly even freed, and we crash.
      
      The patch below simply increases the default I/O timeout to avoid this race
      condition. This is also the timeout value that nearly all IBM SAN storage
      recommends setting as the default value.
      
      Link: https://lore.kernel.org/r/1610463998-19791-1-git-send-email-brking@linux.vnet.ibm.com
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7a479e1
    • Felix Fietkau's avatar
      mac80211: fix fast-rx encryption check · b7079890
      Felix Fietkau authored
      [ Upstream commit 622d3b4e
      
       ]
      
      When using WEP, the default unicast key needs to be selected, instead of
      the STA PTK.
      
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Link: https://lore.kernel.org/r/20201218184718.93650-5-nbd@nbd.name
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b7079890
    • Javed Hasan's avatar
      scsi: libfc: Avoid invoking response handler twice if ep is already completed · d29232eb
      Javed Hasan authored
      [ Upstream commit b2b0f16f
      
       ]
      
      A race condition exists between the response handler getting called because
      of exchange_mgr_reset() (which clears out all the active XIDs) and the
      response we get via an interrupt.
      
      Sequence of events:
      
      	 rport ba0200: Port timeout, state PLOGI
      	 rport ba0200: Port entered PLOGI state from PLOGI state
      	 xid 1052: Exchange timer armed : 20000 msecs      xid timer armed here
      	 rport ba0200: Received LOGO request while in state PLOGI
      	 rport ba0200: Delete port
      	 rport ba0200: work event 3
      	 rport ba0200: lld callback ev 3
      	 bnx2fc: rport_event_hdlr: event = 3, port_id = 0xba0200
      	 bnx2fc: ba0200 - rport not created Yet!!
      	 /* Here we reset any outstanding exchanges before
      	 freeing rport using the exch_mgr_reset() */
      	 xid 1052: Exchange timer canceled
      	 /* Here we got two responses for one xid */
      	 xid 1052: invoking resp(), esb 20000000 state 3
      	 xid 1052: invoking resp(), esb 20000000 state 3
      	 xid 1052: fc_rport_plogi_resp() : ep->resp_active 2
      	 xid 1052: fc_rport_plogi_resp() : ep->resp_active 2
      
      Skip the response if the exchange is already completed.
      
      Link: https://lore.kernel.org/r/20201215194731.2326-1-jhasan@marvell.com
      Signed-off-by: default avatarJaved Hasan <jhasan@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d29232eb
    • Martin Wilck's avatar
      scsi: scsi_transport_srp: Don't block target in failfast state · 2b27b3f8
      Martin Wilck authored
      [ Upstream commit 72eeb7c7
      
       ]
      
      If the port is in SRP_RPORT_FAIL_FAST state when srp_reconnect_rport() is
      entered, a transition to SDEV_BLOCK would be illegal, and a kernel WARNING
      would be triggered. Skip scsi_target_block() in this case.
      
      Link: https://lore.kernel.org/r/20210111142541.21534-1-mwilck@suse.com
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2b27b3f8
    • Peter Zijlstra's avatar
      x86: __always_inline __{rd,wr}msr() · 3b9aacf2
      Peter Zijlstra authored
      [ Upstream commit 66a42501
      
       ]
      
      When the compiler choses to not inline the trivial MSR helpers:
      
        vmlinux.o: warning: objtool: __sev_es_nmi_complete()+0xce: call to __wrmsr.constprop.14() leaves .noinstr.text section
      
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
      Link: https://lore.kernel.org/r/X/bf3gV+BW7kGEsB@hirez.programming.kicks-ass.net
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b9aacf2
    • Arnold Gozum's avatar
      platform/x86: intel-vbtn: Support for tablet mode on Dell Inspiron 7352 · 96c5db6c
      Arnold Gozum authored
      [ Upstream commit fcd38f17
      
       ]
      
      The Dell Inspiron 7352 is a 2-in-1 model that has chassis-type "Notebook".
      Add this model to the dmi_switches_allow_list.
      
      Signed-off-by: default avatarArnold Gozum <arngozum@gmail.com>
      Link: https://lore.kernel.org/r/20201226205307.249659-1-arngozum@gmail.com
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      96c5db6c
    • Hans de Goede's avatar
      platform/x86: touchscreen_dmi: Add swap-x-y quirk for Goodix touchscreen on Estar Beauty HD tablet · ac518835
      Hans de Goede authored
      [ Upstream commit 46c54cf2
      
       ]
      
      The Estar Beauty HD (MID 7316R) tablet uses a Goodix touchscreen,
      with the X and Y coordinates swapped compared to the LCD panel.
      
      Add a touchscreen_dmi entry for this adding a "touchscreen-swapped-x-y"
      device-property to the i2c-client instantiated for this device before
      the driver binds.
      
      This is the first entry of a Goodix touchscreen to touchscreen_dmi.c,
      so far DMI quirks for Goodix touchscreen's have been added directly
      to drivers/input/touchscreen/goodix.c. Currently there are 3
      DMI tables in goodix.c:
      1. rotated_screen[] for devices where the touchscreen is rotated
         180 degrees vs the LCD panel
      2. inverted_x_screen[] for devices where the X axis is inverted
      3. nine_bytes_report[] for devices which use a non standard touch
         report size
      
      Arguably only 3. really needs to be inside the driver and the other
      2 cases are better handled through the generic touchscreen DMI quirk
      mechanism from touchscreen_dmi.c, which allows adding device-props to
      any i2c-client. Esp. now that goodix.c is using the generic
      touchscreen_properties code.
      
      Alternative to the approach from this patch we could add a 4th
      dmi_system_id table for devices with swapped-x-y axis to goodix.c,
      but that seems undesirable.
      
      Cc: Bastien Nocera <hadess@hadess.net>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20201224135158.10976-1-hdegoede@redhat.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ac518835
    • Tony Lindgren's avatar
      phy: cpcap-usb: Fix warning for missing regulator_disable · 836e842b
      Tony Lindgren authored
      [ Upstream commit 764257d9
      
       ]
      
      On deferred probe, we will get the following splat:
      
      cpcap-usb-phy cpcap-usb-phy.0: could not initialize VBUS or ID IIO: -517
      WARNING: CPU: 0 PID: 21 at drivers/regulator/core.c:2123 regulator_put+0x68/0x78
      ...
      (regulator_put) from [<c068ebf0>] (release_nodes+0x1b4/0x1fc)
      (release_nodes) from [<c068a9a4>] (really_probe+0x104/0x4a0)
      (really_probe) from [<c068b034>] (driver_probe_device+0x58/0xb4)
      
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Link: https://lore.kernel.org/r/20201230102105.11826-1-tony@atomide.com
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      836e842b
    • Eric Dumazet's avatar
      net_sched: gen_estimator: support large ewma log · 69874c31
      Eric Dumazet authored
      commit dd5e0733 upstream
      
      syzbot report reminded us that very big ewma_log were supported in the past,
      even if they made litle sense.
      
      tc qdisc replace dev xxx root est 1sec 131072sec ...
      
      While fixing the bug, also add boundary checks for ewma_log, in line
      with range supported by iproute2.
      
      UBSAN: shift-out-of-bounds in net/core/gen_estimator.c:83:38
      shift exponent -1 is negative
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.0-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x107/0x163 lib/dump_stack.c:120
       ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
       __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:395
       est_timer.cold+0xbb/0x12d net/core/gen_estimator.c:83
       call_timer_fn+0x1a5/0x710 kernel/time/timer.c:1417
       expire_timers kernel/time/timer.c:1462 [inline]
       __run_timers.part.0+0x692/0xa80 kernel/time/timer.c:1731
       __run_timers kernel/time/timer.c:1712 [inline]
       run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1744
       __do_softirq+0x2bc/0xa77 kernel/softirq.c:343
       asm_call_irq_on_stack+0xf/0x20
       </IRQ>
       __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
       run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
       do_softirq_own_stack+0xaa/0xd0 arch/x86/kernel/irq_64.c:77
       invoke_softirq kernel/softirq.c:226 [inline]
       __irq_exit_rcu+0x17f/0x200 kernel/softirq.c:420
       irq_exit_rcu+0x5/0x20 kernel/softirq.c:432
       sysvec_apic_timer_interrupt+0x4d/0x100 arch/x86/kernel/apic/apic.c:1096
       asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:628
      RIP: 0010:native_save_fl arch/x86/include/asm/irqflags.h:29 [inline]
      RIP: 0010:arch_local_save_flags arch/x86/include/asm/irqflags.h:79 [inline]
      RIP: 0010:arch_irqs_disabled arch/x86/include/asm/irqflags.h:169 [inline]
      RIP: 0010:acpi_safe_halt drivers/acpi/processor_idle.c:111 [inline]
      RIP: 0010:acpi_idle_do_entry+0x1c9/0x250 drivers/acpi/processor_idle.c:516
      
      Fixes: 1c0d32fd
      
       ("net_sched: gen_estimator: complete rewrite of rate estimators")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Link: https://lore.kernel.org/r/20210114181929.1717985-1-eric.dumazet@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      [sudip: adjust context]
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      69874c31