1. 13 Sep, 2024 7 commits
  2. 12 Sep, 2024 21 commits
  3. 11 Sep, 2024 12 commits
    • Sean Anderson's avatar
      net: dpaa: Pad packets to ETH_ZLEN · cbd7ec08
      Sean Anderson authored
      When sending packets under 60 bytes, up to three bytes of the buffer
      following the data may be leaked. Avoid this by extending all packets to
      ETH_ZLEN, ensuring nothing is leaked in the padding. This bug can be
      reproduced by running
      
      	$ ping -s 11 destination
      
      Fixes: 9ad1a374 ("dpaa_eth: add support for DPAA Ethernet")
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarSean Anderson <sean.anderson@linux.dev>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20240910143144.1439910-1-sean.anderson@linux.devSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cbd7ec08
    • Edward Adam Davis's avatar
      mptcp: pm: Fix uaf in __timer_delete_sync · b4cd80b0
      Edward Adam Davis authored
      There are two paths to access mptcp_pm_del_add_timer, result in a race
      condition:
      
           CPU1				CPU2
           ====                               ====
           net_rx_action
           napi_poll                          netlink_sendmsg
           __napi_poll                        netlink_unicast
           process_backlog                    netlink_unicast_kernel
           __netif_receive_skb                genl_rcv
           __netif_receive_skb_one_core       netlink_rcv_skb
           NF_HOOK                            genl_rcv_msg
           ip_local_deliver_finish            genl_family_rcv_msg
           ip_protocol_deliver_rcu            genl_family_rcv_msg_doit
           tcp_v4_rcv                         mptcp_pm_nl_flush_addrs_doit
           tcp_v4_do_rcv                      mptcp_nl_remove_addrs_list
           tcp_rcv_established                mptcp_pm_remove_addrs_and_subflows
           tcp_data_queue                     remove_anno_list_by_saddr
           mptcp_incoming_options             mptcp_pm_del_add_timer
           mptcp_pm_del_add_timer             kfree(entry)
      
      In remove_anno_list_by_saddr(running on CPU2), after leaving the critical
      zone protected by "pm.lock", the entry will be released, which leads to the
      occurrence of uaf in the mptcp_pm_del_add_timer(running on CPU1).
      
      Keeping a reference to add_timer inside the lock, and calling
      sk_stop_timer_sync() with this reference, instead of "entry->add_timer".
      
      Move list_del(&entry->list) to mptcp_pm_del_add_timer and inside the pm lock,
      do not directly access any members of the entry outside the pm lock, which
      can avoid similar "entry->x" uaf.
      
      Fixes: 00cfd77b ("mptcp: retransmit ADD_ADDR when timeout")
      Cc: stable@vger.kernel.org
      Reported-and-tested-by: syzbot+f3a31fb909db9b2a5c4d@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=f3a31fb909db9b2a5c4dSigned-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Link: https://patch.msgid.link/tencent_7142963A37944B4A74EF76CD66EA3C253609@qq.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b4cd80b0
    • Jiawen Wu's avatar
      net: libwx: fix number of Rx and Tx descriptors · 077ee7e6
      Jiawen Wu authored
      The number of transmit and receive descriptors must be a multiple of 128
      due to the hardware limitation. If it is set to a multiple of 8 instead of
      a multiple 128, the queues will easily be hung.
      
      Cc: stable@vger.kernel.org
      Fixes: 883b5984 ("net: wangxun: add ethtool_ops for ring parameters")
      Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://patch.msgid.link/20240910095629.570674-1-jiawenwu@trustnetic.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      077ee7e6
    • Xiaoliang Yang's avatar
      net: dsa: felix: ignore pending status of TAS module when it's disabled · 70654f4c
      Xiaoliang Yang authored
      The TAS module could not be configured when it's running in pending
      status. We need disable the module and configure it again. However, the
      pending status is not cleared after the module disabled. TC taprio set
      will always return busy even it's disabled.
      
      For example, a user uses tc-taprio to configure Qbv and a future
      basetime. The TAS module will run in a pending status. There is no way
      to reconfigure Qbv, it always returns busy.
      
      Actually the TAS module can be reconfigured when it's disabled. So it
      doesn't need to check the pending status if the TAS module is disabled.
      
      After the patch, user can delete the tc taprio configuration to disable
      Qbv and reconfigure it again.
      
      Fixes: de143c0e ("net: dsa: felix: Configure Time-Aware Scheduler via taprio offload")
      Signed-off-by: default avatarXiaoliang Yang <xiaoliang.yang_1@nxp.com>
      Link: https://patch.msgid.link/20240906093550.29985-1-xiaoliang.yang_1@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      70654f4c
    • Jeongjun Park's avatar
      net: hsr: prevent NULL pointer dereference in hsr_proxy_announce() · a7789fd4
      Jeongjun Park authored
      In the function hsr_proxy_annouance() added in the previous commit
      5f703ce5 ("net: hsr: Send supervisory frames to HSR network
      with ProxyNodeTable data"), the return value of the hsr_port_get_hsr()
      function is not checked to be a NULL pointer, which causes a NULL
      pointer dereference.
      
      To solve this, we need to add code to check whether the return value
      of hsr_port_get_hsr() is NULL.
      
      Reported-by: syzbot+02a42d9b1bd395cbcab4@syzkaller.appspotmail.com
      Fixes: 5f703ce5 ("net: hsr: Send supervisory frames to HSR network with ProxyNodeTable data")
      Signed-off-by: default avatarJeongjun Park <aha310510@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Acked-by: default avatarLukasz Majewski <lukma@denx.de>
      Link: https://patch.msgid.link/20240907190341.162289-1-aha310510@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a7789fd4
    • Jakub Kicinski's avatar
      Merge branch 'selftests-mptcp-misc-small-fixes' · 62540317
      Jakub Kicinski authored
      Matthieu Baerts says:
      
      ====================
      selftests: mptcp: misc. small fixes
      
      Here are some various fixes for the MPTCP selftests.
      
      Patch 1 fixes a recently modified test to continue to work as expected
      on older kernels. This is a fix for a recent fix that can be backported
      up to v5.15.
      
      Patch 2 and 3 include dependences when exporting or installing the
      tests. Two fixes for v6.11-rc1.
      ====================
      
      Link: https://patch.msgid.link/20240910-net-selftests-mptcp-fix-install-v1-0-8f124aa9156d@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      62540317
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: include net_helper.sh file · c66c08e5
      Matthieu Baerts (NGI0) authored
      Similar to the previous commit, the net_helper.sh file from the parent
      directory is used by the MPTCP selftests and it needs to be present when
      running the tests.
      
      This file then needs to be listed in the Makefile to be included when
      exporting or installing the tests, e.g. with:
      
        make -C tools/testing/selftests \
                TARGETS=net/mptcp \
                install INSTALL_PATH=$KSFT_INSTALL_PATH
      
        cd $KSFT_INSTALL_PATH
        ./run_kselftest.sh -c net/mptcp
      
      Fixes: 1af3bc91 ("selftests: mptcp: lib: use wait_local_port_listen helper")
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240910-net-selftests-mptcp-fix-install-v1-3-8f124aa9156d@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c66c08e5
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: include lib.sh file · 1a5a2d19
      Matthieu Baerts (NGI0) authored
      The lib.sh file from the parent directory is used by the MPTCP selftests
      and it needs to be present when running the tests.
      
      This file then needs to be listed in the Makefile to be included when
      exporting or installing the tests, e.g. with:
      
        make -C tools/testing/selftests \
                TARGETS=net/mptcp \
                install INSTALL_PATH=$KSFT_INSTALL_PATH
      
        cd $KSFT_INSTALL_PATH
        ./run_kselftest.sh -c net/mptcp
      
      Fixes: f265d311 ("selftests: mptcp: lib: use setup/cleanup_ns helpers")
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240910-net-selftests-mptcp-fix-install-v1-2-8f124aa9156d@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1a5a2d19
    • Matthieu Baerts (NGI0)'s avatar
      selftests: mptcp: join: restrict fullmesh endp on 1st sf · 49ac6f05
      Matthieu Baerts (NGI0) authored
      A new endpoint using the IP of the initial subflow has been recently
      added to increase the code coverage. But it breaks the test when using
      old kernels not having commit 86e39e04 ("mptcp: keep track of local
      endpoint still available for each msk"), e.g. on v5.15.
      
      Similar to commit d4c81bbb ("selftests: mptcp: join: support local
      endpoint being tracked or not"), it is possible to add the new endpoint
      conditionally, by checking if "mptcp_pm_subflow_check_next" is present
      in kallsyms: this is not directly linked to the commit introducing this
      symbol but for the parent one which is linked anyway. So we can know in
      advance what will be the expected behaviour, and add the new endpoint
      only when it makes sense to do so.
      
      Fixes: 4878f9f8 ("selftests: mptcp: join: validate fullmesh endp on 1st sf")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
      Link: https://patch.msgid.link/20240910-net-selftests-mptcp-fix-install-v1-1-8f124aa9156d@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      49ac6f05
    • Florian Westphal's avatar
      netfilter: nft_socket: make cgroupsv2 matching work with namespaces · 7f3287db
      Florian Westphal authored
      When running in container environmment, /sys/fs/cgroup/ might not be
      the real root node of the sk-attached cgroup.
      
      Example:
      
      In container:
      % stat /sys//fs/cgroup/
      Device: 0,21    Inode: 2214  ..
      % stat /sys/fs/cgroup/foo
      Device: 0,21    Inode: 2264  ..
      
      The expectation would be for:
      
        nft add rule .. socket cgroupv2 level 1 "foo" counter
      
      to match traffic from a process that got added to "foo" via
      "echo $pid > /sys/fs/cgroup/foo/cgroup.procs".
      
      However, 'level 3' is needed to make this work.
      
      Seen from initial namespace, the complete hierarchy is:
      
      % stat /sys/fs/cgroup/system.slice/docker-.../foo
        Device: 0,21    Inode: 2264 ..
      
      i.e. hierarchy is
      0    1               2              3
      / -> system.slice -> docker-1... -> foo
      
      ... but the container doesn't know that its "/" is the "docker-1.."
      cgroup.  Current code will retrieve the 'system.slice' cgroup node
      and store its kn->id in the destination register, so compare with
      2264 ("foo" cgroup id) will not match.
      
      Fetch "/" cgroup from ->init() and add its level to the level we try to
      extract.  cgroup root-level is 0 for the init-namespace or the level
      of the ancestor that is exposed as the cgroup root inside the container.
      
      In the above case, cgrp->level of "/" resolved in the container is 2
      (docker-1...scope/) and request for 'level 1' will get adjusted
      to fetch the actual level (3).
      
      v2: use CONFIG_SOCK_CGROUP_DATA, eval function depends on it.
          (kernel test robot)
      
      Cc: cgroups@vger.kernel.org
      Fixes: e0bb96db ("netfilter: nft_socket: add support for cgroupsv2")
      Reported-by: default avatarNadia Pinaeva <n.m.pinaeva@gmail.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      7f3287db
    • Florian Westphal's avatar
      netfilter: nft_socket: fix sk refcount leaks · 8b26ff7a
      Florian Westphal authored
      We must put 'sk' reference before returning.
      
      Fixes: 039b1f4f ("netfilter: nft_socket: fix erroneous socket assignment")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      8b26ff7a
    • Han Xu's avatar
      spi: nxp-fspi: fix the KASAN report out-of-bounds bug · 2a8787c1
      Han Xu authored
      Change the memcpy length to fix the out-of-bounds issue when writing the
      data that is not 4 byte aligned to TX FIFO.
      
      To reproduce the issue, write 3 bytes data to NOR chip.
      
      dd if=3b of=/dev/mtd0
      [   36.926103] ==================================================================
      [   36.933409] BUG: KASAN: slab-out-of-bounds in nxp_fspi_exec_op+0x26ec/0x2838
      [   36.940514] Read of size 4 at addr ffff00081037c2a0 by task dd/455
      [   36.946721]
      [   36.948235] CPU: 3 UID: 0 PID: 455 Comm: dd Not tainted 6.11.0-rc5-gc7b0e37c8434 #1070
      [   36.956185] Hardware name: Freescale i.MX8QM MEK (DT)
      [   36.961260] Call trace:
      [   36.963723]  dump_backtrace+0x90/0xe8
      [   36.967414]  show_stack+0x18/0x24
      [   36.970749]  dump_stack_lvl+0x78/0x90
      [   36.974451]  print_report+0x114/0x5cc
      [   36.978151]  kasan_report+0xa4/0xf0
      [   36.981670]  __asan_report_load_n_noabort+0x1c/0x28
      [   36.986587]  nxp_fspi_exec_op+0x26ec/0x2838
      [   36.990800]  spi_mem_exec_op+0x8ec/0xd30
      [   36.994762]  spi_mem_no_dirmap_read+0x190/0x1e0
      [   36.999323]  spi_mem_dirmap_write+0x238/0x32c
      [   37.003710]  spi_nor_write_data+0x220/0x374
      [   37.007932]  spi_nor_write+0x110/0x2e8
      [   37.011711]  mtd_write_oob_std+0x154/0x1f0
      [   37.015838]  mtd_write_oob+0x104/0x1d0
      [   37.019617]  mtd_write+0xb8/0x12c
      [   37.022953]  mtdchar_write+0x224/0x47c
      [   37.026732]  vfs_write+0x1e4/0x8c8
      [   37.030163]  ksys_write+0xec/0x1d0
      [   37.033586]  __arm64_sys_write+0x6c/0x9c
      [   37.037539]  invoke_syscall+0x6c/0x258
      [   37.041327]  el0_svc_common.constprop.0+0x160/0x22c
      [   37.046244]  do_el0_svc+0x44/0x5c
      [   37.049589]  el0_svc+0x38/0x78
      [   37.052681]  el0t_64_sync_handler+0x13c/0x158
      [   37.057077]  el0t_64_sync+0x190/0x194
      [   37.060775]
      [   37.062274] Allocated by task 455:
      [   37.065701]  kasan_save_stack+0x2c/0x54
      [   37.069570]  kasan_save_track+0x20/0x3c
      [   37.073438]  kasan_save_alloc_info+0x40/0x54
      [   37.077736]  __kasan_kmalloc+0xa0/0xb8
      [   37.081515]  __kmalloc_noprof+0x158/0x2f8
      [   37.085563]  mtd_kmalloc_up_to+0x120/0x154
      [   37.089690]  mtdchar_write+0x130/0x47c
      [   37.093469]  vfs_write+0x1e4/0x8c8
      [   37.096901]  ksys_write+0xec/0x1d0
      [   37.100332]  __arm64_sys_write+0x6c/0x9c
      [   37.104287]  invoke_syscall+0x6c/0x258
      [   37.108064]  el0_svc_common.constprop.0+0x160/0x22c
      [   37.112972]  do_el0_svc+0x44/0x5c
      [   37.116319]  el0_svc+0x38/0x78
      [   37.119401]  el0t_64_sync_handler+0x13c/0x158
      [   37.123788]  el0t_64_sync+0x190/0x194
      [   37.127474]
      [   37.128977] The buggy address belongs to the object at ffff00081037c2a0
      [   37.128977]  which belongs to the cache kmalloc-8 of size 8
      [   37.141177] The buggy address is located 0 bytes inside of
      [   37.141177]  allocated 3-byte region [ffff00081037c2a0, ffff00081037c2a3)
      [   37.153465]
      [   37.154971] The buggy address belongs to the physical page:
      [   37.160559] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x89037c
      [   37.168596] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
      [   37.175149] page_type: 0xfdffffff(slab)
      [   37.179021] raw: 0bfffe0000000000 ffff000800002500 dead000000000122 0000000000000000
      [   37.186788] raw: 0000000000000000 0000000080800080 00000001fdffffff 0000000000000000
      [   37.194553] page dumped because: kasan: bad access detected
      [   37.200144]
      [   37.201647] Memory state around the buggy address:
      [   37.206460]  ffff00081037c180: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc
      [   37.213701]  ffff00081037c200: fa fc fc fc 05 fc fc fc 03 fc fc fc 02 fc fc fc
      [   37.220946] >ffff00081037c280: 06 fc fc fc 03 fc fc fc fc fc fc fc fc fc fc fc
      [   37.228186]                                ^
      [   37.232473]  ffff00081037c300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   37.239718]  ffff00081037c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   37.246962] ==================================================================
      [   37.254394] Disabling lock debugging due to kernel taint
      0+1 records in
      0+1 records out
      3 bytes copied, 0.335911 s, 0.0 kB/s
      
      Fixes: a5356aef ("spi: spi-mem: Add driver for NXP FlexSPI controller")
      Cc: stable@kernel.org
      Signed-off-by: default avatarHan Xu <han.xu@nxp.com>
      Link: https://patch.msgid.link/20240911211146.3337068-1-han.xu@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      2a8787c1