Skip to content
  1. Mar 17, 2023
    • Shigeru Yoshida's avatar
      net: caif: Fix use-after-free in cfusbl_device_notify() · 287027d8
      Shigeru Yoshida authored
      [ Upstream commit 9781e98a ]
      
      syzbot reported use-after-free in cfusbl_device_notify() [1].  This
      causes a stack trace like below:
      
      BUG: KASAN: use-after-free in cfusbl_device_notify+0x7c9/0x870 net/caif/caif_usb.c:138
      Read of size 8 at addr ffff88807ac4e6f0 by task kworker/u4:6/1214
      
      CPU: 0 PID: 1214 Comm: kworker/u4:6 Not tainted 5.19.0-rc3-syzkaller-00146-g92f20ff72066 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: netns cleanup_net
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313
       print_report mm/kasan/report.c:429 [inline]
       kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
       cfusbl_device_notify+0x7c9/0x870 net/caif/caif_usb.c:138
       notifier_call_chain+0xb5/0x200 kernel/notifier.c:87
       call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945
       call_netdevice_notifiers_extack net/core/dev.c:1983 [inline]
       call_netdevice_notifiers net/core/dev.c:1997 [inline]
       netdev_wait_allrefs_any net/core/dev.c:10227 [inline]
       netdev_run_todo+0xbc0/0x10f0 net/core/dev.c:10341
       default_device_exit_batch+0x44e/0x590 net/core/dev.c:11334
       ops_exit_list+0x125/0x170 net/core/net_namespace.c:167
       cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594
       process_one_work+0x996/0x1610 kernel/workqueue.c:2289
       worker_thread+0x665/0x1080 kernel/workqueue.c:2436
       kthread+0x2e9/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302
       </TASK>
      
      When unregistering a net device, unregister_netdevice_many_notify()
      sets the device's reg_state to NETREG_UNREGISTERING, calls notifiers
      with NETDEV_UNREGISTER, and adds the device to the todo list.
      
      Later on, devices in the todo list are processed by netdev_run_todo().
      netdev_run_todo() waits devices' reference count become 1 while
      rebdoadcasting NETDEV_UNREGISTER notification.
      
      When cfusbl_device_notify() is called with NETDEV_UNREGISTER multiple
      times, the parent device might be freed.  This could cause UAF.
      Processing NETDEV_UNREGISTER multiple times also causes inbalance of
      reference count for the module.
      
      This patch fixes the issue by accepting only first NETDEV_UNREGISTER
      notification.
      
      Fixes: 7ad65bf6
      
       ("caif: Add support for CAIF over CDC NCM USB interface")
      CC: sjur.brandeland@stericsson.com <sjur.brandeland@stericsson.com>
      Reported-by: default avatar <syzbot+b563d33852b893653a9e@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?id=c3bfd8e2450adab3bffe4d80821fbbced600407f [1]
      Signed-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
      Link: https://lore.kernel.org/r/20230301163913.391304-1-syoshida@redhat.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      287027d8
    • Yuiko Oshino's avatar
      net: lan78xx: fix accessing the LAN7800's internal phy specific registers from the MAC driver · 34f099b3
      Yuiko Oshino authored
      [ Upstream commit e57cf363 ]
      
      Move the LAN7800 internal phy (phy ID  0x0007c132) specific register
      accesses to the phy driver (microchip.c).
      
      Fix the error reported by Enguerrand de Ribaucourt in December 2022,
      "Some operations during the cable switch workaround modify the register
      LAN88XX_INT_MASK of the PHY. However, this register is specific to the
      LAN8835 PHY. For instance, if a DP8322I PHY is connected to the LAN7801,
      that register (0x19), corresponds to the LED and MAC address
      configuration, resulting in unapropriate behavior."
      
      I did not test with the DP8322I PHY, but I tested with an EVB-LAN7800
      with the internal PHY.
      
      Fixes: 14437e3f
      
       ("lan78xx: workaround of forced 100 Full/Half duplex mode error")
      Signed-off-by: default avatarYuiko Oshino <yuiko.oshino@microchip.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20230301154307.30438-1-yuiko.oshino@microchip.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34f099b3
    • Changbin Du's avatar
      perf stat: Fix counting when initial delay configured · 0b30a06b
      Changbin Du authored
      [ Upstream commit 25f69c69 ]
      
      When creating counters with initial delay configured, the enable_on_exec
      field is not set. So we need to enable the counters later. The problem
      is, when a workload is specified the target__none() is true. So we also
      need to check stat_config.initial_delay.
      
      In this change, we add a new field 'initial_delay' for struct target
      which could be shared by other subcommands. And define
      target__enable_on_exec() which returns whether enable_on_exec should be
      set on normal cases.
      
      Before this fix the event is not counted:
      
        $ ./perf stat -e instructions -D 100 sleep 2
        Events disabled
        Events enabled
      
         Performance counter stats for 'sleep 2':
      
             <not counted>      instructions
      
               1.901661124 seconds time elapsed
      
               0.001602000 seconds user
               0.000000000 seconds sys
      
      After fix it works:
      
        $ ./perf stat -e instructions -D 100 sleep 2
        Events disabled
        Events enabled
      
         Performance counter stats for 'sleep 2':
      
                   404,214      instructions
      
               1.901743475 seconds time elapsed
      
               0.001617000 seconds user
               0.000000000 seconds sys
      
      Fixes: c587e77e
      
       ("perf stat: Do not delay the workload with --delay")
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hui Wang <hw.huiwang@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230302031146.2801588-2-changbin.du@huawei.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0b30a06b
    • Brian Vazquez's avatar
      net: use indirect calls helpers for sk_exit_memory_pressure() · e8d7615d
      Brian Vazquez authored
      [ Upstream commit 5c1ebbfa ]
      
      Florian reported a regression and sent a patch with the following
      changelog:
      
      <quote>
       There is a noticeable tcp performance regression (loopback or cross-netns),
       seen with iperf3 -Z (sendfile mode) when generic retpolines are needed.
      
       With SK_RECLAIM_THRESHOLD checks gone number of calls to enter/leave
       memory pressure happen much more often. For TCP indirect calls are
       used.
      
       We can't remove the if-set-return short-circuit check in
       tcp_enter_memory_pressure because there are callers other than
       sk_enter_memory_pressure.  Doing a check in the sk wrapper too
       reduces the indirect calls enough to recover some performance.
      
       Before,
       0.00-60.00  sec   322 GBytes  46.1 Gbits/sec                  receiver
      
       After:
       0.00-60.04  sec   359 GBytes  51.4 Gbits/sec                  receiver
      
       "iperf3 -c $peer -t 60 -Z -f g", connected via veth in another netns.
      </quote>
      
      It seems we forgot to upstream this indirect call mitigation we
      had for years, lets do this instead.
      
      [edumazet] - It seems we forgot to upstream this indirect call
                   mitigation we had for years, let's do this instead.
                 - Changed to INDIRECT_CALL_INET_1() to avoid bots reports.
      
      Fixes: 4890b686
      
       ("net: keep sk->sk_forward_alloc as small as possible")
      Reported-by: default avatarFlorian Westphal <fw@strlen.de>
      Link: https://lore.kernel.org/netdev/20230227152741.4a53634b@kernel.org/T/
      Signed-off-by: default avatarBrian Vazquez <brianvv@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20230301133247.2346111-1-edumazet@google.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e8d7615d
    • Hangyu Hua's avatar
      net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_setsockopt_conf() · 14c17c67
      Hangyu Hua authored
      [ Upstream commit 49c47cc2 ]
      
      ctx->crypto_send.info is not protected by lock_sock in
      do_tls_getsockopt_conf(). A race condition between do_tls_getsockopt_conf()
      and error paths of do_tls_setsockopt_conf() may lead to a use-after-free
      or null-deref.
      
      More discussion:  https://lore.kernel.org/all/Y/ht6gQL+u6fj3dG@hog/
      
      Fixes: 3c4d7559
      
       ("tls: kernel TLS support")
      Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
      Link: https://lore.kernel.org/r/20230228023344.9623-1-hbh25y@gmail.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      14c17c67
    • Pablo Neira Ayuso's avatar
      netfilter: nft_quota: copy content when cloning expression · 34869f8e
      Pablo Neira Ayuso authored
      [ Upstream commit aabef97a ]
      
      If the ruleset contains consumed quota, restore them accordingly.
      Otherwise, listing after restoration shows never used items.
      
      Restore the user-defined quota and flags too.
      
      Fixes: ed0a0c60
      
       ("netfilter: nft_quota: move stateful fields out of expression data")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34869f8e
    • Pablo Neira Ayuso's avatar
      netfilter: nft_last: copy content when cloning expression · 227a7266
      Pablo Neira Ayuso authored
      [ Upstream commit 860e8742 ]
      
      If the ruleset contains last timestamps, restore them accordingly.
      Otherwise, listing after restoration shows never used items.
      
      Fixes: 33a24de3
      
       ("netfilter: nft_last: move stateful fields out of expression data")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      227a7266
    • Hangbin Liu's avatar
      selftests: nft_nat: ensuring the listening side is up before starting the client · 5d241eb8
      Hangbin Liu authored
      [ Upstream commit 2067e7a0 ]
      
      The test_local_dnat_portonly() function initiates the client-side as
      soon as it sets the listening side to the background. This could lead to
      a race condition where the server may not be ready to listen. To ensure
      that the server-side is up and running before initiating the
      client-side, a delay is introduced to the test_local_dnat_portonly()
      function.
      
      Before the fix:
        # ./nft_nat.sh
        PASS: netns routing/connectivity: ns0-rthlYrBU can reach ns1-rthlYrBU and ns2-rthlYrBU
        PASS: ping to ns1-rthlYrBU was ip NATted to ns2-rthlYrBU
        PASS: ping to ns1-rthlYrBU OK after ip nat output chain flush
        PASS: ipv6 ping to ns1-rthlYrBU was ip6 NATted to ns2-rthlYrBU
        2023/02/27 04:11:03 socat[6055] E connect(5, AF=2 10.0.1.99:2000, 16): Connection refused
        ERROR: inet port rewrite
      
      After the fix:
        # ./nft_nat.sh
        PASS: netns routing/connectivity: ns0-9sPJV6JJ can reach ns1-9sPJV6JJ and ns2-9sPJV6JJ
        PASS: ping to ns1-9sPJV6JJ was ip NATted to ns2-9sPJV6JJ
        PASS: ping to ns1-9sPJV6JJ OK after ip nat output chain flush
        PASS: ipv6 ping to ns1-9sPJV6JJ was ip6 NATted to ns2-9sPJV6JJ
        PASS: inet port rewrite without l3 address
      
      Fixes: 282e5f8f
      
       ("netfilter: nat: really support inet nat without l3 address")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d241eb8
    • Horatiu Vultur's avatar
      net: lan966x: Fix port police support using tc-matchall · 6fac7714
      Horatiu Vultur authored
      [ Upstream commit 81563d85 ]
      
      When the police was removed from the port, then it was trying to
      remove the police from the police id and not from the actual
      police index.
      The police id represents the id of the police and police index
      represents the position in HW where the police is situated.
      The port police id can be any number while the port police index
      is a number based on the port chip port.
      Fix this by deleting the police from HW that is situated at the
      police index and not police id.
      
      Fixes: 5390334b
      
       ("net: lan966x: Add port police support using tc-matchall")
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6fac7714
    • Eric Dumazet's avatar
      ila: do not generate empty messages in ila_xlat_nl_cmd_get_mapping() · 25b54f24
      Eric Dumazet authored
      [ Upstream commit 693aa2c0 ]
      
      ila_xlat_nl_cmd_get_mapping() generates an empty skb,
      triggerring a recent sanity check [1].
      
      Instead, return an error code, so that user space
      can get it.
      
      [1]
      skb_assert_len
      WARNING: CPU: 0 PID: 5923 at include/linux/skbuff.h:2527 skb_assert_len include/linux/skbuff.h:2527 [inline]
      WARNING: CPU: 0 PID: 5923 at include/linux/skbuff.h:2527 __dev_queue_xmit+0x1bc0/0x3488 net/core/dev.c:4156
      Modules linked in:
      CPU: 0 PID: 5923 Comm: syz-executor269 Not tainted 6.2.0-syzkaller-18300-g2ebd1fbb946d #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
      pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : skb_assert_len include/linux/skbuff.h:2527 [inline]
      pc : __dev_queue_xmit+0x1bc0/0x3488 net/core/dev.c:4156
      lr : skb_assert_len include/linux/skbuff.h:2527 [inline]
      lr : __dev_queue_xmit+0x1bc0/0x3488 net/core/dev.c:4156
      sp : ffff80001e0d6c40
      x29: ffff80001e0d6e60 x28: dfff800000000000 x27: ffff0000c86328c0
      x26: dfff800000000000 x25: ffff0000c8632990 x24: ffff0000c8632a00
      x23: 0000000000000000 x22: 1fffe000190c6542 x21: ffff0000c8632a10
      x20: ffff0000c8632a00 x19: ffff80001856e000 x18: ffff80001e0d5fc0
      x17: 0000000000000000 x16: ffff80001235d16c x15: 0000000000000000
      x14: 0000000000000000 x13: 0000000000000001 x12: 0000000000000001
      x11: ff80800008353a30 x10: 0000000000000000 x9 : 21567eaf25bfb600
      x8 : 21567eaf25bfb600 x7 : 0000000000000001 x6 : 0000000000000001
      x5 : ffff80001e0d6558 x4 : ffff800015c74760 x3 : ffff800008596744
      x2 : 0000000000000001 x1 : 0000000100000000 x0 : 000000000000000e
      Call trace:
      skb_assert_len include/linux/skbuff.h:2527 [inline]
      __dev_queue_xmit+0x1bc0/0x3488 net/core/dev.c:4156
      dev_queue_xmit include/linux/netdevice.h:3033 [inline]
      __netlink_deliver_tap_skb net/netlink/af_netlink.c:307 [inline]
      __netlink_deliver_tap+0x45c/0x6f8 net/netlink/af_netlink.c:325
      netlink_deliver_tap+0xf4/0x174 net/netlink/af_netlink.c:338
      __netlink_sendskb net/netlink/af_netlink.c:1283 [inline]
      netlink_sendskb+0x6c/0x154 net/netlink/af_netlink.c:1292
      netlink_unicast+0x334/0x8d4 net/netlink/af_netlink.c:1380
      nlmsg_unicast include/net/netlink.h:1099 [inline]
      genlmsg_unicast include/net/genetlink.h:433 [inline]
      genlmsg_reply include/net/genetlink.h:443 [inline]
      ila_xlat_nl_cmd_get_mapping+0x620/0x7d0 net/ipv6/ila/ila_xlat.c:493
      genl_family_rcv_msg_doit net/netlink/genetlink.c:968 [inline]
      genl_family_rcv_msg net/netlink/genetlink.c:1048 [inline]
      genl_rcv_msg+0x938/0xc1c net/netlink/genetlink.c:1065
      netlink_rcv_skb+0x214/0x3c4 net/netlink/af_netlink.c:2574
      genl_rcv+0x38/0x50 net/netlink/genetlink.c:1076
      netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
      netlink_unicast+0x660/0x8d4 net/netlink/af_netlink.c:1365
      netlink_sendmsg+0x800/0xae0 net/netlink/af_netlink.c:1942
      sock_sendmsg_nosec net/socket.c:714 [inline]
      sock_sendmsg net/socket.c:734 [inline]
      ____sys_sendmsg+0x558/0x844 net/socket.c:2479
      ___sys_sendmsg net/socket.c:2533 [inline]
      __sys_sendmsg+0x26c/0x33c net/socket.c:2562
      __do_sys_sendmsg net/socket.c:2571 [inline]
      __se_sys_sendmsg net/socket.c:2569 [inline]
      __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2569
      __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
      invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
      el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
      do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193
      el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
      el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
      el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
      irq event stamp: 136484
      hardirqs last enabled at (136483): [<ffff800008350244>] __up_console_sem+0x60/0xb4 kernel/printk/printk.c:345
      hardirqs last disabled at (136484): [<ffff800012358d60>] el1_dbg+0x24/0x80 arch/arm64/kernel/entry-common.c:405
      softirqs last enabled at (136418): [<ffff800008020ea8>] softirq_handle_end kernel/softirq.c:414 [inline]
      softirqs last enabled at (136418): [<ffff800008020ea8>] __do_softirq+0xd4c/0xfa4 kernel/softirq.c:600
      softirqs last disabled at (136371): [<ffff80000802b4a4>] ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
      ---[ end trace 0000000000000000 ]---
      skb len=0 headroom=0 headlen=0 tailroom=192
      mac=(0,0) net=(0,-1) trans=-1
      shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0))
      csum(0x0 ip_summed=0 complete_sw=0 valid=0 level=0)
      hash(0x0 sw=0 l4=0) proto=0x0010 pkttype=6 iif=0
      dev name=nlmon0 feat=0x0000000000005861
      
      Fixes: 7f00feaf
      
       ("ila: Add generic ILA translation facility")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      25b54f24
    • Dmitry Baryshkov's avatar
      drm/msm/dpu: disable features unsupported by QCM2290 · 78891a3c
      Dmitry Baryshkov authored
      [ Upstream commit a2a448b4 ]
      
      QCM2290 doesn't seem to support reg-dma, UBWC and CSC. Drop
      corresponding features being incorrectly enabled for qcm2290.
      
      Cc: Loic Poulain <loic.poulain@linaro.org>
      Fixes: 5334087e
      
       ("drm/msm: add support for QCM2290 MDSS")
      Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/522209/
      Link: https://lore.kernel.org/r/20230211231259.1308718-3-dmitry.baryshkov@linaro.org
      Signed-off-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      78891a3c
    • Jakub Kicinski's avatar
      tls: rx: fix return value for async crypto · a3a087ed
      Jakub Kicinski authored
      [ Upstream commit 4d42cd6b
      
       ]
      
      Gaurav reports that TLS Rx is broken with async crypto
      accelerators. The commit under fixes missed updating
      the retval byte counting logic when updating how records
      are stored. Even tho both before and after the change
      'decrypted' was updated inside the main loop, it was
      completely overwritten when processing the async
      completions. Now that the rx_list only holds
      non-zero-copy records we need to add, not overwrite.
      
      Reported-and-bisected-by: default avatarGaurav Jain <gaurav.jain@nxp.com>
      Fixes: cbbdee99
      
       ("tls: rx: async: don't put async zc on the list")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=217064
      Tested-by: default avatarGaurav Jain <gaurav.jain@nxp.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230227181201.1793772-1-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a3a087ed
    • Vladimir Oltean's avatar
      powerpc: dts: t1040rdb: fix compatible string for Rev A boards · a7e0439c
      Vladimir Oltean authored
      [ Upstream commit ae44f1c9 ]
      
      It looks like U-Boot fails to start the kernel properly when the
      compatible string of the board isn't fsl,T1040RDB, so stop overriding it
      from the rev-a.dts.
      
      Fixes: 5ebb7474
      
       ("powerpc: dts: t1040rdb: fix ports names for Seville Ethernet switch")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a7e0439c
    • Kang Chen's avatar
      nfc: fdp: add null check of devm_kmalloc_array in fdp_nci_i2c_read_device_properties · ce93f1af
      Kang Chen authored
      [ Upstream commit 11f180a5 ]
      
      devm_kmalloc_array may fails, *fw_vsc_cfg might be null and cause
      out-of-bounds write in device_property_read_u8_array later.
      
      Fixes: a06347c0
      
       ("NFC: Add Intel Fields Peak NFC solution driver")
      Signed-off-by: default avatarKang Chen <void0red@gmail.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230227093037.907654-1-void0red@gmail.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ce93f1af
    • Rafał Miłecki's avatar
      bgmac: fix *initial* chip reset to support BCM5358 · 3ee0c9fb
      Rafał Miłecki authored
      [ Upstream commit f99e6d7c ]
      
      While bringing hardware up we should perform a full reset including the
      switch bit (BGMAC_BCMA_IOCTL_SW_RESET aka SICF_SWRST). It's what
      specification says and what reference driver does.
      
      This seems to be critical for the BCM5358. Without this hardware doesn't
      get initialized properly and doesn't seem to transmit or receive any
      packets.
      
      Originally bgmac was calling bgmac_chip_reset() before setting
      "has_robosw" property which resulted in expected behaviour. That has
      changed as a side effect of adding platform device support which
      regressed BCM5358 support.
      
      Fixes: f6a95a24
      
       ("net: ethernet: bgmac: Add platform device support")
      Cc: Jon Mason <jdmason@kudzu.us>
      Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
      Reviewed-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20230227091156.19509-1-zajec5@gmail.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3ee0c9fb
    • Dmitry Baryshkov's avatar
      drm/msm/a5xx: fix context faults during ring switch · 56d67b97
      Dmitry Baryshkov authored
      [ Upstream commit 32e70834 ]
      
      The rptr_addr is set in the preempt_init_ring(), which is called from
      a5xx_gpu_init(). It uses shadowptr() to set the address, however the
      shadow_iova is not yet initialized at that time. Move the rptr_addr
      setting to the a5xx_preempt_hw_init() which is called after setting the
      shadow_iova, getting the correct value for the address.
      
      Fixes: 8907afb4
      
       ("drm/msm: Allow a5xx to mark the RPTR shadow as privileged")
      Suggested-by: default avatarRob Clark <robdclark@gmail.com>
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/522640/
      Link: https://lore.kernel.org/r/20230214020956.164473-5-dmitry.baryshkov@linaro.org
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      56d67b97
    • Dmitry Baryshkov's avatar
      drm/msm/a5xx: fix the emptyness check in the preempt code · ac3af300
      Dmitry Baryshkov authored
      [ Upstream commit b4fb748f
      
       ]
      
      Quoting Yassine: ring->memptrs->rptr is never updated and stays 0, so
      the comparison always evaluates to false and get_next_ring always
      returns ring 0 thinking it isn't empty.
      
      Fix this by calling get_rptr() instead of reading rptr directly.
      
      Reported-by: default avatarYassine Oudjana <y.oudjana@protonmail.com>
      Fixes: b1fc2839
      
       ("drm/msm: Implement preemption for A5XX targets")
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/522642/
      Link: https://lore.kernel.org/r/20230214020956.164473-4-dmitry.baryshkov@linaro.org
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ac3af300
    • Dmitry Baryshkov's avatar
      drm/msm/a5xx: fix highest bank bit for a530 · 84053e7d
      Dmitry Baryshkov authored
      [ Upstream commit 141f66eb ]
      
      A530 has highest bank bit equal to 15 (like A540). Fix values written to
      REG_A5XX_RB_MODE_CNTL and REG_A5XX_TPL1_MODE_CNTL registers.
      
      Fixes: 1d832ab3
      
       ("drm/msm/a5xx: Add support for Adreno 508, 509, 512 GPUs")
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/522639/
      Link: https://lore.kernel.org/r/20230214020956.164473-3-dmitry.baryshkov@linaro.org
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      84053e7d
    • Dmitry Baryshkov's avatar
      drm/msm/a5xx: fix setting of the CP_PREEMPT_ENABLE_LOCAL register · d334248d
      Dmitry Baryshkov authored
      [ Upstream commit a7a4c19c ]
      
      Rather than writing CP_PREEMPT_ENABLE_GLOBAL twice, follow the vendor
      kernel and set CP_PREEMPT_ENABLE_LOCAL register instead. a5xx_submit()
      will override it during submission, but let's get the sequence correct.
      
      Fixes: b1fc2839
      
       ("drm/msm: Implement preemption for A5XX targets")
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/522638/
      Link: https://lore.kernel.org/r/20230214020956.164473-2-dmitry.baryshkov@linaro.org
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d334248d
    • Rob Clark's avatar
      drm/msm: Fix potential invalid ptr free · fa73f67a
      Rob Clark authored
      [ Upstream commit 8a86f213 ]
      
      The error path cleanup expects that chain and syncobj are either NULL or
      valid pointers.  But post_deps was not allocated with __GFP_ZERO.
      
      Fixes: ab723b7a
      
       ("drm/msm: Add syncobj support.")
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reviewed-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
      Patchwork: https://patchwork.freedesktop.org/patch/523051/
      Link: https://lore.kernel.org/r/20230215235048.1166484-1-robdclark@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fa73f67a
    • Jiri Slaby (SUSE)'s avatar
      drm/nouveau/kms/nv50: fix nv50_wndw_new_ prototype · 5dca6961
      Jiri Slaby (SUSE) authored
      [ Upstream commit 3638a820 ]
      
      gcc-13 warns about mismatching types for enums. That revealed switched
      arguments of nv50_wndw_new_():
        drivers/gpu/drm/nouveau/dispnv50/wndw.c:696:1: error: conflicting types for 'nv50_wndw_new_' due to enum/integer mismatch; have 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, u32,  enum nv50_disp_interlock_type,  u32,  struct nv50_wndw **)'
        drivers/gpu/drm/nouveau/dispnv50/wndw.h:36:5: note: previous declaration of 'nv50_wndw_new_' with type 'int(const struct nv50_wndw_func *, struct drm_device *, enum drm_plane_type,  const char *, int,  const u32 *, enum nv50_disp_interlock_type,  u32,  u32,  struct nv50_wndw **)'
      
      It can be barely visible, but the declaration says about the parameters
      in the middle:
        enum nv50_disp_interlock_type,
        u32 interlock_data,
        u32 heads,
      
      While the definition states differently:
        u32 heads,
        enum nv50_disp_interlock_type interlock_type,
        u32 interlock_data,
      
      Unify/fix the declaration to match the definition.
      
      Fixes: 53e0a3e7
      
       ("drm/nouveau/kms/nv50-: simplify tracking of channel interlocks")
      Cc: Martin Liska <mliska@suse.cz>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Karol Herbst <kherbst@redhat.com>
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: David Airlie <airlied@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: dri-devel@lists.freedesktop.org
      Cc: nouveau@lists.freedesktop.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarJiri Slaby (SUSE) <jirislaby@kernel.org>
      Signed-off-by: default avatarKarol Herbst <kherbst@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221031114229.10289-1-jirislaby@kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5dca6961
    • Paulo Alcantara's avatar
      cifs: improve checking of DFS links over STATUS_OBJECT_NAME_INVALID · 512aa2fd
      Paulo Alcantara authored
      [ Upstream commit b9ee2e30 ]
      
      Do not map STATUS_OBJECT_NAME_INVALID to -EREMOTE under non-DFS
      shares, or 'nodfs' mounts or CONFIG_CIFS_DFS_UPCALL=n builds.
      Otherwise, in the slow path, get a referral to figure out whether it
      is an actual DFS link.
      
      This could be simply reproduced under a non-DFS share by running the
      following
      
        $ mount.cifs //srv/share /mnt -o ...
        $ cat /mnt/$(printf '\U110000')
        cat: '/mnt/'$'\364\220\200\200': Object is remote
      
      Fixes: c877ce47
      
       ("cifs: reduce roundtrips on create/qinfo requests")
      CC: stable@vger.kernel.org # 6.2
      Signed-off-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
      Reviewed-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      512aa2fd
    • Jan Kara's avatar
      ext4: Fix possible corruption when moving a directory · b0bb1361
      Jan Kara authored
      [ Upstream commit 0813299c ]
      
      When we are renaming a directory to a different directory, we need to
      update '..' entry in the moved directory. However nothing prevents moved
      directory from being modified and even converted from the inline format
      to the normal format. When such race happens the rename code gets
      confused and we crash. Fix the problem by locking the moved directory.
      
      CC: stable@vger.kernel.org
      Fixes: 32f7f22c
      
       ("ext4: let ext4_rename handle inline dir")
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20230126112221.11866-1-jack@suse.cz
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b0bb1361
    • Bart Van Assche's avatar
      scsi: core: Remove the /proc/scsi/${proc_name} directory earlier · 17e98a5e
      Bart Van Assche authored
      [ Upstream commit fc663711 ]
      
      Remove the /proc/scsi/${proc_name} directory earlier to fix a race
      condition between unloading and reloading kernel modules. This fixes a bug
      introduced in 2009 by commit 77c01976 ("[SCSI] fix /proc memory leak in
      the SCSI core").
      
      Fix the following kernel warning:
      
      proc_dir_entry 'scsi/scsi_debug' already registered
      WARNING: CPU: 19 PID: 27986 at fs/proc/generic.c:376 proc_register+0x27d/0x2e0
      Call Trace:
       proc_mkdir+0xb5/0xe0
       scsi_proc_hostdir_add+0xb5/0x170
       scsi_host_alloc+0x683/0x6c0
       sdebug_driver_probe+0x6b/0x2d0 [scsi_debug]
       really_probe+0x159/0x540
       __driver_probe_device+0xdc/0x230
       driver_probe_device+0x4f/0x120
       __device_attach_driver+0xef/0x180
       bus_for_each_drv+0xe5/0x130
       __device_attach+0x127/0x290
       device_initial_probe+0x17/0x20
       bus_probe_device+0x110/0x130
       device_add+0x673/0xc80
       device_register+0x1e/0x30
       sdebug_add_host_helper+0x1a7/0x3b0 [scsi_debug]
       scsi_debug_init+0x64f/0x1000 [scsi_debug]
       do_one_initcall+0xd7/0x470
       do_init_module+0xe7/0x330
       load_module+0x122a/0x12c0
       __do_sys_finit_module+0x124/0x1a0
       __x64_sys_finit_module+0x46/0x50
       do_syscall_64+0x38/0x80
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Link: https://lore.kernel.org/r/20230210205200.36973-3-bvanassche@acm.org
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Yi Zhang <yi.zhang@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 77c01976
      
       ("[SCSI] fix /proc memory leak in the SCSI core")
      Reported-by: default avatarYi Zhang <yi.zhang@redhat.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      17e98a5e
    • Liao Chang's avatar
      riscv: Add header include guards to insn.h · 0d14555f
      Liao Chang authored
      [ Upstream commit 8ac6e619 ]
      
      Add header include guards to insn.h to prevent repeating declaration of
      any identifiers in insn.h.
      
      Fixes: edde5584
      
       ("riscv: Add SW single-step support for KDB")
      Signed-off-by: default avatarLiao Chang <liaochang1@huawei.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Fixes: c9c1af3f
      
       ("RISC-V: rename parse_asm.h to insn.h")
      Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://lore.kernel.org/r/20230129094242.282620-1-liaochang1@huawei.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0d14555f
    • Yu Kuai's avatar
      block: fix scan partition for exclusively open device again · 82f713e8
      Yu Kuai authored
      [ Upstream commit e5cfefa9 ]
      
      As explained in commit 36369f46 ("block: Do not reread partition table
      on exclusively open device"), reread partition on the device that is
      exclusively opened by someone else is problematic.
      
      This patch will make sure partition scan will only be proceed if current
      thread open the device exclusively, or the device is not opened
      exclusively, and in the later case, other scanners and exclusive openers
      will be blocked temporarily until partition scan is done.
      
      Fixes: 10c70d95
      
       ("block: remove the bd_openers checks in blk_drop_partitions")
      Cc: <stable@vger.kernel.org>
      Suggested-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/20230217022200.3092987-3-yukuai1@huaweicloud.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      82f713e8
    • Yu Kuai's avatar
      block: Revert "block: Do not reread partition table on exclusively open device" · 573e58f5
      Yu Kuai authored
      [ Upstream commit 0f77b29a ]
      
      This reverts commit 36369f46
      
      .
      
      This patch can't fix the problem in a corner case that device can be
      opened exclusively after the checking and before blkdev_get_by_dev().
      We'll use a new solution to fix the problem in the next patch, and
      the new solution doesn't need to change apis.
      
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Acked-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20230217022200.3092987-2-yukuai1@huaweicloud.com
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Stable-dep-of: e5cfefa9
      
       ("block: fix scan partition for exclusively open device again")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      573e58f5
    • Ville Syrjälä's avatar
      drm/i915: Populate encoder->devdata for DSI on icl+ · 783c225e
      Ville Syrjälä authored
      [ Upstream commit 14e591a1
      
       ]
      
      We now have some eDP+DSI dual panel systems floating around
      where the DSI panel is the secondary LFP and thus needs to
      consult "panel type 2" in VBT in order to locate all the
      other panel type dependant stuff correctly.
      
      To that end we need to pass in the devdata to
      intel_bios_init_panel_late(), otherwise it'll just assume
      we want the primary panel type. So let's try to just populate
      the vbt.ports[] stuff and encoder->devdata for icl+ DSI
      panels as well.
      
      We can't do this on older platforms as there we risk a DSI
      port aliasing with a HDMI/DP port, which is a totally legal
      thing as the DSI ports live in their own little parallel
      universe.
      
      Cc: stable@vger.kernel.org
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8016
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230207064337.18697-3-ville.syrjala@linux.intel.com
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      (cherry picked from commit ba00eb6a
      
      )
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      783c225e
    • Ville Syrjälä's avatar
      drm/i915: Do panel VBT init early if the VBT declares an explicit panel type · bd61a84b
      Ville Syrjälä authored
      [ Upstream commit 3f9ffce5
      
       ]
      
      Lots of ADL machines out there with bogus VBTs that declare
      two eDP child devices. In order for those to work we need to
      figure out which power sequencer to use before we try the EDID
      read. So let's do the panel VBT init early if we can, falling
      back to the post-EDID init otherwise.
      
      The post-EDID init panel_type=0xff approach of assuming the
      power sequencer should already be enabled doesn't really work
      with multiple eDP panels, and currently we just end up using
      the same power sequencer for both eDP ports, which at least
      confuses the wakeref tracking, and potentially also causes us
      to toggle the VDD for the panel when we should not.
      
      Cc: Animesh Manna <animesh.manna@intel.com>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221125173156.31689-3-ville.syrjala@linux.intel.com
      Stable-dep-of: 14e591a1
      
       ("drm/i915: Populate encoder->devdata for DSI on icl+")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bd61a84b
    • Ville Syrjälä's avatar
      drm/i915: Introduce intel_panel_init_alloc() · e340197a
      Ville Syrjälä authored
      [ Upstream commit f70f8153
      
       ]
      
      Introduce a place where we can initialize connector->panel
      after it's been allocated. We already have a intel_panel_init()
      so had to get creative with the name and came up with
      intel_panel_init_alloc().
      
      Cc: Animesh Manna <animesh.manna@intel.com>
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221125173156.31689-2-ville.syrjala@linux.intel.com
      Stable-dep-of: 14e591a1
      
       ("drm/i915: Populate encoder->devdata for DSI on icl+")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e340197a
    • Mika Westerberg's avatar
      spi: intel: Check number of chip selects after reading the descriptor · 87228e1c
      Mika Westerberg authored
      [ Upstream commit 574fbb95
      
       ]
      
      The flash decriptor contains the number of flash components that we use
      to figure out how many flash chips there are connected. Therefore we
      need to read it first before deciding how many chip selects the
      controller has.
      
      Reported-by: default avatarMarcin Witkowski <marcin.witkowski@intel.com>
      Fixes: 3f03c618
      
       ("spi: intel: Add support for second flash chip")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Link: https://lore.kernel.org/r/20230215110040.42186-1-mika.westerberg@linux.intel.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87228e1c
    • Corey Minyard's avatar
      ipmi:ssif: Add a timer between request retries · 9858e0fb
      Corey Minyard authored
      [ Upstream commit 00bb7e76
      
       ]
      
      The IPMI spec has a time (T6) specified between request retries.  Add
      the handling for that.
      
      Reported by: Tony Camuso <tcamuso@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9858e0fb
    • Corey Minyard's avatar
      ipmi:ssif: Increase the message retry time · 8a676b6e
      Corey Minyard authored
      [ Upstream commit 39721d62
      
       ]
      
      The spec states that the minimum message retry time is 60ms, but it was
      set to 20ms.  Correct it.
      
      Reported by: Tony Camuso <tcamuso@redhat.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Stable-dep-of: 00bb7e76
      
       ("ipmi:ssif: Add a timer between request retries")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8a676b6e
    • Corey Minyard's avatar
      ipmi:ssif: Remove rtc_us_timer · f12869ff
      Corey Minyard authored
      [ Upstream commit 9e8b8992
      
       ]
      
      It was cruft left over from older handling of run to completion.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f12869ff
    • Dmitry Torokhov's avatar
      Input: exc3000 - properly stop timer on shutdown · 526a177a
      Dmitry Torokhov authored
      [ Upstream commit 79c81d13 ]
      
      We need to stop the timer on driver unbind or probe failures, otherwise
      we get UAF/Oops.
      
      Fixes: 7e577a17
      
       ("Input: add I2C attached EETI EXC3000 multi touch driver")
      Reported-by: default avatar"Stahl, Michael" <mstahl@moba.de>
      Link: https://lore.kernel.org/r/Y9dK57BFqtlf8NmN@google.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      526a177a
    • Manivannan Sadhasivam's avatar
      bus: mhi: ep: Change state_lock to mutex · 86e9eb69
      Manivannan Sadhasivam authored
      [ Upstream commit 1ddc7618 ]
      
      state_lock, the spinlock type is meant to protect race against concurrent
      MHI state transitions. In mhi_ep_set_m0_state(), while the state_lock is
      being held, the channels are resumed in mhi_ep_resume_channels() if the
      previous state was M3. This causes sleeping in atomic bug, since
      mhi_ep_resume_channels() use mutex internally.
      
      Since the state_lock is supposed to be held throughout the state change,
      it is not ideal to drop the lock before calling mhi_ep_resume_channels().
      So to fix this issue, let's change the type of state_lock to mutex. This
      would also allow holding the lock throughout all state transitions thereby
      avoiding any potential race.
      
      Cc: <stable@vger.kernel.org> # 5.19
      Fixes: e4b7b5f0
      
       ("bus: mhi: ep: Add support for suspending and resuming channels")
      Reported-by: default avatarDan Carpenter <error27@gmail.com>
      Reviewed-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
      Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      86e9eb69
    • Manivannan Sadhasivam's avatar
      bus: mhi: ep: Power up/down MHI stack during MHI RESET · b6dc68ac
      Manivannan Sadhasivam authored
      [ Upstream commit 47a1dcae
      
       ]
      
      During graceful shutdown scenario, host will issue MHI RESET to the
      endpoint device before initiating shutdown. In that case, it makes sense
      to completely power down the MHI stack as sooner or later the access to
      MMIO registers will be prohibited. Also, the stack needs to be powered
      up in the case of SYS_ERR to recover the device.
      
      Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Reviewed-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
      Link: https://lore.kernel.org/r/20221228161704.255268-2-manivannan.sadhasivam@linaro.org
      Signed-off-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
      Stable-dep-of: 1ddc7618
      
       ("bus: mhi: ep: Change state_lock to mutex")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b6dc68ac
    • Jan Kara's avatar
      udf: Fix off-by-one error when discarding preallocation · 9ee18ff0
      Jan Kara authored
      [ Upstream commit f54aa97f ]
      
      The condition determining whether the preallocation can be used had
      an off-by-one error so we didn't discard preallocation when new
      allocation was just following it. This can then confuse code in
      inode_getblk().
      
      CC: stable@vger.kernel.org
      Fixes: 16d05565
      
       ("udf: Discard preallocation before extending file with a hole")
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9ee18ff0
    • Alexander Aring's avatar
      fs: dlm: fix race setting stop tx flag · a926daa8
      Alexander Aring authored
      [ Upstream commit 16427211 ]
      
      This patch sets the stop tx flag before we commit the dlm message.
      This flag will report about unexpected transmissions after we
      send the DLM_FIN message out, which should be the last message sent.
      When we commit the dlm fin message, it could be that we already
      got an ack back and the CLOSED state change already happened.
      We should not set this flag when we are in CLOSED state. To avoid this
      race we simply set the tx flag before the state change can be in
      progress by moving it before dlm_midcomms_commit_mhandle().
      
      Cc: stable@vger.kernel.org
      Fixes: 489d8e55
      
       ("fs: dlm: add reliable connection if reconnect")
      Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
      Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a926daa8
    • Alexander Aring's avatar
      fs: dlm: be sure to call dlm_send_queue_flush() · 3c1bc8de
      Alexander Aring authored
      [ Upstream commit 7354fa4e ]
      
      If we release a midcomms node structure, there should be nothing left
      inside the dlm midcomms send queue. However, sometimes this is not true
      because I believe some DLM_FIN message was not acked... if we run
      into a shutdown timeout, then we should be sure there is no pending send
      dlm message inside this queue when releasing midcomms node structure.
      
      Cc: stable@vger.kernel.org
      Fixes: 489d8e55
      
       ("fs: dlm: add reliable connection if reconnect")
      Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
      Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c1bc8de