Skip to content
  1. Sep 15, 2022
    • Takashi Iwai's avatar
      ALSA: usb-audio: Register card again for iface over delayed_register option · 59f1c62d
      Takashi Iwai authored
      [ Upstream commit 2027f114 ]
      
      When the delayed registration is specified via either delayed_register
      option or the quirk, we delay the invocation of snd_card_register()
      until the given interface.  But if a wrong value has been set there
      and there are more interfaces over the given interface number,
      snd_card_register() call would be missing for those interfaces.
      
      This patch catches up those missing calls by fixing the comparison of
      the interface number.  Now the call is skipped only if the processed
      interface is less than the given interface, instead of the exact
      match.
      
      Fixes: b70038ef
      
       ("ALSA: usb-audio: Add delayed_register option")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216082
      Link: https://lore.kernel.org/r/20220831125901.4660-2-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      59f1c62d
    • Takashi Iwai's avatar
      ALSA: usb-audio: Inform the delayed registration more properly · 4dc401ef
      Takashi Iwai authored
      [ Upstream commit 7e1afce5 ]
      
      The info message that was added in the commit a4aad563 ("ALSA:
      usb-audio: Inform devices that need delayed registration") is actually
      useful to know the need for the delayed registration.  However, it
      turned out that this doesn't catch the all cases; namely, this warned
      only when a PCM stream is attached onto the existing PCM instance, but
      it doesn't count for a newly created PCM instance.  This made
      confusion as if there were no further delayed registration.
      
      This patch moves the check to the code path for either adding a stream
      or creating a PCM instance.  Also, make it simpler by checking the
      card->registered flag instead of querying each snd_device state.
      
      Fixes: a4aad563
      
       ("ALSA: usb-audio: Inform devices that need delayed registration")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216082
      Link: https://lore.kernel.org/r/20220831125901.4660-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4dc401ef
    • yangx.jy@fujitsu.com's avatar
      RDMA/srp: Set scmnd->result only when scmnd is not NULL · a8edd49c
      yangx.jy@fujitsu.com authored
      [ Upstream commit 12f35199 ]
      
      This change fixes the following kernel NULL pointer dereference
      which is reproduced by blktests srp/007 occasionally.
      
      BUG: kernel NULL pointer dereference, address: 0000000000000170
      PGD 0 P4D 0
      Oops: 0002 [#1] PREEMPT SMP NOPTI
      CPU: 0 PID: 9 Comm: kworker/0:1H Kdump: loaded Not tainted 6.0.0-rc1+ #37
      Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-29-g6a62e0cb0dfe-prebuilt.qemu.org 04/01/2014
      Workqueue:  0x0 (kblockd)
      RIP: 0010:srp_recv_done+0x176/0x500 [ib_srp]
      Code: 00 4d 85 ff 0f 84 52 02 00 00 48 c7 82 80 02 00 00 00 00 00 00 4c 89 df 4c 89 14 24 e8 53 d3 4a f6 4c 8b 14 24 41 0f b6 42 13 <41> 89 87 70 01 00 00 41 0f b6 52 12 f6 c2 02 74 44 41 8b 42 1c b9
      RSP: 0018:ffffaef7c0003e28 EFLAGS: 00000282
      RAX: 0000000000000000 RBX: ffff9bc9486dea60 RCX: 0000000000000000
      RDX: 0000000000000102 RSI: ffffffffb76bbd0e RDI: 00000000ffffffff
      RBP: ffff9bc980099a00 R08: 0000000000000001 R09: 0000000000000001
      R10: ffff9bca53ef0000 R11: ffff9bc980099a10 R12: ffff9bc956e14000
      R13: ffff9bc9836b9cb0 R14: ffff9bc9557b4480 R15: 0000000000000000
      FS:  0000000000000000(0000) GS:ffff9bc97ec00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000170 CR3: 0000000007e04000 CR4: 00000000000006f0
      Call Trace:
       <IRQ>
       __ib_process_cq+0xb7/0x280 [ib_core]
       ib_poll_handler+0x2b/0x130 [ib_core]
       irq_poll_softirq+0x93/0x150
       __do_softirq+0xee/0x4b8
       irq_exit_rcu+0xf7/0x130
       sysvec_apic_timer_interrupt+0x8e/0xc0
       </IRQ>
      
      Fixes: ad215aae
      
       ("RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent")
      Link: https://lore.kernel.org/r/20220831081626.18712-1-yangx.jy@fujitsu.com
      Signed-off-by: default avatarXiao Yang <yangx.jy@fujitsu.com>
      Acked-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a8edd49c
    • David Leadbeater's avatar
      netfilter: nf_conntrack_irc: Fix forged IP logic · 451c9ce1
      David Leadbeater authored
      [ Upstream commit 0efe125c ]
      
      Ensure the match happens in the right direction, previously the
      destination used was the server, not the NAT host, as the comment
      shows the code intended.
      
      Additionally nf_nat_irc uses port 0 as a signal and there's no valid way
      it can appear in a DCC message, so consider port 0 also forged.
      
      Fixes: 869f37d8
      
       ("[NETFILTER]: nf_conntrack/nf_nat: add IRC helper port")
      Signed-off-by: default avatarDavid Leadbeater <dgl@dgl.cx>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      451c9ce1
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: clean up hook list when offload flags check fails · 1ce55ec5
      Pablo Neira Ayuso authored
      [ Upstream commit 77972a36 ]
      
      splice back the hook list so nft_chain_release_hook() has a chance to
      release the hooks.
      
      BUG: memory leak
      unreferenced object 0xffff88810180b100 (size 96):
        comm "syz-executor133", pid 3619, jiffies 4294945714 (age 12.690s)
        hex dump (first 32 bytes):
          28 64 23 02 81 88 ff ff 28 64 23 02 81 88 ff ff  (d#.....(d#.....
          90 a8 aa 83 ff ff ff ff 00 00 b5 0f 81 88 ff ff  ................
        backtrace:
          [<ffffffff83a8c59b>] kmalloc include/linux/slab.h:600 [inline]
          [<ffffffff83a8c59b>] nft_netdev_hook_alloc+0x3b/0xc0 net/netfilter/nf_tables_api.c:1901
          [<ffffffff83a9239a>] nft_chain_parse_netdev net/netfilter/nf_tables_api.c:1998 [inline]
          [<ffffffff83a9239a>] nft_chain_parse_hook+0x33a/0x530 net/netfilter/nf_tables_api.c:2073
          [<ffffffff83a9b14b>] nf_tables_addchain.constprop.0+0x10b/0x950 net/netfilter/nf_tables_api.c:2218
          [<ffffffff83a9c41b>] nf_tables_newchain+0xa8b/0xc60 net/netfilter/nf_tables_api.c:2593
          [<ffffffff83a3d6a6>] nfnetlink_rcv_batch+0xa46/0xd20 net/netfilter/nfnetlink.c:517
          [<ffffffff83a3db79>] nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:638 [inline]
          [<ffffffff83a3db79>] nfnetlink_rcv+0x1f9/0x220 net/netfilter/nfnetlink.c:656
          [<ffffffff83a13b17>] netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
          [<ffffffff83a13b17>] netlink_unicast+0x397/0x4c0 net/netlink/af_netlink.c:1345
          [<ffffffff83a13fd6>] netlink_sendmsg+0x396/0x710 net/netlink/af_netlink.c:1921
          [<ffffffff83865ab6>] sock_sendmsg_nosec net/socket.c:714 [inline]
          [<ffffffff83865ab6>] sock_sendmsg+0x56/0x80 net/socket.c:734
          [<ffffffff8386601c>] ____sys_sendmsg+0x36c/0x390 net/socket.c:2482
          [<ffffffff8386a918>] ___sys_sendmsg+0xa8/0x110 net/socket.c:2536
          [<ffffffff8386aaa8>] __sys_sendmsg+0x88/0x100 net/socket.c:2565
          [<ffffffff845e5955>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
          [<ffffffff845e5955>] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
          [<ffffffff84800087>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: d54725cd
      
       ("netfilter: nf_tables: support for multiple devices per netdev hook")
      Reported-by: default avatar <syzbot+5fcdbfab6d6744c57418@syzkaller.appspotmail.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1ce55ec5
    • Harsh Modi's avatar
      netfilter: br_netfilter: Drop dst references before setting. · 92837ac0
      Harsh Modi authored
      [ Upstream commit d047283a ]
      
      The IPv6 path already drops dst in the daddr changed case, but the IPv4
      path does not. This change makes the two code paths consistent.
      
      Further, it is possible that there is already a metadata_dst allocated from
      ingress that might already be attached to skbuff->dst while following
      the bridge path. If it is not released before setting a new
      metadata_dst, it will be leaked. This is similar to what is done in
      bpf_set_tunnel_key() or ip6_route_input().
      
      It is important to note that the memory being leaked is not the dst
      being set in the bridge code, but rather memory allocated from some
      other code path that is not being freed correctly before the skb dst is
      overwritten.
      
      An example of the leakage fixed by this commit found using kmemleak:
      
      unreferenced object 0xffff888010112b00 (size 256):
        comm "softirq", pid 0, jiffies 4294762496 (age 32.012s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 80 16 f1 83 ff ff ff ff  ................
          e1 4e f6 82 ff ff ff ff 00 00 00 00 00 00 00 00  .N..............
        backtrace:
          [<00000000d79567ea>] metadata_dst_alloc+0x1b/0xe0
          [<00000000be113e13>] udp_tun_rx_dst+0x174/0x1f0
          [<00000000a36848f4>] geneve_udp_encap_recv+0x350/0x7b0
          [<00000000d4afb476>] udp_queue_rcv_one_skb+0x380/0x560
          [<00000000ac064aea>] udp_unicast_rcv_skb+0x75/0x90
          [<000000009a8ee8c5>] ip_protocol_deliver_rcu+0xd8/0x230
          [<00000000ef4980bb>] ip_local_deliver_finish+0x7a/0xa0
          [<00000000d7533c8c>] __netif_receive_skb_one_core+0x89/0xa0
          [<00000000a879497d>] process_backlog+0x93/0x190
          [<00000000e41ade9f>] __napi_poll+0x28/0x170
          [<00000000b4c0906b>] net_rx_action+0x14f/0x2a0
          [<00000000b20dd5d4>] __do_softirq+0xf4/0x305
          [<000000003a7d7e15>] __irq_exit_rcu+0xc3/0x140
          [<00000000968d39a2>] sysvec_apic_timer_interrupt+0x9e/0xc0
          [<000000009e920794>] asm_sysvec_apic_timer_interrupt+0x16/0x20
          [<000000008942add0>] native_safe_halt+0x13/0x20
      
      Florian Westphal says: "Original code was likely fine because nothing
      ever did set a skb->dst entry earlier than bridge in those days."
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarHarsh Modi <harshmodi@google.com>
      Acked-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      92837ac0
    • Claudiu Beznea's avatar
      ARM: dts: at91: sama5d2_icp: don't keep vdd_other enabled all the time · 940e58f2
      Claudiu Beznea authored
      [ Upstream commit 3d074b75 ]
      
      VDD_OTHER is not connected to any on board consumer thus it is not
      needed to keep it enabled all the time.
      
      Fixes: 68a95ef7
      
       ("ARM: dts: at91: sama5d2-icp: add SAMA5D2-ICP")
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220826083927.3107272-9-claudiu.beznea@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      940e58f2
    • Claudiu Beznea's avatar
      ARM: dts: at91: sama5d27_wlsom1: don't keep ldo2 enabled all the time · 86706fa9
      Claudiu Beznea authored
      [ Upstream commit 617a0d9f ]
      
      ldo2 is not used by any consumer on sama5d27_wlsom1 board, thus
      don't keep it enabled all the time.
      
      Fixes: 5d4c3cfb
      
       ("ARM: dts: at91: sama5d27_wlsom1: add SAMA5D27 wlsom1 and wlsom1-ek")
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220826083927.3107272-8-claudiu.beznea@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      86706fa9
    • Claudiu Beznea's avatar
      ARM: dts: at91: sama5d2_icp: specify proper regulator output ranges · d6015c56
      Claudiu Beznea authored
      [ Upstream commit 7737d936 ]
      
      Min and max output ranges of regulators need to satisfy board
      requirements not PMIC requirements. Thus adjust device tree to
      cope with this.
      
      Fixes: 68a95ef7
      
       ("ARM: dts: at91: sama5d2-icp: add SAMA5D2-ICP")
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220826083927.3107272-6-claudiu.beznea@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d6015c56
    • Claudiu Beznea's avatar
      ARM: dts: at91: sama5d27_wlsom1: specify proper regulator output ranges · a8ab10c3
      Claudiu Beznea authored
      [ Upstream commit addf7efe ]
      
      Min and max output ranges of regulators need to satisfy board
      requirements not PMIC requirements. Thus adjust device tree to
      cope with this.
      
      Fixes: 5d4c3cfb
      
       ("ARM: dts: at91: sama5d27_wlsom1: add SAMA5D27 wlsom1 and wlsom1-ek")
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220826083927.3107272-5-claudiu.beznea@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a8ab10c3
    • Claudiu Beznea's avatar
      ARM: at91: pm: fix DDR recalibration when resuming from backup and self-refresh · 6fbff44c
      Claudiu Beznea authored
      [ Upstream commit 7a94b83a ]
      
      On SAMA7G5, when resuming from backup and self-refresh, the bootloader
      performs DDR PHY recalibration by restoring the value of ZQ0SR0 (stored
      in RAM by Linux before going to backup and self-refresh). It has been
      discovered that the current procedure doesn't work for all possible values
      that might go to ZQ0SR0 due to hardware bug. The workaround to this is to
      avoid storing some values in ZQ0SR0. Thus Linux will read the ZQ0SR0
      register and cache its value in RAM after processing it (using
      modified_gray_code array). The bootloader will restore the processed value.
      
      Fixes: d2d4716d
      
       ("ARM: at91: pm: save ddr phy calibration data to securam")
      Suggested-by: default avatarFrederic Schumacher <frederic.schumacher@microchip.com>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Link: https://lore.kernel.org/r/20220826083927.3107272-4-claudiu.beznea@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6fbff44c
    • Claudiu Beznea's avatar
      ARM: at91: pm: fix self-refresh for sama7g5 · e11d08c8
      Claudiu Beznea authored
      [ Upstream commit a02875c4 ]
      
      It has been discovered that on some parts, from time to time, self-refresh
      procedure doesn't work as expected. Debugging and investigating it proved
      that disabling AC DLL introduce glitches in RAM controllers which
      leads to unexpected behavior. This is confirmed as a hardware bug. DLL
      bypass disables 3 DLLs: 2 DX DLLs and AC DLL. Thus, keep only DX DLLs
      disabled. This introduce 6mA extra current consumption on VDDCORE when
      switching to any ULP mode or standby mode but the self-refresh procedure
      still works.
      
      Fixes: f0bbf179
      
       ("ARM: at91: pm: add self-refresh support for sama7g5")
      Suggested-by: default avatarFrederic Schumacher <frederic.schumacher@microchip.com>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
      Tested-by: default avatarCristian Birsan <cristian.birsan@microchip.com>
      Link: https://lore.kernel.org/r/20220826083927.3107272-3-claudiu.beznea@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e11d08c8
    • Ajay.Kathat@microchip.com's avatar
      wifi: wilc1000: fix DMA on stack objects · 32dd0b22
      Ajay.Kathat@microchip.com authored
      [ Upstream commit 40b717bf ]
      
      Sometimes 'wilc_sdio_cmd53' is called with addresses pointing to an
      object on the stack. Use dynamically allocated memory for cmd53 instead
      of stack address which is not DMA'able.
      
      Fixes: 5625f965
      
       ("wilc1000: move wilc driver out of staging")
      Reported-by: default avatarMichael Walle <mwalle@kernel.org>
      Suggested-by: default avatarMichael Walle <mwalle@kernel.org>
      Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
      Reviewed-by: default avatarMichael Walle <mwalle@kernel.org>
      Tested-by: default avatarMichael Walle <mwalle@kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/20220809075749.62752-1-ajay.kathat@microchip.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      32dd0b22
    • Wenpeng Liang's avatar
      RDMA/hns: Fix wrong fixed value of qp->rq.wqe_shift · 6f7aa102
      Wenpeng Liang authored
      [ Upstream commit 0c8b5d62 ]
      
      The value of qp->rq.wqe_shift of HIP08 is always determined by the number
      of sge. So delete the wrong branch.
      
      Fixes: cfc85f3e ("RDMA/hns: Add profile support for hip08 driver")
      Fixes: 926a01dc
      
       ("RDMA/hns: Add QP operations support for hip08 SoC")
      Link: https://lore.kernel.org/r/20220829105021.1427804-3-liangwenpeng@huawei.com
      Signed-off-by: default avatarWenpeng Liang <liangwenpeng@huawei.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6f7aa102
    • Chengchang Tang's avatar
      RDMA/hns: Fix supported page size · c1796dd5
      Chengchang Tang authored
      [ Upstream commit 55af9d49 ]
      
      The supported page size for hns is (4K, 128M), not (4K, 2G).
      
      Fixes: cfc85f3e
      
       ("RDMA/hns: Add profile support for hip08 driver")
      Link: https://lore.kernel.org/r/20220829105021.1427804-2-liangwenpeng@huawei.com
      Signed-off-by: default avatarChengchang Tang <tangchengchang@huawei.com>
      Signed-off-by: default avatarWenpeng Liang <liangwenpeng@huawei.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c1796dd5
    • Liang He's avatar
      soc: brcmstb: pm-arm: Fix refcount leak and __iomem leak bugs · 43245c77
      Liang He authored
      [ Upstream commit 1085f508 ]
      
      In brcmstb_pm_probe(), there are two kinds of leak bugs:
      
      (1) we need to add of_node_put() when for_each__matching_node() breaks
      (2) we need to add iounmap() for each iomap in fail path
      
      Fixes: 0b741b82
      
       ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
      Signed-off-by: default avatarLiang He <windhl@126.com>
      Link: https://lore.kernel.org/r/20220707015620.306468-1-windhl@126.com
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43245c77
    • Michael Guralnik's avatar
      RDMA/cma: Fix arguments order in net device validation · d3eb252d
      Michael Guralnik authored
      [ Upstream commit 27cfde79 ]
      
      Fix the order of source and destination addresses when resolving the
      route between server and client to validate use of correct net device.
      
      The reverse order we had so far didn't actually validate the net device
      as the server would try to resolve the route to itself, thus always
      getting the server's net device.
      
      The issue was discovered when running cm applications on a single host
      between 2 interfaces with same subnet and source based routing rules.
      When resolving the reverse route the source based route rules were
      ignored.
      
      Fixes: f887f2ac
      
       ("IB/cma: Validate routing of incoming requests")
      Link: https://lore.kernel.org/r/1c1ec2277a131d277ebcceec987fd338d35b775f.1661251872.git.leonro@nvidia.com
      Signed-off-by: default avatarMichael Guralnik <michaelgur@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d3eb252d
    • Jens Wiklander's avatar
      tee: fix compiler warning in tee_shm_register() · e2ec1064
      Jens Wiklander authored
      [ Upstream commit eccd7439 ]
      
      Include <linux/uaccess.h> to avoid the warning:
         drivers/tee/tee_shm.c: In function 'tee_shm_register':
      >> drivers/tee/tee_shm.c:242:14: error: implicit declaration of function 'access_ok' [-Werror=implicit-function-declaration]
           242 |         if (!access_ok((void __user *)addr, length))
               |              ^~~~~~~~~
         cc1: some warnings being treated as errors
      
      Fixes: 573ae4f1
      
       ("tee: add overflow check in register_shm_helper()")
      Reviewed-by: default avatarSumit Garg <sumit.garg@linaro.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e2ec1064
    • Andrew Halaney's avatar
      regulator: core: Clean up on enable failure · eb53e84d
      Andrew Halaney authored
      [ Upstream commit c32f1ebf ]
      
      If regulator_enable() fails, enable_count is incremented still.
      A consumer, assuming no matching regulator_disable() is necessary on
      failure, will then get this error message upon regulator_put()
      since enable_count is non-zero:
      
          [    1.277418] WARNING: CPU: 3 PID: 1 at drivers/regulator/core.c:2304 _regulator_put.part.0+0x168/0x170
      
      The consumer could try to fix this in their driver by cleaning up on
      error from regulator_enable() (i.e. call regulator_disable()), but that
      results in the following since regulator_enable() failed and didn't
      increment user_count:
      
          [    1.258112] unbalanced disables for vreg_l17c
          [    1.262606] WARNING: CPU: 4 PID: 1 at drivers/regulator/core.c:2899 _regulator_disable+0xd4/0x190
      
      Fix this by decrementing enable_count upon failure to enable.
      
      With this in place, just the reason for failure to enable is printed
      as expected and developers can focus on the root cause of their issue
      instead of thinking their usage of the regulator consumer api is
      incorrect. For example, in my case:
      
          [    1.240426] vreg_l17c: invalid input voltage found
      
      Fixes: 5451781d
      
       ("regulator: core: Only count load for enabled consumers")
      Signed-off-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarBrian Masney <bmasney@redhat.com>
      Link: https://lore.kernel.org/r/20220819194336.382740-1-ahalaney@redhat.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eb53e84d
    • Marek Vasut's avatar
      soc: imx: gpcv2: Assert reset before ungating clock · a53b3071
      Marek Vasut authored
      [ Upstream commit df88005b ]
      
      In case the power domain clock are ungated before the reset is asserted,
      the system might freeze completely. This is likely due to a device is an
      undefined state being attached to bus, which sporadically leads to a bus
      hang. Assert the reset before the clock are enabled to assure the device
      is in defined state before being attached to bus.
      
      Fixes: fe58c887
      
       ("soc: imx: gpcv2: add support for optional resets")
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Reviewed-by: default avatarFabio Estevam <festevam@denx.de>
      Reviewed-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a53b3071
    • Marco Felsch's avatar
      ARM: dts: imx6qdl-kontron-samx6i: remove duplicated node · 83a7e5d2
      Marco Felsch authored
      [ Upstream commit 204f67d8 ]
      
      The regulator node 'regulator-3p3v-s0' was dupplicated. Remove it to
      clean the DTS.
      
      Fixes: 2a51f9da
      
       ("ARM: dts: imx6qdl-kontron-samx6i: Add iMX6-based Kontron SMARC-sAMX6i module")
      Signed-off-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      83a7e5d2
    • Jack Wang's avatar
      RDMA/rtrs-srv: Pass the correct number of entries for dma mapped SGL · ae8e70e3
      Jack Wang authored
      [ Upstream commit 56c310de ]
      
      ib_dma_map_sg() augments the SGL into a 'dma mapped SGL'. This process
      may change the number of entries and the lengths of each entry.
      
      Code that touches dma_address is iterating over the 'dma mapped SGL'
      and must use dma_nents which returned from ib_dma_map_sg().
      
      We should use the return count from ib_dma_map_sg for futher usage.
      
      Fixes: 9cb83748
      
       ("RDMA/rtrs: server: main functionality")
      Link: https://lore.kernel.org/r/20220818105355.110344-4-haris.iqbal@ionos.com
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarAleksei Marov <aleksei.marov@ionos.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ae8e70e3
    • Jack Wang's avatar
      RDMA/rtrs-clt: Use the right sg_cnt after ib_dma_map_sg · ad69caa4
      Jack Wang authored
      [ Upstream commit b66905e0 ]
      
      When iommu is enabled, we hit warnings like this:
      WARNING: at rtrs/rtrs.c:178 rtrs_iu_post_rdma_write_imm+0x9b/0x110
      
      rtrs warn on one sge entry length is 0, which is unexpected.
      
      The problem is ib_dma_map_sg augments the SGL into a 'dma mapped SGL'.
      This process may change the number of entries and the lengths of each
      entry.
      
      Code that touches dma_address is iterating over the 'dma mapped SGL'
      and must use dma_nents which returned from ib_dma_map_sg().
      So pass the count return from ib_dma_map_sg.
      
      Fixes: 6a98d71d
      
       ("RDMA/rtrs: client: main functionality")
      Link: https://lore.kernel.org/r/20220818105355.110344-3-haris.iqbal@ionos.com
      Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
      Reviewed-by: default avatarAleksei Marov <aleksei.marov@ionos.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ad69caa4
    • Srinivas Kandagatla's avatar
      ASoC: qcom: sm8250: add missing module owner · 237f1639
      Srinivas Kandagatla authored
      [ Upstream commit c6e14bb9 ]
      
      Add missing module owner to able to build and load this driver as module.
      
      Fixes: aa2e2785
      
       ("ASoC: qcom: sm8250: add sound card qrb5165-rb5 support")
      Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20220816165229.7971-1-srinivas.kandagatla@linaro.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      237f1639
    • Tejun Heo's avatar
      cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock · 3bf4bf54
      Tejun Heo authored
      [ Upstream commit 4f7e7236
      
       ]
      
      Bringing up a CPU may involve creating and destroying tasks which requires
      read-locking threadgroup_rwsem, so threadgroup_rwsem nests inside
      cpus_read_lock(). However, cpuset's ->attach(), which may be called with
      thredagroup_rwsem write-locked, also wants to disable CPU hotplug and
      acquires cpus_read_lock(), leading to a deadlock.
      
      Fix it by guaranteeing that ->attach() is always called with CPU hotplug
      disabled and removing cpus_read_lock() call from cpuset_attach().
      
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-and-tested-by: default avatarImran Khan <imran.f.khan@oracle.com>
      Reported-and-tested-by: default avatarXuewen Yan <xuewen.yan@unisoc.com>
      Fixes: 05c7b7a9
      
       ("cgroup/cpuset: Fix a race between cpuset_attach() and cpu hotplug")
      Cc: stable@vger.kernel.org # v5.17+
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3bf4bf54
    • Tejun Heo's avatar
      cgroup: Elide write-locking threadgroup_rwsem when updating csses on an empty subtree · 509e3456
      Tejun Heo authored
      [ Upstream commit 671c11f0
      
       ]
      
      cgroup_update_dfl_csses() write-lock the threadgroup_rwsem as updating the
      csses can trigger process migrations. However, if the subtree doesn't
      contain any tasks, there aren't gonna be any cgroup migrations. This
      condition can be trivially detected by testing whether
      mgctx.preloaded_src_csets is empty. Elide write-locking threadgroup_rwsem if
      the subtree is empty.
      
      After this optimization, the usage pattern of creating a cgroup, enabling
      the necessary controllers, and then seeding it with CLONE_INTO_CGROUP and
      then removing the cgroup after it becomes empty doesn't need to write-lock
      threadgroup_rwsem at all.
      
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Michal Koutný <mkoutny@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      509e3456
    • Trond Myklebust's avatar
      NFS: Fix another fsync() issue after a server reboot · 3b97deb4
      Trond Myklebust authored
      [ Upstream commit 67f4b5dc ]
      
      Currently, when the writeback code detects a server reboot, it redirties
      any pages that were not committed to disk, and it sets the flag
      NFS_CONTEXT_RESEND_WRITES in the nfs_open_context of the file descriptor
      that dirtied the file. While this allows the file descriptor in question
      to redrive its own writes, it violates the fsync() requirement that we
      should be synchronising all writes to disk.
      While the problem is infrequent, we do see corner cases where an
      untimely server reboot causes the fsync() call to abandon its attempt to
      sync data to disk and causing data corruption issues due to missed error
      conditions or similar.
      
      In order to tighted up the client's ability to deal with this situation
      without introducing livelocks, add a counter that records the number of
      times pages are redirtied due to a server reboot-like condition, and use
      that in fsync() to redrive the sync to disk.
      
      Fixes: 2197e9b0
      
       ("NFS: Fix up fsync() when the server rebooted")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3b97deb4
    • Trond Myklebust's avatar
      NFS: Save some space in the inode · 31b992b3
      Trond Myklebust authored
      [ Upstream commit e591b298
      
       ]
      
      Save some space in the nfs_inode by setting up an anonymous union with
      the fields that are peculiar to a specific type of filesystem object.
      
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      31b992b3
    • Trond Myklebust's avatar
      NFS: Further optimisations for 'ls -l' · 88d24e83
      Trond Myklebust authored
      [ Upstream commit ff81dfb5
      
       ]
      
      If a user is doing 'ls -l', we have a heuristic in GETATTR that tells
      the readdir code to try to use READDIRPLUS in order to refresh the inode
      attributes. In certain cirumstances, we also try to invalidate the
      remaining directory entries in order to ensure this refresh.
      
      If there are multiple readers of the directory, we probably should avoid
      invalidating the page cache, since the heuristic breaks down in that
      situation anyway.
      
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Tested-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      88d24e83
    • Yang Yingliang's avatar
      scsi: lpfc: Add missing destroy_workqueue() in error path · 1dcc3088
      Yang Yingliang authored
      commit da6d507f upstream.
      
      Add the missing destroy_workqueue() before return from
      lpfc_sli4_driver_resource_setup() in the error path.
      
      Link: https://lore.kernel.org/r/20220823044237.285643-1-yangyingliang@huawei.com
      Fixes: 3cee98db
      
       ("scsi: lpfc: Fix crash on driver unload in wq free")
      Reviewed-by: default avatarJames Smart <jsmart2021@gmail.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1dcc3088
    • Sreekanth Reddy's avatar
      scsi: mpt3sas: Fix use-after-free warning · 6229fa49
      Sreekanth Reddy authored
      commit 991df3dd
      
       upstream.
      
      Fix the following use-after-free warning which is observed during
      controller reset:
      
      refcount_t: underflow; use-after-free.
      WARNING: CPU: 23 PID: 5399 at lib/refcount.c:28 refcount_warn_saturate+0xa6/0xf0
      
      Link: https://lore.kernel.org/r/20220906134908.1039-2-sreekanth.reddy@broadcom.com
      Signed-off-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6229fa49
    • Ville Syrjälä's avatar
      drm/i915: Implement WaEdpLinkRateDataReload · d2ca79dd
      Ville Syrjälä authored
      commit 672d6ca7
      
       upstream.
      
      A lot of modern laptops use the Parade PS8461E MUX for eDP
      switching. The MUX can operate in jitter cleaning mode or
      redriver mode, the first one resulting in higher link
      quality. The jitter cleaning mode needs to know the link
      rate used and the MUX achieves this by snooping the
      LINK_BW_SET, LINK_RATE_SELECT and SUPPORTED_LINK_RATES
      DPCD accesses.
      
      When the MUX is powered down (seems this can happen whenever
      the display is turned off) it loses track of the snooped
      link rates so when we do the LINK_RATE_SELECT write it no
      longer knowns which link rate we're selecting, and thus it
      falls back to the lower quality redriver mode. This results
      in unstable high link rates (eg. usually 8.1Gbps link rate
      no longer works correctly).
      
      In order to avoid all that let's re-snoop SUPPORTED_LINK_RATES
      from the sink at the start of every link training.
      
      Unfortunately we don't have a way to detect the presence of
      the MUX. It looks like the set of laptops equipped with this
      MUX is fairly large and contains devices from multiple
      manufacturers. It may also still be growing with new models.
      So a quirk doesn't seem like a very easily maintainable
      option, thus we shall attempt to do this unconditionally on
      all machines that use LINK_RATE_SELECT. Hopefully this extra
      DPCD read doesn't cause issues for any unaffected machine.
      If that turns out to be the case we'll need to convert this
      into a quirk in the future.
      
      Cc: stable@vger.kernel.org
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6205
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220902070319.15395-1-ville.syrjala@linux.intel.com
      Tested-by: default avatarAaron Ma <aaron.ma@canonical.com>
      Tested-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      (cherry picked from commit 25899c59
      
      )
      Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d2ca79dd
    • Bart Van Assche's avatar
      nvmet: fix a use-after-free · ebf46da5
      Bart Van Assche authored
      commit 6a02a61e upstream.
      
      Fix the following use-after-free complaint triggered by blktests nvme/004:
      
      BUG: KASAN: user-memory-access in blk_mq_complete_request_remote+0xac/0x350
      Read of size 4 at addr 0000607bd1835943 by task kworker/13:1/460
      Workqueue: nvmet-wq nvme_loop_execute_work [nvme_loop]
      Call Trace:
       show_stack+0x52/0x58
       dump_stack_lvl+0x49/0x5e
       print_report.cold+0x36/0x1e2
       kasan_report+0xb9/0xf0
       __asan_load4+0x6b/0x80
       blk_mq_complete_request_remote+0xac/0x350
       nvme_loop_queue_response+0x1df/0x275 [nvme_loop]
       __nvmet_req_complete+0x132/0x4f0 [nvmet]
       nvmet_req_complete+0x15/0x40 [nvmet]
       nvmet_execute_io_connect+0x18a/0x1f0 [nvmet]
       nvme_loop_execute_work+0x20/0x30 [nvme_loop]
       process_one_work+0x56e/0xa70
       worker_thread+0x2d1/0x640
       kthread+0x183/0x1c0
       ret_from_fork+0x1f/0x30
      
      Cc: stable@vger.kernel.org
      Fixes: a07b4970
      
       ("nvmet: add a generic NVMe target")
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebf46da5
    • Greg Kroah-Hartman's avatar
      drm/amd/display: fix memory leak when using debugfs_lookup() · 58acd2eb
      Greg Kroah-Hartman authored
      commit cbfac7fa
      
       upstream.
      
      When calling debugfs_lookup() the result must have dput() called on it,
      otherwise the memory will leak over time.  Fix this up by properly
      calling dput().
      
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Leo Li <sunpeng.li@amd.com>
      Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: hersen wu <hersenxs.wu@amd.com>
      Cc: Wenjing Liu <wenjing.liu@amd.com>
      Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
      Cc: Thelford Williams <tdwilliamsiv@gmail.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Yongzhi Liu <lyz_cs@pku.edu.cn>
      Cc: Mikita Lipski <mikita.lipski@amd.com>
      Cc: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
      Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: amd-gfx@lists.freedesktop.org
      Cc: dri-devel@lists.freedesktop.org
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58acd2eb
    • Greg Kroah-Hartman's avatar
      sched/debug: fix dentry leak in update_sched_domain_debugfs · 26e9a1de
      Greg Kroah-Hartman authored
      commit c2e40659
      
       upstream.
      
      Kuyo reports that the pattern of using debugfs_remove(debugfs_lookup())
      leaks a dentry and with a hotplug stress test, the machine eventually
      runs out of memory.
      
      Fix this up by using the newly created debugfs_lookup_and_remove() call
      instead which properly handles the dentry reference counting logic.
      
      Cc: Major Chen <major.chen@samsung.com>
      Cc: stable <stable@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Vincent Guittot <vincent.guittot@linaro.org>
      Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ben Segall <bsegall@google.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
      Cc: Valentin Schneider <vschneid@redhat.com>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Reported-by: default avatarKuyo Chang <kuyo.chang@mediatek.com>
      Tested-by: default avatarKuyo Chang <kuyo.chang@mediatek.com>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220902123107.109274-2-gregkh@linuxfoundation.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      26e9a1de
    • Greg Kroah-Hartman's avatar
      debugfs: add debugfs_lookup_and_remove() · 94c84128
      Greg Kroah-Hartman authored
      commit dec9b2f1
      
       upstream.
      
      There is a very common pattern of using
      debugfs_remove(debufs_lookup(..)) which results in a dentry leak of the
      dentry that was looked up.  Instead of having to open-code the correct
      pattern of calling dput() on the dentry, create
      debugfs_lookup_and_remove() to handle this pattern automatically and
      properly without any memory leaks.
      
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarKuyo Chang <kuyo.chang@mediatek.com>
      Tested-by: default avatarKuyo Chang <kuyo.chang@mediatek.com>
      Link: https://lore.kernel.org/r/YxIaQ8cSinDR881k@kroah.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94c84128
    • Christian A. Ehrhardt's avatar
      kprobes: Prohibit probes in gate area · 8875d606
      Christian A. Ehrhardt authored
      commit 1efda38d upstream.
      
      The system call gate area counts as kernel text but trying
      to install a kprobe in this area fails with an Oops later on.
      To fix this explicitly disallow the gate area for kprobes.
      
      Found by syzkaller with the following reproducer:
      perf_event_open$cgroup(&(0x7f00000001c0)={0x6, 0x80, 0x0, 0x0, 0x0, 0x0, 0x80ffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @perf_config_ext={0x0, 0xffffffffff600000}}, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0x0)
      
      Sample report:
      BUG: unable to handle page fault for address: fffffbfff3ac6000
      PGD 6dfcb067 P4D 6dfcb067 PUD 6df8f067 PMD 6de4d067 PTE 0
      Oops: 0000 [#1] PREEMPT SMP KASAN NOPTI
      CPU: 0 PID: 21978 Comm: syz-executor.2 Not tainted 6.0.0-rc3-00363-g7726d4c3e60b-dirty #6
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      RIP: 0010:__insn_get_emulate_prefix arch/x86/lib/insn.c:91 [inline]
      RIP: 0010:insn_get_emulate_prefix arch/x86/lib/insn.c:106 [inline]
      RIP: 0010:insn_get_prefixes.part.0+0xa8/0x1110 arch/x86/lib/insn.c:134
      Code: 49 be 00 00 00 00 00 fc ff df 48 8b 40 60 48 89 44 24 08 e9 81 00 00 00 e8 e5 4b 39 ff 4c 89 fa 4c 89 f9 48 c1 ea 03 83 e1 07 <42> 0f b6 14 32 38 ca 7f 08 84 d2 0f 85 06 10 00 00 48 89 d8 48 89
      RSP: 0018:ffffc900088bf860 EFLAGS: 00010246
      RAX: 0000000000040000 RBX: ffffffff9b9bebc0 RCX: 0000000000000000
      RDX: 1ffffffff3ac6000 RSI: ffffc90002d82000 RDI: ffffc900088bf9e8
      RBP: ffffffff9d630001 R08: 0000000000000000 R09: ffffc900088bf9e8
      R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
      R13: ffffffff9d630000 R14: dffffc0000000000 R15: ffffffff9d630000
      FS:  00007f63eef63640(0000) GS:ffff88806d000000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: fffffbfff3ac6000 CR3: 0000000029d90005 CR4: 0000000000770ef0
      PKRU: 55555554
      Call Trace:
       <TASK>
       insn_get_prefixes arch/x86/lib/insn.c:131 [inline]
       insn_get_opcode arch/x86/lib/insn.c:272 [inline]
       insn_get_modrm+0x64a/0x7b0 arch/x86/lib/insn.c:343
       insn_get_sib+0x29a/0x330 arch/x86/lib/insn.c:421
       insn_get_displacement+0x350/0x6b0 arch/x86/lib/insn.c:464
       insn_get_immediate arch/x86/lib/insn.c:632 [inline]
       insn_get_length arch/x86/lib/insn.c:707 [inline]
       insn_decode+0x43a/0x490 arch/x86/lib/insn.c:747
       can_probe+0xfc/0x1d0 arch/x86/kernel/kprobes/core.c:282
       arch_prepare_kprobe+0x79/0x1c0 arch/x86/kernel/kprobes/core.c:739
       prepare_kprobe kernel/kprobes.c:1160 [inline]
       register_kprobe kernel/kprobes.c:1641 [inline]
       register_kprobe+0xb6e/0x1690 kernel/kprobes.c:1603
       __register_trace_kprobe kernel/trace/trace_kprobe.c:509 [inline]
       __register_trace_kprobe+0x26a/0x2d0 kernel/trace/trace_kprobe.c:477
       create_local_trace_kprobe+0x1f7/0x350 kernel/trace/trace_kprobe.c:1833
       perf_kprobe_init+0x18c/0x280 kernel/trace/trace_event_perf.c:271
       perf_kprobe_event_init+0xf8/0x1c0 kernel/events/core.c:9888
       perf_try_init_event+0x12d/0x570 kernel/events/core.c:11261
       perf_init_event kernel/events/core.c:11325 [inline]
       perf_event_alloc.part.0+0xf7f/0x36a0 kernel/events/core.c:11619
       perf_event_alloc kernel/events/core.c:12059 [inline]
       __do_sys_perf_event_open+0x4a8/0x2a00 kernel/events/core.c:12157
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f63ef7efaed
      Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f63eef63028 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
      RAX: ffffffffffffffda RBX: 00007f63ef90ff80 RCX: 00007f63ef7efaed
      RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 00000000200001c0
      RBP: 00007f63ef86019c R08: 0000000000000000 R09: 0000000000000000
      R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000
      R13: 0000000000000002 R14: 00007f63ef90ff80 R15: 00007f63eef43000
       </TASK>
      Modules linked in:
      CR2: fffffbfff3ac6000
      ---[ end trace 0000000000000000 ]---
      RIP: 0010:__insn_get_emulate_prefix arch/x86/lib/insn.c:91 [inline]
      RIP: 0010:insn_get_emulate_prefix arch/x86/lib/insn.c:106 [inline]
      RIP: 0010:insn_get_prefixes.part.0+0xa8/0x1110 arch/x86/lib/insn.c:134
      Code: 49 be 00 00 00 00 00 fc ff df 48 8b 40 60 48 89 44 24 08 e9 81 00 00 00 e8 e5 4b 39 ff 4c 89 fa 4c 89 f9 48 c1 ea 03 83 e1 07 <42> 0f b6 14 32 38 ca 7f 08 84 d2 0f 85 06 10 00 00 48 89 d8 48 89
      RSP: 0018:ffffc900088bf860 EFLAGS: 00010246
      RAX: 0000000000040000 RBX: ffffffff9b9bebc0 RCX: 0000000000000000
      RDX: 1ffffffff3ac6000 RSI: ffffc90002d82000 RDI: ffffc900088bf9e8
      RBP: ffffffff9d630001 R08: 0000000000000000 R09: ffffc900088bf9e8
      R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000001
      R13: ffffffff9d630000 R14: dffffc0000000000 R15: ffffffff9d630000
      FS:  00007f63eef63640(0000) GS:ffff88806d000000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: fffffbfff3ac6000 CR3: 0000000029d90005 CR4: 0000000000770ef0
      PKRU: 55555554
      ==================================================================
      
      Link: https://lkml.kernel.org/r/20220907200917.654103-1-lk@c--e.de
      
      cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
      cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      cc: "David S. Miller" <davem@davemloft.net>
      Cc: stable@vger.kernel.org
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarChristian A. Ehrhardt <lk@c--e.de>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8875d606
    • Alex Williamson's avatar
      vfio/type1: Unpin zero pages · 5321908e
      Alex Williamson authored
      commit 873aefb3
      
       upstream.
      
      There's currently a reference count leak on the zero page.  We increment
      the reference via pin_user_pages_remote(), but the page is later handled
      as an invalid/reserved page, therefore it's not accounted against the
      user and not unpinned by our put_pfn().
      
      Introducing special zero page handling in put_pfn() would resolve the
      leak, but without accounting of the zero page, a single user could
      still create enough mappings to generate a reference count overflow.
      
      The zero page is always resident, so for our purposes there's no reason
      to keep it pinned.  Therefore, add a loop to walk pages returned from
      pin_user_pages_remote() and unpin any zero pages.
      
      Cc: stable@vger.kernel.org
      Reported-by: default avatarLuboslav Pivarc <lpivarc@redhat.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Link: https://lore.kernel.org/r/166182871735.3518559.8884121293045337358.stgit@omen
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5321908e
    • Shin'ichiro Kawasaki's avatar
      btrfs: zoned: set pseudo max append zone limit in zone emulation mode · 7da1afa4
      Shin'ichiro Kawasaki authored
      commit cac5c44c upstream.
      
      The commit 7d7672bc ("btrfs: convert count_max_extents() to use
      fs_info->max_extent_size") introduced a division by
      fs_info->max_extent_size. This max_extent_size is initialized with max
      zone append limit size of the device btrfs runs on. However, in zone
      emulation mode, the device is not zoned then its zone append limit is
      zero. This resulted in zero value of fs_info->max_extent_size and caused
      zero division error.
      
      Fix the error by setting non-zero pseudo value to max append zone limit
      in zone emulation mode. Set the pseudo value based on max_segments as
      suggested in the commit c2ae7b77 ("btrfs: zoned: revive
      max_zone_append_bytes").
      
      Fixes: 7d7672bc
      
       ("btrfs: convert count_max_extents() to use fs_info->max_extent_size")
      CC: stable@vger.kernel.org # 5.12+
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
      Signed-off-by: default avatarShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7da1afa4
    • Masami Hiramatsu (Google)'s avatar
      tracing: Fix to check event_mutex is held while accessing trigger list · 75082ade
      Masami Hiramatsu (Google) authored
      commit cecf8e12 upstream.
      
      Since the check_user_trigger() is called outside of RCU
      read lock, this list_for_each_entry_rcu() caused a suspicious
      RCU usage warning.
      
       # echo hist:keys=pid > events/sched/sched_stat_runtime/trigger
       # cat events/sched/sched_stat_runtime/trigger
      [   43.167032]
      [   43.167418] =============================
      [   43.167992] WARNING: suspicious RCU usage
      [   43.168567] 5.19.0-rc5-00029-g19ebe4651abf #59 Not tainted
      [   43.169283] -----------------------------
      [   43.169863] kernel/trace/trace_events_trigger.c:145 RCU-list traversed in non-reader section!!
      ...
      
      However, this file->triggers list is safe when it is accessed
      under event_mutex is held.
      To fix this warning, adds a lockdep_is_held check to the
      list_for_each_entry_rcu().
      
      Link: https://lkml.kernel.org/r/166226474977.223837.1992182913048377113.stgit@devnote2
      
      Cc: stable@vger.kernel.org
      Fixes: 7491e2c4
      
       ("tracing: Add a probe that attaches to trace events")
      Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75082ade