Skip to content
Snippets Groups Projects
  1. Mar 06, 2024
    • Oleksij Rempel's avatar
      lan78xx: enable auto speed configuration for LAN7850 if no EEPROM is detected · c1c7396b
      Oleksij Rempel authored
      
      [ Upstream commit 0e67899a ]
      
      Same as LAN7800, LAN7850 can be used without EEPROM. If EEPROM is not
      present or not flashed, LAN7850 will fail to sync the speed detected by the PHY
      with the MAC. In case link speed is 100Mbit, it will accidentally work,
      otherwise no data can be transferred.
      
      Better way would be to implement link_up callback, or set auto speed
      configuration unconditionally. But this changes would be more intrusive.
      So, for now, set it only if no EEPROM is found.
      
      Fixes: e69647a1 ("lan78xx: Set ASD in MAC_CR when EEE is enabled.")
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/r/20240222123839.2816561-1-o.rempel@pengutronix.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c1c7396b
    • Eric Dumazet's avatar
      ipv6: fix potential "struct net" leak in inet6_rtm_getaddr() · 810fa7d5
      Eric Dumazet authored
      
      [ Upstream commit 10bfd453 ]
      
      It seems that if userspace provides a correct IFA_TARGET_NETNSID value
      but no IFA_ADDRESS and IFA_LOCAL attributes, inet6_rtm_getaddr()
      returns -EINVAL with an elevated "struct net" refcount.
      
      Fixes: 6ecf4c37 ("ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: David Ahern <dsahern@kernel.org>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      810fa7d5
    • Yunjian Wang's avatar
      tun: Fix xdp_rxq_info's queue_index when detaching · 906986fe
      Yunjian Wang authored
      
      [ Upstream commit 2a770cdc ]
      
      When a queue(tfile) is detached, we only update tfile's queue_index,
      but do not update xdp_rxq_info's queue_index. This patch fixes it.
      
      Fixes: 8bf5c4ee ("tun: setup xdp_rxq_info")
      Signed-off-by: default avatarYunjian Wang <wangyunjian@huawei.com>
      Link: https://lore.kernel.org/r/1708398727-46308-1-git-send-email-wangyunjian@huawei.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      906986fe
    • Florian Westphal's avatar
      net: ip_tunnel: prevent perpetual headroom growth · 2e95350f
      Florian Westphal authored
      
      [ Upstream commit 5ae1e992 ]
      
      syzkaller triggered following kasan splat:
      BUG: KASAN: use-after-free in __skb_flow_dissect+0x19d1/0x7a50 net/core/flow_dissector.c:1170
      Read of size 1 at addr ffff88812fb4000e by task syz-executor183/5191
      [..]
       kasan_report+0xda/0x110 mm/kasan/report.c:588
       __skb_flow_dissect+0x19d1/0x7a50 net/core/flow_dissector.c:1170
       skb_flow_dissect_flow_keys include/linux/skbuff.h:1514 [inline]
       ___skb_get_hash net/core/flow_dissector.c:1791 [inline]
       __skb_get_hash+0xc7/0x540 net/core/flow_dissector.c:1856
       skb_get_hash include/linux/skbuff.h:1556 [inline]
       ip_tunnel_xmit+0x1855/0x33c0 net/ipv4/ip_tunnel.c:748
       ipip_tunnel_xmit+0x3cc/0x4e0 net/ipv4/ipip.c:308
       __netdev_start_xmit include/linux/netdevice.h:4940 [inline]
       netdev_start_xmit include/linux/netdevice.h:4954 [inline]
       xmit_one net/core/dev.c:3548 [inline]
       dev_hard_start_xmit+0x13d/0x6d0 net/core/dev.c:3564
       __dev_queue_xmit+0x7c1/0x3d60 net/core/dev.c:4349
       dev_queue_xmit include/linux/netdevice.h:3134 [inline]
       neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1592
       ...
       ip_finish_output2+0x833/0x2550 net/ipv4/ip_output.c:235
       ip_finish_output+0x31/0x310 net/ipv4/ip_output.c:323
       ..
       iptunnel_xmit+0x5b4/0x9b0 net/ipv4/ip_tunnel_core.c:82
       ip_tunnel_xmit+0x1dbc/0x33c0 net/ipv4/ip_tunnel.c:831
       ipgre_xmit+0x4a1/0x980 net/ipv4/ip_gre.c:665
       __netdev_start_xmit include/linux/netdevice.h:4940 [inline]
       netdev_start_xmit include/linux/netdevice.h:4954 [inline]
       xmit_one net/core/dev.c:3548 [inline]
       dev_hard_start_xmit+0x13d/0x6d0 net/core/dev.c:3564
       ...
      
      The splat occurs because skb->data points past skb->head allocated area.
      This is because neigh layer does:
        __skb_pull(skb, skb_network_offset(skb));
      
      ... but skb_network_offset() returns a negative offset and __skb_pull()
      arg is unsigned.  IOW, we skb->data gets "adjusted" by a huge value.
      
      The negative value is returned because skb->head and skb->data distance is
      more than 64k and skb->network_header (u16) has wrapped around.
      
      The bug is in the ip_tunnel infrastructure, which can cause
      dev->needed_headroom to increment ad infinitum.
      
      The syzkaller reproducer consists of packets getting routed via a gre
      tunnel, and route of gre encapsulated packets pointing at another (ipip)
      tunnel.  The ipip encapsulation finds gre0 as next output device.
      
      This results in the following pattern:
      
      1). First packet is to be sent out via gre0.
      Route lookup found an output device, ipip0.
      
      2).
      ip_tunnel_xmit for gre0 bumps gre0->needed_headroom based on the future
      output device, rt.dev->needed_headroom (ipip0).
      
      3).
      ip output / start_xmit moves skb on to ipip0. which runs the same
      code path again (xmit recursion).
      
      4).
      Routing step for the post-gre0-encap packet finds gre0 as output device
      to use for ipip0 encapsulated packet.
      
      tunl0->needed_headroom is then incremented based on the (already bumped)
      gre0 device headroom.
      
      This repeats for every future packet:
      
      gre0->needed_headroom gets inflated because previous packets' ipip0 step
      incremented rt->dev (gre0) headroom, and ipip0 incremented because gre0
      needed_headroom was increased.
      
      For each subsequent packet, gre/ipip0->needed_headroom grows until
      post-expand-head reallocations result in a skb->head/data distance of
      more than 64k.
      
      Once that happens, skb->network_header (u16) wraps around when
      pskb_expand_head tries to make sure that skb_network_offset() is unchanged
      after the headroom expansion/reallocation.
      
      After this skb_network_offset(skb) returns a different (and negative)
      result post headroom expansion.
      
      The next trip to neigh layer (or anything else that would __skb_pull the
      network header) makes skb->data point to a memory location outside
      skb->head area.
      
      v2: Cap the needed_headroom update to an arbitarily chosen upperlimit to
      prevent perpetual increase instead of dropping the headroom increment
      completely.
      
      Reported-and-tested-by: default avatar <syzbot+bfde3bef047a81b8fde6@syzkaller.appspotmail.com>
      Closes: https://groups.google.com/g/syzkaller-bugs/c/fL9G6GtWskY/m/VKk_PR5FBAAJ
      
      
      Fixes: 243aad83 ("ip_gre: include route header_len in max_headroom calculation")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240220135606.4939-1-fw@strlen.de
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2e95350f
    • Ryosuke Yasuoka's avatar
      netlink: Fix kernel-infoleak-after-free in __skb_datagram_iter · f19d1f98
      Ryosuke Yasuoka authored
      
      [ Upstream commit 661779e1 ]
      
      syzbot reported the following uninit-value access issue [1]:
      
      netlink_to_full_skb() creates a new `skb` and puts the `skb->data`
      passed as a 1st arg of netlink_to_full_skb() onto new `skb`. The data
      size is specified as `len` and passed to skb_put_data(). This `len`
      is based on `skb->end` that is not data offset but buffer offset. The
      `skb->end` contains data and tailroom. Since the tailroom is not
      initialized when the new `skb` created, KMSAN detects uninitialized
      memory area when copying the data.
      
      This patch resolved this issue by correct the len from `skb->end` to
      `skb->len`, which is the actual data offset.
      
      BUG: KMSAN: kernel-infoleak-after-free in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in copy_to_user_iter lib/iov_iter.c:24 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in iterate_ubuf include/linux/iov_iter.h:29 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in iterate_and_advance include/linux/iov_iter.h:271 [inline]
      BUG: KMSAN: kernel-infoleak-after-free in _copy_to_iter+0x364/0x2520 lib/iov_iter.c:186
       instrument_copy_to_user include/linux/instrumented.h:114 [inline]
       copy_to_user_iter lib/iov_iter.c:24 [inline]
       iterate_ubuf include/linux/iov_iter.h:29 [inline]
       iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
       iterate_and_advance include/linux/iov_iter.h:271 [inline]
       _copy_to_iter+0x364/0x2520 lib/iov_iter.c:186
       copy_to_iter include/linux/uio.h:197 [inline]
       simple_copy_to_iter+0x68/0xa0 net/core/datagram.c:532
       __skb_datagram_iter+0x123/0xdc0 net/core/datagram.c:420
       skb_copy_datagram_iter+0x5c/0x200 net/core/datagram.c:546
       skb_copy_datagram_msg include/linux/skbuff.h:3960 [inline]
       packet_recvmsg+0xd9c/0x2000 net/packet/af_packet.c:3482
       sock_recvmsg_nosec net/socket.c:1044 [inline]
       sock_recvmsg net/socket.c:1066 [inline]
       sock_read_iter+0x467/0x580 net/socket.c:1136
       call_read_iter include/linux/fs.h:2014 [inline]
       new_sync_read fs/read_write.c:389 [inline]
       vfs_read+0x8f6/0xe00 fs/read_write.c:470
       ksys_read+0x20f/0x4c0 fs/read_write.c:613
       __do_sys_read fs/read_write.c:623 [inline]
       __se_sys_read fs/read_write.c:621 [inline]
       __x64_sys_read+0x93/0xd0 fs/read_write.c:621
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      Uninit was stored to memory at:
       skb_put_data include/linux/skbuff.h:2622 [inline]
       netlink_to_full_skb net/netlink/af_netlink.c:181 [inline]
       __netlink_deliver_tap_skb net/netlink/af_netlink.c:298 [inline]
       __netlink_deliver_tap+0x5be/0xc90 net/netlink/af_netlink.c:325
       netlink_deliver_tap net/netlink/af_netlink.c:338 [inline]
       netlink_deliver_tap_kernel net/netlink/af_netlink.c:347 [inline]
       netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
       netlink_unicast+0x10f1/0x1250 net/netlink/af_netlink.c:1368
       netlink_sendmsg+0x1238/0x13d0 net/netlink/af_netlink.c:1910
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg net/socket.c:745 [inline]
       ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2584
       ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638
       __sys_sendmsg net/socket.c:2667 [inline]
       __do_sys_sendmsg net/socket.c:2676 [inline]
       __se_sys_sendmsg net/socket.c:2674 [inline]
       __x64_sys_sendmsg+0x307/0x490 net/socket.c:2674
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      Uninit was created at:
       free_pages_prepare mm/page_alloc.c:1087 [inline]
       free_unref_page_prepare+0xb0/0xa40 mm/page_alloc.c:2347
       free_unref_page_list+0xeb/0x1100 mm/page_alloc.c:2533
       release_pages+0x23d3/0x2410 mm/swap.c:1042
       free_pages_and_swap_cache+0xd9/0xf0 mm/swap_state.c:316
       tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
       tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
       tlb_flush_mmu+0x6f5/0x980 mm/mmu_gather.c:300
       tlb_finish_mmu+0x101/0x260 mm/mmu_gather.c:392
       exit_mmap+0x49e/0xd30 mm/mmap.c:3321
       __mmput+0x13f/0x530 kernel/fork.c:1349
       mmput+0x8a/0xa0 kernel/fork.c:1371
       exit_mm+0x1b8/0x360 kernel/exit.c:567
       do_exit+0xd57/0x4080 kernel/exit.c:858
       do_group_exit+0x2fd/0x390 kernel/exit.c:1021
       __do_sys_exit_group kernel/exit.c:1032 [inline]
       __se_sys_exit_group kernel/exit.c:1030 [inline]
       __x64_sys_exit_group+0x3c/0x50 kernel/exit.c:1030
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x63/0x6b
      
      Bytes 3852-3903 of 3904 are uninitialized
      Memory access of size 3904 starts at ffff88812ea1e000
      Data copied to user address 0000000020003280
      
      CPU: 1 PID: 5043 Comm: syz-executor297 Not tainted 6.7.0-rc5-syzkaller-00047-g5bd7ef53ffe5 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
      
      Fixes: 1853c949 ("netlink, mmap: transform mmap skb into full skb on taps")
      Reported-and-tested-by: default avatar <syzbot+34ad5fab48f7bf510349@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=34ad5fab48f7bf510349
      
       [1]
      Signed-off-by: default avatarRyosuke Yasuoka <ryasuoka@redhat.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20240221074053.1794118-1-ryasuoka@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f19d1f98
    • Han Xu's avatar
      mtd: spinand: gigadevice: Fix the get ecc status issue · acd9f6d4
      Han Xu authored
      
      [ Upstream commit 59950610 ]
      
      Some GigaDevice ecc_get_status functions use on-stack buffer for
      spi_mem_op causes spi_mem_check_op failing, fix the issue by using
      spinand scratchbuf.
      
      Fixes: c40c7a99 ("mtd: spinand: Add support for GigaDevice GD5F1GQ4UExxG")
      Signed-off-by: default avatarHan Xu <han.xu@nxp.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20231108150701.593912-1-han.xu@nxp.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      acd9f6d4
    • Reto Schneider's avatar
      mtd: spinand: gigadevice: Support GD5F1GQ5UExxG · 8e3a8675
      Reto Schneider authored
      
      [ Upstream commit 469b9924 ]
      
      The relevant changes to the already existing GD5F1GQ4UExxG support has
      been determined by consulting the GigaDevice product change notice
      AN-0392-10, version 1.0 from November 30, 2020.
      
      As the overlaps are huge, variable names have been generalized
      accordingly.
      
      Apart from the lowered ECC strength (4 instead of 8 bits per 512 bytes),
      the new device ID, and the extra quad IO dummy byte, no changes had to
      be taken into account.
      
      New hardware features are not supported, namely:
       - Power on reset
       - Unique ID
       - Double transfer rate (DTR)
       - Parameter page
       - Random data quad IO
      
      The inverted semantic of the "driver strength" register bits, defaulting
      to 100% instead of 50% for the Q5 devices, got ignored as the driver has
      never touched them anyway.
      
      The no longer supported "read from cache during block erase"
      functionality is not reflected as the current SPI NAND core does not
      support it anyway.
      
      Implementation has been tested on MediaTek MT7688 based GARDENA smart
      Gateways using both, GigaDevice GD5F1GQ5UEYIG and GD5F1GQ4UBYIG.
      
      Signed-off-by: default avatarReto Schneider <reto.schneider@husqvarnagroup.com>
      Reviewed-by: default avatarFrieder Schrempf <frieder.schrempf@kontron.de>
      Reviewed-by: default avatarStefan Roese <sr@denx.de>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Link: https://lore.kernel.org/linux-mtd/20210211113619.3502-1-code@reto-schneider.ch
      
      
      Stable-dep-of: 59950610 ("mtd: spinand: gigadevice: Fix the get ecc status issue")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8e3a8675
    • zhenwei pi's avatar
      crypto: virtio/akcipher - Fix stack overflow on memcpy · 37077ed1
      zhenwei pi authored
      [ Upstream commit c0ec2a71 ]
      
      sizeof(struct virtio_crypto_akcipher_session_para) is less than
      sizeof(struct virtio_crypto_op_ctrl_req::u), copying more bytes from
      stack variable leads stack overflow. Clang reports this issue by
      commands:
      make -j CC=clang-14 mrproper >/dev/null 2>&1
      make -j O=/tmp/crypto-build CC=clang-14 allmodconfig >/dev/null 2>&1
      make -j O=/tmp/crypto-build W=1 CC=clang-14 drivers/crypto/virtio/
        virtio_crypto_akcipher_algs.o
      
      Fixes: 59ca6c93 ("virtio-crypto: implement RSA algorithm")
      Link: https://lore.kernel.org/all/0a194a79-e3a3-45e7-be98-83abd3e1cb7e@roeck-us.net/
      
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarzhenwei pi <pizhenwei@bytedance.com>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      37077ed1
    • Hans de Goede's avatar
      platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names · bf85def4
      Hans de Goede authored
      [ Upstream commit dbcbfd66 ]
      
      On some devices the ACPI name of the touchscreen is e.g. either
      MSSL1680:00 or MSSL1680:01 depending on the BIOS version.
      
      This happens for example on the "Chuwi Hi8 Air" tablet where the initial
      commit's ts_data uses "MSSL1680:00" but the tablets from the github issue
      and linux-hardware.org probe linked below both use "MSSL1680:01".
      
      Replace the strcmp() match on ts_data->acpi_name with a strstarts()
      check to allow using a partial match on just the ACPI HID of "MSSL1680"
      and change the ts_data->acpi_name for the "Chuwi Hi8 Air" accordingly
      to fix the touchscreen not working on models where it is "MSSL1680:01".
      
      Note this drops the length check for I2C_NAME_SIZE. This never was
      necessary since the ACPI names used are never more then 11 chars and
      I2C_NAME_SIZE is 20 so the replaced strncmp() would always stop long
      before reaching I2C_NAME_SIZE.
      
      Link: https://linux-hardware.org/?computer=AC4301C0542A
      Fixes: bbb97d72 ("platform/x86: touchscreen_dmi: Add info for the Chuwi Hi8 Air tablet")
      Closes: https://github.com/onitake/gsl-firmware/issues/91
      
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20240212120608.30469-1-hdegoede@redhat.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf85def4
  2. Mar 01, 2024
Loading