Skip to content
  1. Sep 23, 2023
    • Olga Zaborska's avatar
      igbvf: Change IGBVF_MIN to allow set rx/tx value between 64 and 80 · 6bdb9889
      Olga Zaborska authored
      [ Upstream commit 83607175 ]
      
      Change the minimum value of RX/TX descriptors to 64 to enable setting the rx/tx
      value between 64 and 80. All igbvf devices can use as low as 64 descriptors.
      This change will unify igbvf with other drivers.
      Based on commit 7b1be198 ("e1000e: lower ring minimum size to 64")
      
      Fixes: d4e0fe01
      
       ("igbvf: add new driver to support 82576 virtual functions")
      Signed-off-by: default avatarOlga Zaborska <olga.zaborska@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6bdb9889
    • Shigeru Yoshida's avatar
      kcm: Destroy mutex in kcm_exit_net() · 4ffbdd3a
      Shigeru Yoshida authored
      [ Upstream commit 6ad40b36 ]
      
      kcm_exit_net() should call mutex_destroy() on knet->mutex. This is especially
      needed if CONFIG_DEBUG_MUTEXES is enabled.
      
      Fixes: ab7ac4eb
      
       ("kcm: Kernel Connection Multiplexor module")
      Signed-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
      Link: https://lore.kernel.org/r/20230902170708.1727999-1-syoshida@redhat.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4ffbdd3a
    • valis's avatar
      net: sched: sch_qfq: Fix UAF in qfq_dequeue() · d9f43fc5
      valis authored
      [ Upstream commit 8fc134fe ]
      
      When the plug qdisc is used as a class of the qfq qdisc it could trigger a
      UAF. This issue can be reproduced with following commands:
      
        tc qdisc add dev lo root handle 1: qfq
        tc class add dev lo parent 1: classid 1:1 qfq weight 1 maxpkt 512
        tc qdisc add dev lo parent 1:1 handle 2: plug
        tc filter add dev lo parent 1: basic classid 1:1
        ping -c1 127.0.0.1
      
      and boom:
      
      [  285.353793] BUG: KASAN: slab-use-after-free in qfq_dequeue+0xa7/0x7f0
      [  285.354910] Read of size 4 at addr ffff8880bad312a8 by task ping/144
      [  285.355903]
      [  285.356165] CPU: 1 PID: 144 Comm: ping Not tainted 6.5.0-rc3+ #4
      [  285.357112] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
      [  285.358376] Call Trace:
      [  285.358773]  <IRQ>
      [  285.359109]  dump_stack_lvl+0x44/0x60
      [  285.359708]  print_address_description.constprop.0+0x2c/0x3c0
      [  285.360611]  kasan_report+0x10c/0x120
      [  285.361195]  ? qfq_dequeue+0xa7/0x7f0
      [  285.361780]  qfq_dequeue+0xa7/0x7f0
      [  285.362342]  __qdisc_run+0xf1/0x970
      [  285.362903]  net_tx_action+0x28e/0x460
      [  285.363502]  __do_softirq+0x11b/0x3de
      [  285.364097]  do_softirq.part.0+0x72/0x90
      [  285.364721]  </IRQ>
      [  285.365072]  <TASK>
      [  285.365422]  __local_bh_enable_ip+0x77/0x90
      [  285.366079]  __dev_queue_xmit+0x95f/0x1550
      [  285.366732]  ? __pfx_csum_and_copy_from_iter+0x10/0x10
      [  285.367526]  ? __pfx___dev_queue_xmit+0x10/0x10
      [  285.368259]  ? __build_skb_around+0x129/0x190
      [  285.368960]  ? ip_generic_getfrag+0x12c/0x170
      [  285.369653]  ? __pfx_ip_generic_getfrag+0x10/0x10
      [  285.370390]  ? csum_partial+0x8/0x20
      [  285.370961]  ? raw_getfrag+0xe5/0x140
      [  285.371559]  ip_finish_output2+0x539/0xa40
      [  285.372222]  ? __pfx_ip_finish_output2+0x10/0x10
      [  285.372954]  ip_output+0x113/0x1e0
      [  285.373512]  ? __pfx_ip_output+0x10/0x10
      [  285.374130]  ? icmp_out_count+0x49/0x60
      [  285.374739]  ? __pfx_ip_finish_output+0x10/0x10
      [  285.375457]  ip_push_pending_frames+0xf3/0x100
      [  285.376173]  raw_sendmsg+0xef5/0x12d0
      [  285.376760]  ? do_syscall_64+0x40/0x90
      [  285.377359]  ? __static_call_text_end+0x136578/0x136578
      [  285.378173]  ? do_syscall_64+0x40/0x90
      [  285.378772]  ? kasan_enable_current+0x11/0x20
      [  285.379469]  ? __pfx_raw_sendmsg+0x10/0x10
      [  285.380137]  ? __sock_create+0x13e/0x270
      [  285.380673]  ? __sys_socket+0xf3/0x180
      [  285.381174]  ? __x64_sys_socket+0x3d/0x50
      [  285.381725]  ? entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      [  285.382425]  ? __rcu_read_unlock+0x48/0x70
      [  285.382975]  ? ip4_datagram_release_cb+0xd8/0x380
      [  285.383608]  ? __pfx_ip4_datagram_release_cb+0x10/0x10
      [  285.384295]  ? preempt_count_sub+0x14/0xc0
      [  285.384844]  ? __list_del_entry_valid+0x76/0x140
      [  285.385467]  ? _raw_spin_lock_bh+0x87/0xe0
      [  285.386014]  ? __pfx__raw_spin_lock_bh+0x10/0x10
      [  285.386645]  ? release_sock+0xa0/0xd0
      [  285.387148]  ? preempt_count_sub+0x14/0xc0
      [  285.387712]  ? freeze_secondary_cpus+0x348/0x3c0
      [  285.388341]  ? aa_sk_perm+0x177/0x390
      [  285.388856]  ? __pfx_aa_sk_perm+0x10/0x10
      [  285.389441]  ? check_stack_object+0x22/0x70
      [  285.390032]  ? inet_send_prepare+0x2f/0x120
      [  285.390603]  ? __pfx_inet_sendmsg+0x10/0x10
      [  285.391172]  sock_sendmsg+0xcc/0xe0
      [  285.391667]  __sys_sendto+0x190/0x230
      [  285.392168]  ? __pfx___sys_sendto+0x10/0x10
      [  285.392727]  ? kvm_clock_get_cycles+0x14/0x30
      [  285.393328]  ? set_normalized_timespec64+0x57/0x70
      [  285.393980]  ? _raw_spin_unlock_irq+0x1b/0x40
      [  285.394578]  ? __x64_sys_clock_gettime+0x11c/0x160
      [  285.395225]  ? __pfx___x64_sys_clock_gettime+0x10/0x10
      [  285.395908]  ? _copy_to_user+0x3e/0x60
      [  285.396432]  ? exit_to_user_mode_prepare+0x1a/0x120
      [  285.397086]  ? syscall_exit_to_user_mode+0x22/0x50
      [  285.397734]  ? do_syscall_64+0x71/0x90
      [  285.398258]  __x64_sys_sendto+0x74/0x90
      [  285.398786]  do_syscall_64+0x64/0x90
      [  285.399273]  ? exit_to_user_mode_prepare+0x1a/0x120
      [  285.399949]  ? syscall_exit_to_user_mode+0x22/0x50
      [  285.400605]  ? do_syscall_64+0x71/0x90
      [  285.401124]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      [  285.401807] RIP: 0033:0x495726
      [  285.402233] Code: ff ff ff f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 11 b8 2c 00 00 00 0f 09
      [  285.404683] RSP: 002b:00007ffcc25fb618 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      [  285.405677] RAX: ffffffffffffffda RBX: 0000000000000040 RCX: 0000000000495726
      [  285.406628] RDX: 0000000000000040 RSI: 0000000002518750 RDI: 0000000000000000
      [  285.407565] RBP: 00000000005205ef R08: 00000000005f8838 R09: 000000000000001c
      [  285.408523] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000002517634
      [  285.409460] R13: 00007ffcc25fb6f0 R14: 0000000000000003 R15: 0000000000000000
      [  285.410403]  </TASK>
      [  285.410704]
      [  285.410929] Allocated by task 144:
      [  285.411402]  kasan_save_stack+0x1e/0x40
      [  285.411926]  kasan_set_track+0x21/0x30
      [  285.412442]  __kasan_slab_alloc+0x55/0x70
      [  285.412973]  kmem_cache_alloc_node+0x187/0x3d0
      [  285.413567]  __alloc_skb+0x1b4/0x230
      [  285.414060]  __ip_append_data+0x17f7/0x1b60
      [  285.414633]  ip_append_data+0x97/0xf0
      [  285.415144]  raw_sendmsg+0x5a8/0x12d0
      [  285.415640]  sock_sendmsg+0xcc/0xe0
      [  285.416117]  __sys_sendto+0x190/0x230
      [  285.416626]  __x64_sys_sendto+0x74/0x90
      [  285.417145]  do_syscall_64+0x64/0x90
      [  285.417624]  entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      [  285.418306]
      [  285.418531] Freed by task 144:
      [  285.418960]  kasan_save_stack+0x1e/0x40
      [  285.419469]  kasan_set_track+0x21/0x30
      [  285.419988]  kasan_save_free_info+0x27/0x40
      [  285.420556]  ____kasan_slab_free+0x109/0x1a0
      [  285.421146]  kmem_cache_free+0x1c2/0x450
      [  285.421680]  __netif_receive_skb_core+0x2ce/0x1870
      [  285.422333]  __netif_receive_skb_one_core+0x97/0x140
      [  285.423003]  process_backlog+0x100/0x2f0
      [  285.423537]  __napi_poll+0x5c/0x2d0
      [  285.424023]  net_rx_action+0x2be/0x560
      [  285.424510]  __do_softirq+0x11b/0x3de
      [  285.425034]
      [  285.425254] The buggy address belongs to the object at ffff8880bad31280
      [  285.425254]  which belongs to the cache skbuff_head_cache of size 224
      [  285.426993] The buggy address is located 40 bytes inside of
      [  285.426993]  freed 224-byte region [ffff8880bad31280, ffff8880bad31360)
      [  285.428572]
      [  285.428798] The buggy address belongs to the physical page:
      [  285.429540] page:00000000f4b77674 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xbad31
      [  285.430758] flags: 0x100000000000200(slab|node=0|zone=1)
      [  285.431447] page_type: 0xffffffff()
      [  285.431934] raw: 0100000000000200 ffff88810094a8c0 dead000000000122 0000000000000000
      [  285.432757] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
      [  285.433562] page dumped because: kasan: bad access detected
      [  285.434144]
      [  285.434320] Memory state around the buggy address:
      [  285.434828]  ffff8880bad31180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  285.435580]  ffff8880bad31200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  285.436264] >ffff8880bad31280: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  285.436777]                                   ^
      [  285.437106]  ffff8880bad31300: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
      [  285.437616]  ffff8880bad31380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  285.438126] ==================================================================
      [  285.438662] Disabling lock debugging due to kernel taint
      
      Fix this by:
      1. Changing sch_plug's .peek handler to qdisc_peek_dequeued(), a
      function compatible with non-work-conserving qdiscs
      2. Checking the return value of qdisc_dequeue_peeked() in sch_qfq.
      
      Fixes: 462dbc91
      
       ("pkt_sched: QFQ Plus: fair-queueing service at DRR cost")
      Reported-by: default avatarvalis <sec@valis.email>
      Signed-off-by: default avatarvalis <sec@valis.email>
      Signed-off-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Link: https://lore.kernel.org/r/20230901162237.11525-1-jhs@mojatatu.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d9f43fc5
    • Kuniyuki Iwashima's avatar
      af_unix: Fix data race around sk->sk_err. · 7f0723b3
      Kuniyuki Iwashima authored
      [ Upstream commit b1928129 ]
      
      As with sk->sk_shutdown shown in the previous patch, sk->sk_err can be
      read locklessly by unix_dgram_sendmsg().
      
      Let's use READ_ONCE() for sk_err as well.
      
      Note that the writer side is marked by commit cc04410a ("af_unix:
      annotate lockless accesses to sk->sk_err").
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7f0723b3
    • Kuniyuki Iwashima's avatar
      af_unix: Fix data-races around sk->sk_shutdown. · da3a7957
      Kuniyuki Iwashima authored
      [ Upstream commit afe8764f ]
      
      sk->sk_shutdown is changed under unix_state_lock(sk), but
      unix_dgram_sendmsg() calls two functions to read sk_shutdown locklessly.
      
        sock_alloc_send_pskb
        `- sock_wait_for_wmem
      
      Let's use READ_ONCE() there.
      
      Note that the writer side was marked by commit e1d09c2c ("af_unix:
      Fix data races around sk->sk_shutdown.").
      
      BUG: KCSAN: data-race in sock_alloc_send_pskb / unix_release_sock
      
      write (marked) to 0xffff8880069af12c of 1 bytes by task 1 on cpu 1:
       unix_release_sock+0x75c/0x910 net/unix/af_unix.c:631
       unix_release+0x59/0x80 net/unix/af_unix.c:1053
       __sock_release+0x7d/0x170 net/socket.c:654
       sock_close+0x19/0x30 net/socket.c:1386
       __fput+0x2a3/0x680 fs/file_table.c:384
       ____fput+0x15/0x20 fs/file_table.c:412
       task_work_run+0x116/0x1a0 kernel/task_work.c:179
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
       exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204
       __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
       syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297
       do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
      read to 0xffff8880069af12c of 1 bytes by task 28650 on cpu 0:
       sock_alloc_send_pskb+0xd2/0x620 net/core/sock.c:2767
       unix_dgram_sendmsg+0x2f8/0x14f0 net/unix/af_unix.c:1944
       unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
       unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
       sock_sendmsg_nosec net/socket.c:725 [inline]
       sock_sendmsg+0x148/0x160 net/socket.c:748
       ____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
       ___sys_sendmsg+0xc6/0x140 net/socket.c:2548
       __sys_sendmsg+0x94/0x140 net/socket.c:2577
       __do_sys_sendmsg net/socket.c:2586 [inline]
       __se_sys_sendmsg net/socket.c:2584 [inline]
       __x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
      value changed: 0x00 -> 0x03
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 28650 Comm: systemd-coredum Not tainted 6.4.0-11989-g6843306689af #6
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      da3a7957
    • Kuniyuki Iwashima's avatar
      af_unix: Fix data-race around unix_tot_inflight. · 31b46d5e
      Kuniyuki Iwashima authored
      [ Upstream commit ade32bd8 ]
      
      unix_tot_inflight is changed under spin_lock(unix_gc_lock), but
      unix_release_sock() reads it locklessly.
      
      Let's use READ_ONCE() for unix_tot_inflight.
      
      Note that the writer side was marked by commit 9d6d7f1c ("af_unix:
      annote lockless accesses to unix_tot_inflight & gc_in_progress")
      
      BUG: KCSAN: data-race in unix_inflight / unix_release_sock
      
      write (marked) to 0xffffffff871852b8 of 4 bytes by task 123 on cpu 1:
       unix_inflight+0x130/0x180 net/unix/scm.c:64
       unix_attach_fds+0x137/0x1b0 net/unix/scm.c:123
       unix_scm_to_skb net/unix/af_unix.c:1832 [inline]
       unix_dgram_sendmsg+0x46a/0x14f0 net/unix/af_unix.c:1955
       sock_sendmsg_nosec net/socket.c:724 [inline]
       sock_sendmsg+0x148/0x160 net/socket.c:747
       ____sys_sendmsg+0x4e4/0x610 net/socket.c:2493
       ___sys_sendmsg+0xc6/0x140 net/socket.c:2547
       __sys_sendmsg+0x94/0x140 net/socket.c:2576
       __do_sys_sendmsg net/socket.c:2585 [inline]
       __se_sys_sendmsg net/socket.c:2583 [inline]
       __x64_sys_sendmsg+0x45/0x50 net/socket.c:2583
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      read to 0xffffffff871852b8 of 4 bytes by task 4891 on cpu 0:
       unix_release_sock+0x608/0x910 net/unix/af_unix.c:671
       unix_release+0x59/0x80 net/unix/af_unix.c:1058
       __sock_release+0x7d/0x170 net/socket.c:653
       sock_close+0x19/0x30 net/socket.c:1385
       __fput+0x179/0x5e0 fs/file_table.c:321
       ____fput+0x15/0x20 fs/file_table.c:349
       task_work_run+0x116/0x1a0 kernel/task_work.c:179
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
       exit_to_user_mode_prepare+0x174/0x180 kernel/entry/common.c:204
       __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
       syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:297
       do_syscall_64+0x4b/0x90 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      value changed: 0x00000000 -> 0x00000001
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 4891 Comm: systemd-coredum Not tainted 6.4.0-rc5-01219-gfa0e21fa4443 #5
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      
      Fixes: 9305cfa4
      
       ("[AF_UNIX]: Make unix_tot_inflight counter non-atomic")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      31b46d5e
    • Kuniyuki Iwashima's avatar
      af_unix: Fix data-races around user->unix_inflight. · df97b5ea
      Kuniyuki Iwashima authored
      [ Upstream commit 0bc36c06 ]
      
      user->unix_inflight is changed under spin_lock(unix_gc_lock),
      but too_many_unix_fds() reads it locklessly.
      
      Let's annotate the write/read accesses to user->unix_inflight.
      
      BUG: KCSAN: data-race in unix_attach_fds / unix_inflight
      
      write to 0xffffffff8546f2d0 of 8 bytes by task 44798 on cpu 1:
       unix_inflight+0x157/0x180 net/unix/scm.c:66
       unix_attach_fds+0x147/0x1e0 net/unix/scm.c:123
       unix_scm_to_skb net/unix/af_unix.c:1827 [inline]
       unix_dgram_sendmsg+0x46a/0x14f0 net/unix/af_unix.c:1950
       unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
       unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
       sock_sendmsg_nosec net/socket.c:725 [inline]
       sock_sendmsg+0x148/0x160 net/socket.c:748
       ____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
       ___sys_sendmsg+0xc6/0x140 net/socket.c:2548
       __sys_sendmsg+0x94/0x140 net/socket.c:2577
       __do_sys_sendmsg net/socket.c:2586 [inline]
       __se_sys_sendmsg net/socket.c:2584 [inline]
       __x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
      read to 0xffffffff8546f2d0 of 8 bytes by task 44814 on cpu 0:
       too_many_unix_fds net/unix/scm.c:101 [inline]
       unix_attach_fds+0x54/0x1e0 net/unix/scm.c:110
       unix_scm_to_skb net/unix/af_unix.c:1827 [inline]
       unix_dgram_sendmsg+0x46a/0x14f0 net/unix/af_unix.c:1950
       unix_seqpacket_sendmsg net/unix/af_unix.c:2308 [inline]
       unix_seqpacket_sendmsg+0xba/0x130 net/unix/af_unix.c:2292
       sock_sendmsg_nosec net/socket.c:725 [inline]
       sock_sendmsg+0x148/0x160 net/socket.c:748
       ____sys_sendmsg+0x4e4/0x610 net/socket.c:2494
       ___sys_sendmsg+0xc6/0x140 net/socket.c:2548
       __sys_sendmsg+0x94/0x140 net/socket.c:2577
       __do_sys_sendmsg net/socket.c:2586 [inline]
       __se_sys_sendmsg net/socket.c:2584 [inline]
       __x64_sys_sendmsg+0x45/0x50 net/socket.c:2584
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x6e/0xd8
      
      value changed: 0x000000000000000c -> 0x000000000000000d
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 44814 Comm: systemd-coredum Not tainted 6.4.0-11989-g6843306689af #6
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      
      Fixes: 712f4aad
      
       ("unix: properly account for FDs passed over unix sockets")
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Acked-by: default avatarWilly Tarreau <w@1wt.eu>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      df97b5ea
    • Alex Henrie's avatar
      net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr · d66e729a
      Alex Henrie authored
      [ Upstream commit f31867d0 ]
      
      The existing code incorrectly casted a negative value (the result of a
      subtraction) to an unsigned value without checking. For example, if
      /proc/sys/net/ipv6/conf/*/temp_prefered_lft was set to 1, the preferred
      lifetime would jump to 4 billion seconds. On my machine and network the
      shortest lifetime that avoided underflow was 3 seconds.
      
      Fixes: 76506a98
      
       ("IPv6: fix DESYNC_FACTOR")
      Signed-off-by: default avatarAlex Henrie <alexhenrie24@gmail.com>
      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>
      d66e729a
    • Corinna Vinschen's avatar
      igb: disable virtualization features on 82580 · 93e7fbc2
      Corinna Vinschen authored
      [ Upstream commit fa09bc40 ]
      
      Disable virtualization features on 82580 just as on i210/i211.
      This avoids that virt functions are acidentally called on 82850.
      
      Fixes: 55cac248
      
       ("igb: Add full support for 82580 devices")
      Signed-off-by: default avatarCorinna Vinschen <vinschen@redhat.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      93e7fbc2
    • Eric Dumazet's avatar
      net: read sk->sk_family once in sk_mc_loop() · 7586a66b
      Eric Dumazet authored
      [ Upstream commit a3e0fdf7 ]
      
      syzbot is playing with IPV6_ADDRFORM quite a lot these days,
      and managed to hit the WARN_ON_ONCE(1) in sk_mc_loop()
      
      We have many more similar issues to fix.
      
      WARNING: CPU: 1 PID: 1593 at net/core/sock.c:782 sk_mc_loop+0x165/0x260
      Modules linked in:
      CPU: 1 PID: 1593 Comm: kworker/1:3 Not tainted 6.1.40-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
      Workqueue: events_power_efficient gc_worker
      RIP: 0010:sk_mc_loop+0x165/0x260 net/core/sock.c:782
      Code: 34 1b fd 49 81 c7 18 05 00 00 4c 89 f8 48 c1 e8 03 42 80 3c 20 00 74 08 4c 89 ff e8 25 36 6d fd 4d 8b 37 eb 13 e8 db 33 1b fd <0f> 0b b3 01 eb 34 e8 d0 33 1b fd 45 31 f6 49 83 c6 38 4c 89 f0 48
      RSP: 0018:ffffc90000388530 EFLAGS: 00010246
      RAX: ffffffff846d9b55 RBX: 0000000000000011 RCX: ffff88814f884980
      RDX: 0000000000000102 RSI: ffffffff87ae5160 RDI: 0000000000000011
      RBP: ffffc90000388550 R08: 0000000000000003 R09: ffffffff846d9a65
      R10: 0000000000000002 R11: ffff88814f884980 R12: dffffc0000000000
      R13: ffff88810dbee000 R14: 0000000000000010 R15: ffff888150084000
      FS: 0000000000000000(0000) GS:ffff8881f6b00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000020000180 CR3: 000000014ee5b000 CR4: 00000000003506e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <IRQ>
      [<ffffffff8507734f>] ip6_finish_output2+0x33f/0x1ae0 net/ipv6/ip6_output.c:83
      [<ffffffff85062766>] __ip6_finish_output net/ipv6/ip6_output.c:200 [inline]
      [<ffffffff85062766>] ip6_finish_output+0x6c6/0xb10 net/ipv6/ip6_output.c:211
      [<ffffffff85061f8c>] NF_HOOK_COND include/linux/netfilter.h:298 [inline]
      [<ffffffff85061f8c>] ip6_output+0x2bc/0x3d0 net/ipv6/ip6_output.c:232
      [<ffffffff852071cf>] dst_output include/net/dst.h:444 [inline]
      [<ffffffff852071cf>] ip6_local_out+0x10f/0x140 net/ipv6/output_core.c:161
      [<ffffffff83618fb4>] ipvlan_process_v6_outbound drivers/net/ipvlan/ipvlan_core.c:483 [inline]
      [<ffffffff83618fb4>] ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:529 [inline]
      [<ffffffff83618fb4>] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:602 [inline]
      [<ffffffff83618fb4>] ipvlan_queue_xmit+0x1174/0x1be0 drivers/net/ipvlan/ipvlan_core.c:677
      [<ffffffff8361ddd9>] ipvlan_start_xmit+0x49/0x100 drivers/net/ipvlan/ipvlan_main.c:229
      [<ffffffff84763fc0>] netdev_start_xmit include/linux/netdevice.h:4925 [inline]
      [<ffffffff84763fc0>] xmit_one net/core/dev.c:3644 [inline]
      [<ffffffff84763fc0>] dev_hard_start_xmit+0x320/0x980 net/core/dev.c:3660
      [<ffffffff8494c650>] sch_direct_xmit+0x2a0/0x9c0 net/sched/sch_generic.c:342
      [<ffffffff8494d883>] qdisc_restart net/sched/sch_generic.c:407 [inline]
      [<ffffffff8494d883>] __qdisc_run+0xb13/0x1e70 net/sched/sch_generic.c:415
      [<ffffffff8478c426>] qdisc_run+0xd6/0x260 include/net/pkt_sched.h:125
      [<ffffffff84796eac>] net_tx_action+0x7ac/0x940 net/core/dev.c:5247
      [<ffffffff858002bd>] __do_softirq+0x2bd/0x9bd kernel/softirq.c:599
      [<ffffffff814c3fe8>] invoke_softirq kernel/softirq.c:430 [inline]
      [<ffffffff814c3fe8>] __irq_exit_rcu+0xc8/0x170 kernel/softirq.c:683
      [<ffffffff814c3f09>] irq_exit_rcu+0x9/0x20 kernel/softirq.c:695
      
      Fixes: 7ad6848c
      
       ("ip: fix mc_loop checks for tunnels with multicast outer addresses")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20230830101244.1146934-1-edumazet@google.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7586a66b
    • Vladimir Zapolskiy's avatar
      pwm: lpc32xx: Remove handling of PWM channels · abd9b2ee
      Vladimir Zapolskiy authored
      [ Upstream commit 4aae44f6
      
       ]
      
      Because LPC32xx PWM controllers have only a single output which is
      registered as the only PWM device/channel per controller, it is known in
      advance that pwm->hwpwm value is always 0. On basis of this fact
      simplify the code by removing operations with pwm->hwpwm, there is no
      controls which require channel number as input.
      
      Even though I wasn't aware at the time when I forward ported that patch,
      this fixes a null pointer dereference as lpc32xx->chip.pwms is NULL
      before devm_pwmchip_add() is called.
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Fixes: 3d2813fb
      
       ("pwm: lpc32xx: Don't modify HW state in .probe() after the PWM chip was registered")
      Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      abd9b2ee
    • Raag Jadav's avatar
      watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load · 3f97f632
      Raag Jadav authored
      [ Upstream commit cf38e769 ]
      
      When built with CONFIG_INTEL_MID_WATCHDOG=m, currently the driver
      needs to be loaded manually, for the lack of module alias.
      This causes unintended resets in cases where watchdog timer is
      set-up by bootloader and the driver is not explicitly loaded.
      Add MODULE_ALIAS() to load the driver automatically at boot and
      avoid this issue.
      
      Fixes: 87a1ef80
      
       ("watchdog: add Intel MID watchdog driver support")
      Signed-off-by: default avatarRaag Jadav <raag.jadav@intel.com>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Link: https://lore.kernel.org/r/20230811120220.31578-1-raag.jadav@intel.com
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3f97f632
    • Sean Christopherson's avatar
      x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm() · 789a5b2d
      Sean Christopherson authored
      [ Upstream commit 5df8ecfe ]
      
      Drop the explicit check on the extended CPUID level in cpu_has_svm(), the
      kernel's cached CPUID info will leave the entire SVM leaf unset if said
      leaf is not supported by hardware.  Prior to using cached information,
      the check was needed to avoid false positives due to Intel's rather crazy
      CPUID behavior of returning the values of the maximum supported leaf if
      the specified leaf is unsupported.
      
      Fixes: 682a8108
      
       ("x86/kvm/svm: Simplify cpu_has_svm()")
      Link: https://lore.kernel.org/r/20230721201859.2307736-13-seanjc@google.com
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      789a5b2d
    • Fedor Pchelkin's avatar
      NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info · 1935b79c
      Fedor Pchelkin authored
      commit 96562c45
      
       upstream.
      
      It is an almost improbable error case but when page allocating loop in
      nfs4_get_device_info() fails then we should only free the already
      allocated pages, as __free_page() can't deal with NULL arguments.
      
      Found by Linux Verification Center (linuxtesting.org).
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1935b79c
    • Dmitry Baryshkov's avatar
      clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock · f5273c92
      Dmitry Baryshkov authored
      commit 1583694b upstream.
      
      The pll0_vote clock definitely should have pll0 as a parent (instead of
      pll8).
      
      Fixes: 7792a8d6
      
       ("clk: mdm9615: Add support for MDM9615 Clock Controllers")
      Cc: stable@kernel.org
      Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@linaro.org>
      Link: https://lore.kernel.org/r/20230512211727.3445575-7-dmitry.baryshkov@linaro.org
      Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5273c92
    • Helge Deller's avatar
      parisc: led: Reduce CPU overhead for disk & lan LED computation · b0930dce
      Helge Deller authored
      commit 358ad816
      
       upstream.
      
      Older PA-RISC machines have LEDs which show the disk- and LAN-activity.
      The computation is done in software and takes quite some time, e.g. on a
      J6500 this may take up to 60% time of one CPU if the machine is loaded
      via network traffic.
      
      Since most people don't care about the LEDs, start with LEDs disabled and
      just show a CPU heartbeat LED. The disk and LAN LEDs can be turned on
      manually via /proc/pdc/led.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b0930dce
    • Helge Deller's avatar
      parisc: led: Fix LAN receive and transmit LEDs · a1a5142b
      Helge Deller authored
      commit 4db89524
      
       upstream.
      
      Fix the LAN receive and LAN transmit LEDs, which where swapped
      up to now.
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a1a5142b
    • Thomas Zimmermann's avatar
      drm/ast: Fix DRAM init on AST2200 · 3da50c80
      Thomas Zimmermann authored
      commit 4cfe75f0
      
       upstream.
      
      Fix the test for the AST2200 in the DRAM initialization. The value
      in ast->chip has to be compared against an enum constant instead of
      a numerical value.
      
      This bug got introduced when the driver was first imported into the
      kernel.
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: 312fec14
      
       ("drm: Initial KMS driver for AST (ASpeed Technologies) 2000 series (v2)")
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v3.5+
      Reviewed-by: default avatarSui Jingfeng <suijingfeng@loongson.cn>
      Reviewed-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
      Tested-by: Jocelyn Falempe <jfalempe@redhat.com> # AST2600
      Link: https://patchwork.freedesktop.org/patch/msgid/20230621130032.3568-2-tzimmermann@suse.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3da50c80
    • Thomas Zimmermann's avatar
      fbdev/ep93xx-fb: Do not assign to struct fb_info.dev · ffdf2b02
      Thomas Zimmermann authored
      commit f90a0e52
      
       upstream.
      
      Do not assing the Linux device to struct fb_info.dev. The call to
      register_framebuffer() initializes the field to the fbdev device.
      Drivers should not override its value.
      
      Fixes a bug where the driver incorrectly decreases the hardware
      device's reference counter and leaks the fbdev device.
      
      v2:
      	* add Fixes tag (Dan)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: 88017bda
      
       ("ep93xx video driver")
      Cc: <stable@vger.kernel.org> # v2.6.32+
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-15-tzimmermann@suse.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ffdf2b02
    • Quinn Tran's avatar
      scsi: qla2xxx: Turn off noisy message log · bf9ddbfb
      Quinn Tran authored
      commit 8ebaa451
      
       upstream.
      
      Some consider noisy log as test failure.  Turn off noisy message log.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarQuinn Tran <qutran@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20230714070104.40052-8-njavali@marvell.com
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bf9ddbfb
    • Quinn Tran's avatar
      scsi: qla2xxx: fix inconsistent TMF timeout · 4c67aa16
      Quinn Tran authored
      commit 009e7fe4
      
       upstream.
      
      Different behavior were experienced of session being torn down vs not when
      TMF is timed out. When FW detects the time out, the session is torn down.
      When driver detects the time out, the session is not torn down.
      
      Allow TMF error to return to upper layer without session tear down.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarQuinn Tran <qutran@marvell.com>
      Signed-off-by: default avatarNilesh Javali <njavali@marvell.com>
      Link: https://lore.kernel.org/r/20230714070104.40052-10-njavali@marvell.com
      Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c67aa16
    • Thomas Bourgoin's avatar
      crypto: stm32 - fix loop iterating through scatterlist for DMA · c303e0e8
      Thomas Bourgoin authored
      commit d9c83f71 upstream.
      
      We were reading the length of the scatterlist sg after copying value of
      tsg inside.
      So we are using the size of the previous scatterlist and for the first
      one we are using an unitialised value.
      Fix this by copying tsg in sg[0] before reading the size.
      
      Fixes : 8a1012d3
      
       ("crypto: stm32 - Support for STM32 HASH module")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThomas Bourgoin <thomas.bourgoin@foss.st.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c303e0e8
    • Enlin Mu's avatar
      pstore/ram: Check start of empty przs during init · 89312657
      Enlin Mu authored
      commit fe8c3623 upstream.
      
      After commit 30696378 ("pstore/ram: Do not treat empty buffers as
      valid"), initialization would assume a prz was valid after seeing that
      the buffer_size is zero (regardless of the buffer start position). This
      unchecked start value means it could be outside the bounds of the buffer,
      leading to future access panics when written to:
      
       sysdump_panic_event+0x3b4/0x5b8
       atomic_notifier_call_chain+0x54/0x90
       panic+0x1c8/0x42c
       die+0x29c/0x2a8
       die_kernel_fault+0x68/0x78
       __do_kernel_fault+0x1c4/0x1e0
       do_bad_area+0x40/0x100
       do_translation_fault+0x68/0x80
       do_mem_abort+0x68/0xf8
       el1_da+0x1c/0xc0
       __raw_writeb+0x38/0x174
       __memcpy_toio+0x40/0xac
       persistent_ram_update+0x44/0x12c
       persistent_ram_write+0x1a8/0x1b8
       ramoops_pstore_write+0x198/0x1e8
       pstore_console_write+0x94/0xe0
       ...
      
      To avoid this, also check if the prz start is 0 during the initialization
      phase. If not, the next prz sanity check case will discover it (start >
      size) and zap the buffer back to a sane state.
      
      Fixes: 30696378
      
       ("pstore/ram: Do not treat empty buffers as valid")
      Cc: Yunlong Xing <yunlong.xing@unisoc.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarEnlin Mu <enlin.mu@unisoc.com>
      Link: https://lore.kernel.org/r/20230801060432.1307717-1-yunlong.xing@unisoc.com
      [kees: update commit log with backtrace and clarifications]
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89312657
    • Nicolas Dichtel's avatar
      net: handle ARPHRD_PPP in dev_is_mac_header_xmit() · c4383d66
      Nicolas Dichtel authored
      commit a4f39c9f upstream.
      
      The goal is to support a bpf_redirect() from an ethernet device (ingress)
      to a ppp device (egress).
      The l2 header is added automatically by the ppp driver, thus the ethernet
      header should be removed.
      
      CC: stable@vger.kernel.org
      Fixes: 27b29f63
      
       ("bpf: add bpf_redirect() helper")
      Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Tested-by: default avatarSiwar Zitouni <siwar.zitouni@6wind.com>
      Reviewed-by: default avatarGuillaume Nault <gnault@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c4383d66
    • Thore Sommer's avatar
      X.509: if signature is unsupported skip validation · 27d694a3
      Thore Sommer authored
      commit ef5b52a6
      
       upstream.
      
      When the hash algorithm for the signature is not available the digest size
      is 0 and the signature in the certificate is marked as unsupported.
      
      When validating a self-signed certificate, this needs to be checked,
      because otherwise trying to validate the signature will fail with an
      warning:
      
      Loading compiled-in X.509 certificates
      WARNING: CPU: 0 PID: 1 at crypto/rsa-pkcs1pad.c:537 \
      pkcs1pad_verify+0x46/0x12c
      ...
      Problem loading in-kernel X.509 certificate (-22)
      
      Signed-off-by: default avatarThore Sommer <public@thson.de>
      Cc: stable@vger.kernel.org # v4.7+
      Fixes: 6c2dc5ae
      
       ("X.509: Extract signature digest and make self-signed cert checks earlier")
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27d694a3
    • Jann Horn's avatar
      dccp: Fix out of bounds access in DCCP error handler · 3533e102
      Jann Horn authored
      commit 977ad86c upstream.
      
      There was a previous attempt to fix an out-of-bounds access in the DCCP
      error handlers, but that fix assumed that the error handlers only want
      to access the first 8 bytes of the DCCP header. Actually, they also look
      at the DCCP sequence number, which is stored beyond 8 bytes, so an
      explicit pskb_may_pull() is required.
      
      Fixes: 6706a97f ("dccp: fix out of bound access in dccp_v4_err()")
      Fixes: 1aa9d1a0
      
       ("ipv6: dccp: fix out of bound access in dccp_v6_err()")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3533e102
    • Helge Deller's avatar
      parisc: Fix /proc/cpuinfo output for lscpu · 17353a03
      Helge Deller authored
      commit 9f5ba4b3 upstream.
      
      The lscpu command is broken since commit cab56b51 ("parisc: Fix
      device names in /proc/iomem") added the PA pathname to all PA
      devices, includig the CPUs.
      
      lscpu parses /proc/cpuinfo and now believes it found different CPU
      types since every CPU is listed with an unique identifier (PA
      pathname).
      
      Fix this problem by simply dropping the PA pathname when listing the
      CPUs in /proc/cpuinfo. There is no need to show the pathname in this
      procfs file.
      
      Fixes: cab56b51
      
       ("parisc: Fix device names in /proc/iomem")
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Cc: <stable@vger.kernel.org> # v4.9+
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17353a03
    • Aleksa Sarai's avatar
      procfs: block chmod on /proc/thread-self/comm · 7e388d0f
      Aleksa Sarai authored
      commit ccf61486 upstream.
      
      Due to an oversight in commit 1b3044e3 ("procfs: fix pthread
      cross-thread naming if !PR_DUMPABLE") in switching from REG to NOD,
      chmod operations on /proc/thread-self/comm were no longer blocked as
      they are on almost all other procfs files.
      
      A very similar situation with /proc/self/environ was used to as a root
      exploit a long time ago, but procfs has SB_I_NOEXEC so this is simply a
      correctness issue.
      
      Ref: https://lwn.net/Articles/191954/
      Ref: 6d76fa58 ("Don't allow chmod() on the /proc/<pid>/ files")
      Fixes: 1b3044e3
      
       ("procfs: fix pthread cross-thread naming if !PR_DUMPABLE")
      Cc: stable@vger.kernel.org # v4.7+
      Signed-off-by: default avatarAleksa Sarai <cyphar@cyphar.com>
      Message-Id: <20230713141001.27046-1-cyphar@cyphar.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e388d0f
    • Bjorn Helgaas's avatar
      Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset" · bbdd38aa
      Bjorn Helgaas authored
      commit 5260bd6d upstream.
      
      This reverts commit d5af729d.
      
      d5af729d ("PCI: Mark NVIDIA T4 GPUs to avoid bus reset") avoided
      Secondary Bus Reset on the T4 because the reset seemed to not work when the
      T4 was directly attached to a Root Port.
      
      But NVIDIA thinks the issue is probably related to some issue with the Root
      Port, not with the T4.  The T4 provides neither PM nor FLR reset, so
      masking bus reset compromises this device for assignment scenarios.
      
      Revert d5af729d
      
       as requested by Wu Zongyong.  This will leave SBR
      broken in the specific configuration Wu tested, as it was in v6.5, so Wu
      will debug that further.
      
      Link: https://lore.kernel.org/r/ZPqMCDWvITlOLHgJ@wuzongyong-alibaba
      Link: https://lore.kernel.org/r/20230908201104.GA305023@bhelgaas
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bbdd38aa
    • Dave Jiang's avatar
      ntb: Fix calculation ntb_transport_tx_free_entry() · e4d447a6
      Dave Jiang authored
      commit 5a7693e6 upstream.
      
      ntb_transport_tx_free_entry() never returns 0 with the current
      calculation. If head == tail, then it would return qp->tx_max_entry.
      Change compare to tail >= head and when they are equal, a 0 would be
      returned.
      
      Fixes: e74bfeed
      
       ("NTB: Add flow control to the ntb_netdev")
      Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarrenlonglong <ren.longlong@h3c.com>
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4d447a6
    • Dave Jiang's avatar
      ntb: Clean up tx tail index on link down · 6ec95c4f
      Dave Jiang authored
      commit cc79bd27 upstream.
      
      The tx tail index is not reset when the link goes down. This causes the
      tail index to go out of sync when the link goes down and comes back up.
      Refactor the ntb_qp_link_down_reset() and reset the tail index as well.
      
      Fixes: 2849b5d7
      
       ("NTB: Reset transport QP link stats on down")
      Reported-by: default avatarYuan Y Lu <yuan.y.lu@intel.com>
      Tested-by: default avatarYuan Y Lu <yuan.y.lu@intel.com>
      Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ec95c4f
    • Dave Jiang's avatar
      ntb: Drop packets when qp link is down · aa6d6ed2
      Dave Jiang authored
      commit f195a1a6 upstream.
      
      Currently when the transport receive packets after netdev has closed the
      transport returns error and triggers tx errors to be incremented and
      carrier to be stopped. There is no reason to return error if the device is
      already closed. Drop the packet and return 0.
      
      Fixes: e26a5843
      
       ("NTB: Split ntb_hw_intel and ntb_transport drivers")
      Reported-by: default avatarYuan Y Lu <yuan.y.lu@intel.com>
      Tested-by: default avatarYuan Y Lu <yuan.y.lu@intel.com>
      Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa6d6ed2
    • Greg Kroah-Hartman's avatar
      media: dvb: symbol fixup for dvb_attach() · cd98086a
      Greg Kroah-Hartman authored
      commit 86495af1 upstream.
      
      In commit 9011e49d ("modules: only allow symbol_get of
      EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted
      to GPL-only marked symbols.  This interacts oddly with the DVB logic
      which only uses dvb_attach() to load the dvb driver which then uses
      symbol_get().
      
      Fix this up by properly marking all of the dvb_attach attach symbols as
      EXPORT_SYMBOL_GPL().
      
      Fixes: 9011e49d
      
       ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules")
      Cc: stable <stable@kernel.org>
      Reported-by: default avatarStefan Lippers-Hollmann <s.l-h@gmx.de>
      Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: linux-media@vger.kernel.org
      Cc: linux-modules@vger.kernel.org
      Acked-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Acked-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Link: https://lore.kernel.org/r/20230908092035.3815268-2-gregkh@linuxfoundation.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cd98086a
    • Thomas Zimmermann's avatar
      backlight/lv5207lp: Compare against struct fb_info.device · 789d4439
      Thomas Zimmermann authored
      commit 1ca88193 upstream.
      
      Struct lv5207lp_platform_data refers to a platform device within
      the Linux device hierarchy. The test in lv5207lp_backlight_check_fb()
      compares it against the fbdev device in struct fb_info.dev, which
      is different. Fix the test by comparing to struct fb_info.device.
      
      Fixes a bug in the backlight driver and prepares fbdev for making
      struct fb_info.dev optional.
      
      v2:
      	* move renames into separate patch (Javier, Sam, Michael)
      
      Fixes: 82e5c40d
      
       ("backlight: Add Sanyo LV5207LP backlight driver")
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Cc: Lee Jones <lee@kernel.org>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Jingoo Han <jingoohan1@gmail.com>
      Cc: linux-sh@vger.kernel.org
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v3.12+
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-6-tzimmermann@suse.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      789d4439
    • Thomas Zimmermann's avatar
      backlight/bd6107: Compare against struct fb_info.device · 807acfaf
      Thomas Zimmermann authored
      commit 992bddda upstream.
      
      Struct bd6107_platform_data refers to a platform device within
      the Linux device hierarchy. The test in bd6107_backlight_check_fb()
      compares it against the fbdev device in struct fb_info.dev, which
      is different. Fix the test by comparing to struct fb_info.device.
      
      Fixes a bug in the backlight driver and prepares fbdev for making
      struct fb_info.dev optional.
      
      v2:
      	* move renames into separate patch (Javier, Sam, Michael)
      
      Fixes: 67b43e59
      
       ("backlight: Add ROHM BD6107 backlight driver")
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Cc: Lee Jones <lee@kernel.org>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Jingoo Han <jingoohan1@gmail.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v3.12+
      Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-2-tzimmermann@suse.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      807acfaf
    • Thomas Zimmermann's avatar
      backlight/gpio_backlight: Compare against struct fb_info.device · e948d5b0
      Thomas Zimmermann authored
      commit 7b91d017
      
       upstream.
      
      Struct gpio_backlight_platform_data refers to a platform device within
      the Linux device hierarchy. The test in gpio_backlight_check_fb()
      compares it against the fbdev device in struct fb_info.dev, which
      is different. Fix the test by comparing to struct fb_info.device.
      
      Fixes a bug in the backlight driver and prepares fbdev for making
      struct fb_info.dev optional.
      
      v2:
      	* move renames into separate patch (Javier, Sam, Michael)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: 8b770e3c
      
       ("backlight: Add GPIO-based backlight driver")
      Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Cc: Lee Jones <lee@kernel.org>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Jingoo Han <jingoohan1@gmail.com>
      Cc: linux-sh@vger.kernel.org
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v3.12+
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230613110953.24176-4-tzimmermann@suse.de
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e948d5b0
    • Gustavo A. R. Silva's avatar
      ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch() · 20ef4bb8
      Gustavo A. R. Silva authored
      commit 847fb80c upstream.
      
      If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end
      up accessing array pwrdm->state_counter through negative index
      -22. This is wrong and the compiler is legitimately warning us
      about this potential problem.
      
      Fix this by sanity checking the value stored in variable _prev_
      before accessing array pwrdm->state_counter.
      
      Address the following -Warray-bounds warning:
      arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]
      
      Link: https://github.com/KSPP/linux/issues/307
      Fixes: ba20bb12
      
       ("OMAP: PM counter infrastructure.")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/lkml/20230607050639.LzbPn%25lkp@intel.com/
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Message-ID: <ZIFVGwImU3kpaGeH@work>
      Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      20ef4bb8
    • Takashi Iwai's avatar
      ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl · 860e4a77
      Takashi Iwai authored
      commit 358040e3
      
       upstream.
      
      The update of rate_num/den and msbits were factored out to
      fixup_unreferenced_params() function to be called explicitly after the
      hw_refine or hw_params procedure.  It's called from
      snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl.
      This ended up with the incomplete rate_num/den and msbits parameters
      when 32bit compat ioctl is used.
      
      This patch adds the missing call in snd_pcm_ioctl_hw_params_compat().
      
      Reported-by: default avatar <Meng_Cai@novatek.com.cn>
      Fixes: f9a076bf
      
       ("ALSA: pcm: calculate non-mask/non-interval parameters always when possible")
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20230829134344.31588-1-tiwai@suse.de
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      860e4a77
    • Boris Brezillon's avatar
      PM / devfreq: Fix leak in devfreq_dev_release() · 74624834
      Boris Brezillon authored
      commit 5693d077 upstream.
      
      srcu_init_notifier_head() allocates resources that need to be released
      with a srcu_cleanup_notifier_head() call.
      
      Reported by kmemleak.
      
      Fixes: 0fe3a664
      
       ("PM / devfreq: Add new DEVFREQ_TRANSITION_NOTIFIER notifier")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
      Reviewed-by: default avatarDhruva Gole <d-gole@ti.com>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      74624834
    • Radoslaw Tyl's avatar
      igb: set max size RX buffer when store bad packet is enabled · 017d5c8e
      Radoslaw Tyl authored
      commit bb5ed01c upstream.
      
      Increase the RX buffer size to 3K when the SBP bit is on. The size of
      the RX buffer determines the number of pages allocated which may not
      be sufficient for receive frames larger than the set MTU size.
      
      Cc: stable@vger.kernel.org
      Fixes: 89eaefb6
      
       ("igb: Support RX-ALL feature flag.")
      Reported-by: default avatarManfred Rudigier <manfred.rudigier@omicronenergy.com>
      Signed-off-by: default avatarRadoslaw Tyl <radoslawx.tyl@intel.com>
      Tested-by: Arpana Arland <arpanax.arland@intel.com> (A Contingent worker at Intel)
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      017d5c8e