Skip to content
  1. Jul 27, 2023
    • Daniel Golle's avatar
      net: ethernet: mtk_eth_soc: handle probe deferral · 5ed16eca
      Daniel Golle authored
      [ Upstream commit 1d6d537d ]
      
      Move the call to of_get_ethdev_address to mtk_add_mac which is part of
      the probe function and can hence itself return -EPROBE_DEFER should
      of_get_ethdev_address return -EPROBE_DEFER. This allows us to entirely
      get rid of the mtk_init function.
      
      The problem of of_get_ethdev_address returning -EPROBE_DEFER surfaced
      in situations in which the NVMEM provider holding the MAC address has
      not yet be loaded at the time mtk_eth_soc is initially probed. In this
      case probing of mtk_eth_soc should be deferred instead of falling back
      to use a random MAC address, so once the NVMEM provider becomes
      available probing can be repeated.
      
      Fixes: 656e7052
      
       ("net-next: mediatek: add support for MT7623 ethernet")
      Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5ed16eca
    • Jakub Kicinski's avatar
      ethernet: use of_get_ethdev_address() · 39479093
      Jakub Kicinski authored
      [ Upstream commit 9ca01b25
      
       ]
      
      Use the new of_get_ethdev_address() helper for the cases
      where dev->dev_addr is passed in directly as the destination.
      
        @@
        expression dev, np;
        @@
        - of_get_mac_address(np, dev->dev_addr)
        + of_get_ethdev_address(np, dev)
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1d6d537d
      
       ("net: ethernet: mtk_eth_soc: handle probe deferral")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      39479093
    • Jakub Kicinski's avatar
      of: net: add a helper for loading netdev->dev_addr · cb1e666e
      Jakub Kicinski authored
      [ Upstream commit d466effe ]
      
      Commit 406f42fa
      
       ("net-next: When a bond have a massive amount
      of VLANs...") introduced a rbtree for faster Ethernet address look
      up. To maintain netdev->dev_addr in this tree we need to make all
      the writes to it got through appropriate helpers.
      
      There are roughly 40 places where netdev->dev_addr is passed
      as the destination to a of_get_mac_address() call. Add a helper
      which takes a dev pointer instead, so it can call an appropriate
      helper.
      
      Note that of_get_mac_address() already assumes the address is
      6 bytes long (ETH_ALEN) so use eth_hw_addr_set().
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1d6d537d
      
       ("net: ethernet: mtk_eth_soc: handle probe deferral")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cb1e666e
    • Jakub Kicinski's avatar
      ethernet: use eth_hw_addr_set() instead of ether_addr_copy() · 43da399e
      Jakub Kicinski authored
      [ Upstream commit f3956ebb
      
       ]
      
      Convert Ethernet from ether_addr_copy() to eth_hw_addr_set():
      
        @@
        expression dev, np;
        @@
        - ether_addr_copy(dev->dev_addr, np)
        + eth_hw_addr_set(dev, np)
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Stable-dep-of: 1d6d537d
      
       ("net: ethernet: mtk_eth_soc: handle probe deferral")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43da399e
    • Kuniyuki Iwashima's avatar
      bridge: Add extack warning when enabling STP in netns. · 3fb402bd
      Kuniyuki Iwashima authored
      [ Upstream commit 56a16035 ]
      
      When we create an L2 loop on a bridge in netns, we will see packets storm
      even if STP is enabled.
      
        # unshare -n
        # ip link add br0 type bridge
        # ip link add veth0 type veth peer name veth1
        # ip link set veth0 master br0 up
        # ip link set veth1 master br0 up
        # ip link set br0 type bridge stp_state 1
        # ip link set br0 up
        # sleep 30
        # ip -s link show br0
        2: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
            link/ether b6:61:98:1c:1c:b5 brd ff:ff:ff:ff:ff:ff
            RX: bytes  packets  errors  dropped missed  mcast
            956553768  12861249 0       0       0       12861249  <-. Keep
            TX: bytes  packets  errors  dropped carrier collsns     |  increasing
            1027834    11951    0       0       0       0         <-'   rapidly
      
      This is because llc_rcv() drops all packets in non-root netns and BPDU
      is dropped.
      
      Let's add extack warning when enabling STP in netns.
      
        # unshare -n
        # ip link add br0 type bridge
        # ip link set br0 type bridge stp_state 1
        Warning: bridge: STP does not work in non-root netns.
      
      Note this commit will be reverted later when we namespacify the whole LLC
      infra.
      
      Fixes: e730c155
      
       ("[NET]: Make packet reception network namespace safe")
      Suggested-by: default avatarHarry Coin <hcoin@quietfountain.com>
      Link: https://lore.kernel.org/netdev/0f531295-e289-022d-5add-5ceffa0df9bc@quietfountain.com/
      Suggested-by: default avatarIdo Schimmel <idosch@idosch.org>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3fb402bd
    • Tanmay Patil's avatar
      net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()/cpsw_ale_set_field() · ec4ac15e
      Tanmay Patil authored
      [ Upstream commit b685f1a5 ]
      
      CPSW ALE has 75 bit ALE entries which are stored within three 32 bit words.
      The cpsw_ale_get_field() and cpsw_ale_set_field() functions assume that the
      field will be strictly contained within one word. However, this is not
      guaranteed to be the case and it is possible for ALE field entries to span
      across up to two words at the most.
      
      Fix the methods to handle getting/setting fields spanning up to two words.
      
      Fixes: db82173f
      
       ("netdev: driver: ethernet: add cpsw address lookup engine support")
      Signed-off-by: default avatarTanmay Patil <t-patil@ti.com>
      [s-vadapalli@ti.com: rephrased commit message and added Fixes tag]
      Signed-off-by: default avatarSiddharth Vadapalli <s-vadapalli@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ec4ac15e
    • Mario Limonciello's avatar
      pinctrl: amd: Use amd_pinconf_set() for all config options · 6a5d6096
      Mario Limonciello authored
      [ Upstream commit 635a750d
      
       ]
      
      On ASUS TUF A16 it is reported that the ITE5570 ACPI device connected to
      GPIO 7 is causing an interrupt storm.  This issue doesn't happen on
      Windows.
      
      Comparing the GPIO register configuration between Windows and Linux
      bit 20 has been configured as a pull up on Windows, but not on Linux.
      Checking GPIO declaration from the firmware it is clear it *should* have
      been a pull up on Linux as well.
      
      ```
      GpioInt (Level, ActiveLow, Exclusive, PullUp, 0x0000,
      	 "\\_SB.GPIO", 0x00, ResourceConsumer, ,)
      {   // Pin list
      0x0007
      }
      ```
      
      On Linux amd_gpio_set_config() is currently only used for programming
      the debounce. Actually the GPIO core calls it with all the arguments
      that are supported by a GPIO, pinctrl-amd just responds `-ENOTSUPP`.
      
      To solve this issue expand amd_gpio_set_config() to support the other
      arguments amd_pinconf_set() supports, namely `PIN_CONFIG_BIAS_PULL_DOWN`,
      `PIN_CONFIG_BIAS_PULL_UP`, and `PIN_CONFIG_DRIVE_STRENGTH`.
      
      Reported-by: default avatarNik P <npliashechnikov@gmail.com>
      Reported-by: default avatarNathan Schulte <nmschulte@gmail.com>
      Reported-by: default avatarFriedrich Vock <friedrich.vock@gmx.de>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217336
      Reported-by: default avatar <dridri85@gmail.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217493
      Link: https://lore.kernel.org/linux-input/20230530154058.17594-1-friedrich.vock@gmx.de/
      Tested-by: default avatarJan Visser <starquake@linuxeverywhere.org>
      Fixes: 2956b5d9
      
       ("pinctrl / gpio: Introduce .set_config() callback for GPIO chips")
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://lore.kernel.org/r/20230705133005.577-3-mario.limonciello@amd.com
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6a5d6096
    • James Clark's avatar
      perf build: Fix library not found error when using CSLIBS · 4727cece
      James Clark authored
      [ Upstream commit 1feece27 ]
      
      -L only specifies the search path for libraries directly provided in the
      link line with -l. Because -lopencsd isn't specified, it's only linked
      because it's a dependency of -lopencsd_c_api. Dependencies like this are
      resolved using the default system search paths or -rpath-link=... rather
      than -L. This means that compilation only works if OpenCSD is installed
      to the system rather than provided with the CSLIBS (-L) option.
      
      This could be fixed by adding -Wl,-rpath-link=$(CSLIBS) but that is less
      conventional than just adding -lopencsd to the link line so that it uses
      -L. -lopencsd seems to have been removed in commit ed17b191
      ("perf tools: Drop requirement for libstdc++.so for libopencsd check")
      because it was thought that there was a chance compilation would work
      even if it didn't exist, but I think that only applies to libstdc++ so
      there is no harm to add it back. libopencsd.so and libopencsd_c_api.so
      would always exist together.
      
      Testing
      =======
      
      The following scenarios now all work:
      
       * Cross build with OpenCSD installed
       * Cross build using CSLIBS=...
       * Native build with OpenCSD installed
       * Native build using CSLIBS=...
       * Static cross build with OpenCSD installed
       * Static cross build with CSLIBS=...
      
      Committer testing:
      
        ⬢[acme@toolbox perf-tools]$ alias m
        alias m='make -k BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools -C tools/perf install-bin && git status && perf test python ;  perf record -o /dev/null sleep 0.01 ; perf stat --null sleep 0.01'
        ⬢[acme@toolbox perf-tools]$ ldd ~/bin/perf | grep csd
        	libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007fd49c44e000)
        	libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007fd49bd56000)
        ⬢[acme@toolbox perf-tools]$ cat /etc/redhat-release
        Fedora release 36 (Thirty Six)
        ⬢[acme@toolbox perf-tools]$
      
      Fixes: ed17b191
      
       ("perf tools: Drop requirement for libstdc++.so for libopencsd check")
      Reported-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.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>
      Cc: Uwe Kleine-König <uwe@kleine-koenig.org>
      Cc: coresight@lists.linaro.org
      Closes: https://lore.kernel.org/linux-arm-kernel/56905d7a-a91e-883a-b707-9d5f686ba5f1@arm.com/
      Link: https://lore.kernel.org/all/36cc4dc6-bf4b-1093-1c0a-876e368af183@kleine-koenig.org/
      Link: https://lore.kernel.org/r/20230707154546.456720-1-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4727cece
    • Martin Kaiser's avatar
      fbdev: imxfb: warn about invalid left/right margin · 29fb046e
      Martin Kaiser authored
      [ Upstream commit 4e47382f ]
      
      Warn about invalid var->left_margin or var->right_margin. Their values
      are read from the device tree.
      
      We store var->left_margin-3 and var->right_margin-1 in register
      fields. These fields should be >= 0.
      
      Fixes: 7e8549bc
      
       ("imxfb: Fix margin settings")
      Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      29fb046e
    • Jonas Gorski's avatar
      spi: bcm63xx: fix max prepend length · 5d191467
      Jonas Gorski authored
      [ Upstream commit 5158814c ]
      
      The command word is defined as following:
      
          /* Command */
          #define SPI_CMD_COMMAND_SHIFT           0
          #define SPI_CMD_DEVICE_ID_SHIFT         4
          #define SPI_CMD_PREPEND_BYTE_CNT_SHIFT  8
          #define SPI_CMD_ONE_BYTE_SHIFT          11
          #define SPI_CMD_ONE_WIRE_SHIFT          12
      
      If the prepend byte count field starts at bit 8, and the next defined
      bit is SPI_CMD_ONE_BYTE at bit 11, it can be at most 3 bits wide, and
      thus the max value is 7, not 15.
      
      Fixes: b17de076
      
       ("spi/bcm63xx: work around inability to keep CS up")
      Signed-off-by: default avatarJonas Gorski <jonas.gorski@gmail.com>
      Link: https://lore.kernel.org/r/20230629071453.62024-1-jonas.gorski@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d191467
    • Immad Mir's avatar
      FS: JFS: Check for read-only mounted filesystem in txBegin · 2febd5f8
      Immad Mir authored
      [ Upstream commit 95e2b352
      
       ]
      
       This patch adds a check for read-only mounted filesystem
       in txBegin before starting a transaction potentially saving
       from NULL pointer deref.
      
      Signed-off-by: default avatarImmad Mir <mirimmad17@gmail.com>
      Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2febd5f8
    • Immad Mir's avatar
      FS: JFS: Fix null-ptr-deref Read in txBegin · 3e94d0d3
      Immad Mir authored
      [ Upstream commit 47cfdc33
      
       ]
      
       Syzkaller reported an issue where txBegin may be called
       on a superblock in a read-only mounted filesystem which leads
       to NULL pointer deref. This could be solved by checking if
       the filesystem is read-only before calling txBegin, and returning
       with appropiate error code.
      
      Reported-By: default avatar <syzbot+f1faa20eec55e0c8644c@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?id=be7e52c50c5182cc09a09ea6fc456446b2039de3
      
      Signed-off-by: default avatarImmad Mir <mirimmad17@gmail.com>
      Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e94d0d3
    • Gustavo A. R. Silva's avatar
      MIPS: dec: prom: Address -Warray-bounds warning · 13ae3f2f
      Gustavo A. R. Silva authored
      [ Upstream commit 7b191b9b
      
       ]
      
      Zero-length arrays are deprecated, and we are replacing them with flexible
      array members instead. So, replace zero-length array with flexible-array
      member in struct memmap.
      
      Address the following warning found after building (with GCC-13) mips64
      with decstation_64_defconfig:
      In function 'rex_setup_memory_region',
          inlined from 'prom_meminit' at arch/mips/dec/prom/memory.c:91:3:
      arch/mips/dec/prom/memory.c:72:31: error: array subscript i is outside array bounds of 'unsigned char[0]' [-Werror=array-bounds=]
         72 |                 if (bm->bitmap[i] == 0xff)
            |                     ~~~~~~~~~~^~~
      In file included from arch/mips/dec/prom/memory.c:16:
      ./arch/mips/include/asm/dec/prom.h: In function 'prom_meminit':
      ./arch/mips/include/asm/dec/prom.h:73:23: note: while referencing 'bitmap'
         73 |         unsigned char bitmap[0];
      
      This helps with the ongoing efforts to globally enable -Warray-bounds.
      
      This results in no differences in binary output.
      
      Link: https://github.com/KSPP/linux/issues/79
      Link: https://github.com/KSPP/linux/issues/323
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      13ae3f2f
    • Yogesh's avatar
      fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev · 39f6292d
      Yogesh authored
      [ Upstream commit 4e302336
      
       ]
      
      Syzkaller reported the following issue:
      
      UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:1965:6
      index -84 is out of range for type 's8[341]' (aka 'signed char[341]')
      CPU: 1 PID: 4995 Comm: syz-executor146 Not tainted 6.4.0-rc6-syzkaller-00037-gb6dad5178cea #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
       ubsan_epilogue lib/ubsan.c:217 [inline]
       __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348
       dbAllocDmapLev+0x3e5/0x430 fs/jfs/jfs_dmap.c:1965
       dbAllocCtl+0x113/0x920 fs/jfs/jfs_dmap.c:1809
       dbAllocAG+0x28f/0x10b0 fs/jfs/jfs_dmap.c:1350
       dbAlloc+0x658/0xca0 fs/jfs/jfs_dmap.c:874
       dtSplitUp fs/jfs/jfs_dtree.c:974 [inline]
       dtInsert+0xda7/0x6b00 fs/jfs/jfs_dtree.c:863
       jfs_create+0x7b6/0xbb0 fs/jfs/namei.c:137
       lookup_open fs/namei.c:3492 [inline]
       open_last_lookups fs/namei.c:3560 [inline]
       path_openat+0x13df/0x3170 fs/namei.c:3788
       do_filp_open+0x234/0x490 fs/namei.c:3818
       do_sys_openat2+0x13f/0x500 fs/open.c:1356
       do_sys_open fs/open.c:1372 [inline]
       __do_sys_openat fs/open.c:1388 [inline]
       __se_sys_openat fs/open.c:1383 [inline]
       __x64_sys_openat+0x247/0x290 fs/open.c:1383
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7f1f4e33f7e9
      Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 51 14 00 00 90 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 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffc21129578 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1f4e33f7e9
      RDX: 000000000000275a RSI: 0000000020000040 RDI: 00000000ffffff9c
      RBP: 00007f1f4e2ff080 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1f4e2ff110
      R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
       </TASK>
      
      The bug occurs when the dbAllocDmapLev()function attempts to access
      dp->tree.stree[leafidx + LEAFIND] while the leafidx value is negative.
      
      To rectify this, the patch introduces a safeguard within the
      dbAllocDmapLev() function. A check has been added to verify if leafidx is
      negative. If it is, the function immediately returns an I/O error, preventing
      any further execution that could potentially cause harm.
      
      Tested via syzbot.
      
      Reported-by: default avatar <syzbot+853a6f4dfa3cf37d3aea@syzkaller.appspotmail.com>
      Link: https://syzkaller.appspot.com/bug?extid=ae2f5a27a07ae44b0f17
      Signed-off-by: default avatarYogesh <yogi.kernel@gmail.com>
      Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      39f6292d
    • Jan Kara's avatar
      udf: Fix uninitialized array access for some pathnames · 985f9666
      Jan Kara authored
      [ Upstream commit 028f6055
      
       ]
      
      For filenames that begin with . and are between 2 and 5 characters long,
      UDF charset conversion code would read uninitialized memory in the
      output buffer. The only practical impact is that the name may be prepended a
      "unification hash" when it is not actually needed but still it is good
      to fix this.
      
      Reported-by: default avatar <syzbot+cd311b1e43cc25f90d18@syzkaller.appspotmail.com>
      Link: https://lore.kernel.org/all/000000000000e2638a05fe9dc8f9@google.com
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      985f9666
    • Ye Bin's avatar
      quota: fix warning in dqgrab() · 579d814d
      Ye Bin authored
      [ Upstream commit d6a95db3
      
       ]
      
      There's issue as follows when do fault injection:
      WARNING: CPU: 1 PID: 14870 at include/linux/quotaops.h:51 dquot_disable+0x13b7/0x18c0
      Modules linked in:
      CPU: 1 PID: 14870 Comm: fsconfig Not tainted 6.3.0-next-20230505-00006-g5107a9c821af-dirty #541
      RIP: 0010:dquot_disable+0x13b7/0x18c0
      RSP: 0018:ffffc9000acc79e0 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff88825e41b980
      RDX: 0000000000000000 RSI: ffff88825e41b980 RDI: 0000000000000002
      RBP: ffff888179f68000 R08: ffffffff82087ca7 R09: 0000000000000000
      R10: 0000000000000001 R11: ffffed102f3ed026 R12: ffff888179f68130
      R13: ffff888179f68110 R14: dffffc0000000000 R15: ffff888179f68118
      FS:  00007f450a073740(0000) GS:ffff88882fc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007ffe96f2efd8 CR3: 000000025c8ad000 CR4: 00000000000006e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       dquot_load_quota_sb+0xd53/0x1060
       dquot_resume+0x172/0x230
       ext4_reconfigure+0x1dc6/0x27b0
       reconfigure_super+0x515/0xa90
       __x64_sys_fsconfig+0xb19/0xd20
       do_syscall_64+0x39/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Above issue may happens as follows:
      ProcessA              ProcessB                    ProcessC
      sys_fsconfig
        vfs_fsconfig_locked
         reconfigure_super
           ext4_remount
            dquot_suspend -> suspend all type quota
      
                       sys_fsconfig
                        vfs_fsconfig_locked
                          reconfigure_super
                           ext4_remount
                            dquot_resume
                             ret = dquot_load_quota_sb
                              add_dquot_ref
                                                 do_open  -> open file O_RDWR
                                                  vfs_open
                                                   do_dentry_open
                                                    get_write_access
                                                     atomic_inc_unless_negative(&inode->i_writecount)
                                                    ext4_file_open
                                                     dquot_file_open
                                                      dquot_initialize
                                                        __dquot_initialize
                                                         dqget
      						    atomic_inc(&dquot->dq_count);
      
                                __dquot_initialize
                                 __dquot_initialize
                                  dqget
                                   if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
                                     ext4_acquire_dquot
      			        -> Return error DQ_ACTIVE_B flag isn't set
                               dquot_disable
      			  invalidate_dquots
      			   if (atomic_read(&dquot->dq_count))
      	                    dqgrab
      			     WARN_ON_ONCE(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
      	                      -> Trigger warning
      
      In the above scenario, 'dquot->dq_flags' has no DQ_ACTIVE_B is normal when
      dqgrab().
      To solve above issue just replace the dqgrab() use in invalidate_dquots() with
      atomic_inc(&dquot->dq_count).
      
      Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230605140731.2427629-3-yebin10@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      579d814d
    • Jan Kara's avatar
      quota: Properly disable quotas when add_dquot_ref() fails · 32c2f51f
      Jan Kara authored
      [ Upstream commit 6a4e3363
      
       ]
      
      When add_dquot_ref() fails (usually due to IO error or ENOMEM), we want
      to disable quotas we are trying to enable. However dquot_disable() call
      was passed just the flags we are enabling so in case flags ==
      DQUOT_USAGE_ENABLED dquot_disable() call will just fail with EINVAL
      instead of properly disabling quotas. Fix the problem by always passing
      DQUOT_LIMITS_ENABLED | DQUOT_USAGE_ENABLED to dquot_disable() in this
      case.
      
      Reported-and-tested-by: default avatarYe Bin <yebin10@huawei.com>
      Reported-by: default avatar <syzbot+e633c79ceaecbf479854@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230605140731.2427629-2-yebin10@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      32c2f51f
    • Oswald Buddenhagen's avatar
      ALSA: emu10k1: roll up loops in DSP setup code for Audigy · d3630750
      Oswald Buddenhagen authored
      [ Upstream commit 8cabf83c
      
       ]
      
      There is no apparent reason for the massive code duplication.
      
      Signed-off-by: default avatarOswald Buddenhagen <oswald.buddenhagen@gmx.de>
      Link: https://lore.kernel.org/r/20230510173917.3073107-3-oswald.buddenhagen@gmx.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d3630750
    • hackyzh002's avatar
      drm/radeon: Fix integer overflow in radeon_cs_parser_init · c0d7dbc6
      hackyzh002 authored
      [ Upstream commit f828b681
      
       ]
      
      The type of size is unsigned, if size is 0x40000000, there will be an
      integer overflow, size will be zero after size *= sizeof(uint32_t),
      will cause uninitialized memory to be referenced later
      
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarhackyzh002 <hackyzh002@gmail.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0d7dbc6
    • Eric Whitney's avatar
      ext4: correct inline offset when handling xattrs in inode body · bca9fb7a
      Eric Whitney authored
      commit 6909cf5c
      
       upstream.
      
      When run on a file system where the inline_data feature has been
      enabled, xfstests generic/269, generic/270, and generic/476 cause ext4
      to emit error messages indicating that inline directory entries are
      corrupted.  This occurs because the inline offset used to locate
      inline directory entries in the inode body is not updated when an
      xattr in that shared region is deleted and the region is shifted in
      memory to recover the space it occupied.  If the deleted xattr precedes
      the system.data attribute, which points to the inline directory entries,
      that attribute will be moved further up in the region.  The inline
      offset continues to point to whatever is located in system.data's former
      location, with unfortunate effects when used to access directory entries
      or (presumably) inline data in the inode body.
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarEric Whitney <enwlinux@gmail.com>
      Link: https://lore.kernel.org/r/20230522181520.1570360-1-enwlinux@gmail.com
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bca9fb7a
    • Johan Hovold's avatar
      ASoC: codecs: wcd938x: fix soundwire initialisation race · 87336783
      Johan Hovold authored
      commit 6f492568 upstream.
      
      Make sure that the soundwire device used for register accesses has been
      enumerated and initialised before trying to read the codec variant
      during component probe.
      
      This specifically avoids interpreting (a masked and shifted) -EBUSY
      errno as the variant:
      
      	wcd938x_codec audio-codec: ASoC: error at soc_component_read_no_lock on audio-codec for register: [0x000034b0] -16
      
      in case the soundwire device has not yet been initialised, which in turn
      prevents some headphone controls from being registered.
      
      Fixes: 8d78602a
      
       ("ASoC: codecs: wcd938x: add basic driver")
      Cc: stable@vger.kernel.org	# 5.14
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Reported-by: default avatarSteev Klimaszewski <steev@kali.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Tested-by: default avatarSteev Klimaszewski <steev@kali.org>
      Link: https://lore.kernel.org/r/20230701094723.29379-1-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      87336783
    • Johan Hovold's avatar
      ASoC: codecs: wcd938x: fix codec initialisation race · a14527c3
      Johan Hovold authored
      commit 85a61b1c upstream.
      
      Make sure to resume the codec and soundwire device before trying to read
      the codec variant and configure the device during component probe.
      
      This specifically avoids interpreting (a masked and shifted) -EBUSY
      errno as the variant:
      
      	wcd938x_codec audio-codec: ASoC: error at soc_component_read_no_lock on audio-codec for register: [0x000034b0] -16
      
      when the soundwire device happens to be suspended, which in turn
      prevents some headphone controls from being registered.
      
      Fixes: 8d78602a
      
       ("ASoC: codecs: wcd938x: add basic driver")
      Cc: stable@vger.kernel.org      # 5.14
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Reported-by: default avatarSteev Klimaszewski <steev@kali.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20230630120318.6571-1-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a14527c3
    • Johan Hovold's avatar
      ASoC: codecs: wcd934x: fix resource leaks on component remove · 4ca00045
      Johan Hovold authored
      commit 798590cc upstream.
      
      Make sure to release allocated MBHC resources also on component remove.
      
      This is specifically needed to allow probe deferrals of the sound card
      which otherwise fails when reprobing the codec component.
      
      Fixes: 9fb9b169
      
       ("ASoC: codecs: wcd934x: add mbhc support")
      Cc: stable@vger.kernel.org      # 5.14
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230705123018.30903-6-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ca00045
    • Johan Hovold's avatar
      ASoC: codecs: wcd938x: fix missing mbhc init error handling · 5a34d252
      Johan Hovold authored
      commit 7dfae263 upstream.
      
      MBHC initialisation can fail so add the missing error handling to avoid
      dereferencing an error pointer when later configuring the jack:
      
          Unable to handle kernel paging request at virtual address fffffffffffffff8
      
          pc : wcd_mbhc_start+0x28/0x380 [snd_soc_wcd_mbhc]
          lr : wcd938x_codec_set_jack+0x28/0x48 [snd_soc_wcd938x]
      
          Call trace:
           wcd_mbhc_start+0x28/0x380 [snd_soc_wcd_mbhc]
           wcd938x_codec_set_jack+0x28/0x48 [snd_soc_wcd938x]
           snd_soc_component_set_jack+0x28/0x8c [snd_soc_core]
           qcom_snd_wcd_jack_setup+0x7c/0x19c [snd_soc_qcom_common]
           sc8280xp_snd_init+0x20/0x2c [snd_soc_sc8280xp]
           snd_soc_link_init+0x28/0x90 [snd_soc_core]
           snd_soc_bind_card+0x628/0xbfc [snd_soc_core]
           snd_soc_register_card+0xec/0x104 [snd_soc_core]
           devm_snd_soc_register_card+0x4c/0xa4 [snd_soc_core]
           sc8280xp_platform_probe+0xf0/0x108 [snd_soc_sc8280xp]
      
      Fixes: bcee7ed0
      
       ("ASoC: codecs: wcd938x: add Multi Button Headset Control support")
      Cc: stable@vger.kernel.org      # 5.15
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Link: https://lore.kernel.org/r/20230703124701.11734-1-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a34d252
    • Johan Hovold's avatar
      ASoC: codecs: wcd938x: fix resource leaks on component remove · aa44782a
      Johan Hovold authored
      commit a3406f87 upstream.
      
      Make sure to release allocated resources on component probe failure and
      on remove.
      
      This is specifically needed to allow probe deferrals of the sound card
      which otherwise fails when reprobing the codec component:
      
          snd-sc8280xp sound: ASoC: failed to instantiate card -517
          genirq: Flags mismatch irq 289. 00002001 (HPHR PDM WD INT) vs. 00002001 (HPHR PDM WD INT)
          wcd938x_codec audio-codec: Failed to request HPHR WD interrupt (-16)
          genirq: Flags mismatch irq 290. 00002001 (HPHL PDM WD INT) vs. 00002001 (HPHL PDM WD INT)
          wcd938x_codec audio-codec: Failed to request HPHL WD interrupt (-16)
          genirq: Flags mismatch irq 291. 00002001 (AUX PDM WD INT) vs. 00002001 (AUX PDM WD INT)
          wcd938x_codec audio-codec: Failed to request Aux WD interrupt (-16)
          genirq: Flags mismatch irq 292. 00002001 (mbhc sw intr) vs. 00002001 (mbhc sw intr)
          wcd938x_codec audio-codec: Failed to request mbhc interrupts -16
      
      Fixes: 8d78602a
      
       ("ASoC: codecs: wcd938x: add basic driver")
      Cc: stable@vger.kernel.org	# 5.14
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230705123018.30903-5-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa44782a
    • Johan Hovold's avatar
      ASoC: codecs: wcd-mbhc-v2: fix resource leaks on component remove · 90ab6446
      Johan Hovold authored
      commit a5475829 upstream.
      
      The MBHC resources must be released on component probe failure and
      removal so can not be tied to the lifetime of the component device.
      
      This is specifically needed to allow probe deferrals of the sound card
      which otherwise fails when reprobing the codec component:
      
          snd-sc8280xp sound: ASoC: failed to instantiate card -517
          genirq: Flags mismatch irq 299. 00002001 (mbhc sw intr) vs. 00002001 (mbhc sw intr)
          wcd938x_codec audio-codec: Failed to request mbhc interrupts -16
          wcd938x_codec audio-codec: mbhc initialization failed
          wcd938x_codec audio-codec: ASoC: error at snd_soc_component_probe on audio-codec: -16
          snd-sc8280xp sound: ASoC: failed to instantiate card -16
      
      Fixes: 0e5c9e7f
      
       ("ASoC: codecs: wcd: add multi button Headset detection support")
      Cc: stable@vger.kernel.org      # 5.14
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230705123018.30903-7-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90ab6446
    • Johan Hovold's avatar
      ASoC: codecs: wcd938x: fix missing clsh ctrl error handling · a05a277a
      Johan Hovold authored
      commit ed0dd920 upstream.
      
      Allocation of the clash control structure may fail so add the missing
      error handling to avoid dereferencing an error pointer.
      
      Fixes: 8d78602a
      
       ("ASoC: codecs: wcd938x: add basic driver")
      Cc: stable@vger.kernel.org	# 5.14
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
      Reviewed-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Link: https://lore.kernel.org/r/20230705123018.30903-4-johan+linaro@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a05a277a
    • Matus Gajdos's avatar
      ASoC: fsl_sai: Disable bit clock with transmitter · 574ffa6f
      Matus Gajdos authored
      commit 269f399d
      
       upstream.
      
      Otherwise bit clock remains running writing invalid data to the DAC.
      
      Signed-off-by: default avatarMatus Gajdos <matuszpd@gmail.com>
      Acked-by: default avatarShengjiu Wang <shengjiu.wang@gmail.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230712124934.32232-1-matuszpd@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      574ffa6f
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Keep PHY active for DP displays on DCN31 · 925bbcdb
      Nicholas Kazlauskas authored
      commit 2387ccf4
      
       upstream.
      
      [Why & How]
      Port of a change that went into DCN314 to keep the PHY enabled
      when we have a connected and active DP display.
      
      The PHY can hang if PHY refclk is disabled inadvertently.
      
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarJosip Pavic <josip.pavic@amd.com>
      Acked-by: default avatarAlan Liu <haoping.liu@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      925bbcdb
    • Zhikai Zhai's avatar
      drm/amd/display: Disable MPC split by default on special asic · 74234037
      Zhikai Zhai authored
      commit a460beef
      
       upstream.
      
      [WHY]
      All of pipes will be used when the MPC split enable on the dcn
      which just has 2 pipes. Then MPO enter will trigger the minimal
      transition which need programe dcn from 2 pipes MPC split to 2
      pipes MPO. This action will cause lag if happen frequently.
      
      [HOW]
      Disable the MPC split for the platform which dcn resource is limited
      
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarAlvin Lee <alvin.lee2@amd.com>
      Acked-by: default avatarAlan Liu <haoping.liu@amd.com>
      Signed-off-by: default avatarZhikai Zhai <zhikai.zhai@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74234037
    • Jocelyn Falempe's avatar
      drm/client: Fix memory leak in drm_client_modeset_probe · 1369d0c5
      Jocelyn Falempe authored
      commit 2329cc7a
      
       upstream.
      
      When a new mode is set to modeset->mode, the previous mode should be freed.
      This fixes the following kmemleak report:
      
      drm_mode_duplicate+0x45/0x220 [drm]
      drm_client_modeset_probe+0x944/0xf50 [drm]
      __drm_fb_helper_initial_config_and_unlock+0xb4/0x2c0 [drm_kms_helper]
      drm_fbdev_client_hotplug+0x2bc/0x4d0 [drm_kms_helper]
      drm_client_register+0x169/0x240 [drm]
      ast_pci_probe+0x142/0x190 [ast]
      local_pci_probe+0xdc/0x180
      work_for_cpu_fn+0x4e/0xa0
      process_one_work+0x8b7/0x1540
      worker_thread+0x70a/0xed0
      kthread+0x29f/0x340
      ret_from_fork+0x1f/0x30
      
      cc: <stable@vger.kernel.org>
      Reported-by: default avatarZhang Yi <yizhan@redhat.com>
      Signed-off-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230711092203.68157-3-jfalempe@redhat.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1369d0c5
    • Jocelyn Falempe's avatar
      drm/client: Fix memory leak in drm_client_target_cloned · a85e23a1
      Jocelyn Falempe authored
      commit c2a88e8b upstream.
      
      dmt_mode is allocated and never freed in this function.
      It was found with the ast driver, but most drivers using generic fbdev
      setup are probably affected.
      
      This fixes the following kmemleak report:
        backtrace:
          [<00000000b391296d>] drm_mode_duplicate+0x45/0x220 [drm]
          [<00000000e45bb5b3>] drm_client_target_cloned.constprop.0+0x27b/0x480 [drm]
          [<00000000ed2d3a37>] drm_client_modeset_probe+0x6bd/0xf50 [drm]
          [<0000000010e5cc9d>] __drm_fb_helper_initial_config_and_unlock+0xb4/0x2c0 [drm_kms_helper]
          [<00000000909f82ca>] drm_fbdev_client_hotplug+0x2bc/0x4d0 [drm_kms_helper]
          [<00000000063a69aa>] drm_client_register+0x169/0x240 [drm]
          [<00000000a8c61525>] ast_pci_probe+0x142/0x190 [ast]
          [<00000000987f19bb>] local_pci_probe+0xdc/0x180
          [<000000004fca231b>] work_for_cpu_fn+0x4e/0xa0
          [<0000000000b85301>] process_one_work+0x8b7/0x1540
          [<000000003375b17c>] worker_thread+0x70a/0xed0
          [<00000000b0d43cd9>] kthread+0x29f/0x340
          [<000000008d770833>] ret_from_fork+0x1f/0x30
      unreferenced object 0xff11000333089a00 (size 128):
      
      cc: <stable@vger.kernel.org>
      Fixes: 1d42bbc8
      
       ("drm/fbdev: fix cloning on fbcon")
      Reported-by: default avatarZhang Yi <yizhan@redhat.com>
      Signed-off-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230711092203.68157-2-jfalempe@redhat.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a85e23a1
    • Matthieu Baerts's avatar
      selftests: tc: add ConnTrack procfs kconfig · 82690148
      Matthieu Baerts authored
      commit 031c99e7 upstream.
      
      When looking at the TC selftest reports, I noticed one test was failing
      because /proc/net/nf_conntrack was not available.
      
        not ok 373 3992 - Add ct action triggering DNAT tuple conflict
        	Could not match regex pattern. Verify command output:
        cat: /proc/net/nf_conntrack: No such file or directory
      
      It is only available if NF_CONNTRACK_PROCFS kconfig is set. So the issue
      can be fixed simply by adding it to the list of required kconfig.
      
      Fixes: e4690564
      
       ("tc-testing: add test for ct DNAT tuple collision")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/netdev/0e061d4a-9a23-9f58-3b35-d8919de332d7@tessares.net/T/ [1]
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Tested-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Link: https://lore.kernel.org/r/20230713-tc-selftests-lkft-v1-3-1eb4fd3a96e7@tessares.net
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82690148
    • YueHaibing's avatar
      can: bcm: Fix UAF in bcm_proc_show() · 3c3941bb
      YueHaibing authored
      commit 55c3b960 upstream.
      
      BUG: KASAN: slab-use-after-free in bcm_proc_show+0x969/0xa80
      Read of size 8 at addr ffff888155846230 by task cat/7862
      
      CPU: 1 PID: 7862 Comm: cat Not tainted 6.5.0-rc1-00153-gc8746099c197 #230
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      Call Trace:
       <TASK>
       dump_stack_lvl+0xd5/0x150
       print_report+0xc1/0x5e0
       kasan_report+0xba/0xf0
       bcm_proc_show+0x969/0xa80
       seq_read_iter+0x4f6/0x1260
       seq_read+0x165/0x210
       proc_reg_read+0x227/0x300
       vfs_read+0x1d5/0x8d0
       ksys_read+0x11e/0x240
       do_syscall_64+0x35/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Allocated by task 7846:
       kasan_save_stack+0x1e/0x40
       kasan_set_track+0x21/0x30
       __kasan_kmalloc+0x9e/0xa0
       bcm_sendmsg+0x264b/0x44e0
       sock_sendmsg+0xda/0x180
       ____sys_sendmsg+0x735/0x920
       ___sys_sendmsg+0x11d/0x1b0
       __sys_sendmsg+0xfa/0x1d0
       do_syscall_64+0x35/0xb0
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Freed by task 7846:
       kasan_save_stack+0x1e/0x40
       kasan_set_track+0x21/0x30
       kasan_save_free_info+0x27/0x40
       ____kasan_slab_free+0x161/0x1c0
       slab_free_freelist_hook+0x119/0x220
       __kmem_cache_free+0xb4/0x2e0
       rcu_core+0x809/0x1bd0
      
      bcm_op is freed before procfs entry be removed in bcm_release(),
      this lead to bcm_proc_show() may read the freed bcm_op.
      
      Fixes: ffd980f9
      
       ("[CAN]: Add broadcast manager (bcm) protocol")
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Link: https://lore.kernel.org/all/20230715092543.15548-1-yuehaibing@huawei.com
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c3941bb
    • Mark Brown's avatar
      regmap: Account for register length in SMBus I/O limits · 14845378
      Mark Brown authored
      commit 0c9d2eb5
      
       upstream.
      
      The SMBus I2C buses have limits on the size of transfers they can do but
      do not factor in the register length meaning we may try to do a transfer
      longer than our length limit, the core will not take care of this.
      Future changes will factor this out into the core but there are a number
      of users that assume current behaviour so let's just do something
      conservative here.
      
      This does not take account padding bits but practically speaking these
      are very rarely if ever used on I2C buses given that they generally run
      slowly enough to mean there's no issue.
      
      Cc: stable@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarXu Yilun <yilun.xu@intel.com>
      Link: https://lore.kernel.org/r/20230712-regmap-max-transfer-v1-2-80e2aed22e83@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      14845378
    • Mark Brown's avatar
      regmap: Drop initial version of maximum transfer length fixes · 6ce258d0
      Mark Brown authored
      commit bc647348 upstream.
      
      When problems were noticed with the register address not being taken
      into account when limiting raw transfers with I2C devices we fixed this
      in the core.  Unfortunately it has subsequently been realised that a lot
      of buses were relying on the prior behaviour, partly due to unclear
      documentation not making it obvious what was intended in the core.  This
      is all more involved to fix than is sensible for a fix commit so let's
      just drop the original fixes, a separate commit will fix the originally
      observed problem in an I2C specific way
      
      Fixes: 39815141 ("regmap: Account for register length when chunking")
      Fixes: c8e79689
      
       ("regmap: spi-avmm: Fix regmap_bus max_raw_write")
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarXu Yilun <yilun.xu@intel.com>
      Cc: stable@kernel.org
      Link: https://lore.kernel.org/r/20230712-regmap-max-transfer-v1-1-80e2aed22e83@kernel.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ce258d0
    • Matthieu Baerts's avatar
      selftests: tc: add 'ct' action kconfig dep · d3ee089a
      Matthieu Baerts authored
      commit 719b4774 upstream.
      
      When looking for something else in LKFT reports [1], I noticed most of
      the tests were skipped because the "teardown stage" did not complete
      successfully.
      
      Pedro found out this is due to the fact CONFIG_NF_FLOW_TABLE is required
      but not listed in the 'config' file. Adding it to the list fixes the
      issues on LKFT side. CONFIG_NET_ACT_CT is now set to 'm' in the final
      kconfig.
      
      Fixes: c34b961a
      
       ("net/sched: act_ct: Create nf flow table per zone")
      Cc: stable@vger.kernel.org
      Link: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230711/testrun/18267241/suite/kselftest-tc-testing/test/tc-testing_tdc_sh/log [1]
      Link: https://lore.kernel.org/netdev/0e061d4a-9a23-9f58-3b35-d8919de332d7@tessares.net/T/ [2]
      Suggested-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Tested-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Link: https://lore.kernel.org/r/20230713-tc-selftests-lkft-v1-2-1eb4fd3a96e7@tessares.net
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d3ee089a
    • Matthieu Baerts's avatar
      selftests: tc: set timeout to 15 minutes · 4a888b22
      Matthieu Baerts authored
      commit fda05798 upstream.
      
      When looking for something else in LKFT reports [1], I noticed that the
      TC selftest ended with a timeout error:
      
        not ok 1 selftests: tc-testing: tdc.sh # TIMEOUT 45 seconds
      
      The timeout had been introduced 3 years ago, see the Fixes commit below.
      
      This timeout is only in place when executing the selftests via the
      kselftests runner scripts. I guess this is not what most TC devs are
      using and nobody noticed the issue before.
      
      The new timeout is set to 15 minutes as suggested by Pedro [2]. It looks
      like it is plenty more time than what it takes in "normal" conditions.
      
      Fixes: 852c8cbf
      
       ("selftests/kselftest/runner.sh: Add 45 second timeout per test")
      Cc: stable@vger.kernel.org
      Link: https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20230711/testrun/18267241/suite/kselftest-tc-testing/test/tc-testing_tdc_sh/log [1]
      Link: https://lore.kernel.org/netdev/0e061d4a-9a23-9f58-3b35-d8919de332d7@tessares.net/T/ [2]
      Suggested-by: default avatarPedro Tammela <pctammela@mojatatu.com>
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Reviewed-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Link: https://lore.kernel.org/r/20230713-tc-selftests-lkft-v1-1-1eb4fd3a96e7@tessares.net
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a888b22
    • Miklos Szeredi's avatar
      fuse: ioctl: translate ENOSYS in outarg · 62ee5840
      Miklos Szeredi authored
      commit 6a567e92 upstream.
      
      Fuse shouldn't return ENOSYS from its ioctl implementation. If userspace
      responds with ENOSYS it should be translated to ENOTTY.
      
      There are two ways to return an error from the IOCTL request:
      
       - fuse_out_header.error
       - fuse_ioctl_out.result
      
      Commit 02c0cab8
      
       ("fuse: ioctl: translate ENOSYS") already fixed this
      issue for the first case, but missed the second case.  This patch fixes the
      second case.
      
      Reported-by: default avatarJonathan Katz <jkatz@eitmlabs.org>
      Closes: https://lore.kernel.org/all/CALKgVmcC1VUV_gJVq70n--omMJZUb4HSh_FqvLTHgNBc+HCLFQ@mail.gmail.com/
      Fixes: 02c0cab8
      
       ("fuse: ioctl: translate ENOSYS")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62ee5840
    • Filipe Manana's avatar
      btrfs: zoned: fix memory leak after finding block group with super blocks · ab80a901
      Filipe Manana authored
      commit f1a07c2b upstream.
      
      At exclude_super_stripes(), if we happen to find a block group that has
      super blocks mapped to it and we are on a zoned filesystem, we error out
      as this is not supposed to happen, indicating either a bug or maybe some
      memory corruption for example. However we are exiting the function without
      freeing the memory allocated for the logical address of the super blocks.
      Fix this by freeing the logical address.
      
      Fixes: 12659251
      
       ("btrfs: implement log-structured superblock for ZONED mode")
      CC: stable@vger.kernel.org # 5.10+
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ab80a901