1. 28 1月, 2021 40 次提交
    • J
      bpf: Save correct stopping point in file seq iteration · f31fd3b8
      Jonathan Lemon 提交于
      stable inclusion
      from stable-5.10.9
      commit 1f63b3393baccf8c34319b16b6a70a7188026238
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 69ca310f ]
      
      On some systems, some variant of the following splat is
      repeatedly seen.  The common factor in all traces seems
      to be the entry point to task_file_seq_next().  With the
      patch, all warnings go away.
      
          rcu: INFO: rcu_sched self-detected stall on CPU
          rcu: \x0926-....: (20992 ticks this GP) idle=d7e/1/0x4000000000000002 softirq=81556231/81556231 fqs=4876
          \x09(t=21033 jiffies g=159148529 q=223125)
          NMI backtrace for cpu 26
          CPU: 26 PID: 2015853 Comm: bpftool Kdump: loaded Not tainted 5.6.13-0_fbk4_3876_gd8d1f9bf80bb #1
          Hardware name: Quanta Twin Lakes MP/Twin Lakes Passive MP, BIOS F09_3A12 10/08/2018
          Call Trace:
           <IRQ>
           dump_stack+0x50/0x70
           nmi_cpu_backtrace.cold.6+0x13/0x50
           ? lapic_can_unplug_cpu.cold.30+0x40/0x40
           nmi_trigger_cpumask_backtrace+0xba/0xca
           rcu_dump_cpu_stacks+0x99/0xc7
           rcu_sched_clock_irq.cold.90+0x1b4/0x3aa
           ? tick_sched_do_timer+0x60/0x60
           update_process_times+0x24/0x50
           tick_sched_timer+0x37/0x70
           __hrtimer_run_queues+0xfe/0x270
           hrtimer_interrupt+0xf4/0x210
           smp_apic_timer_interrupt+0x5e/0x120
           apic_timer_interrupt+0xf/0x20
           </IRQ>
          RIP: 0010:get_pid_task+0x38/0x80
          Code: 89 f6 48 8d 44 f7 08 48 8b 00 48 85 c0 74 2b 48 83 c6 55 48 c1 e6 04 48 29 f0 74 19 48 8d 78 20 ba 01 00 00 00 f0 0f c1 50 20 <85> d2 74 27 78 11 83 c2 01 78 0c 48 83 c4 08 c3 31 c0 48 83 c4 08
          RSP: 0018:ffffc9000d293dc8 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff13
          RAX: ffff888637c05600 RBX: ffffc9000d293e0c RCX: 0000000000000000
          RDX: 0000000000000001 RSI: 0000000000000550 RDI: ffff888637c05620
          RBP: ffffffff8284eb80 R08: ffff88831341d300 R09: ffff88822ffd8248
          R10: ffff88822ffd82d0 R11: 00000000003a93c0 R12: 0000000000000001
          R13: 00000000ffffffff R14: ffff88831341d300 R15: 0000000000000000
           ? find_ge_pid+0x1b/0x20
           task_seq_get_next+0x52/0xc0
           task_file_seq_get_next+0x159/0x220
           task_file_seq_next+0x4f/0xa0
           bpf_seq_read+0x159/0x390
           vfs_read+0x8a/0x140
           ksys_read+0x59/0xd0
           do_syscall_64+0x42/0x110
           entry_SYSCALL_64_after_hwframe+0x44/0xa9
          RIP: 0033:0x7f95ae73e76e
          Code: Bad RIP value.
          RSP: 002b:00007ffc02c1dbf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
          RAX: ffffffffffffffda RBX: 000000000170faa0 RCX: 00007f95ae73e76e
          RDX: 0000000000001000 RSI: 00007ffc02c1dc30 RDI: 0000000000000007
          RBP: 00007ffc02c1ec70 R08: 0000000000000005 R09: 0000000000000006
          R10: fffffffffffff20b R11: 0000000000000246 R12: 00000000019112a0
          R13: 0000000000000000 R14: 0000000000000007 R15: 00000000004283c0
      
      If unable to obtain the file structure for the current task,
      proceed to the next task number after the one returned from
      task_seq_get_next(), instead of the next task number from the
      original iterator.
      
      Also, save the stopping task number from task_seq_get_next()
      on failure in case of restarts.
      
      Fixes: eaaacd23 ("bpf: Add task and task/file iterator targets")
      Signed-off-by: NJonathan Lemon <jonathan.lemon@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20201218185032.2464558-2-jonathan.lemon@gmail.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      f31fd3b8
    • S
      bpf: Simplify task_file_seq_get_next() · 37e4f715
      Song Liu 提交于
      stable inclusion
      from stable-5.10.9
      commit a3a51c69c1a9a61ed4f2d5e372f3a761d39dd65d
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 91b2db27 ]
      
      Simplify task_file_seq_get_next() by removing two in/out arguments: task
      and fstruct. Use info->task and info->files instead.
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/20201120002833.2481110-1-songliubraving@fb.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      37e4f715
    • U
      rcu-tasks: Move RCU-tasks initialization to before early_initcall() · 15fc7c16
      Uladzislau Rezki (Sony) 提交于
      stable inclusion
      from stable-5.10.9
      commit 30b491e2b6cc669b23179809ea47314fcae24941
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 1b04fa99 ]
      
      PowerPC testing encountered boot failures due to RCU Tasks not being
      fully initialized until core_initcall() time.  This commit therefore
      initializes RCU Tasks (along with Rude RCU and RCU Tasks Trace) just
      before early_initcall() time, thus allowing waiting on RCU Tasks grace
      periods from early_initcall() handlers.
      
      Link: https://lore.kernel.org/rcu/87eekfh80a.fsf@dja-thinkpad.axtens.net/
      Fixes: 36dadef2 ("kprobes: Init kprobes in early_initcall")
      Tested-by: NDaniel Axtens <dja@axtens.net>
      Signed-off-by: NUladzislau Rezki (Sony) <urezki@gmail.com>
      Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      15fc7c16
    • L
      poll: fix performance regression due to out-of-line __put_user() · 4611f8b1
      Linus Torvalds 提交于
      stable inclusion
      from stable-5.10.9
      commit bc880f2040e0c22fa60893e20a7e64744cde7bfc
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit ef0ba055 ]
      
      The kernel test robot reported a -5.8% performance regression on the
      "poll2" test of will-it-scale, and bisected it to commit d55564cf
      ("x86: Make __put_user() generate an out-of-line call").
      
      I didn't expect an out-of-line __put_user() to matter, because no normal
      core code should use that non-checking legacy version of user access any
      more.  But I had overlooked the very odd poll() usage, which does a
      __put_user() to update the 'revents' values of the poll array.
      
      Now, Al Viro correctly points out that instead of updating just the
      'revents' field, it would be much simpler to just copy the _whole_
      pollfd entry, and then we could just use "copy_to_user()" on the whole
      array of entries, the same way we use "copy_from_user()" a few lines
      earlier to get the original values.
      
      But that is not what we've traditionally done, and I worry that threaded
      applications might be concurrently modifying the other fields of the
      pollfd array.  So while Al's suggestion is simpler - and perhaps worth
      trying in the future - this instead keeps the "just update revents"
      model.
      
      To fix the performance regression, use the modern "unsafe_put_user()"
      instead of __put_user(), with the proper "user_write_access_begin()"
      guarding in place. This improves code generation enormously.
      
      Link: https://lore.kernel.org/lkml/20210107134723.GA28532@xsang-OptiPlex-9020/Reported-by: Nkernel test robot <oliver.sang@intel.com>
      Tested-by: NOliver Sang <oliver.sang@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: David Laight <David.Laight@aculab.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      4611f8b1
    • A
      ARM: picoxcell: fix missing interrupt-parent properties · 61a78341
      Arnd Bergmann 提交于
      stable inclusion
      from stable-5.10.9
      commit e30f6e1ac3ce73e2bfab7ac9ddd3c61d07a5a3cf
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit bac71717 ]
      
      dtc points out that the interrupts for some devices are not parsable:
      
      picoxcell-pc3x2.dtsi:45.19-49.5: Warning (interrupts_property): /paxi/gem@30000: Missing interrupt-parent
      picoxcell-pc3x2.dtsi:51.21-55.5: Warning (interrupts_property): /paxi/dmac@40000: Missing interrupt-parent
      picoxcell-pc3x2.dtsi:57.21-61.5: Warning (interrupts_property): /paxi/dmac@50000: Missing interrupt-parent
      picoxcell-pc3x2.dtsi:233.21-237.5: Warning (interrupts_property): /rwid-axi/axi2pico@c0000000: Missing interrupt-parent
      
      There are two VIC instances, so it's not clear which one needs to be
      used. I found the BSP sources that reference VIC0, so use that:
      
      https://github.com/r1mikey/meta-picoxcell/blob/master/recipes-kernel/linux/linux-picochip-3.0/0001-picoxcell-support-for-Picochip-picoXcell-SoC.patchAcked-by: NJamie Iles <jamie@jamieiles.com>
      Link: https://lore.kernel.org/r/20201230152010.3914962-1-arnd@kernel.org'
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      61a78341
    • C
      drm/msm: Call msm_init_vram before binding the gpu · 0440d732
      Craig Tatlor 提交于
      stable inclusion
      from stable-5.10.9
      commit d565c626b4e14864be4f6886d73e86f3338f7bac
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit d863f0c7 ]
      
      vram.size is needed when binding a gpu without an iommu and is defined
      in msm_init_vram(), so run that before binding it.
      Signed-off-by: NCraig Tatlor <ctatlor97@gmail.com>
      Reviewed-by: NBrian Masney <masneyb@onstation.org>
      Tested-by: NAlexey Minnekhanov <alexeymin@postmarketos.org>
      Signed-off-by: NRob Clark <robdclark@chromium.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      0440d732
    • S
      ACPI: scan: add stub acpi_create_platform_device() for !CONFIG_ACPI · 04babe79
      Shawn Guo 提交于
      stable inclusion
      from stable-5.10.9
      commit 45f7e133f9e8182409fe7ac18256586442a513c6
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit ee61cfd9 ]
      
      It adds a stub acpi_create_platform_device() for !CONFIG_ACPI build, so
      that caller doesn't have to deal with !CONFIG_ACPI build issue.
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NShawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      04babe79
    • L
      iommu/vt-d: Fix lockdep splat in sva bind()/unbind() · 33d987cd
      Lu Baolu 提交于
      stable inclusion
      from stable-5.10.9
      commit a4c84cd83c158df7f4e9c634cabbac0b9cade8cc
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 420d42f6 ]
      
      Lock(&iommu->lock) without disabling irq causes lockdep warnings.
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      
      ========================================================
      WARNING: possible irq lock inversion dependency detected
      5.11.0-rc1+ #828 Not tainted
      --------------------------------------------------------
      kworker/0:1H/120 just changed the state of lock:
      ffffffffad9ea1b8 (device_domain_lock){..-.}-{2:2}, at:
      iommu_flush_dev_iotlb.part.0+0x32/0x120
      but this lock took another, SOFTIRQ-unsafe lock in the past:
       (&iommu->lock){+.+.}-{2:2}
      
      and interrupts could create inverse lock ordering between them.
      
      other info that might help us debug this:
       Possible interrupt unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(&iommu->lock);
                                     local_irq_disable();
                                     lock(device_domain_lock);
                                     lock(&iommu->lock);
        <Interrupt>
          lock(device_domain_lock);
      
       *** DEADLOCK ***
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Link: https://lore.kernel.org/r/20201231005323.2178523-5-baolu.lu@linux.intel.comSigned-off-by: NWill Deacon <will@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      33d987cd
    • P
      usb: typec: Fix copy paste error for NVIDIA alt-mode description · fb9f4177
      Peter Robinson 提交于
      stable inclusion
      from stable-5.10.9
      commit 2c7b7660c611ee995652f89eec3edea0fd5e237a
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 41952a66 ]
      
      The name of the module for the NVIDIA alt-mode is incorrect as it
      looks to be a copy-paste error from the entry above, update it to
      the correct typec_nvidia module name.
      
      Cc: Ajay Gupta <ajayg@nvidia.com>
      Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: NPeter Robinson <pbrobinson@gmail.com>
      Link: https://lore.kernel.org/r/20210106001605.167917-1-pbrobinson@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      fb9f4177
    • J
      drm/amdgpu: fix potential memory leak during navi12 deinitialization · 035358b3
      Jiawei Gu 提交于
      stable inclusion
      from stable-5.10.9
      commit 279af879c3df88a08d0d40fd42108d13a48a7bdf
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit e6d5c64e ]
      
      Navi12 HDCP & DTM deinitialization needs continue to free bo if already
      created though initialized flag is not set.
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NJiawei Gu <Jiawei.Gu@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      035358b3
    • X
      drm/amd/pm: fix the failure when change power profile for renoir · 5a08292e
      Xiaojian Du 提交于
      stable inclusion
      from stable-5.10.9
      commit 9910f52b4cb46ed65a0ebf59fd53b928b44715e7
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 44cb39e1 ]
      
      This patch is to fix the failure when change power profile to
      "profile_peak" for renoir.
      Signed-off-by: NXiaojian Du <Xiaojian.Du@amd.com>
      Reviewed-by: NHuang Rui <ray.huang@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      5a08292e
    • D
      drm/amdgpu: fix a GPU hang issue when remove device · c606ecc8
      Dennis Li 提交于
      stable inclusion
      from stable-5.10.9
      commit a973bc7d8ab521e35846c793476027b11bbe5a3f
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 88e21af1 ]
      
      When GFXOFF is enabled and GPU is idle, driver will fail to access some
      registers. Therefore change to disable power gating before all access
      registers with MMIO.
      
      Dmesg log is as following:
      amdgpu 0000:03:00.0: amdgpu: amdgpu: finishing device.
      amdgpu: cp queue pipe 4 queue 0 preemption failed
      amdgpu 0000:03:00.0: amdgpu: failed to write reg 2890 wait reg 28a2
      amdgpu 0000:03:00.0: amdgpu: failed to write reg 1a6f4 wait reg 1a706
      amdgpu 0000:03:00.0: amdgpu: failed to write reg 2890 wait reg 28a2
      amdgpu 0000:03:00.0: amdgpu: failed to write reg 1a6f4 wait reg 1a706
      Signed-off-by: NDennis Li <Dennis.Li@amd.com>
      Reviewed-by: NHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      c606ecc8
    • K
      drm/amd/display: fix sysfs amdgpu_current_backlight_pwm NULL pointer issue · 795e045e
      Kevin Wang 提交于
      stable inclusion
      from stable-5.10.9
      commit 26f0adb0b4c80248b8c111fd4f34b324c9420970
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit a7b5d9dd ]
      
      fix NULL pointer issue when read sysfs amdgpu_current_backlight_pwm sysfs node.
      
      Call Trace:
      [  248.273833] BUG: kernel NULL pointer dereference, address: 0000000000000130
      [  248.273930] #PF: supervisor read access in kernel mode
      [  248.273993] #PF: error_code(0x0000) - not-present page
      [  248.274054] PGD 0 P4D 0
      [  248.274092] Oops: 0000 [#1] SMP PTI
      [  248.274138] CPU: 2 PID: 1377 Comm: cat Tainted: G           OE     5.9.0-rc5-drm-next-5.9+ #1
      [  248.274233] Hardware name: System manufacturer System Product Name/Z170-A, BIOS 3802 03/15/2018
      [  248.274641] RIP: 0010:dc_link_get_backlight_level+0x5/0x70 [amdgpu]
      [  248.274718] Code: 67 ff ff ff 41 b9 03 00 00 00 e9 45 ff ff ff d1 ea e9 55 ff ff ff 0f 1f 44 00 00 66 2e
      0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 <48> 8b 87 30 01 00 00 48 8b 00 48 8b 88 88 03 00 00 48 8d 81 e8 01
      [  248.274919] RSP: 0018:ffffb5ad809b3df0 EFLAGS: 00010203
      [  248.274982] RAX: ffffa0f77d1c0010 RBX: ffffa0f793ae9168 RCX: 0000000000000001
      [  248.275064] RDX: ffffa0f79753db00 RSI: 0000000000000001 RDI: 0000000000000000
      [  248.275145] RBP: ffffb5ad809b3e00 R08: ffffb5ad809b3da0 R09: 0000000000000000
      [  248.275225] R10: ffffb5ad809b3e68 R11: 0000000000000000 R12: ffffa0f793ae9190
      [  248.275306] R13: ffffb5ad809b3ef0 R14: 0000000000000001 R15: ffffa0f793ae9168
      [  248.275388] FS:  00007f5f1ec4d540(0000) GS:ffffa0f79ec80000(0000) knlGS:0000000000000000
      [  248.275480] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  248.275547] CR2: 0000000000000130 CR3: 000000042a03c005 CR4: 00000000003706e0
      [  248.275628] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  248.275708] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  248.275789] Call Trace:
      [  248.276124]  ? current_backlight_read+0x24/0x40 [amdgpu]
      [  248.276194]  seq_read+0xc3/0x3f0
      [  248.276240]  full_proxy_read+0x5c/0x90
      [  248.276290]  vfs_read+0xa7/0x190
      [  248.276334]  ksys_read+0xa7/0xe0
      [  248.276379]  __x64_sys_read+0x1a/0x20
      [  248.276429]  do_syscall_64+0x37/0x80
      [  248.276477]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  248.276538] RIP: 0033:0x7f5f1e75c191
      [  248.276585] Code: fe ff ff 48 8d 3d b7 9d 0a 00 48 83 ec 08 e8 46 4d 02 00 66 0f 1f 44 00 00 48 8d 05 71 07
      2e 00 8b 00 85 c0 75 13 31 c0 0f 05 <48> 3d 00 f0 ff ff 77 57 f3 c3 0f 1f 44 00 00 41 54 55 49 89 d4 53Hw
      [  248.276784] RSP: 002b:00007ffcb1fc3f38 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
      [  248.276872] RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007f5f1e75c191
      [  248.276953] RDX: 0000000000020000 RSI: 00007f5f1ec2b000 RDI: 0000000000000003
      [  248.277034] RBP: 0000000000020000 R08: 00000000ffffffff R09: 0000000000000000
      [  248.277115] R10: 0000000000000022 R11: 0000000000000246 R12: 00007f5f1ec2b000
      [  248.277195] R13: 0000000000000003 R14: 00007f5f1ec2b00f R15: 0000000000020000
      [  248.277279] Modules linked in: amdgpu(OE) iommu_v2 gpu_sched ttm(OE) drm_kms_helper cec drm
      i2c_algo_bit fb_sys_fops syscopyarea sysfillrect sysimgblt rpcsec_gss_krb5 auth_rpcgss nfsv4 nfs
      lockd grace fscache nls_iso8859_1 snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic
      ledtrig_audio intel_rapl_msr intel_rapl_common snd_hda_intel snd_intel_dspcfg x86_pkg_temp_thermal
      intel_powerclamp snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event mei_hdcp
      coretemp snd_rawmidi snd_seq kvm_intel kvm snd_seq_device snd_timer irqbypass joydev snd input_leds soundcore
      crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd glue_helper rapl intel_cstate
      mac_hid mei_me serio_raw mei eeepc_wmi wmi_bmof asus_wmi mxm_wmi intel_wmi_thunderbolt acpi_pad sparse_keymap
      efi_pstore sch_fq_codel parport_pc ppdev lp parport sunrpc ip_tables x_tables autofs4 hid_logitech_hidpp
      hid_logitech_dj hid_generic usbhid hid e1000e psmouse ahci libahci wmi video
      [  248.278211] CR2: 0000000000000130
      [  248.278221] ---[ end trace 1fbe72fe6f91091d ]---
      [  248.357226] RIP: 0010:dc_link_get_backlight_level+0x5/0x70 [amdgpu]
      [  248.357272] Code: 67 ff ff ff 41 b9 03 00 00 00 e9 45 ff ff ff d1 ea e9 55 ff ff ff 0f 1f 44 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 <48> 8b 87 30 01 00 00 48 8b 00 48 8b 88 88 03 00 00 48 8d 81 e8 01
      Signed-off-by: NKevin Wang <kevin1.wang@amd.com>
      Acked-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      795e045e
    • I
      nvmet-rdma: Fix list_del corruption on queue establishment failure · 45809665
      Israel Rukshin 提交于
      stable inclusion
      from stable-5.10.9
      commit 8e57baf3cdb3f752f92b424b8e6154b81723e267
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 9ceb7863 ]
      
      When a queue is in NVMET_RDMA_Q_CONNECTING state, it may has some
      requests at rsp_wait_list. In case a disconnect occurs at this
      state, no one will empty this list and will return the requests to
      free_rsps list. Normally nvmet_rdma_queue_established() free those
      requests after moving the queue to NVMET_RDMA_Q_LIVE state, but in
      this case __nvmet_rdma_queue_disconnect() is called before. The
      crash happens at nvmet_rdma_free_rsps() when calling
      list_del(&rsp->free_list), because the request exists only at
      the wait list. To fix the issue, simply clear rsp_wait_list when
      destroying the queue.
      Signed-off-by: NIsrael Rukshin <israelr@nvidia.com>
      Reviewed-by: NMax Gurtovoy <mgurtovoy@nvidia.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      45809665
    • L
      nvme: avoid possible double fetch in handling CQE · 0aaccf1e
      Lalithambika Krishnakumar 提交于
      stable inclusion
      from stable-5.10.9
      commit 74310d40e0a41483dc7125347a9ccc249655fd85
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 62df8016 ]
      
      While handling the completion queue, keep a local copy of the command id
      from the DMA-accessible completion entry. This silences a time-of-check
      to time-of-use (TOCTOU) warning from KF/x[1], with respect to a
      Thunderclap[2] vulnerability analysis. The double-read impact appears
      benign.
      
      There may be a theoretical window for @command_id to be used as an
      adversary-controlled array-index-value for mounting a speculative
      execution attack, but that mitigation is saved for a potential follow-on.
      A man-in-the-middle attack on the data payload is out of scope for this
      analysis and is hopefully mitigated by filesystem integrity mechanisms.
      
      [1] https://github.com/intel/kernel-fuzzer-for-xen-project
      [2] http://thunderclap.io/thunderclap-paper-ndss2019.pdfSigned-off-by: NLalithambika Krishna Kumar <lalithambika.krishnakumar@intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      0aaccf1e
    • G
      nvme-pci: mark Samsung PM1725a as IGNORE_DEV_SUBNQN · c2ff532d
      Gopal Tiwari 提交于
      stable inclusion
      from stable-5.10.9
      commit afc0002f639683ae98c337b272732fb47ff7ed31
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 7ee5c78c ]
      
      A system with more than one of these SSDs will only have one usable.
      Hence the kernel fails to detect nvme devices due to duplicate cntlids.
      
      [    6.274554] nvme nvme1: Duplicate cntlid 33 with nvme0, rejecting
      [    6.274566] nvme nvme1: Removing after probe failure status: -22
      
      Adding the NVME_QUIRK_IGNORE_DEV_SUBNQN quirk to resolves the issue.
      Signed-off-by: NGopal Tiwari <gtiwari@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      c2ff532d
    • P
      selftests: fix the return value for UDP GRO test · 6a0bb69b
      Po-Hsu Lin 提交于
      stable inclusion
      from stable-5.10.9
      commit 1151161dd029a7d736ffffa356a837441b47e515
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 3503ee6c ]
      
      The udpgro.sh will always return 0 (unless the bpf selftest was not
      build first) even if there are some failed sub test-cases.
      
      Therefore the kselftest framework will report this case is OK.
      
      Check and return the exit status of each test to make it easier to
      spot real failures.
      Signed-off-by: NPo-Hsu Lin <po-hsu.lin@canonical.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      6a0bb69b
    • M
      net: ethernet: fs_enet: Add missing MODULE_LICENSE · 20cd72e6
      Michael Ellerman 提交于
      stable inclusion
      from stable-5.10.9
      commit 2e1939396c77090d9be8f44a66fc7055acd122ec
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 445c6198 ]
      
      Since commit 1d6cd392 ("modpost: turn missing MODULE_LICENSE()
      into error") the ppc32_allmodconfig build fails with:
      
        ERROR: modpost: missing MODULE_LICENSE() in drivers/net/ethernet/freescale/fs_enet/mii-fec.o
        ERROR: modpost: missing MODULE_LICENSE() in drivers/net/ethernet/freescale/fs_enet/mii-bitbang.o
      
      Add the missing MODULE_LICENSEs to fix the build. Both files include a
      copyright header indicating they are GPL v2.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      20cd72e6
    • A
      misdn: dsp: select CONFIG_BITREVERSE · f7d0fd0f
      Arnd Bergmann 提交于
      stable inclusion
      from stable-5.10.9
      commit 8bd59057edf531d241979f458915d4d9cd5df359
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 51049bd9 ]
      
      Without this, we run into a link error
      
      arm-linux-gnueabi-ld: drivers/isdn/mISDN/dsp_audio.o: in function `dsp_audio_generate_law_tables':
      (.text+0x30c): undefined reference to `byte_rev_table'
      arm-linux-gnueabi-ld: drivers/isdn/mISDN/dsp_audio.o:(.text+0x5e4): more undefined references to `byte_rev_table' follow
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      f7d0fd0f
    • R
      arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC · 936e55b5
      Randy Dunlap 提交于
      stable inclusion
      from stable-5.10.9
      commit bb3700925c19d9e71668a3eacee05633542a2ac5
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 8a48c0a3 ]
      
      fs/dax.c uses copy_user_page() but ARC does not provide that interface,
      resulting in a build error.
      
      Provide copy_user_page() in <asm/page.h>.
      
      ../fs/dax.c: In function 'copy_cow_page_dax':
      ../fs/dax.c:702:2: error: implicit declaration of function 'copy_user_page'; did you mean 'copy_to_user_page'? [-Werror=implicit-function-declaration]
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Dan Williams <dan.j.williams@intel.com>
      #Acked-by: Vineet Gupta <vgupta@synopsys.com> # v1
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: linux-nvdimm@lists.01.org
      #Reviewed-by: Ira Weiny <ira.weiny@intel.com> # v2
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      936e55b5
    • J
      bfq: Fix computation of shallow depth · dabe9585
      Jan Kara 提交于
      stable inclusion
      from stable-5.10.9
      commit 7fdaca86fc9b853c44e0104919989b6cb387cdc2
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 6d4d2735 ]
      
      BFQ computes number of tags it allows to be allocated for each request type
      based on tag bitmap. However it uses 1 << bitmap.shift as number of
      available tags which is wrong. 'shift' is just an internal bitmap value
      containing logarithm of how many bits bitmap uses in each bitmap word.
      Thus number of tags allowed for some request types can be far to low.
      Use proper bitmap.depth which has the number of tags instead.
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      dabe9585
    • P
      io_uring: drop file refs after task cancel · a15af68d
      Pavel Begunkov 提交于
      stable inclusion
      from stable-5.10.9
      commit 94dbb87fc0b25285a0eba2350f77316063151be5
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit de7f1d9e ]
      
      io_uring fds marked O_CLOEXEC and we explicitly cancel all requests
      before going through exec, so we don't want to leave task's file
      references to not our anymore io_uring instances.
      Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      a15af68d
    • X
      spi: fix the divide by 0 error when calculating xfer waiting time · 50eab22e
      Xu Yilun 提交于
      stable inclusion
      from stable-5.10.9
      commit 501e1875da3237a876f8d09e1a286ec2ff83d4fe
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 6170d077 ]
      
      The xfer waiting time is the result of xfer->len / xfer->speed_hz. This
      patch makes the assumption of 100khz xfer speed if the xfer->speed_hz is
      not assigned and stays 0. This avoids the divide by 0 issue and ensures
      a reasonable tolerant waiting time.
      Signed-off-by: NXu Yilun <yilun.xu@intel.com>
      Link: https://lore.kernel.org/r/1609723749-3557-1-git-send-email-yilun.xu@intel.comSigned-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      50eab22e
    • M
      kconfig: remove 'kvmconfig' and 'xenconfig' shorthands · 0d55aab2
      Masahiro Yamada 提交于
      stable inclusion
      from stable-5.10.9
      commit 17a08680ab6a6c057949cb48c352933e09ea377a
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 9bba03d4 ]
      
      Linux 5.10 is out. Remove the 'kvmconfig' and 'xenconfig' shorthands
      as previously announced.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      0d55aab2
    • J
      lib/raid6: Let $(UNROLL) rules work with macOS userland · 1ee75828
      John Millikin 提交于
      stable inclusion
      from stable-5.10.9
      commit 2aa134d9abca5f31f09e3ad7610dd08b28c42b0a
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 0c36d88c ]
      
      Older versions of BSD awk are fussy about the order of '-v' and '-f'
      flags, and require a space after the flag name. This causes build
      failures on platforms with an old awk, such as macOS and NetBSD.
      
      Since GNU awk and modern versions of BSD awk (distributed with
      FreeBSD/OpenBSD) are fine with either form, the definition of
      'cmd_unroll' can be trivially tweaked to let the lib/raid6 Makefile
      work with both old and new awk flag dialects.
      Signed-off-by: NJohn Millikin <john@john-millikin.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      1ee75828
    • U
      hwmon: (pwm-fan) Ensure that calculation doesn't discard big period values · 207b2eae
      Uwe Kleine-König 提交于
      stable inclusion
      from stable-5.10.9
      commit 3163d7c1fbd32d96d242557ad443fe595a9ee281
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 1eda5233 ]
      
      With MAX_PWM being defined to 255 the code
      
      	unsigned long period;
      	...
      	period = ctx->pwm->args.period;
      	state.duty_cycle = DIV_ROUND_UP(pwm * (period - 1), MAX_PWM);
      
      calculates a too small value for duty_cycle if the configured period is
      big (either by discarding the 64 bit value ctx->pwm->args.period or by
      overflowing the multiplication). As this results in a too slow fan and
      so maybe an overheating machine better be safe than sorry and error out
      in .probe.
      Signed-off-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Link: https://lore.kernel.org/r/20201215092031.152243-1-u.kleine-koenig@pengutronix.deSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      207b2eae
    • D
      habanalabs: Fix memleak in hl_device_reset · dc0814d3
      Dinghao Liu 提交于
      stable inclusion
      from stable-5.10.9
      commit 8c3520e21f6b048901534463233d7aa73900a112
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit b000700d ]
      
      When kzalloc() fails, we should execute hl_mmu_fini()
      to release the MMU module. It's the same when
      hl_ctx_init() fails.
      Signed-off-by: NDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: NOded Gabbay <ogabbay@kernel.org>
      Signed-off-by: NOded Gabbay <ogabbay@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      dc0814d3
    • X
      spi: altera: fix return value for altera_spi_txrx() · 75f7b7d8
      Xu Yilun 提交于
      stable inclusion
      from stable-5.10.9
      commit 78755373aa48eb50367bcb674f99fdb79e236bff
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit ede090f5 ]
      
      This patch fixes the return value for altera_spi_txrx. It should return
      1 for interrupt transfer mode, and return 0 for polling transfer mode.
      
      The altera_spi_txrx() implements the spi_controller.transfer_one
      callback. According to the spi-summary.rst, the transfer_one should
      return 0 when transfer is finished, return 1 when transfer is still in
      progress.
      Signed-off-by: NXu Yilun <yilun.xu@intel.com>
      Link: https://lore.kernel.org/r/1609219662-27057-2-git-send-email-yilun.xu@intel.comSigned-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      75f7b7d8
    • C
      staging: spmi: hisi-spmi-controller: Fix some error handling paths · f02c21ee
      Christophe JAILLET 提交于
      stable inclusion
      from stable-5.10.9
      commit 560e9b900e12781706b686e7aa40fb59c9fa5dcb
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 12b38ea0 ]
      
      IN the probe function, if an error occurs after calling
      'spmi_controller_alloc()', it must be undone by a corresponding
      'spmi_controller_put() call.
      
      In the remove function, use 'spmi_controller_put(ctrl)' instead of
      'kfree(ctrl)'.
      
      While a it fix an error message
      (s/spmi_add_controller/spmi_controller_add/)
      Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Link: https://lore.kernel.org/r/20201213151105.137731-1-christophe.jaillet@wanadoo.frSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      f02c21ee
    • O
      habanalabs: register to pci shutdown callback · fb1b67b1
      Oded Gabbay 提交于
      stable inclusion
      from stable-5.10.9
      commit c78cff56baad24ebb10d748e1a1b78bae203debe
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit fcaebc73 ]
      
      We need to make sure our device is idle when rebooting a virtual
      machine. This is done in the driver level.
      
      The firmware will later handle FLR but we want to be extra safe and
      stop the devices until the FLR is handled.
      Signed-off-by: NOded Gabbay <ogabbay@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      fb1b67b1
    • O
      habanalabs/gaudi: retry loading TPC f/w on -EINTR · a631df0d
      Oded Gabbay 提交于
      stable inclusion
      from stable-5.10.9
      commit 68a9abf536ff3c54b80983780315d8426da43125
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 98e8781f ]
      
      If loading the firmware file for the TPC f/w was interrupted, try
      to do it again, up to 5 times.
      Signed-off-by: NOded Gabbay <ogabbay@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      a631df0d
    • O
      habanalabs: adjust pci controller init to new firmware · 0a01aece
      Oded Gabbay 提交于
      stable inclusion
      from stable-5.10.9
      commit 8d0522d9688c787b33fa2dca17ee298829fafaba
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 377182a3 ]
      
      When the firmware security is enabled, the pcie_aux_dbi_reg_addr
      register in the PCI controller is blocked. Therefore, ignore
      the result of writing to this register and assume it worked. Also
      remove the prints on errors in the internal ELBI write function.
      
      If the security is enabled, the firmware is responsible for setting
      this register correctly so we won't have any problem.
      
      If the security is disabled, the write will work (unless something
      is totally broken at the PCI level and then the whole sequence
      will fail).
      
      In addition, remove a write to register pcie_aux_dbi_reg_addr+4,
      which was never actually needed.
      
      Moreover, PCIE_DBI registers are blocked to access from host when
      firmware security is enabled. Use a different register to flush the
      writes.
      Signed-off-by: NOded Gabbay <ogabbay@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      0a01aece
    • L
      ARM: dts: ux500/golden: Set display max brightness · 8c0a6771
      Linus Walleij 提交于
      stable inclusion
      from stable-5.10.9
      commit 06b0d83b33b5b06e4228c56abbe32fb754813e8d
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 7887cc89 ]
      
      A too high brightness by default (default is max) makes the
      screen go blank. Set this to 15 as in the Vendor tree.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Cc: Stephan Gerhold <stephan@gerhold.net>
      Link: https://lore.kernel.org/r/20201214223413.253893-1-linus.walleij@linaro.org'
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      8c0a6771
    • R
      ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram · 4e67d219
      Rasmus Villemoes 提交于
      stable inclusion
      from stable-5.10.9
      commit d5285a5eb3da527509a4b29b9d5aa03e99277bd8
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 887078de ]
      
      Table 8-53 in the QUICC Engine Reference manual shows definitions of
      fields up to a size of 192 bytes, not just 128. But in table 8-111,
      one does find the text
      
        Base Address of the Global Transmitter Parameter RAM Page. [...]
        The user needs to allocate 128 bytes for this page. The address must
        be aligned to the page size.
      
      I've checked both rev. 7 (11/2015) and rev. 9 (05/2018) of the manual;
      they both have this inconsistency (and the table numbers are the
      same).
      
      Adding a bit of debug printing, on my board the struct
      ucc_geth_tx_global_pram is allocated at offset 0x880, while
      the (opaque) ucc_geth_thread_data_tx gets allocated immediately
      afterwards, at 0x900. So whatever the engine writes into the thread
      data overlaps with the tail of the global tx pram (and devmem says
      that something does get written during a simple ping).
      
      I haven't observed any failure that could be attributed to this, but
      it seems to be the kind of thing that would be extremely hard to
      debug. So extend the struct definition so that we do allocate 192
      bytes.
      Signed-off-by: NRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      4e67d219
    • G
      regulator: bd718x7: Add enable times · 7059cb26
      Guido Günther 提交于
      stable inclusion
      from stable-5.10.9
      commit 36afeaad76711ff80c2dc57450ad9c5f2f382b41
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 3b66e4a8 ]
      
      Use the typical startup times from the data sheet so boards get a
      reasonable default. Not setting any enable time can lead to board hangs
      when e.g. clocks are enabled too soon afterwards.
      
      This fixes gpu power domain resume on the Librem 5.
      
      [Moved #defines into driver, seems to be general agreement and avoids any
      cross tree issues -- broonie]
      Signed-off-by: NGuido Günther <agx@sigxcpu.org>
      Reviewed-by: NMatti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
      Link: https://lore.kernel.org/r/41fb2ed19f584f138336344e2297ae7301f72b75.1608316658.git.agx@sigxcpu.orgSigned-off-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      7059cb26
    • F
      btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan · bcda164f
      Filipe Manana 提交于
      stable inclusion
      from stable-5.10.9
      commit 29543864c8b8d58e30ba1bc2feb99191f7971abb
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit cb13eea3 ]
      
      If we remount a filesystem in RO mode while the qgroup rescan worker is
      running, we can end up having it still running after the remount is done,
      and at unmount time we may end up with an open transaction that ends up
      never getting committed. If that happens we end up with several memory
      leaks and can crash when hardware acceleration is unavailable for crc32c.
      Possibly it can lead to other nasty surprises too, due to use-after-free
      issues.
      
      The following steps explain how the problem happens.
      
      1) We have a filesystem mounted in RW mode and the qgroup rescan worker is
         running;
      
      2) We remount the filesystem in RO mode, and never stop/pause the rescan
         worker, so after the remount the rescan worker is still running. The
         important detail here is that the rescan task is still running after
         the remount operation committed any ongoing transaction through its
         call to btrfs_commit_super();
      
      3) The rescan is still running, and after the remount completed, the
         rescan worker started a transaction, after it finished iterating all
         leaves of the extent tree, to update the qgroup status item in the
         quotas tree. It does not commit the transaction, it only releases its
         handle on the transaction;
      
      4) A filesystem unmount operation starts shortly after;
      
      5) The unmount task, at close_ctree(), stops the transaction kthread,
         which had not had a chance to commit the open transaction since it was
         sleeping and the commit interval (default of 30 seconds) has not yet
         elapsed since the last time it committed a transaction;
      
      6) So after stopping the transaction kthread we still have the transaction
         used to update the qgroup status item open. At close_ctree(), when the
         filesystem is in RO mode and no transaction abort happened (or the
         filesystem is in error mode), we do not expect to have any transaction
         open, so we do not call btrfs_commit_super();
      
      7) We then proceed to destroy the work queues, free the roots and block
         groups, etc. After that we drop the last reference on the btree inode
         by calling iput() on it. Since there are dirty pages for the btree
         inode, corresponding to the COWed extent buffer for the quotas btree,
         btree_write_cache_pages() is invoked to flush those dirty pages. This
         results in creating a bio and submitting it, which makes us end up at
         btrfs_submit_metadata_bio();
      
      8) At btrfs_submit_metadata_bio() we end up at the if-then-else branch
         that calls btrfs_wq_submit_bio(), because check_async_write() returned
         a value of 1. This value of 1 is because we did not have hardware
         acceleration available for crc32c, so BTRFS_FS_CSUM_IMPL_FAST was not
         set in fs_info->flags;
      
      9) Then at btrfs_wq_submit_bio() we call btrfs_queue_work() against the
         workqueue at fs_info->workers, which was already freed before by the
         call to btrfs_stop_all_workers() at close_ctree(). This results in an
         invalid memory access due to a use-after-free, leading to a crash.
      
      When this happens, before the crash there are several warnings triggered,
      since we have reserved metadata space in a block group, the delayed refs
      reservation, etc:
      
        ------------[ cut here ]------------
        WARNING: CPU: 4 PID: 1729896 at fs/btrfs/block-group.c:125 btrfs_put_block_group+0x63/0xa0 [btrfs]
        Modules linked in: btrfs dm_snapshot dm_thin_pool (...)
        CPU: 4 PID: 1729896 Comm: umount Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        RIP: 0010:btrfs_put_block_group+0x63/0xa0 [btrfs]
        Code: f0 01 00 00 48 39 c2 75 (...)
        RSP: 0018:ffffb270826bbdd8 EFLAGS: 00010206
        RAX: 0000000000000001 RBX: ffff947ed73e4000 RCX: ffff947ebc8b29c8
        RDX: 0000000000000001 RSI: ffffffffc0b150a0 RDI: ffff947ebc8b2800
        RBP: ffff947ebc8b2800 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000001 R12: ffff947ed73e4110
        R13: ffff947ed73e4160 R14: ffff947ebc8b2988 R15: dead000000000100
        FS:  00007f15edfea840(0000) GS:ffff9481ad600000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f37e2893320 CR3: 0000000138f68001 CR4: 00000000003706e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         btrfs_free_block_groups+0x17f/0x2f0 [btrfs]
         close_ctree+0x2ba/0x2fa [btrfs]
         generic_shutdown_super+0x6c/0x100
         kill_anon_super+0x14/0x30
         btrfs_kill_super+0x12/0x20 [btrfs]
         deactivate_locked_super+0x31/0x70
         cleanup_mnt+0x100/0x160
         task_work_run+0x68/0xb0
         exit_to_user_mode_prepare+0x1bb/0x1c0
         syscall_exit_to_user_mode+0x4b/0x260
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f15ee221ee7
        Code: ff 0b 00 f7 d8 64 89 01 48 (...)
        RSP: 002b:00007ffe9470f0f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
        RAX: 0000000000000000 RBX: 00007f15ee347264 RCX: 00007f15ee221ee7
        RDX: ffffffffffffff78 RSI: 0000000000000000 RDI: 000056169701d000
        RBP: 0000561697018a30 R08: 0000000000000000 R09: 00007f15ee2e2be0
        R10: 000056169701efe0 R11: 0000000000000246 R12: 0000000000000000
        R13: 000056169701d000 R14: 0000561697018b40 R15: 0000561697018c60
        irq event stamp: 0
        hardirqs last  enabled at (0): [<0000000000000000>] 0x0
        hardirqs last disabled at (0): [<ffffffff8bcae560>] copy_process+0x8a0/0x1d70
        softirqs last  enabled at (0): [<ffffffff8bcae560>] copy_process+0x8a0/0x1d70
        softirqs last disabled at (0): [<0000000000000000>] 0x0
        ---[ end trace dd74718fef1ed5c6 ]---
        ------------[ cut here ]------------
        WARNING: CPU: 2 PID: 1729896 at fs/btrfs/block-rsv.c:459 btrfs_release_global_block_rsv+0x70/0xc0 [btrfs]
        Modules linked in: btrfs dm_snapshot dm_thin_pool (...)
        CPU: 2 PID: 1729896 Comm: umount Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        RIP: 0010:btrfs_release_global_block_rsv+0x70/0xc0 [btrfs]
        Code: 48 83 bb b0 03 00 00 00 (...)
        RSP: 0018:ffffb270826bbdd8 EFLAGS: 00010206
        RAX: 000000000033c000 RBX: ffff947ed73e4000 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffffffffc0b0d8c1 RDI: 00000000ffffffff
        RBP: ffff947ebc8b7000 R08: 0000000000000001 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000001 R12: ffff947ed73e4110
        R13: ffff947ed73e5278 R14: dead000000000122 R15: dead000000000100
        FS:  00007f15edfea840(0000) GS:ffff9481aca00000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 0000561a79f76e20 CR3: 0000000138f68006 CR4: 00000000003706e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         btrfs_free_block_groups+0x24c/0x2f0 [btrfs]
         close_ctree+0x2ba/0x2fa [btrfs]
         generic_shutdown_super+0x6c/0x100
         kill_anon_super+0x14/0x30
         btrfs_kill_super+0x12/0x20 [btrfs]
         deactivate_locked_super+0x31/0x70
         cleanup_mnt+0x100/0x160
         task_work_run+0x68/0xb0
         exit_to_user_mode_prepare+0x1bb/0x1c0
         syscall_exit_to_user_mode+0x4b/0x260
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f15ee221ee7
        Code: ff 0b 00 f7 d8 64 89 01 (...)
        RSP: 002b:00007ffe9470f0f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
        RAX: 0000000000000000 RBX: 00007f15ee347264 RCX: 00007f15ee221ee7
        RDX: ffffffffffffff78 RSI: 0000000000000000 RDI: 000056169701d000
        RBP: 0000561697018a30 R08: 0000000000000000 R09: 00007f15ee2e2be0
        R10: 000056169701efe0 R11: 0000000000000246 R12: 0000000000000000
        R13: 000056169701d000 R14: 0000561697018b40 R15: 0000561697018c60
        irq event stamp: 0
        hardirqs last  enabled at (0): [<0000000000000000>] 0x0
        hardirqs last disabled at (0): [<ffffffff8bcae560>] copy_process+0x8a0/0x1d70
        softirqs last  enabled at (0): [<ffffffff8bcae560>] copy_process+0x8a0/0x1d70
        softirqs last disabled at (0): [<0000000000000000>] 0x0
        ---[ end trace dd74718fef1ed5c7 ]---
        ------------[ cut here ]------------
        WARNING: CPU: 2 PID: 1729896 at fs/btrfs/block-group.c:3377 btrfs_free_block_groups+0x25d/0x2f0 [btrfs]
        Modules linked in: btrfs dm_snapshot dm_thin_pool (...)
        CPU: 5 PID: 1729896 Comm: umount Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        RIP: 0010:btrfs_free_block_groups+0x25d/0x2f0 [btrfs]
        Code: ad de 49 be 22 01 00 (...)
        RSP: 0018:ffffb270826bbde8 EFLAGS: 00010206
        RAX: ffff947ebeae1d08 RBX: ffff947ed73e4000 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffff947e9d823ae8 RDI: 0000000000000246
        RBP: ffff947ebeae1d08 R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000000 R11: 0000000000000001 R12: ffff947ebeae1c00
        R13: ffff947ed73e5278 R14: dead000000000122 R15: dead000000000100
        FS:  00007f15edfea840(0000) GS:ffff9481ad200000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f1475d98ea8 CR3: 0000000138f68005 CR4: 00000000003706e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         close_ctree+0x2ba/0x2fa [btrfs]
         generic_shutdown_super+0x6c/0x100
         kill_anon_super+0x14/0x30
         btrfs_kill_super+0x12/0x20 [btrfs]
         deactivate_locked_super+0x31/0x70
         cleanup_mnt+0x100/0x160
         task_work_run+0x68/0xb0
         exit_to_user_mode_prepare+0x1bb/0x1c0
         syscall_exit_to_user_mode+0x4b/0x260
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f15ee221ee7
        Code: ff 0b 00 f7 d8 64 89 (...)
        RSP: 002b:00007ffe9470f0f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
        RAX: 0000000000000000 RBX: 00007f15ee347264 RCX: 00007f15ee221ee7
        RDX: ffffffffffffff78 RSI: 0000000000000000 RDI: 000056169701d000
        RBP: 0000561697018a30 R08: 0000000000000000 R09: 00007f15ee2e2be0
        R10: 000056169701efe0 R11: 0000000000000246 R12: 0000000000000000
        R13: 000056169701d000 R14: 0000561697018b40 R15: 0000561697018c60
        irq event stamp: 0
        hardirqs last  enabled at (0): [<0000000000000000>] 0x0
        hardirqs last disabled at (0): [<ffffffff8bcae560>] copy_process+0x8a0/0x1d70
        softirqs last  enabled at (0): [<ffffffff8bcae560>] copy_process+0x8a0/0x1d70
        softirqs last disabled at (0): [<0000000000000000>] 0x0
        ---[ end trace dd74718fef1ed5c8 ]---
        BTRFS info (device sdc): space_info 4 has 268238848 free, is not full
        BTRFS info (device sdc): space_info total=268435456, used=114688, pinned=0, reserved=16384, may_use=0, readonly=65536
        BTRFS info (device sdc): global_block_rsv: size 0 reserved 0
        BTRFS info (device sdc): trans_block_rsv: size 0 reserved 0
        BTRFS info (device sdc): chunk_block_rsv: size 0 reserved 0
        BTRFS info (device sdc): delayed_block_rsv: size 0 reserved 0
        BTRFS info (device sdc): delayed_refs_rsv: size 524288 reserved 0
      
      And the crash, which only happens when we do not have crc32c hardware
      acceleration, produces the following trace immediately after those
      warnings:
      
        stack segment: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI
        CPU: 2 PID: 1749129 Comm: umount Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        RIP: 0010:btrfs_queue_work+0x36/0x190 [btrfs]
        Code: 54 55 53 48 89 f3 (...)
        RSP: 0018:ffffb27082443ae8 EFLAGS: 00010282
        RAX: 0000000000000004 RBX: ffff94810ee9ad90 RCX: 0000000000000000
        RDX: 0000000000000001 RSI: ffff94810ee9ad90 RDI: ffff947ed8ee75a0
        RBP: a56b6b6b6b6b6b6b R08: 0000000000000000 R09: 0000000000000000
        R10: 0000000000000007 R11: 0000000000000001 R12: ffff947fa9b435a8
        R13: ffff94810ee9ad90 R14: 0000000000000000 R15: ffff947e93dc0000
        FS:  00007f3cfe974840(0000) GS:ffff9481ac600000(0000) knlGS:0000000000000000
        CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
        CR2: 00007f1b42995a70 CR3: 0000000127638003 CR4: 00000000003706e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
         btrfs_wq_submit_bio+0xb3/0xd0 [btrfs]
         btrfs_submit_metadata_bio+0x44/0xc0 [btrfs]
         submit_one_bio+0x61/0x70 [btrfs]
         btree_write_cache_pages+0x414/0x450 [btrfs]
         ? kobject_put+0x9a/0x1d0
         ? trace_hardirqs_on+0x1b/0xf0
         ? _raw_spin_unlock_irqrestore+0x3c/0x60
         ? free_debug_processing+0x1e1/0x2b0
         do_writepages+0x43/0xe0
         ? lock_acquired+0x199/0x490
         __writeback_single_inode+0x59/0x650
         writeback_single_inode+0xaf/0x120
         write_inode_now+0x94/0xd0
         iput+0x187/0x2b0
         close_ctree+0x2c6/0x2fa [btrfs]
         generic_shutdown_super+0x6c/0x100
         kill_anon_super+0x14/0x30
         btrfs_kill_super+0x12/0x20 [btrfs]
         deactivate_locked_super+0x31/0x70
         cleanup_mnt+0x100/0x160
         task_work_run+0x68/0xb0
         exit_to_user_mode_prepare+0x1bb/0x1c0
         syscall_exit_to_user_mode+0x4b/0x260
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f3cfebabee7
        Code: ff 0b 00 f7 d8 64 89 01 (...)
        RSP: 002b:00007ffc9c9a05f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
        RAX: 0000000000000000 RBX: 00007f3cfecd1264 RCX: 00007f3cfebabee7
        RDX: ffffffffffffff78 RSI: 0000000000000000 RDI: 0000562b6b478000
        RBP: 0000562b6b473a30 R08: 0000000000000000 R09: 00007f3cfec6cbe0
        R10: 0000562b6b479fe0 R11: 0000000000000246 R12: 0000000000000000
        R13: 0000562b6b478000 R14: 0000562b6b473b40 R15: 0000562b6b473c60
        Modules linked in: btrfs dm_snapshot dm_thin_pool (...)
        ---[ end trace dd74718fef1ed5cc ]---
      
      Finally when we remove the btrfs module (rmmod btrfs), there are several
      warnings about objects that were allocated from our slabs but were never
      freed, consequence of the transaction that was never committed and got
      leaked:
      
        =============================================================================
        BUG btrfs_delayed_ref_head (Tainted: G    B   W        ): Objects remaining in btrfs_delayed_ref_head on __kmem_cache_shutdown()
        -----------------------------------------------------------------------------
      
        INFO: Slab 0x0000000094c2ae56 objects=24 used=2 fp=0x000000002bfa2521 flags=0x17fffc000010200
        CPU: 5 PID: 1729921 Comm: rmmod Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x8d/0xb5
         slab_err+0xb7/0xdc
         ? lock_acquired+0x199/0x490
         __kmem_cache_shutdown+0x1ac/0x3c0
         ? lock_release+0x20e/0x4c0
         kmem_cache_destroy+0x55/0x120
         btrfs_delayed_ref_exit+0x11/0x35 [btrfs]
         exit_btrfs_fs+0xa/0x59 [btrfs]
         __x64_sys_delete_module+0x194/0x260
         ? fpregs_assert_state_consistent+0x1e/0x40
         ? exit_to_user_mode_prepare+0x55/0x1c0
         ? trace_hardirqs_on+0x1b/0xf0
         do_syscall_64+0x33/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f693e305897
        Code: 73 01 c3 48 8b 0d f9 f5 (...)
        RSP: 002b:00007ffcf73eb508 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
        RAX: ffffffffffffffda RBX: 0000559df504f760 RCX: 00007f693e305897
        RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559df504f7c8
        RBP: 00007ffcf73eb568 R08: 0000000000000000 R09: 0000000000000000
        R10: 00007f693e378ac0 R11: 0000000000000206 R12: 00007ffcf73eb740
        R13: 00007ffcf73ec5a6 R14: 0000559df504f2a0 R15: 0000559df504f760
        INFO: Object 0x0000000050cbdd61 @offset=12104
        INFO: Allocated in btrfs_add_delayed_tree_ref+0xbb/0x480 [btrfs] age=1894 cpu=6 pid=1729873
      	__slab_alloc.isra.0+0x109/0x1c0
      	kmem_cache_alloc+0x7bb/0x830
      	btrfs_add_delayed_tree_ref+0xbb/0x480 [btrfs]
      	btrfs_free_tree_block+0x128/0x360 [btrfs]
      	__btrfs_cow_block+0x489/0x5f0 [btrfs]
      	btrfs_cow_block+0xf7/0x220 [btrfs]
      	btrfs_search_slot+0x62a/0xc40 [btrfs]
      	btrfs_del_orphan_item+0x65/0xd0 [btrfs]
      	btrfs_find_orphan_roots+0x1bf/0x200 [btrfs]
      	open_ctree+0x125a/0x18a0 [btrfs]
      	btrfs_mount_root.cold+0x13/0xed [btrfs]
      	legacy_get_tree+0x30/0x60
      	vfs_get_tree+0x28/0xe0
      	fc_mount+0xe/0x40
      	vfs_kern_mount.part.0+0x71/0x90
      	btrfs_mount+0x13b/0x3e0 [btrfs]
        INFO: Freed in __btrfs_run_delayed_refs+0x1117/0x1290 [btrfs] age=4292 cpu=2 pid=1729526
      	kmem_cache_free+0x34c/0x3c0
      	__btrfs_run_delayed_refs+0x1117/0x1290 [btrfs]
      	btrfs_run_delayed_refs+0x81/0x210 [btrfs]
      	commit_cowonly_roots+0xfb/0x300 [btrfs]
      	btrfs_commit_transaction+0x367/0xc40 [btrfs]
      	sync_filesystem+0x74/0x90
      	generic_shutdown_super+0x22/0x100
      	kill_anon_super+0x14/0x30
      	btrfs_kill_super+0x12/0x20 [btrfs]
      	deactivate_locked_super+0x31/0x70
      	cleanup_mnt+0x100/0x160
      	task_work_run+0x68/0xb0
      	exit_to_user_mode_prepare+0x1bb/0x1c0
      	syscall_exit_to_user_mode+0x4b/0x260
      	entry_SYSCALL_64_after_hwframe+0x44/0xa9
        INFO: Object 0x0000000086e9b0ff @offset=12776
        INFO: Allocated in btrfs_add_delayed_tree_ref+0xbb/0x480 [btrfs] age=1900 cpu=6 pid=1729873
      	__slab_alloc.isra.0+0x109/0x1c0
      	kmem_cache_alloc+0x7bb/0x830
      	btrfs_add_delayed_tree_ref+0xbb/0x480 [btrfs]
      	btrfs_alloc_tree_block+0x2bf/0x360 [btrfs]
      	alloc_tree_block_no_bg_flush+0x4f/0x60 [btrfs]
      	__btrfs_cow_block+0x12d/0x5f0 [btrfs]
      	btrfs_cow_block+0xf7/0x220 [btrfs]
      	btrfs_search_slot+0x62a/0xc40 [btrfs]
      	btrfs_del_orphan_item+0x65/0xd0 [btrfs]
      	btrfs_find_orphan_roots+0x1bf/0x200 [btrfs]
      	open_ctree+0x125a/0x18a0 [btrfs]
      	btrfs_mount_root.cold+0x13/0xed [btrfs]
      	legacy_get_tree+0x30/0x60
      	vfs_get_tree+0x28/0xe0
      	fc_mount+0xe/0x40
      	vfs_kern_mount.part.0+0x71/0x90
        INFO: Freed in __btrfs_run_delayed_refs+0x1117/0x1290 [btrfs] age=3141 cpu=6 pid=1729803
      	kmem_cache_free+0x34c/0x3c0
      	__btrfs_run_delayed_refs+0x1117/0x1290 [btrfs]
      	btrfs_run_delayed_refs+0x81/0x210 [btrfs]
      	btrfs_write_dirty_block_groups+0x17d/0x3d0 [btrfs]
      	commit_cowonly_roots+0x248/0x300 [btrfs]
      	btrfs_commit_transaction+0x367/0xc40 [btrfs]
      	close_ctree+0x113/0x2fa [btrfs]
      	generic_shutdown_super+0x6c/0x100
      	kill_anon_super+0x14/0x30
      	btrfs_kill_super+0x12/0x20 [btrfs]
      	deactivate_locked_super+0x31/0x70
      	cleanup_mnt+0x100/0x160
      	task_work_run+0x68/0xb0
      	exit_to_user_mode_prepare+0x1bb/0x1c0
      	syscall_exit_to_user_mode+0x4b/0x260
      	entry_SYSCALL_64_after_hwframe+0x44/0xa9
        kmem_cache_destroy btrfs_delayed_ref_head: Slab cache still has objects
        CPU: 5 PID: 1729921 Comm: rmmod Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x8d/0xb5
         kmem_cache_destroy+0x119/0x120
         btrfs_delayed_ref_exit+0x11/0x35 [btrfs]
         exit_btrfs_fs+0xa/0x59 [btrfs]
         __x64_sys_delete_module+0x194/0x260
         ? fpregs_assert_state_consistent+0x1e/0x40
         ? exit_to_user_mode_prepare+0x55/0x1c0
         ? trace_hardirqs_on+0x1b/0xf0
         do_syscall_64+0x33/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f693e305897
        Code: 73 01 c3 48 8b 0d f9 f5 0b (...)
        RSP: 002b:00007ffcf73eb508 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
        RAX: ffffffffffffffda RBX: 0000559df504f760 RCX: 00007f693e305897
        RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559df504f7c8
        RBP: 00007ffcf73eb568 R08: 0000000000000000 R09: 0000000000000000
        R10: 00007f693e378ac0 R11: 0000000000000206 R12: 00007ffcf73eb740
        R13: 00007ffcf73ec5a6 R14: 0000559df504f2a0 R15: 0000559df504f760
        =============================================================================
        BUG btrfs_delayed_tree_ref (Tainted: G    B   W        ): Objects remaining in btrfs_delayed_tree_ref on __kmem_cache_shutdown()
        -----------------------------------------------------------------------------
      
        INFO: Slab 0x0000000011f78dc0 objects=37 used=2 fp=0x0000000032d55d91 flags=0x17fffc000010200
        CPU: 3 PID: 1729921 Comm: rmmod Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x8d/0xb5
         slab_err+0xb7/0xdc
         ? lock_acquired+0x199/0x490
         __kmem_cache_shutdown+0x1ac/0x3c0
         ? lock_release+0x20e/0x4c0
         kmem_cache_destroy+0x55/0x120
         btrfs_delayed_ref_exit+0x1d/0x35 [btrfs]
         exit_btrfs_fs+0xa/0x59 [btrfs]
         __x64_sys_delete_module+0x194/0x260
         ? fpregs_assert_state_consistent+0x1e/0x40
         ? exit_to_user_mode_prepare+0x55/0x1c0
         ? trace_hardirqs_on+0x1b/0xf0
         do_syscall_64+0x33/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f693e305897
        Code: 73 01 c3 48 8b 0d f9 f5 (...)
        RSP: 002b:00007ffcf73eb508 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
        RAX: ffffffffffffffda RBX: 0000559df504f760 RCX: 00007f693e305897
        RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559df504f7c8
        RBP: 00007ffcf73eb568 R08: 0000000000000000 R09: 0000000000000000
        R10: 00007f693e378ac0 R11: 0000000000000206 R12: 00007ffcf73eb740
        R13: 00007ffcf73ec5a6 R14: 0000559df504f2a0 R15: 0000559df504f760
        INFO: Object 0x000000001a340018 @offset=4408
        INFO: Allocated in btrfs_add_delayed_tree_ref+0x9e/0x480 [btrfs] age=1917 cpu=6 pid=1729873
      	__slab_alloc.isra.0+0x109/0x1c0
      	kmem_cache_alloc+0x7bb/0x830
      	btrfs_add_delayed_tree_ref+0x9e/0x480 [btrfs]
      	btrfs_free_tree_block+0x128/0x360 [btrfs]
      	__btrfs_cow_block+0x489/0x5f0 [btrfs]
      	btrfs_cow_block+0xf7/0x220 [btrfs]
      	btrfs_search_slot+0x62a/0xc40 [btrfs]
      	btrfs_del_orphan_item+0x65/0xd0 [btrfs]
      	btrfs_find_orphan_roots+0x1bf/0x200 [btrfs]
      	open_ctree+0x125a/0x18a0 [btrfs]
      	btrfs_mount_root.cold+0x13/0xed [btrfs]
      	legacy_get_tree+0x30/0x60
      	vfs_get_tree+0x28/0xe0
      	fc_mount+0xe/0x40
      	vfs_kern_mount.part.0+0x71/0x90
      	btrfs_mount+0x13b/0x3e0 [btrfs]
        INFO: Freed in __btrfs_run_delayed_refs+0x63d/0x1290 [btrfs] age=4167 cpu=4 pid=1729795
      	kmem_cache_free+0x34c/0x3c0
      	__btrfs_run_delayed_refs+0x63d/0x1290 [btrfs]
      	btrfs_run_delayed_refs+0x81/0x210 [btrfs]
      	btrfs_commit_transaction+0x60/0xc40 [btrfs]
      	create_subvol+0x56a/0x990 [btrfs]
      	btrfs_mksubvol+0x3fb/0x4a0 [btrfs]
      	__btrfs_ioctl_snap_create+0x119/0x1a0 [btrfs]
      	btrfs_ioctl_snap_create+0x58/0x80 [btrfs]
      	btrfs_ioctl+0x1a92/0x36f0 [btrfs]
      	__x64_sys_ioctl+0x83/0xb0
      	do_syscall_64+0x33/0x80
      	entry_SYSCALL_64_after_hwframe+0x44/0xa9
        INFO: Object 0x000000002b46292a @offset=13648
        INFO: Allocated in btrfs_add_delayed_tree_ref+0x9e/0x480 [btrfs] age=1923 cpu=6 pid=1729873
      	__slab_alloc.isra.0+0x109/0x1c0
      	kmem_cache_alloc+0x7bb/0x830
      	btrfs_add_delayed_tree_ref+0x9e/0x480 [btrfs]
      	btrfs_alloc_tree_block+0x2bf/0x360 [btrfs]
      	alloc_tree_block_no_bg_flush+0x4f/0x60 [btrfs]
      	__btrfs_cow_block+0x12d/0x5f0 [btrfs]
      	btrfs_cow_block+0xf7/0x220 [btrfs]
      	btrfs_search_slot+0x62a/0xc40 [btrfs]
      	btrfs_del_orphan_item+0x65/0xd0 [btrfs]
      	btrfs_find_orphan_roots+0x1bf/0x200 [btrfs]
      	open_ctree+0x125a/0x18a0 [btrfs]
      	btrfs_mount_root.cold+0x13/0xed [btrfs]
      	legacy_get_tree+0x30/0x60
      	vfs_get_tree+0x28/0xe0
      	fc_mount+0xe/0x40
      	vfs_kern_mount.part.0+0x71/0x90
        INFO: Freed in __btrfs_run_delayed_refs+0x63d/0x1290 [btrfs] age=3164 cpu=6 pid=1729803
      	kmem_cache_free+0x34c/0x3c0
      	__btrfs_run_delayed_refs+0x63d/0x1290 [btrfs]
      	btrfs_run_delayed_refs+0x81/0x210 [btrfs]
      	commit_cowonly_roots+0xfb/0x300 [btrfs]
      	btrfs_commit_transaction+0x367/0xc40 [btrfs]
      	close_ctree+0x113/0x2fa [btrfs]
      	generic_shutdown_super+0x6c/0x100
      	kill_anon_super+0x14/0x30
      	btrfs_kill_super+0x12/0x20 [btrfs]
      	deactivate_locked_super+0x31/0x70
      	cleanup_mnt+0x100/0x160
      	task_work_run+0x68/0xb0
      	exit_to_user_mode_prepare+0x1bb/0x1c0
      	syscall_exit_to_user_mode+0x4b/0x260
      	entry_SYSCALL_64_after_hwframe+0x44/0xa9
        kmem_cache_destroy btrfs_delayed_tree_ref: Slab cache still has objects
        CPU: 5 PID: 1729921 Comm: rmmod Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x8d/0xb5
         kmem_cache_destroy+0x119/0x120
         btrfs_delayed_ref_exit+0x1d/0x35 [btrfs]
         exit_btrfs_fs+0xa/0x59 [btrfs]
         __x64_sys_delete_module+0x194/0x260
         ? fpregs_assert_state_consistent+0x1e/0x40
         ? exit_to_user_mode_prepare+0x55/0x1c0
         ? trace_hardirqs_on+0x1b/0xf0
         do_syscall_64+0x33/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f693e305897
        Code: 73 01 c3 48 8b 0d f9 f5 (...)
        RSP: 002b:00007ffcf73eb508 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
        RAX: ffffffffffffffda RBX: 0000559df504f760 RCX: 00007f693e305897
        RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559df504f7c8
        RBP: 00007ffcf73eb568 R08: 0000000000000000 R09: 0000000000000000
        R10: 00007f693e378ac0 R11: 0000000000000206 R12: 00007ffcf73eb740
        R13: 00007ffcf73ec5a6 R14: 0000559df504f2a0 R15: 0000559df504f760
        =============================================================================
        BUG btrfs_delayed_extent_op (Tainted: G    B   W        ): Objects remaining in btrfs_delayed_extent_op on __kmem_cache_shutdown()
        -----------------------------------------------------------------------------
      
        INFO: Slab 0x00000000f145ce2f objects=22 used=1 fp=0x00000000af0f92cf flags=0x17fffc000010200
        CPU: 5 PID: 1729921 Comm: rmmod Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x8d/0xb5
         slab_err+0xb7/0xdc
         ? lock_acquired+0x199/0x490
         __kmem_cache_shutdown+0x1ac/0x3c0
         ? __mutex_unlock_slowpath+0x45/0x2a0
         kmem_cache_destroy+0x55/0x120
         exit_btrfs_fs+0xa/0x59 [btrfs]
         __x64_sys_delete_module+0x194/0x260
         ? fpregs_assert_state_consistent+0x1e/0x40
         ? exit_to_user_mode_prepare+0x55/0x1c0
         ? trace_hardirqs_on+0x1b/0xf0
         do_syscall_64+0x33/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f693e305897
        Code: 73 01 c3 48 8b 0d f9 f5 (...)
        RSP: 002b:00007ffcf73eb508 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
        RAX: ffffffffffffffda RBX: 0000559df504f760 RCX: 00007f693e305897
        RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559df504f7c8
        RBP: 00007ffcf73eb568 R08: 0000000000000000 R09: 0000000000000000
        R10: 00007f693e378ac0 R11: 0000000000000206 R12: 00007ffcf73eb740
        R13: 00007ffcf73ec5a6 R14: 0000559df504f2a0 R15: 0000559df504f760
        INFO: Object 0x000000004cf95ea8 @offset=6264
        INFO: Allocated in btrfs_alloc_tree_block+0x1e0/0x360 [btrfs] age=1931 cpu=6 pid=1729873
      	__slab_alloc.isra.0+0x109/0x1c0
      	kmem_cache_alloc+0x7bb/0x830
      	btrfs_alloc_tree_block+0x1e0/0x360 [btrfs]
      	alloc_tree_block_no_bg_flush+0x4f/0x60 [btrfs]
      	__btrfs_cow_block+0x12d/0x5f0 [btrfs]
      	btrfs_cow_block+0xf7/0x220 [btrfs]
      	btrfs_search_slot+0x62a/0xc40 [btrfs]
      	btrfs_del_orphan_item+0x65/0xd0 [btrfs]
      	btrfs_find_orphan_roots+0x1bf/0x200 [btrfs]
      	open_ctree+0x125a/0x18a0 [btrfs]
      	btrfs_mount_root.cold+0x13/0xed [btrfs]
      	legacy_get_tree+0x30/0x60
      	vfs_get_tree+0x28/0xe0
      	fc_mount+0xe/0x40
      	vfs_kern_mount.part.0+0x71/0x90
      	btrfs_mount+0x13b/0x3e0 [btrfs]
        INFO: Freed in __btrfs_run_delayed_refs+0xabd/0x1290 [btrfs] age=3173 cpu=6 pid=1729803
      	kmem_cache_free+0x34c/0x3c0
      	__btrfs_run_delayed_refs+0xabd/0x1290 [btrfs]
      	btrfs_run_delayed_refs+0x81/0x210 [btrfs]
      	commit_cowonly_roots+0xfb/0x300 [btrfs]
      	btrfs_commit_transaction+0x367/0xc40 [btrfs]
      	close_ctree+0x113/0x2fa [btrfs]
      	generic_shutdown_super+0x6c/0x100
      	kill_anon_super+0x14/0x30
      	btrfs_kill_super+0x12/0x20 [btrfs]
      	deactivate_locked_super+0x31/0x70
      	cleanup_mnt+0x100/0x160
      	task_work_run+0x68/0xb0
      	exit_to_user_mode_prepare+0x1bb/0x1c0
      	syscall_exit_to_user_mode+0x4b/0x260
      	entry_SYSCALL_64_after_hwframe+0x44/0xa9
        kmem_cache_destroy btrfs_delayed_extent_op: Slab cache still has objects
        CPU: 3 PID: 1729921 Comm: rmmod Tainted: G    B   W         5.10.0-rc4-btrfs-next-73 #1
        Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
        Call Trace:
         dump_stack+0x8d/0xb5
         kmem_cache_destroy+0x119/0x120
         exit_btrfs_fs+0xa/0x59 [btrfs]
         __x64_sys_delete_module+0x194/0x260
         ? fpregs_assert_state_consistent+0x1e/0x40
         ? exit_to_user_mode_prepare+0x55/0x1c0
         ? trace_hardirqs_on+0x1b/0xf0
         do_syscall_64+0x33/0x80
         entry_SYSCALL_64_after_hwframe+0x44/0xa9
        RIP: 0033:0x7f693e305897
        Code: 73 01 c3 48 8b 0d f9 (...)
        RSP: 002b:00007ffcf73eb508 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
        RAX: ffffffffffffffda RBX: 0000559df504f760 RCX: 00007f693e305897
        RDX: 000000000000000a RSI: 0000000000000800 RDI: 0000559df504f7c8
        RBP: 00007ffcf73eb568 R08: 0000000000000000 R09: 0000000000000000
        R10: 00007f693e378ac0 R11: 0000000000000206 R12: 00007ffcf73eb740
        R13: 00007ffcf73ec5a6 R14: 0000559df504f2a0 R15: 0000559df504f760
        BTRFS: state leak: start 30408704 end 30425087 state 1 in tree 1 refs 1
      
      Fix this issue by having the remount path stop the qgroup rescan worker
      when we are remounting RO and teach the rescan worker to stop when a
      remount is in progress. If later a remount in RW mode happens, we are
      already resuming the qgroup rescan worker through the call to
      btrfs_qgroup_rescan_resume(), so we do not need to worry about that.
      Tested-by: NFabian Vogt <fvogt@suse.com>
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NFilipe Manana <fdmanana@suse.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      bcda164f
    • P
      btrfs: merge critical sections of discard lock in workfn · 14e8bf83
      Pavel Begunkov 提交于
      stable inclusion
      from stable-5.10.9
      commit f89d84b35af33b58ec67c78ac7cc670f57ae2466
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 8fc05859 ]
      
      btrfs_discard_workfn() drops discard_ctl->lock just to take it again in
      a moment in btrfs_discard_schedule_work(). Avoid that and also reuse
      ktime.
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
      Reviewed-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      14e8bf83
    • P
      btrfs: fix async discard stall · b37ec365
      Pavel Begunkov 提交于
      stable inclusion
      from stable-5.10.9
      commit 33061bd104cbf6798738cf2f5608f18910d9f9da
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit ea9ed87c ]
      
      Might happen that bg->discard_eligible_time was changed without
      rescheduling, so btrfs_discard_workfn() wakes up earlier than that new
      time, peek_discard_list() returns NULL, and all work halts and goes to
      sleep without further rescheduling even there are block groups to
      discard.
      
      It happens pretty often, but not so visible from the userspace because
      after some time it usually will be kicked off anyway by someone else
      calling btrfs_discard_reschedule_work().
      
      Fix it by continue rescheduling if block group discard lists are not
      empty.
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      b37ec365
    • C
      ath11k: qmi: try to allocate a big block of DMA memory first · f6c10846
      Carl Huang 提交于
      stable inclusion
      from stable-5.10.9
      commit d18e04ce283a2aa28815a04d274157d27b1872cf
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit f6f92968 ]
      
      Not all firmware versions support allocating DMA memory in smaller blocks so
      first try to allocate big block of DMA memory for QMI. If the allocation fails,
      let firmware request multiple blocks of DMA memory with smaller size.
      
      This also fixes an unnecessary error message seen during ath11k probe on
      QCA6390:
      
      ath11k_pci 0000:06:00.0: Respond mem req failed, result: 1, err: 0
      ath11k_pci 0000:06:00.0: qmi failed to respond fw mem req:-22
      
      Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
      Signed-off-by: NCarl Huang <cjhuang@codeaurora.org>
      Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
      Link: https://lore.kernel.org/r/1608127593-15192-1-git-send-email-kvalo@codeaurora.orgSigned-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      f6c10846
    • V
      netfilter: ipset: fixes possible oops in mtype_resize · 5e65ff1a
      Vasily Averin 提交于
      stable inclusion
      from stable-5.10.9
      commit cc77e4a020aa308265a67ed4cb3188100a1787a0
      bugzilla: 47457
      
      --------------------------------
      
      [ Upstream commit 2b33d6ff ]
      
      currently mtype_resize() can cause oops
      
              t = ip_set_alloc(htable_size(htable_bits));
              if (!t) {
                      ret = -ENOMEM;
                      goto out;
              }
              t->hregion = ip_set_alloc(ahash_sizeof_regions(htable_bits));
      
      Increased htable_bits can force htable_size() to return 0.
      In own turn ip_set_alloc(0) returns not 0 but ZERO_SIZE_PTR,
      so follwoing access to t->hregion should trigger an OOPS.
      Signed-off-by: NVasily Averin <vvs@virtuozzo.com>
      Acked-by: NJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      5e65ff1a