Skip to content
Snippets Groups Projects
  1. Jul 07, 2022
    • Eric Dumazet's avatar
      net: bonding: fix possible NULL deref in rlb code · ec7269b2
      Eric Dumazet authored
      
      commit ab84db25 upstream.
      
      syzbot has two reports involving the same root cause.
      
      bond_alb_initialize() must not set bond->alb_info.rlb_enabled
      if a memory allocation error is detected.
      
      Report 1:
      
      general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
      CPU: 0 PID: 12276 Comm: kworker/u4:10 Not tainted 5.19.0-rc3-syzkaller-00132-g3b89b511ea0c #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Workqueue: netns cleanup_net
      RIP: 0010:rlb_clear_slave+0x10e/0x690 drivers/net/bonding/bond_alb.c:393
      Code: 8e fc 83 fb ff 0f 84 74 02 00 00 e8 cc 2a 8e fc 48 8b 44 24 08 89 dd 48 c1 e5 06 4c 8d 34 28 49 8d 7e 14 48 89 f8 48 c1 e8 03 <42> 0f b6 14 20 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85
      RSP: 0018:ffffc90018a8f678 EFLAGS: 00010203
      RAX: 0000000000000002 RBX: 0000000000000000 RCX: 0000000000000000
      RDX: ffff88803375bb00 RSI: ffffffff84ec4ac4 RDI: 0000000000000014
      RBP: 0000000000000000 R08: 0000000000000005 R09: 00000000ffffffff
      R10: 0000000000000000 R11: 0000000000000000 R12: dffffc0000000000
      R13: ffff8880ac889000 R14: 0000000000000000 R15: ffff88815a668c80
      FS: 0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00005597077e10b0 CR3: 0000000026668000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <TASK>
      bond_alb_deinit_slave+0x43c/0x6b0 drivers/net/bonding/bond_alb.c:1663
      __bond_release_one.cold+0x383/0xd53 drivers/net/bonding/bond_main.c:2370
      bond_slave_netdev_event drivers/net/bonding/bond_main.c:3778 [inline]
      bond_netdev_event+0x993/0xad0 drivers/net/bonding/bond_main.c:3889
      notifier_call_chain+0xb5/0x200 kernel/notifier.c:87
      call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945
      call_netdevice_notifiers_extack net/core/dev.c:1983 [inline]
      call_netdevice_notifiers net/core/dev.c:1997 [inline]
      unregister_netdevice_many+0x948/0x18b0 net/core/dev.c:10839
      default_device_exit_batch+0x449/0x590 net/core/dev.c:11333
      ops_exit_list+0x125/0x170 net/core/net_namespace.c:167
      cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594
      process_one_work+0x996/0x1610 kernel/workqueue.c:2289
      worker_thread+0x665/0x1080 kernel/workqueue.c:2436
      kthread+0x2e9/0x3a0 kernel/kthread.c:376
      ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302
      </TASK>
      
      Report 2:
      
      general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037]
      CPU: 1 PID: 5206 Comm: syz-executor.1 Not tainted 5.18.0-syzkaller-12108-g58f9d52ff689 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:rlb_req_update_slave_clients+0x109/0x2f0 drivers/net/bonding/bond_alb.c:502
      Code: 5d 18 8f fc 41 80 3e 00 0f 85 a5 01 00 00 89 d8 48 c1 e0 06 49 03 84 24 68 01 00 00 48 8d 78 30 49 89 c7 48 89 fa 48 c1 ea 03 <80> 3c 2a 00 0f 85 98 01 00 00 4d 39 6f 30 75 83 e8 22 18 8f fc 49
      RSP: 0018:ffffc9000300ee80 EFLAGS: 00010206
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc90016c11000
      RDX: 0000000000000006 RSI: ffffffff84eb6bf3 RDI: 0000000000000030
      RBP: dffffc0000000000 R08: 0000000000000005 R09: 00000000ffffffff
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff888027c80c80
      R13: ffff88807d7ff800 R14: ffffed1004f901bd R15: 0000000000000000
      FS:  00007f6f46c58700(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020010000 CR3: 00000000516cc000 CR4: 00000000003506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       alb_fasten_mac_swap+0x886/0xa80 drivers/net/bonding/bond_alb.c:1070
       bond_alb_handle_active_change+0x624/0x1050 drivers/net/bonding/bond_alb.c:1765
       bond_change_active_slave+0xfa1/0x29b0 drivers/net/bonding/bond_main.c:1173
       bond_select_active_slave+0x23f/0xa50 drivers/net/bonding/bond_main.c:1253
       bond_enslave+0x3b34/0x53b0 drivers/net/bonding/bond_main.c:2159
       do_set_master+0x1c8/0x220 net/core/rtnetlink.c:2577
       rtnl_newlink_create net/core/rtnetlink.c:3380 [inline]
       __rtnl_newlink+0x13ac/0x17e0 net/core/rtnetlink.c:3580
       rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593
       rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:734
       ____sys_sendmsg+0x6eb/0x810 net/socket.c:2492
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2546
       __sys_sendmsg net/socket.c:2575 [inline]
       __do_sys_sendmsg net/socket.c:2584 [inline]
       __se_sys_sendmsg net/socket.c:2582 [inline]
       __x64_sys_sendmsg+0x132/0x220 net/socket.c:2582
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      RIP: 0033:0x7f6f45a89109
      Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 b8 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007f6f46c58168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00007f6f45b9c030 RCX: 00007f6f45a89109
      RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000006
      RBP: 00007f6f45ae308d R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 00007ffed99029af R14: 00007f6f46c58300 R15: 0000000000022000
       </TASK>
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Jay Vosburgh <j.vosburgh@gmail.com>
      Cc: Veaceslav Falico <vfalico@gmail.com>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Acked-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Link: https://lore.kernel.org/r/20220627102813.126264-1-edumazet@google.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec7269b2
    • Pablo Neira Ayuso's avatar
      netfilter: nft_dynset: restore set element counter when failing to update · 765da035
      Pablo Neira Ayuso authored
      
      commit 05907f10 upstream.
      
      This patch fixes a race condition.
      
      nft_rhash_update() might fail for two reasons:
      
      - Element already exists in the hashtable.
      - Another packet won race to insert an entry in the hashtable.
      
      In both cases, new() has already bumped the counter via atomic_add_unless(),
      therefore, decrement the set element counter.
      
      Fixes: 22fe54d5 ("netfilter: nf_tables: add support for dynamic set updates")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      765da035
    • Jason Wang's avatar
      caif_virtio: fix race between virtio_device_ready() and ndo_open() · eaaa59ae
      Jason Wang authored
      
      commit 11a37eb6 upstream.
      
      We currently depend on probe() calling virtio_device_ready() -
      which happens after netdev
      registration. Since ndo_open() can be called immediately
      after register_netdev, this means there exists a race between
      ndo_open() and virtio_device_ready(): the driver may start to use the
      device (e.g. TX) before DRIVER_OK which violates the spec.
      
      Fix this by switching to use register_netdevice() and protect the
      virtio_device_ready() with rtnl_lock() to make sure ndo_open() can
      only be called after virtio_device_ready().
      
      Fixes: 0d2e1a29 ("caif_virtio: Introduce caif over virtio")
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Message-Id: <20220620051115.3142-3-jasowang@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eaaa59ae
    • Jason A. Donenfeld's avatar
      powerpc/powernv: wire up rng during setup_arch · 432e0083
      Jason A. Donenfeld authored
      
      commit f3eac426 upstream.
      
      The platform's RNG must be available before random_init() in order to be
      useful for initial seeding, which in turn means that it needs to be
      called from setup_arch(), rather than from an init call.
      
      Complicating things, however, is that POWER8 systems need some per-cpu
      state and kmalloc, which isn't available at this stage. So we split
      things up into an early phase and a later opportunistic phase. This
      commit also removes some noisy log messages that don't add much.
      
      Fixes: a4da0d50 ("powerpc: Implement arch_get_random_long/int() for powernv")
      Cc: stable@vger.kernel.org # v3.13+
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      [mpe: Add of_node_put(), use pnv naming, minor change log editing]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20220621140849.127227-1-Jason@zx2c4.com
      
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      432e0083
    • Oliver Neukum's avatar
      usbnet: fix memory allocation in helpers · 671191ce
      Oliver Neukum authored
      
      commit e65af540 upstream.
      
      usbnet provides some helper functions that are also used in
      the context of reset() operations. During a reset the other
      drivers on a device are unable to operate. As that can be block
      drivers, a driver for another interface cannot use paging
      in its memory allocations without risking a deadlock.
      Use GFP_NOIO in the helpers.
      
      Fixes: 877bd862 ("usbnet: introduce usbnet 3 command helpers")
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Link: https://lore.kernel.org/r/20220628093517.7469-1-oneukum@suse.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      671191ce
    • Oliver Neukum's avatar
      usbnet: make sure no NULL pointer is passed through · 5e69b6a2
      Oliver Neukum authored
      
      commit 6c22fce0 upstream.
      
      Coverity reports:
      
      	** CID 751368:  Null pointer dereferences  (FORWARD_NULL)
      	/drivers/net/usb/usbnet.c: 1925 in __usbnet_read_cmd()
      
      	________________________________________________________________________________________________________
      	*** CID 751368:  Null pointer dereferences  (FORWARD_NULL)
      	/drivers/net/usb/usbnet.c: 1925 in __usbnet_read_cmd()
      	1919     EXPORT_SYMBOL(usbnet_link_change);
      	1920
      	1921     /*-------------------------------------------------------------------------*/
      	1922     static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
      	1923                                 u16 value, u16 index, void *data, u16 size)
      	1924     {
      	>>>     CID 751368:  Null pointer dereferences  (FORWARD_NULL)
      	>>>     Assigning: "buf" = "NULL".
      	1925            void *buf = NULL;
      	1926            int err = -ENOMEM;
      	1927
      	1928            netdev_dbg(dev->net, "usbnet_read_cmd cmd=0x%02x reqtype=%02x"
      	1929                       " value=0x%04x index=0x%04x size=%d\n",
      	1930                       cmd, reqtype, value, index, size);
      
      	** CID 751370:  Null pointer dereferences  (FORWARD_NULL)
      	/drivers/net/usb/usbnet.c: 1952 in __usbnet_write_cmd()
      
      	________________________________________________________________________________________________________
      	*** CID 751370:  Null pointer dereferences  (FORWARD_NULL)
      	/drivers/net/usb/usbnet.c: 1952 in __usbnet_write_cmd()
      	1946     }
      	1947
      	1948     static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
      	1949                                  u16 value, u16 index, const void *data,
      	1950                                  u16 size)
      	1951     {
      	>>>     CID 751370:  Null pointer dereferences  (FORWARD_NULL)
      	>>>     Assigning: "buf" = "NULL".
      	1952            void *buf = NULL;
      	1953            int err = -ENOMEM;
      	1954
      	1955            netdev_dbg(dev->net, "usbnet_write_cmd cmd=0x%02x reqtype=%02x"
      	1956                       " value=0x%04x index=0x%04x size=%d\n",
      	1957                       cmd, reqtype, value, index, size);
      
      	** CID 1325026:  Null pointer dereferences  (FORWARD_NULL)
      	/drivers/net/usb/ch9200.c: 143 in control_write()
      
      It is valid to offer commands without a buffer, but then you need a size
      of zero. This should actually be checked.
      
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5e69b6a2
    • Jose Alonso's avatar
      net: usb: ax88179_178a: Fix packet receiving · 4fe8dcf9
      Jose Alonso authored
      
      commit f8ebb3ac upstream.
      
      This patch corrects packet receiving in ax88179_rx_fixup.
      
      - problem observed:
        ifconfig shows allways a lot of 'RX Errors' while packets
        are received normally.
      
        This occurs because ax88179_rx_fixup does not recognise properly
        the usb urb received.
        The packets are normally processed and at the end, the code exits
        with 'return 0', generating RX Errors.
        (pkt_cnt==-2 and ptk_hdr over field rx_hdr trying to identify
         another packet there)
      
        This is a usb urb received by "tcpdump -i usbmon2 -X" on a
        little-endian CPU:
        0x0000:  eeee f8e3 3b19 87a0 94de 80e3 daac 0800
                 ^         packet 1 start (pkt_len = 0x05ec)
                 ^^^^      IP alignment pseudo header
                      ^    ethernet packet start
                 last byte ethernet packet   v
                 padding (8-bytes aligned)     vvvv vvvv
        0x05e0:  c92d d444 1420 8a69 83dd 272f e82b 9811
        0x05f0:  eeee f8e3 3b19 87a0 94de 80e3 daac 0800
        ...      ^ packet 2
        0x0be0:  eeee f8e3 3b19 87a0 94de 80e3 daac 0800
        ...
        0x1130:  9d41 9171 8a38 0ec5 eeee f8e3 3b19 87a0
        ...
        0x1720:  8cfc 15ff 5e4c e85c eeee f8e3 3b19 87a0
        ...
        0x1d10:  ecfa 2a3a 19ab c78c eeee f8e3 3b19 87a0
        ...
        0x2070:  eeee f8e3 3b19 87a0 94de 80e3 daac 0800
        ...      ^ packet 7
        0x2120:  7c88 4ca5 5c57 7dcc 0d34 7577 f778 7e0a
        0x2130:  f032 e093 7489 0740 3008 ec05 0000 0080
                                     ====1==== ====2====
                 hdr_off             ^
                 pkt_len = 0x05ec         ^^^^
                 AX_RXHDR_*=0x00830  ^^^^   ^
                 pkt_len = 0                        ^^^^
                 AX_RXHDR_DROP_ERR=0x80000000  ^^^^   ^
        0x2140:  3008 ec05 0000 0080 3008 5805 0000 0080
        0x2150:  3008 ec05 0000 0080 3008 ec05 0000 0080
        0x2160:  3008 5803 0000 0080 3008 c800 0000 0080
                 ===11==== ===12==== ===13==== ===14====
        0x2170:  0000 0000 0e00 3821
                           ^^^^ ^^^^ rx_hdr
                           ^^^^      pkt_cnt=14
                                ^^^^ hdr_off=0x2138
                 ^^^^ ^^^^           padding
      
        The dump shows that pkt_cnt is the number of entrys in the
        per-packet metadata. It is "2 * packet count".
        Each packet have two entrys. The first have a valid
        value (pkt_len and AX_RXHDR_*) and the second have a
        dummy-header 0x80000000 (pkt_len=0 with AX_RXHDR_DROP_ERR).
        Why exists dummy-header for each packet?!?
        My guess is that this was done probably to align the
        entry for each packet to 64-bits and maintain compatibility
        with old firmware.
        There is also a padding (0x00000000) before the rx_hdr to
        align the end of rx_hdr to 64-bit.
        Note that packets have a alignment of 64-bits (8-bytes).
      
        This patch assumes that the dummy-header and the last
        padding are optional. So it preserves semantics and
        recognises the same valid packets as the current code.
      
        This patch was made using only the dumpfile information and
        tested with only one device:
        0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet
      
      Fixes: 57bc3d3a ("net: usb: ax88179_178a: Fix out-of-bounds accesses in RX fixup")
      Fixes: e2ca90c2 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
      Signed-off-by: default avatarJose Alonso <joalonsof@gmail.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Link: https://lore.kernel.org/r/d6970bb04bf67598af4d316eaeb1792040b18cfd.camel@gmail.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4fe8dcf9
    • Duoming Zhou's avatar
      net: rose: fix UAF bugs caused by timer handler · 3ab68a95
      Duoming Zhou authored
      
      commit 9cc02ede upstream.
      
      There are UAF bugs in rose_heartbeat_expiry(), rose_timer_expiry()
      and rose_idletimer_expiry(). The root cause is that del_timer()
      could not stop the timer handler that is running and the refcount
      of sock is not managed properly.
      
      One of the UAF bugs is shown below:
      
          (thread 1)          |        (thread 2)
                              |  rose_bind
                              |  rose_connect
                              |    rose_start_heartbeat
      rose_release            |    (wait a time)
        case ROSE_STATE_0     |
        rose_destroy_socket   |  rose_heartbeat_expiry
          rose_stop_heartbeat |
          sock_put(sk)        |    ...
        sock_put(sk) // FREE  |
                              |    bh_lock_sock(sk) // USE
      
      The sock is deallocated by sock_put() in rose_release() and
      then used by bh_lock_sock() in rose_heartbeat_expiry().
      
      Although rose_destroy_socket() calls rose_stop_heartbeat(),
      it could not stop the timer that is running.
      
      The KASAN report triggered by POC is shown below:
      
      BUG: KASAN: use-after-free in _raw_spin_lock+0x5a/0x110
      Write of size 4 at addr ffff88800ae59098 by task swapper/3/0
      ...
      Call Trace:
       <IRQ>
       dump_stack_lvl+0xbf/0xee
       print_address_description+0x7b/0x440
       print_report+0x101/0x230
       ? irq_work_single+0xbb/0x140
       ? _raw_spin_lock+0x5a/0x110
       kasan_report+0xed/0x120
       ? _raw_spin_lock+0x5a/0x110
       kasan_check_range+0x2bd/0x2e0
       _raw_spin_lock+0x5a/0x110
       rose_heartbeat_expiry+0x39/0x370
       ? rose_start_heartbeat+0xb0/0xb0
       call_timer_fn+0x2d/0x1c0
       ? rose_start_heartbeat+0xb0/0xb0
       expire_timers+0x1f3/0x320
       __run_timers+0x3ff/0x4d0
       run_timer_softirq+0x41/0x80
       __do_softirq+0x233/0x544
       irq_exit_rcu+0x41/0xa0
       sysvec_apic_timer_interrupt+0x8c/0xb0
       </IRQ>
       <TASK>
       asm_sysvec_apic_timer_interrupt+0x1b/0x20
      RIP: 0010:default_idle+0xb/0x10
      RSP: 0018:ffffc9000012fea0 EFLAGS: 00000202
      RAX: 000000000000bcae RBX: ffff888006660f00 RCX: 000000000000bcae
      RDX: 0000000000000001 RSI: ffffffff843a11c0 RDI: ffffffff843a1180
      RBP: dffffc0000000000 R08: dffffc0000000000 R09: ffffed100da36d46
      R10: dfffe9100da36d47 R11: ffffffff83cf0950 R12: 0000000000000000
      R13: 1ffff11000ccc1e0 R14: ffffffff8542af28 R15: dffffc0000000000
      ...
      Allocated by task 146:
       __kasan_kmalloc+0xc4/0xf0
       sk_prot_alloc+0xdd/0x1a0
       sk_alloc+0x2d/0x4e0
       rose_create+0x7b/0x330
       __sock_create+0x2dd/0x640
       __sys_socket+0xc7/0x270
       __x64_sys_socket+0x71/0x80
       do_syscall_64+0x43/0x90
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Freed by task 152:
       kasan_set_track+0x4c/0x70
       kasan_set_free_info+0x1f/0x40
       ____kasan_slab_free+0x124/0x190
       kfree+0xd3/0x270
       __sk_destruct+0x314/0x460
       rose_release+0x2fa/0x3b0
       sock_close+0xcb/0x230
       __fput+0x2d9/0x650
       task_work_run+0xd6/0x160
       exit_to_user_mode_loop+0xc7/0xd0
       exit_to_user_mode_prepare+0x4e/0x80
       syscall_exit_to_user_mode+0x20/0x40
       do_syscall_64+0x4f/0x90
       entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      This patch adds refcount of sock when we use functions
      such as rose_start_heartbeat() and so on to start timer,
      and decreases the refcount of sock when timer is finished
      or deleted by functions such as rose_stop_heartbeat()
      and so on. As a result, the UAF bugs could be mitigated.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Tested-by: default avatarDuoming Zhou <duoming@zju.edu.cn>
      Link: https://lore.kernel.org/r/20220629002640.5693-1-duoming@zju.edu.cn
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3ab68a95
    • Chuck Lever's avatar
      SUNRPC: Fix READ_PLUS crasher · cc817b7a
      Chuck Lever authored
      
      commit a23dd544 upstream.
      
      Looks like there are still cases when "space_left - frag1bytes" can
      legitimately exceed PAGE_SIZE. Ensure that xdr->end always remains
      within the current encode buffer.
      
      Reported-by: default avatarBruce Fields <bfields@fieldses.org>
      Reported-by: default avatarZorro Lang <zlang@redhat.com>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=216151
      
      
      Fixes: 6c254bf3 ("SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()")
      Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc817b7a
    • Mikulas Patocka's avatar
      dm raid: fix KASAN warning in raid5_add_disks · 2d4e7c98
      Mikulas Patocka authored
      
      commit 617b3658 upstream.
      
      There's a KASAN warning in raid5_add_disk when running the LVM testsuite.
      The warning happens in the test
      lvconvert-raid-reshape-linear_to_raid6-single-type.sh. We fix the warning
      by verifying that rdev->saved_raid_disk is within limits.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d4e7c98
  2. Jul 02, 2022
Loading