Skip to content
Snippets Groups Projects
  1. Dec 27, 2019
    • Yang Yingliang's avatar
      config: change CONFIG_*TUNNEL to m again · e8355d8d
      Yang Yingliang authored and 谢秀奇's avatar 谢秀奇 committed
      euler inclusion
      category: feature
      bugzilla: 4979
      CVE: NA
      ---------------------------------------
      
      Commit bf96e3f19d35("hulk_defconfig: update config based euleros's product config")
      changes the configs to y, we need to change them to m again.
      
      CONFIG_NET_IPIP
      CONFIG_NET_IP_TUNNEL
      CONFIG_NET_UDP_TUNNEL
      CONFIG_NET_FOU
      CONFIG_INET_TUNNEL
      CONFIG_INET6_TUNNEL
      CONFIG_IPV6_TUNNEL
      CONFIG_IPV6_FOU
      CONFIG_IPV6_FOU_TUNNEL
      CONFIG_VXLAN
      
      These configs are changed to m.
      e8355d8d
    • ZhangXiaoxu's avatar
      nfs: fix xfstest generic/099 failed on nfsv3 · ffec2db8
      ZhangXiaoxu authored and 谢秀奇's avatar 谢秀奇 committed
      
      mainline inclusion
      from linux-next/master
      commit ded52fbe
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      -------------------------------------------------
      
      After setxattr, the nfsv3 cached the acl which set by user.
      
      But at the backend, the shared file system (eg. ext4) will check
      the acl, if it can merged with mode, it won't add acl to the file.
      So, the nfsv3 cached acl is redundant.
      
      Don't 'set_cached_acl' when setxattr.
      
      Signed-off-by: default avatarZhangXiaoxu <zhangxiaoxu5@huawei.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarZhangXiaoxu <zhangxiaoxu5@huawei.com>
      Reviewed-by: default avataryangerkun <yangerkun@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      ffec2db8
    • yangerkun's avatar
      ext2: support statx syscall · 1e56701a
      yangerkun authored and 谢秀奇's avatar 谢秀奇 committed
      
      mainline inclusion
      from mainline
      commit 93bc420e
      category: bugfix
      bugzilla: 10895
      CVE: NA
      ---------------------------
      
      Since statx, every filesystem should fill the attributes/attributes_mask
      in routine getattr. But the generic_fillattr has not fill that, so add
      ext2_getattr to do this. This can fix generic/424 while testing ext2.
      
      Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      
      Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
      Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      1e56701a
    • Theodore Ts'o's avatar
      ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT · 14d2a7ce
      Theodore Ts'o authored and 谢秀奇's avatar 谢秀奇 committed
      
      mainline inclusion
      from mainline-5.1
      commit 6e589291
      category: bugfix
      bugzilla: 10709
      CVE: NA
      ---------------------------
      
      A malicious/clueless root user can use EXT4_IOC_SWAP_BOOT to force a
      corner casew which can lead to the file system getting corrupted.
      There's no usefulness to allowing this, so just prohibit this case.
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      
      Conflict:
        fs/ext4/ioctl.c
      
      Signed-off-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
      Reviewed-by: default avataryangerkun <yangerkun@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      14d2a7ce
    • luojiajun's avatar
      jbd2: fix invalid descriptor block checksum · 585adb5d
      luojiajun authored and 谢秀奇's avatar 谢秀奇 committed
      
      euler inclusion
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      -------------------------------------------------
      
      In jbd2_journal_commit_transaction(), if we are in abort mode,
      we may flush the buffer without setting descriptor block checksum
      by goto start_journal_io. Then fs is mounted,
      jbd2_descriptor_block_csum_verify() failed.
      
      [  271.379811] EXT4-fs (vdd): shut down requested (2)
      [  271.381827] Aborting journal on device vdd-8.
      [  271.597136] JBD2: Invalid checksum recovering block 22199 in log
      [  271.598023] JBD2: recovery failed
      [  271.598484] EXT4-fs (vdd): error loading journal
      
      Fix this problem by keep setting descriptor block checksum if the
      descriptor buffer is not NULL.
      
      This checksum problem can be reproduced by xfstests generic/388.
      
      v1->v2:
      checkpatch fix
      
      Signed-off-by: default avatarluojiajun <luojiajun3@huawei.com>
      Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      585adb5d
    • Greg Kroah-Hartman's avatar
      Linux 4.19.25 · 713766cc
      Greg Kroah-Hartman authored and 谢秀奇's avatar 谢秀奇 committed
      
      Merge 21 patches from 4.19.25 stable
      branch (29 total) beside 8 already merged patches:
      
      6a3f723 netfilter: nf_nat_snmp_basic: add missing length checks in ASN.1 cbs
      bc5d972 PCI: Fix __initdata issue with "pci=disable_acs_redir" parameter
      f9e6a18 mmc: meson-gx: fix interrupt name
      a3b6fa3 vxlan: test dev->flags & IFF_UP before calling netif_rx()
      03a6fc5 vsock: cope with memory allocation failure at socket creation time
      4c1b91b net: fix IPv6 prefix route residue
      eb5e686 net: crypto set sk to NULL when af_alg_release.
      bbbefe8 af_packet: fix raw sockets over 6in4 tunnel
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      713766cc
    • Eric Dumazet's avatar
      ax25: fix possible use-after-free · 1b3d3253
      Eric Dumazet authored and 谢秀奇's avatar 谢秀奇 committed
      
      commit 63530aba upstream.
      
      syzbot found that ax25 routes where not properly protected
      against concurrent use [1].
      
      In this particular report the bug happened while
      copying ax25->digipeat.
      
      Fix this problem by making sure we call ax25_get_route()
      while ax25_route_lock is held, so that no modification
      could happen while using the route.
      
      The current two ax25_get_route() callers do not sleep,
      so this change should be fine.
      
      Once we do that, ax25_get_route() no longer needs to
      grab a reference on the found route.
      
      [1]
      ax25_connect(): syz-executor0 uses autobind, please contact jreuter@yaina.de
      BUG: KASAN: use-after-free in memcpy include/linux/string.h:352 [inline]
      BUG: KASAN: use-after-free in kmemdup+0x42/0x60 mm/util.c:113
      Read of size 66 at addr ffff888066641a80 by task syz-executor2/531
      
      ax25_connect(): syz-executor0 uses autobind, please contact jreuter@yaina.de
      CPU: 1 PID: 531 Comm: syz-executor2 Not tainted 5.0.0-rc2+ #10
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x1db/0x2d0 lib/dump_stack.c:113
       print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
       kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
       check_memory_region_inline mm/kasan/generic.c:185 [inline]
       check_memory_region+0x123/0x190 mm/kasan/generic.c:191
       memcpy+0x24/0x50 mm/kasan/common.c:130
       memcpy include/linux/string.h:352 [inline]
       kmemdup+0x42/0x60 mm/util.c:113
       kmemdup include/linux/string.h:425 [inline]
       ax25_rt_autobind+0x25d/0x750 net/ax25/ax25_route.c:424
       ax25_connect.cold+0x30/0xa4 net/ax25/af_ax25.c:1224
       __sys_connect+0x357/0x490 net/socket.c:1664
       __do_sys_connect net/socket.c:1675 [inline]
       __se_sys_connect net/socket.c:1672 [inline]
       __x64_sys_connect+0x73/0xb0 net/socket.c:1672
       do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x458099
      Code: 6d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f870ee22c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458099
      RDX: 0000000000000048 RSI: 0000000020000080 RDI: 0000000000000005
      RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
      ax25_connect(): syz-executor4 uses autobind, please contact jreuter@yaina.de
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007f870ee236d4
      R13: 00000000004be48e R14: 00000000004ce9a8 R15: 00000000ffffffff
      
      Allocated by task 526:
       save_stack+0x45/0xd0 mm/kasan/common.c:73
       set_track mm/kasan/common.c:85 [inline]
       __kasan_kmalloc mm/kasan/common.c:496 [inline]
       __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:469
       kasan_kmalloc+0x9/0x10 mm/kasan/common.c:504
      ax25_connect(): syz-executor5 uses autobind, please contact jreuter@yaina.de
       kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3609
       kmalloc include/linux/slab.h:545 [inline]
       ax25_rt_add net/ax25/ax25_route.c:95 [inline]
       ax25_rt_ioctl+0x3b9/0x1270 net/ax25/ax25_route.c:233
       ax25_ioctl+0x322/0x10b0 net/ax25/af_ax25.c:1763
       sock_do_ioctl+0xe2/0x400 net/socket.c:950
       sock_ioctl+0x32f/0x6c0 net/socket.c:1074
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:509 [inline]
       do_vfs_ioctl+0x107b/0x17d0 fs/ioctl.c:696
       ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
       __do_sys_ioctl fs/ioctl.c:720 [inline]
       __se_sys_ioctl fs/ioctl.c:718 [inline]
       __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
       do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      ax25_connect(): syz-executor5 uses autobind, please contact jreuter@yaina.de
      Freed by task 550:
       save_stack+0x45/0xd0 mm/kasan/common.c:73
       set_track mm/kasan/common.c:85 [inline]
       __kasan_slab_free+0x102/0x150 mm/kasan/common.c:458
       kasan_slab_free+0xe/0x10 mm/kasan/common.c:466
       __cache_free mm/slab.c:3487 [inline]
       kfree+0xcf/0x230 mm/slab.c:3806
       ax25_rt_add net/ax25/ax25_route.c:92 [inline]
       ax25_rt_ioctl+0x304/0x1270 net/ax25/ax25_route.c:233
       ax25_ioctl+0x322/0x10b0 net/ax25/af_ax25.c:1763
       sock_do_ioctl+0xe2/0x400 net/socket.c:950
       sock_ioctl+0x32f/0x6c0 net/socket.c:1074
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:509 [inline]
       do_vfs_ioctl+0x107b/0x17d0 fs/ioctl.c:696
       ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
       __do_sys_ioctl fs/ioctl.c:720 [inline]
       __se_sys_ioctl fs/ioctl.c:718 [inline]
       __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
       do_syscall_64+0x1a3/0x800 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      The buggy address belongs to the object at ffff888066641a80
       which belongs to the cache kmalloc-96 of size 96
      The buggy address is located 0 bytes inside of
       96-byte region [ffff888066641a80, ffff888066641ae0)
      The buggy address belongs to the page:
      page:ffffea0001999040 count:1 mapcount:0 mapping:ffff88812c3f04c0 index:0x0
      flags: 0x1fffc0000000200(slab)
      ax25_connect(): syz-executor4 uses autobind, please contact jreuter@yaina.de
      raw: 01fffc0000000200 ffffea0001817948 ffffea0002341dc8 ffff88812c3f04c0
      raw: 0000000000000000 ffff888066641000 0000000100000020 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff888066641980: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
       ffff888066641a00: 00 00 00 00 00 00 00 00 02 fc fc fc fc fc fc fc
      >ffff888066641a80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                         ^
       ffff888066641b00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
       ffff888066641b80: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      1b3d3253
    • Eric Dumazet's avatar
      mISDN: fix a race in dev_expire_timer() · 5758fc05
      Eric Dumazet authored and 谢秀奇's avatar 谢秀奇 committed
      
      commit bdcc5bc2 upstream.
      
      Since mISDN_close() uses dev->pending to iterate over active
      timers, there is a chance that one timer got removed from the
      ->pending list in dev_expire_timer() but that the thread
      has not called yet wake_up_interruptible()
      
      So mISDN_close() could miss this and free dev before
      completion of at least one dev_expire_timer()
      
      syzbot was able to catch this race :
      
      BUG: KASAN: use-after-free in register_lock_class+0x140c/0x1bf0 kernel/locking/lockdep.c:827
      Write of size 8 at addr ffff88809fc18948 by task syz-executor1/24769
      
      CPU: 1 PID: 24769 Comm: syz-executor1 Not tainted 5.0.0-rc5 #60
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x172/0x1f0 lib/dump_stack.c:113
       print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
       kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
       __asan_report_store8_noabort+0x17/0x20 mm/kasan/generic_report.c:140
       register_lock_class+0x140c/0x1bf0 kernel/locking/lockdep.c:827
       __lock_acquire+0x11f/0x4700 kernel/locking/lockdep.c:3224
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3841
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:152
       __wake_up_common_lock+0xc7/0x190 kernel/sched/wait.c:120
       __wake_up+0xe/0x10 kernel/sched/wait.c:145
       dev_expire_timer+0xe4/0x3b0 drivers/isdn/mISDN/timerdev.c:174
       call_timer_fn+0x190/0x720 kernel/time/timer.c:1325
      protocol 88fb is buggy, dev hsr_slave_0
      protocol 88fb is buggy, dev hsr_slave_1
       expire_timers kernel/time/timer.c:1362 [inline]
       __run_timers kernel/time/timer.c:1681 [inline]
       __run_timers kernel/time/timer.c:1649 [inline]
       run_timer_softirq+0x652/0x1700 kernel/time/timer.c:1694
       __do_softirq+0x266/0x95a kernel/softirq.c:292
       invoke_softirq kernel/softirq.c:373 [inline]
       irq_exit+0x180/0x1d0 kernel/softirq.c:413
       exiting_irq arch/x86/include/asm/apic.h:536 [inline]
       smp_apic_timer_interrupt+0x14a/0x570 arch/x86/kernel/apic/apic.c:1062
       apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807
       </IRQ>
      RIP: 0010:__sanitizer_cov_trace_pc+0x26/0x50 kernel/kcov.c:101
      Code: 90 90 90 90 55 48 89 e5 48 8b 75 08 65 48 8b 04 25 40 ee 01 00 65 8b 15 98 12 92 7e 81 e2 00 01 1f 00 75 2b 8b 90 d8 12 00 00 <83> fa 02 75 20 48 8b 88 e0 12 00 00 8b 80 dc 12 00 00 48 8b 11 48
      RSP: 0018:ffff8880589b7a60 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
      RAX: ffff888087ce25c0 RBX: 0000000000000001 RCX: ffffffff818f8ca3
      RDX: 0000000000000000 RSI: ffffffff818f8b48 RDI: 0000000000000001
      RBP: ffff8880589b7a60 R08: ffff888087ce25c0 R09: ffffed1015d25bd0
      R10: ffffed1015d25bcf R11: ffff8880ae92de7b R12: ffffea0001ae4680
      R13: ffffea0001ae4688 R14: 0000000000000000 R15: ffffea0001b41648
       PageIdle include/linux/page-flags.h:398 [inline]
       page_is_idle include/linux/page_idle.h:29 [inline]
       mark_page_accessed+0x618/0x1140 mm/swap.c:398
       touch_buffer fs/buffer.c:59 [inline]
       __find_get_block+0x312/0xcc0 fs/buffer.c:1298
       sb_find_get_block include/linux/buffer_head.h:338 [inline]
       recently_deleted fs/ext4/ialloc.c:682 [inline]
       find_inode_bit.isra.0+0x202/0x510 fs/ext4/ialloc.c:722
       __ext4_new_inode+0x14ad/0x52c0 fs/ext4/ialloc.c:914
       ext4_symlink+0x3f8/0xbe0 fs/ext4/namei.c:3096
       vfs_symlink fs/namei.c:4126 [inline]
       vfs_symlink+0x378/0x5d0 fs/namei.c:4112
       do_symlinkat+0x22b/0x290 fs/namei.c:4153
       __do_sys_symlink fs/namei.c:4172 [inline]
       __se_sys_symlink fs/namei.c:4170 [inline]
       __x64_sys_symlink+0x59/0x80 fs/namei.c:4170
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x457b67
      Code: 0f 1f 00 b8 5c 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 6d bb fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 58 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 4d bb fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007fff045ce0f8 EFLAGS: 00000202 ORIG_RAX: 0000000000000058
      RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000457b67
      RDX: 00007fff045ce173 RSI: 00000000004bd63f RDI: 00007fff045ce160
      RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000013
      R10: 0000000000000075 R11: 0000000000000202 R12: 0000000000000000
      R13: 0000000000000001 R14: 000000000000029b R15: 0000000000000001
      
      Allocated by task 24763:
       save_stack+0x45/0xd0 mm/kasan/common.c:73
       set_track mm/kasan/common.c:85 [inline]
       __kasan_kmalloc mm/kasan/common.c:496 [inline]
       __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:469
       kasan_kmalloc+0x9/0x10 mm/kasan/common.c:504
       kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3609
       kmalloc include/linux/slab.h:545 [inline]
       mISDN_open+0x9a/0x270 drivers/isdn/mISDN/timerdev.c:59
       misc_open+0x398/0x4c0 drivers/char/misc.c:141
       chrdev_open+0x247/0x6b0 fs/char_dev.c:417
       do_dentry_open+0x47d/0x1130 fs/open.c:771
       vfs_open+0xa0/0xd0 fs/open.c:880
       do_last fs/namei.c:3418 [inline]
       path_openat+0x10d7/0x4690 fs/namei.c:3534
       do_filp_open+0x1a1/0x280 fs/namei.c:3564
       do_sys_open+0x3fe/0x5d0 fs/open.c:1063
       __do_sys_openat fs/open.c:1090 [inline]
       __se_sys_openat fs/open.c:1084 [inline]
       __x64_sys_openat+0x9d/0x100 fs/open.c:1084
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Freed by task 24762:
       save_stack+0x45/0xd0 mm/kasan/common.c:73
       set_track mm/kasan/common.c:85 [inline]
       __kasan_slab_free+0x102/0x150 mm/kasan/common.c:458
       kasan_slab_free+0xe/0x10 mm/kasan/common.c:466
       __cache_free mm/slab.c:3487 [inline]
       kfree+0xcf/0x230 mm/slab.c:3806
       mISDN_close+0x2a1/0x390 drivers/isdn/mISDN/timerdev.c:97
       __fput+0x2df/0x8d0 fs/file_table.c:278
       ____fput+0x16/0x20 fs/file_table.c:309
       task_work_run+0x14a/0x1c0 kernel/task_work.c:113
       tracehook_notify_resume include/linux/tracehook.h:188 [inline]
       exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:166
       prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
       do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      The buggy address belongs to the object at ffff88809fc18900
       which belongs to the cache kmalloc-192 of size 192
      The buggy address is located 72 bytes inside of
       192-byte region [ffff88809fc18900, ffff88809fc189c0)
      The buggy address belongs to the page:
      page:ffffea00027f0600 count:1 mapcount:0 mapping:ffff88812c3f0040 index:0xffff88809fc18000
      flags: 0x1fffc0000000200(slab)
      raw: 01fffc0000000200 ffffea000269f648 ffffea00029f7408 ffff88812c3f0040
      raw: ffff88809fc18000 ffff88809fc18000 000000010000000b 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff88809fc18800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
       ffff88809fc18880: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      >ffff88809fc18900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
       ffff88809fc18980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
       ffff88809fc18a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      5758fc05
    • Eric Dumazet's avatar
      net/x25: do not hold the cpu too long in x25_new_lci() · 7effc48d
      Eric Dumazet authored and 谢秀奇's avatar 谢秀奇 committed
      
      commit cf657d22 upstream.
      
      Due to quadratic behavior of x25_new_lci(), syzbot was able
      to trigger an rcu stall.
      
      Fix this by not blocking BH for the whole duration of
      the function, and inserting a reschedule point when possible.
      
      If we care enough, using a bitmap could get rid of the quadratic
      behavior.
      
      syzbot report :
      
      rcu: INFO: rcu_preempt self-detected stall on CPU
      rcu:    0-...!: (10500 ticks this GP) idle=4fa/1/0x4000000000000002 softirq=283376/283376 fqs=0
      rcu:     (t=10501 jiffies g=383105 q=136)
      rcu: rcu_preempt kthread starved for 10502 jiffies! g383105 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=0
      rcu: RCU grace-period kthread stack dump:
      rcu_preempt     I28928    10      2 0x80000000
      Call Trace:
       context_switch kernel/sched/core.c:2844 [inline]
       __schedule+0x817/0x1cc0 kernel/sched/core.c:3485
       schedule+0x92/0x180 kernel/sched/core.c:3529
       schedule_timeout+0x4db/0xfd0 kernel/time/timer.c:1803
       rcu_gp_fqs_loop kernel/rcu/tree.c:1948 [inline]
       rcu_gp_kthread+0x956/0x17a0 kernel/rcu/tree.c:2105
       kthread+0x357/0x430 kernel/kthread.c:246
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352
      NMI backtrace for cpu 0
      CPU: 0 PID: 8759 Comm: syz-executor2 Not tainted 5.0.0-rc4+ #51
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x172/0x1f0 lib/dump_stack.c:113
       nmi_cpu_backtrace.cold+0x63/0xa4 lib/nmi_backtrace.c:101
       nmi_trigger_cpumask_backtrace+0x1be/0x236 lib/nmi_backtrace.c:62
       arch_trigger_cpumask_backtrace+0x14/0x20 arch/x86/kernel/apic/hw_nmi.c:38
       trigger_single_cpu_backtrace include/linux/nmi.h:164 [inline]
       rcu_dump_cpu_stacks+0x183/0x1cf kernel/rcu/tree.c:1211
       print_cpu_stall kernel/rcu/tree.c:1348 [inline]
       check_cpu_stall kernel/rcu/tree.c:1422 [inline]
       rcu_pending kernel/rcu/tree.c:3018 [inline]
       rcu_check_callbacks.cold+0x500/0xa4a kernel/rcu/tree.c:2521
       update_process_times+0x32/0x80 kernel/time/timer.c:1635
       tick_sched_handle+0xa2/0x190 kernel/time/tick-sched.c:161
       tick_sched_timer+0x47/0x130 kernel/time/tick-sched.c:1271
       __run_hrtimer kernel/time/hrtimer.c:1389 [inline]
       __hrtimer_run_queues+0x33e/0xde0 kernel/time/hrtimer.c:1451
       hrtimer_interrupt+0x314/0x770 kernel/time/hrtimer.c:1509
       local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1035 [inline]
       smp_apic_timer_interrupt+0x120/0x570 arch/x86/kernel/apic/apic.c:1060
       apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807
       </IRQ>
      RIP: 0010:__read_once_size include/linux/compiler.h:193 [inline]
      RIP: 0010:queued_write_lock_slowpath+0x13e/0x290 kernel/locking/qrwlock.c:86
      Code: 00 00 fc ff df 4c 8d 2c 01 41 83 c7 03 41 0f b6 45 00 41 38 c7 7c 08 84 c0 0f 85 0c 01 00 00 8b 03 3d 00 01 00 00 74 1a f3 90 <41> 0f b6 55 00 41 38 d7 7c eb 84 d2 74 e7 48 89 df e8 6c 0f 4f 00
      RSP: 0018:ffff88805f117bd8 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff13
      RAX: 0000000000000300 RBX: ffffffff89413ba0 RCX: 1ffffffff1282774
      RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff89413ba0
      RBP: ffff88805f117c70 R08: 1ffffffff1282774 R09: fffffbfff1282775
      R10: fffffbfff1282774 R11: ffffffff89413ba3 R12: 00000000000000ff
      R13: fffffbfff1282774 R14: 1ffff1100be22f7d R15: 0000000000000003
       queued_write_lock include/asm-generic/qrwlock.h:104 [inline]
       do_raw_write_lock+0x1d6/0x290 kernel/locking/spinlock_debug.c:203
       __raw_write_lock_bh include/linux/rwlock_api_smp.h:204 [inline]
       _raw_write_lock_bh+0x3b/0x50 kernel/locking/spinlock.c:312
       x25_insert_socket+0x21/0xe0 net/x25/af_x25.c:267
       x25_bind+0x273/0x340 net/x25/af_x25.c:705
       __sys_bind+0x23f/0x290 net/socket.c:1505
       __do_sys_bind net/socket.c:1516 [inline]
       __se_sys_bind net/socket.c:1514 [inline]
       __x64_sys_bind+0x73/0xb0 net/socket.c:1514
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x457e39
      Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007fafccd0dc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457e39
      RDX: 0000000000000012 RSI: 0000000020000240 RDI: 0000000000000004
      RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007fafccd0e6d4
      R13: 00000000004bdf8b R14: 00000000004ce4b8 R15: 00000000ffffffff
      Sending NMI from CPU 0 to CPUs 1:
      NMI backtrace for cpu 1
      CPU: 1 PID: 8752 Comm: syz-executor4 Not tainted 5.0.0-rc4+ #51
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      RIP: 0010:__x25_find_socket+0x78/0x120 net/x25/af_x25.c:328
      Code: 89 f8 48 c1 e8 03 80 3c 18 00 0f 85 a6 00 00 00 4d 8b 64 24 68 4d 85 e4 74 7f e8 03 97 3d fb 49 83 ec 68 74 74 e8 f8 96 3d fb <49> 8d bc 24 88 04 00 00 48 89 f8 48 c1 e8 03 0f b6 04 18 84 c0 74
      RSP: 0018:ffff8880639efc58 EFLAGS: 00000246
      RAX: 0000000000040000 RBX: dffffc0000000000 RCX: ffffc9000e677000
      RDX: 0000000000040000 RSI: ffffffff863244b8 RDI: ffff88806a764628
      RBP: ffff8880639efc80 R08: ffff8880a80d05c0 R09: fffffbfff1282775
      R10: fffffbfff1282774 R11: ffffffff89413ba3 R12: ffff88806a7645c0
      R13: 0000000000000001 R14: ffff88809f29ac00 R15: 0000000000000000
      FS:  00007fe8d0c58700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000001b32823000 CR3: 00000000672eb000 CR4: 00000000001406e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       x25_new_lci net/x25/af_x25.c:357 [inline]
       x25_connect+0x374/0xdf0 net/x25/af_x25.c:786
       __sys_connect+0x266/0x330 net/socket.c:1686
       __do_sys_connect net/socket.c:1697 [inline]
       __se_sys_connect net/socket.c:1694 [inline]
       __x64_sys_connect+0x73/0xb0 net/socket.c:1694
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x457e39
      Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007fe8d0c57c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457e39
      RDX: 0000000000000012 RSI: 0000000020000200 RDI: 0000000000000004
      RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe8d0c586d4
      R13: 00000000004be378 R14: 00000000004ceb00 R15: 00000000ffffffff
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Andrew Hendry <andrew.hendry@gmail.com>
      Cc: linux-x25@vger.kernel.org
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      7effc48d
    • Scott Mayhew's avatar
      sunrpc: fix 4 more call sites that were using stack memory with a scatterlist · bac0530a
      Scott Mayhew authored and 谢秀奇's avatar 谢秀奇 committed
      
      commit e7afe6c1 upstream.
      
      While trying to reproduce a reported kernel panic on arm64, I discovered
      that AUTH_GSS basically doesn't work at all with older enctypes on arm64
      systems with CONFIG_VMAP_STACK enabled.  It turns out there still a few
      places using stack memory with scatterlists, causing krb5_encrypt() and
      krb5_decrypt() to produce incorrect results (or a BUG if CONFIG_DEBUG_SG
      is enabled).
      
      Tested with cthon on v4.0/v4.1/v4.2 with krb5/krb5i/krb5p using
      des3-cbc-sha1 and arcfour-hmac-md5.
      
      Signed-off-by: default avatarScott Mayhew <smayhew@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      bac0530a
    • Wei Yongjun's avatar
      scsi: target/core: Use kmem_cache_free() instead of kfree() · 2d5ee233
      Wei Yongjun authored and 谢秀奇's avatar 谢秀奇 committed
      
      commit 8b2db98e upstream.
      
      memory allocated by kmem_cache_alloc() should be freed using
      kmem_cache_free(), not kfree().
      
      Fixes: ad669505 ("scsi: target/core: Make sure that target_wait_for_sess_cmds() waits long enough")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      2d5ee233
    • Wei Yongjun's avatar
      hwmon: (lm80) Fix missing unlock on error in set_fan_div() · 8000ff42
      Wei Yongjun authored and 谢秀奇's avatar 谢秀奇 committed
      
      commit 07bd14cc upstream.
      
      Add the missing unlock before return from function set_fan_div()
      in the error handling case.
      
      Fixes: c9c63915 ("hwmon: (lm80) fix a missing check of the status of SMBus read")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      8000ff42
    • Alexander Duyck's avatar
      net: Do not allocate page fragments that are not skb aligned · 6efac069
      Alexander Duyck authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 3bed3cc4 ]
      
      This patch addresses the fact that there are drivers, specifically tun,
      that will call into the network page fragment allocators with buffer sizes
      that are not cache aligned. Doing this could result in data alignment
      and DMA performance issues as these fragment pools are also shared with the
      skb allocator and any other devices that will use napi_alloc_frags or
      netdev_alloc_frags.
      
      Fixes: ffde7328 ("net: Split netdev_alloc_frag into __alloc_page_frag and add __napi_alloc_frag")
      Reported-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      6efac069
    • Eric Dumazet's avatar
      tcp: tcp_v4_err() should be more careful · 2e0158b8
      Eric Dumazet authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 2c4cc971 ]
      
      ICMP handlers are not very often stressed, we should
      make them more resilient to bugs that might surface in
      the future.
      
      If there is no packet in retransmit queue, we should
      avoid a NULL deref.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsoukjin bae <soukjin.bae@samsung.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      2e0158b8
    • Eric Dumazet's avatar
      tcp: clear icsk_backoff in tcp_write_queue_purge() · 7a813b28
      Eric Dumazet authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 04c03114 ]
      
      soukjin bae reported a crash in tcp_v4_err() handling
      ICMP_DEST_UNREACH after tcp_write_queue_head(sk)
      returned a NULL pointer.
      
      Current logic should have prevented this :
      
        if (seq != tp->snd_una  || !icsk->icsk_retransmits ||
            !icsk->icsk_backoff || fastopen)
            break;
      
      Problem is the write queue might have been purged
      and icsk_backoff has not been cleared.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsoukjin bae <soukjin.bae@samsung.com>
      Acked-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      7a813b28
    • David S. Miller's avatar
      net: Add header for usage of fls64() · 67c4dda8
      David S. Miller authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 8681ef1f ]
      
      Fixes: 3b89ea9c ("net: Fix for_each_netdev_feature on Big endian")
      Suggested-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      67c4dda8
    • Jason Wang's avatar
      vhost: correctly check the return value of translate_desc() in log_used() · 9c4ec6f8
      Jason Wang authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 816db766 ]
      
      When fail, translate_desc() returns negative value, otherwise the
      number of iovs. So we should fail when the return value is negative
      instead of a blindly check against zero.
      
      Detected by CoverityScan, CID# 1442593:  Control flow issues  (DEADCODE)
      
      Fixes: cc5e7107 ("vhost: log dirty page correctly")
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reported-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      9c4ec6f8
    • Kai-Heng Feng's avatar
      sky2: Increase D3 delay again · 8b56b42f
      Kai-Heng Feng authored and 谢秀奇's avatar 谢秀奇 committed
      [ Upstream commit 1765f5dc ]
      
      Another platform requires even longer delay to make the device work
      correctly after S3.
      
      So increase the delay to 300ms.
      
      BugLink: https://bugs.launchpad.net/bugs/1798921
      
      
      
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      8b56b42f
    • Alexandre Torgue's avatar
      net: stmmac: handle endianness in dwmac4_get_timestamp · d9d5eac6
      Alexandre Torgue authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 224babd62d6f19581757a6d8bae3bf9501fc10de ]
      
      GMAC IP is little-endian and used on several kind of CPU (big or little
      endian). Main callbacks functions of the stmmac drivers take care about
      it. It was not the case for dwmac4_get_timestamp function.
      
      Fixes: ba1ffd74 ("stmmac: fix PTP support for GMAC4")
      Signed-off-by: default avatarAlexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      d9d5eac6
    • Jose Abreu's avatar
      net: stmmac: Fix a race in EEE enable callback · 6f3b371d
      Jose Abreu authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 8a7493e5 ]
      
      We are saving the status of EEE even before we try to enable it. This
      leads to a race with XMIT function that tries to arm EEE timer before we
      set it up.
      
      Fix this by only saving the EEE parameters after all operations are
      performed with success.
      
      Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
      Fixes: d765955d ("stmmac: add the Energy Efficient Ethernet support")
      Cc: Joao Pinto <jpinto@synopsys.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      6f3b371d
    • Paul Kocialkowski's avatar
      net: phy: xgmiitorgmii: Support generic PHY status read · 0522d4a7
      Paul Kocialkowski authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 197f9ab7 ]
      
      Some PHY drivers like the generic one do not provide a read_status
      callback on their own but rely on genphy_read_status being called
      directly.
      
      With the current code, this results in a NULL function pointer call.
      Call genphy_read_status instead when there is no specific callback.
      
      Fixes: f411a616 ("net: phy: Add gmiitorgmii converter support")
      Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      0522d4a7
    • Lorenzo Bianconi's avatar
      net: ipv4: use a dedicated counter for icmp_v4 redirect packets · af0b9420
      Lorenzo Bianconi authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit c09551c6 ]
      
      According to the algorithm described in the comment block at the
      beginning of ip_rt_send_redirect, the host should try to send
      'ip_rt_redirect_number' ICMP redirect packets with an exponential
      backoff and then stop sending them at all assuming that the destination
      ignores redirects.
      If the device has previously sent some ICMP error packets that are
      rate-limited (e.g TTL expired) and continues to receive traffic,
      the redirect packets will never be transmitted. This happens since
      peer->rate_tokens will be typically greater than 'ip_rt_redirect_number'
      and so it will never be reset even if the redirect silence timeout
      (ip_rt_redirect_silence) has elapsed without receiving any packet
      requiring redirects.
      
      Fix it by using a dedicated counter for the number of ICMP redirect
      packets that has been sent by the host
      
      I have not been able to identify a given commit that introduced the
      issue since ip_rt_send_redirect implements the same rate-limiting
      algorithm from commit 1da177e4 ("Linux-2.6.12-rc2")
      
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      af0b9420
    • Lorenzo Bianconi's avatar
      net: ip6_gre: initialize erspan_ver just for erspan tunnels · 86c47687
      Lorenzo Bianconi authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 4974d5f6 ]
      
      After commit c706863b ("net: ip6_gre: always reports o_key to
      userspace"), ip6gre and ip6gretap tunnels started reporting TUNNEL_KEY
      output flag even if it is not configured.
      ip6gre_fill_info checks erspan_ver value to add TUNNEL_KEY for
      erspan tunnels, however in commit 84581bda ("erspan: set
      erspan_ver to 1 by default when adding an erspan dev")
      erspan_ver is initialized to 1 even for ip6gre or ip6gretap
      Fix the issue moving erspan_ver initialization in a dedicated routine
      
      Fixes: c706863b ("net: ip6_gre: always reports o_key to userspace")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
      Reviewed-by: default avatarGreg Rose <gvrose8192@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      86c47687
    • Hauke Mehrtens's avatar
      net: Fix for_each_netdev_feature on Big endian · b2eb91a6
      Hauke Mehrtens authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 3b89ea9c ]
      
      The features attribute is of type u64 and stored in the native endianes on
      the system. The for_each_set_bit() macro takes a pointer to a 32 bit array
      and goes over the bits in this area. On little Endian systems this also
      works with an u64 as the most significant bit is on the highest address,
      but on big endian the words are swapped. When we expect bit 15 here we get
      bit 47 (15 + 32).
      
      This patch converts it more or less to its own for_each_set_bit()
      implementation which works on 64 bit integers directly. This is then
      completely in host endianness and should work like expected.
      
      Fixes: fd867d51 ("net/core: generic support for disabling netdev features down stack")
      Signed-off-by: default avatarHauke Mehrtens <hauke.mehrtens@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      b2eb91a6
    • Petr Machata's avatar
      mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable · 56636e75
      Petr Machata authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 28946040 ]
      
      The function-local variable "delay" enters the loop interpreted as delay
      in bits. However, inside the loop it gets overwritten by the result of
      mlxsw_sp_pg_buf_delay_get(), and thus leaves the loop as quantity in
      cells. Thus on second and further loop iterations, the headroom for a
      given priority is configured with a wrong size.
      
      Fix by introducing a loop-local variable, delay_cells. Rename thres to
      thres_cells for consistency.
      
      Fixes: f417f04d ("mlxsw: spectrum: Refactor port buffer configuration")
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      56636e75
    • John David Anglin's avatar
      dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit · 291c01a5
      John David Anglin authored and 谢秀奇's avatar 谢秀奇 committed
      
      [ Upstream commit 7c0db24c ]
      
      The GPIO interrupt controller on the espressobin board only supports edge interrupts.
      If one enables the use of hardware interrupts in the device tree for the 88E6341, it is
      possible to miss an edge.  When this happens, the INTn pin on the Marvell switch is
      stuck low and no further interrupts occur.
      
      I found after adding debug statements to mv88e6xxx_g1_irq_thread_work() that there is
      a race in handling device interrupts (e.g. PHY link interrupts).  Some interrupts are
      directly cleared by reading the Global 1 status register.  However, the device interrupt
      flag, for example, is not cleared until all the unmasked SERDES and PHY ports are serviced.
      This is done by reading the relevant SERDES and PHY status register.
      
      The code only services interrupts whose status bit is set at the time of reading its status
      register.  If an interrupt event occurs after its status is read and before all interrupts
      are serviced, then this event will not be serviced and the INTn output pin will remain low.
      
      This is not a problem with polling or level interrupts since the handler will be called
      again to process the event.  However, it's a big problem when using level interrupts.
      
      The fix presented here is to add a loop around the code servicing switch interrupts.  If
      any pending interrupts remain after the current set has been handled, we loop and process
      the new set.  If there are no pending interrupts after servicing, we are sure that INTn has
      gone high and we will get an edge when a new event occurs.
      
      Tested on espressobin board.
      
      Fixes: dc30c35b ("net: dsa: mv88e6xxx: Implement interrupt support.")
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Tested-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      291c01a5
    • Yang Yingliang's avatar
      driver: roce: update roce driver from driver team · 40bc5e5e
      Yang Yingliang authored and 谢秀奇's avatar 谢秀奇 committed
      
      driver inclusion
      category: feature
      
      -----------------------------------------
      
      Based on 15c940a5062b17c9c2d30700194f1bd9c3bde72b
      ("RDMA/hns: Fix coding style related issues")
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      40bc5e5e
    • Yang Yingliang's avatar
      driver: hns3: update hns3 driver from driver team · 4645e3f4
      Yang Yingliang authored and 谢秀奇's avatar 谢秀奇 committed
      
      driver inclusion
      category: feature
      
      -----------------------------------------
      
      Based on add763cbef9424c6ea624dce6d6d2d51048cf9da
      ("net: hns3: Reduce resources use in kdump kernel")
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      4645e3f4
    • Yang Yingliang's avatar
      Revert "scsi: hisi_sas: fix bug of LM fail to add list which caused by IO... · bea163a4
      Yang Yingliang authored and 谢秀奇's avatar 谢秀奇 committed
      Revert "scsi: hisi_sas: fix bug of LM fail to add list which caused by IO release when receive underflow cq"
      
      hulk inclusion
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      -------------------------------------------------------------------------
      
      Revert this patch to avoid booting fail on D06 with SATA disks.
      
      This reverts commit 07bfef64b24b2b99f67fc52175840fb6c97d93dd.
      
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      bea163a4
    • kong.kongxinwei's avatar
      drm: hibmc: fix vga UNF ras error for rebooting system · 90820fd6
      kong.kongxinwei authored and 谢秀奇's avatar 谢秀奇 committed
      
      When rebooting this system, this vga will report unf bit error as follow:
      
      [  OK  ] Reached target Unmount All Filesystems.
      [  OK  ] Stopped Remount Root and Kernel File Systems.
      [  OK  ] Reached target Shutdown.
      [  OK  ] Reached target Final Step.
      Starting Reboot...
      [  OK  ] Stopped LVM2 metadata daemon.
      NOTICE:  ####################################
      
      NOTICE:  [PciRasInterruptHandle]:[385L] PcieRasTestInterruptHandler
      
      NOTICE:  ####################################
      
      NOTICE:  [PciRasInterruptHandle]:[398L] CPU0 PCIe RAS Check...
      
      NOTICE:  [PciRasInterruptHandle]:[409L] Chip: 0x0, PCIe_CE_status  = 0x0
      NOTICE:  [PciRasInterruptHandle]:[410L] Chip: 0x0, PCIe_UNF_status = 0x10000
      NOTICE:  [PciRasInterruptHandle]:[411L] Chip: 0x0, PCIe_UF_status  = 0x0
      NOTICE:  [PciRasInterruptHandle]:[426L] RP Error Source Identify = 0x800000
      NOTICE:  [PciRasInterruptHandle]:[438L] ErrSrc Identify = (Bus:0x0) (Dev:0x10) (Func: 0x0)
      
      NOTICE:  [PciRasInterruptHandle]:[457L]  DevSts = 0xa
      NOTICE:  [PciRasInterruptHandle]:[458L]    UncErrSts = 0x100000
      NOTICE:  [PciRasInterruptHandle]:[459L]      CorErrSts = 0x0
      NOTICE:  [PciRasInterruptHandle]:[460L]        RootErrSts = 0x8000024
      NOTICE:  ####################################
      
      NOTICE:  Before Notify OS, Dump AER Error data.
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarallan.wang <allan.wang@siliconmotion.com>
      Signed-off-by: default avatarXinwei Kong <kong.kongxinwei@hisilicon.com>
      Signed-off-by: default avatarkong.kongxinwei <kong.kongxinwei@hisilicon.com>
      Reviewed-by: default avatarliudongdong <liudongdong3@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      90820fd6
    • luojiaxing's avatar
      Fix magic number existed at hisi_sas · 6459a1e3
      luojiaxing authored and 谢秀奇's avatar 谢秀奇 committed
      
      we found out some magic number within hisi_sas,
      so fix it.
      
      Also, we fix some other bugs as blow:
      1. Force ptr type to unsigned long without using uintptr_t
      2. Directly use input parameter at some operations
      
      Signed-off-by: default avatarLuo Jiaxing <luojiaxing@huawei.com>
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarluojiaxing <luojiaxing@huawei.com>
      Reviewed-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      6459a1e3
    • chenxiang's avatar
      scsi: hisi_sas: do some changes for coding standard · bd937d53
      chenxiang authored and 谢秀奇's avatar 谢秀奇 committed
      
      There are two changes including:
      - move input parameter before output parameter;
      - change signed int to unsigned int;
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarchenxiang (M) <chenxiang66@hisilicon.com>
      Reviewed-by: default avatarhuangdaode <huangdaode@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      bd937d53
    • Luo Jiaxing's avatar
      scsi: hisi_sas: Add manual trigger for debugfs · efea11f2
      Luo Jiaxing authored and 谢秀奇's avatar 谢秀奇 committed
      
      Tester want to check some dump information sometimes
      even though there is no error happened. So we add manual
      trigger for this need.
      
      Different with code, which used for upstream, I enable
      mutil-dump here.
      
      Signed-off-by: default avatarLuo Jiaxing <luojiaxing@huawei.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      
      Feature or Bugfix:Feature
      
      Signed-off-by: default avatarluojiaxing <luojiaxing@huawei.com>
      Reviewed-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      efea11f2
    • chenxiang's avatar
      scsi: hisi_sas: allocate number of CQ irq vectors according to cpu numbers · fb5231b3
      chenxiang authored and 谢秀奇's avatar 谢秀奇 committed
      
      Currently if number of CQ irq vectors (fixed 16) are less than nr_cpus,
      it will fail to allocate msi interrupt. So allocate number of CQ irq
      vectors from 1 to 16.
      And also if offline those cpus assocationed with CQ irq vectors, no
      need to issue internal abort command to the queue, or internal abort
      command will be timeout as there is no cpu processing the CQ interrupt.
      
      Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarchenxiang (M) <chenxiang66@hisilicon.com>
      Reviewed-by: default avatartanxiaofei <tanxiaofei@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      fb5231b3
    • chenxiang's avatar
      scsi: hisi_sas: some misc tidy-up related to coding standard · 82e9c59c
      chenxiang authored and 谢秀奇's avatar 谢秀奇 committed
      
      Do some code cleanup according to HUAWEI coding standard. It includes:
      - Make the type of return vaule is the same as the function;
      - Keep spaces between annotations and annotator;
      - Add necessary spaces between operator and variable;
      - Remove some un-necessary initialized variable;
      
      Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarchenxiang (M) <chenxiang66@hisilicon.com>
      Reviewed-by: default avatartanxiaofei <tanxiaofei@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      82e9c59c
    • Luo Jiaxing's avatar
      scsi: hisi_sas: correct an error setting of memory allocation size for DQ at Debugfs feature · fd98df2a
      Luo Jiaxing authored and 谢秀奇's avatar 谢秀奇 committed
      
      We allocate memory base on hisi_hba->hw->complete_hdr_size for DQ, but
      it was wrong.For the structure, which used to save DQ, is
      struct hisi_sas_cmd_hdr, and this size is not saved at
      variables: complete_hdr_size.
      
      So we need to correct it.
      
      Signed-off-by: default avatarLuo Jiaxing <luojiaxing@huawei.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarluojiaxing <luojiaxing@huawei.com>
      Reviewed-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      fd98df2a
    • shenjian's avatar
      net: phy: marvell: net: phy: marvell: add new m88e1510 LED configuration for hns3 · ccf99168
      shenjian authored and 谢秀奇's avatar 谢秀奇 committed
      
      The default m88e1510 LED configuration is not fit for hns3 driver.
      This patch adds a new configuration for it.
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarshenjian (K) <shenjian15@huawei.com>
      Reviewed-by: default avatarlipeng <lipeng321@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      ccf99168
    • luojiaxing's avatar
      scsi: hisi_sas: Sync upstream version of DFX feature code · 82153b96
      luojiaxing authored and 谢秀奇's avatar 谢秀奇 committed
      
      John modify some code for upstream, we need to sync those
      to our ci code.
      
      Feature or Bugfix:Feature
      
      Signed-off-by: default avatarluojiaxing <luojiaxing@huawei.com>
      Reviewed-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      82153b96
    • Luo Jiaxing's avatar
      scsi: hisi_sas: Reject request of setting minimum_linkrate exceed 1.5 Gbit at... · 89ae26ec
      Luo Jiaxing authored and 谢秀奇's avatar 谢秀奇 committed
      scsi: hisi_sas: Reject request of setting minimum_linkrate exceed 1.5 Gbit at directly attached environment
      
      At directly attached env, we found out that user can successfully
      set a higher linkrate to minimum_linkrate than negotiated_linkrate.
      Like below:
      
      maximum_linkrate: 6.0 Gbit
      minimum_linkrate: 6.0 Gbit
      negotiated_linkrate: 3.0 Gbit
      
      It mean that the bound of max and min linkrate cannot limit the
      negotiated linkrate. This may cause trouble to user.
      
      Actually, we only send maximum_linkrate to SAS controller, and SAS
      controller will try all the linkrate under the setting value and
      finally negotiate with the highest possible linkrate.
      
      So to the SAS controller at directly attached env, the min linkrate
      is unnecessary. If we want to avoid this issue, the best way is to
      reject the request of setting minimum_linkrate exceed 1.5 Gbit.
      
      Signed-off-by: default avatarLuo Jiaxing <luojiaxing@huawei.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      
      Feature or Bugfix:Bugfix
      
      Signed-off-by: default avatarluojiaxing <luojiaxing@huawei.com>
      Reviewed-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      89ae26ec
    • tanxiaofei's avatar
      fix the issue of losing directly attached disk when hot-plug for v2 hw · ff4e59c0
      tanxiaofei authored and 谢秀奇's avatar 谢秀奇 committed
      
      The issue of losing directly attached disk when hot-plug is only
      resolved on v3 hw. It also exists on v2 hw. This patch is to apply
      the same soluton for v2 hw.
      
      Feature or Bugfix: Bugfix
      
      Signed-off-by: default avatartanxiaofei <tanxiaofei@huawei.com>
      Reviewed-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      ff4e59c0