1. 25 10月, 2021 40 次提交
    • X
      svm: Add svm_set_user_mpam_en to enable/disable mpam for smmu · c50ad40d
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      -------------------------------------------------
      
      The user_mpam_en configuration is used to enable/disable
      mpam for SMMU. If user_mpam_en is set as true, the memory
      requests across SMMU will carry the mpamid information,
      otherwise the mpamid will not take effect.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Reviewed-by: NYingtai Xie <xieyingtai@huawei.com>
      Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      c50ad40d
    • X
      svm: Add support to set svm mpam configuration · 464f6990
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      -------------------------------------------------
      
      This add svm_set_mpam interface in svm module, which traverse all
      accelerators, and set the mpam configuration in SMMU. If error occurs
      during the traverse process, mpam configuration of all accelerators
      will rollback to previous.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Reviewed-by: NYingtai Xie <xieyingtai@huawei.com>
      Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      464f6990
    • X
      svm: Add support to get svm mpam configuration · 0cc88dd8
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      -------------------------------------------------
      
      This add interface to get mpam configuration of accelarators managed
      by svm. The svm mpam get interface traverse all accelrators, and if
      all succeed, return the last successful result.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Reviewed-by: NYingtai Xie <xieyingtai@huawei.com>
      Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      0cc88dd8
    • X
      iommu/arm-smmu-v3: Add support to enable/disable SMMU user_mpam_en · 129938f5
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      -------------------------------------------------
      
      The user_mpam_en configuration is used to enable/disable
      whether SMMU mpam configuration will be used. If user_mpam_en
      is 1, the memory requests across SMMU will not carry the
      SMMU mpam configuration.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Reviewed-by: NYingtai Xie <xieyingtai@huawei.com>
      Reviewed-by: NZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      129938f5
    • X
      iommu/arm-smmu-v3: Add support to get SMMU mpam configuration · 2b7032bc
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      -------------------------------------------------
      
      Add interface to get mpam configuration of CD/STE context, use s1mpam
      to indicate whether partid and pmg from CD or STE.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Reviewed-by: NYingtai Xie <xieyingtai@huawei.com>
      Reviewed-by: NZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      2b7032bc
    • X
      iommu/arm-smmu-v3: Add support to configure mpam in STE/CD context · 7c01a111
      Xingang Wang 提交于
      ascend inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/kernel/issues/I49RB2
      CVE: NA
      
      -------------------------------------------------
      
      To support limiting qos of device, the partid and pmg need to be set
      into the SMMU STE/CD context. This introduce support of SMMU mpam
      feature and add interface to set mpam configuration in STE/CD.
      Signed-off-by: NXingang Wang <wangxingang5@huawei.com>
      Signed-off-by: NRui Zhu <zhurui3@huawei.com>
      Reviewed-by: NYingtai Xie <xieyingtai@huawei.com>
      Reviewed-by: NZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      7c01a111
    • R
      nvme-rdma: destroy cm id before destroy qp to avoid use after free · 6be22ed6
      Ruozhu Li 提交于
      mainline inclusion
      from mainline-v5.15-rc2
      commit 9817d763
      category: bugfix
      bugzilla: NA
      CVE: NA
      Link: https://gitee.com/openeuler/kernel/issues/I1WGZE
      
      We got a panic when host received a rej cm event soon after a connect
      error cm event.
      When host get connect error cm event, it will destroy qp immediately.
      But cm_id is still valid then.Another cm event rise here, try to access
      the qp which was destroyed.Then we got a kernel panic blow:
      
      [87816.777089] [20473] ib_cm:cm_rep_handler:2343: cm_rep_handler: Stale connection. local_comm_id -154357094, remote_comm_id -1133609861
      [87816.777223] [20473] ib_cm:cm_init_qp_rtr_attr:4162: cm_init_qp_rtr_attr: local_id -1150387077, cm_id_priv->id.state: 13
      [87816.777225] [20473] rdma_cm:cma_rep_recv:1871: RDMA CM: CONNECT_ERROR: failed to handle reply. status -22
      [87816.777395] [20473] ib_cm:ib_send_cm_rej:2781: ib_send_cm_rej: local_id -1150387077, cm_id->state: 13
      [87816.777398] [20473] nvme_rdma:nvme_rdma_cm_handler:1718: nvme nvme278: connect error (6): status -22 id 00000000c3809aff
      [87816.801155] [20473] nvme_rdma:nvme_rdma_cm_handler:1742: nvme nvme278: CM error event 6
      [87816.801160] [20473] rdma_cm:cma_ib_handler:1947: RDMA CM: REJECTED: consumer defined
      [87816.801163] nvme nvme278: rdma connection establishment failed (-104)
      [87816.801168] BUG: unable to handle kernel NULL pointer dereference at 0000000000000370
      [87816.801201] RIP: 0010:_ib_modify_qp+0x6e/0x3a0 [ib_core]
      [87816.801215] Call Trace:
      [87816.801223]  cma_modify_qp_err+0x52/0x80 [rdma_cm]
      [87816.801228]  ? __dynamic_pr_debug+0x8a/0xb0
      [87816.801232]  cma_ib_handler+0x25a/0x2f0 [rdma_cm]
      [87816.801235]  cm_process_work+0x60/0xe0 [ib_cm]
      [87816.801238]  cm_work_handler+0x13b/0x1b97 [ib_cm]
      [87816.801243]  ? __switch_to_asm+0x35/0x70
      [87816.801244]  ? __switch_to_asm+0x41/0x70
      [87816.801246]  ? __switch_to_asm+0x35/0x70
      [87816.801248]  ? __switch_to_asm+0x41/0x70
      [87816.801252]  ? __switch_to+0x8c/0x480
      [87816.801254]  ? __switch_to_asm+0x41/0x70
      [87816.801256]  ? __switch_to_asm+0x35/0x70
      [87816.801259]  process_one_work+0x1a7/0x3b0
      [87816.801263]  worker_thread+0x30/0x390
      [87816.801266]  ? create_worker+0x1a0/0x1a0
      [87816.801268]  kthread+0x112/0x130
      [87816.801270]  ? kthread_flush_work_fn+0x10/0x10
      [87816.801272]  ret_from_fork+0x35/0x40
      
      -------------------------------------------------
      
      We should always destroy cm_id before destroy qp to avoid to get cma
      event after qp was destroyed, which may lead to use after free.
      In RDMA connection establishment error flow, don't destroy qp in cm
      event handler.Just report cm_error to upper level, qp will be destroy
      in nvme_rdma_alloc_queue() after destroy cm id.
      Signed-off-by: NRuozhu Li <liruozhu@huawei.com>
      Reviewed-by: NMax Gurtovoy <mgurtovoy@nvidia.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Conflicts:
              drivers/nvme/host/rdma.c
          	[lrz: adjust context]
      Reviewed-by: NJason Yan <yanaijie@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      6be22ed6
    • W
      arm64: Errata: fix kabi changed by cpu_errata · 9f5a4906
      Weilong Chen 提交于
      ascend inclusion
      category: feature
      bugzilla: 46922
      CVE: NA
      
      -------------------------------------
      Patch "cache: Workaround HiSilicon Taishan DC CVAU"
      breaks the kabi symbols:
      cpu_hwcaps
      cpu_hwcap_keys
      
      Fix by using CONFIG_HISILICON_ERRATUM_1980005 to protect it.
      Signed-off-by: NWeilong Chen <chenweilong@huawei.com>
      Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      9f5a4906
    • Y
      config: disable CONFIG_HISILICON_ERRATUM_1980005 by default · 4e7fe8aa
      Yang Yingliang 提交于
      ascend inclusion
      category: feature
      bugzilla: 46922
      CVE: NA
      
      -------------------------------------
      
      disable CONFIG_HISILICON_ERRATUM_1980005 by default.
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      4e7fe8aa
    • W
      cache: Workaround HiSilicon Taishan DC CVAU · 289037d6
      Weilong Chen 提交于
      ascend inclusion
      category: feature
      bugzilla: 46922
      CVE: NA
      
      -------------------------------------
      
      Taishan's L1/L2 cache is inclusive, and the data is consistent.
      Any change of L1 does not require DC operation to brush CL in L1 to L2.
      It's safe that don't clean data cache by address to point of unification.
      
      Without IDC featrue, kernel needs to flush icache as well as dcache,
      causes performance degradation.
      
      The flaw refers to V110/V200 variant 1.
      Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: NWeilong Chen <chenweilong@huawei.com>
      Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      289037d6
    • Y
      kabi: fix kabi broken in struct device · 5b22bdbb
      Yang Yingliang 提交于
      hulk inclusion
      category: bugfix
      bugzilla: NA
      CVE: NA
      
      ---------------------------
      
      fix kabi broken in struct device.
      It's introduced by a2734433 ("PCI/MSI: Protect msi_desc::masked for multi-MSI").
      Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
      Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      5b22bdbb
    • P
      virtio_pci: Support surprise removal of virtio pci device · 3763f311
      Parav Pandit 提交于
      stable inclusion
      from linux-4.19.206
      commit 68208dc42dd906fe626224000d85e9513dbe5199
      
      --------------------------------
      
      [ Upstream commit 43bb40c5 ]
      
      When a virtio pci device undergo surprise removal (aka async removal in
      PCIe spec), mark the device as broken so that any upper layer drivers can
      abort any outstanding operation.
      
      When a virtio net pci device undergo surprise removal which is used by a
      NetworkManager, a below call trace was observed.
      
      kernel:watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [kworker/1:1:27059]
      watchdog: BUG: soft lockup - CPU#1 stuck for 52s! [kworker/1:1:27059]
      CPU: 1 PID: 27059 Comm: kworker/1:1 Tainted: G S      W I  L    5.13.0-hotplug+ #8
      Hardware name: Dell Inc. PowerEdge R640/0H28RR, BIOS 2.9.4 11/06/2020
      Workqueue: events linkwatch_event
      RIP: 0010:virtnet_send_command+0xfc/0x150 [virtio_net]
      Call Trace:
       virtnet_set_rx_mode+0xcf/0x2a7 [virtio_net]
       ? __hw_addr_create_ex+0x85/0xc0
       __dev_mc_add+0x72/0x80
       igmp6_group_added+0xa7/0xd0
       ipv6_mc_up+0x3c/0x60
       ipv6_find_idev+0x36/0x80
       addrconf_add_dev+0x1e/0xa0
       addrconf_dev_config+0x71/0x130
       addrconf_notify+0x1f5/0xb40
       ? rtnl_is_locked+0x11/0x20
       ? __switch_to_asm+0x42/0x70
       ? finish_task_switch+0xaf/0x2c0
       ? raw_notifier_call_chain+0x3e/0x50
       raw_notifier_call_chain+0x3e/0x50
       netdev_state_change+0x67/0x90
       linkwatch_do_dev+0x3c/0x50
       __linkwatch_run_queue+0xd2/0x220
       linkwatch_event+0x21/0x30
       process_one_work+0x1c8/0x370
       worker_thread+0x30/0x380
       ? process_one_work+0x370/0x370
       kthread+0x118/0x140
       ? set_kthread_struct+0x40/0x40
       ret_from_fork+0x1f/0x30
      
      Hence, add the ability to abort the command on surprise removal
      which prevents infinite loop and system lockup.
      Signed-off-by: NParav Pandit <parav@nvidia.com>
      Link: https://lore.kernel.org/r/20210721142648.1525924-5-parav@nvidia.comSigned-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      3763f311
    • S
      ip_gre: add validation for csum_start · 439c5af4
      Shreyansh Chouhan 提交于
      stable inclusion
      from linux-4.19.206
      commit c33471daf2763c5aee2b7926202c74b75c365119
      
      --------------------------------
      
      [ Upstream commit 1d011c48 ]
      
      Validate csum_start in gre_handle_offloads before we call _gre_xmit so
      that we do not crash later when the csum_start value is used in the
      lco_csum function call.
      
      This patch deals with ipv4 code.
      
      Fixes: c5441932 ("GRE: Refactor GRE tunneling code.")
      Reported-by: syzbot+ff8e1b9f2f36481e2efc@syzkaller.appspotmail.com
      Signed-off-by: NShreyansh Chouhan <chouhan.shreyansh630@gmail.com>
      Reviewed-by: NWillem de Bruijn <willemb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      439c5af4
    • S
      netfilter: nft_exthdr: fix endianness of tcp option cast · c68e152b
      Sergey Marinkevich 提交于
      stable inclusion
      from linux-4.19.205
      commit 991158d680774ca5010fe6e15aa3a61aebfdf688
      
      --------------------------------
      
      [ Upstream commit 2e34328b ]
      
      I got a problem on MIPS with Big-Endian is turned on: every time when
      NF trying to change TCP MSS it returns because of new.v16 was greater
      than old.v16. But real MSS was 1460 and my rule was like this:
      
      	add rule table chain tcp option maxseg size set 1400
      
      And 1400 is lesser that 1460, not greater.
      
      Later I founded that main causer is cast from u32 to __be16.
      
      Debugging:
      
      In example MSS = 1400(HEX: 0x578). Here is representation of each byte
      like it is in memory by addresses from left to right(e.g. [0x0 0x1 0x2
      0x3]). LE — Little-Endian system, BE — Big-Endian, left column is type.
      
      	     LE               BE
      	u32: [78 05 00 00]    [00 00 05 78]
      
      As you can see, u32 representation will be casted to u16 from different
      half of 4-byte address range. But actually nf_tables uses registers and
      store data of various size. Actually TCP MSS stored in 2 bytes. But
      registers are still u32 in definition:
      
      	struct nft_regs {
      		union {
      			u32			data[20];
      			struct nft_verdict	verdict;
      		};
      	};
      
      So, access like regs->data[priv->sreg] exactly u32. So, according to
      table presents above, per-byte representation of stored TCP MSS in
      register will be:
      
      	                     LE               BE
      	(u32)regs->data[]:   [78 05 00 00]    [05 78 00 00]
      	                                       ^^ ^^
      
      We see that register uses just half of u32 and other 2 bytes may be
      used for some another data. But in nft_exthdr_tcp_set_eval() it casted
      just like u32 -> __be16:
      
      	new.v16 = src
      
      But u32 overfill __be16, so it get 2 low bytes. For clarity draw
      one more table(<xx xx> means that bytes will be used for cast).
      
      	                     LE                 BE
      	u32:                 [<78 05> 00 00]    [00 00 <05 78>]
      	(u32)regs->data[]:   [<78 05> 00 00]    [05 78 <00 00>]
      
      As you can see, for Little-Endian nothing changes, but for Big-endian we
      take the wrong half. In my case there is some other data instead of
      zeros, so new MSS was wrongly greater.
      
      For shooting this bug I used solution for ports ranges. Applying of this
      patch does not affect Little-Endian systems.
      Signed-off-by: NSergey Marinkevich <sergey.marinkevich@eltex-co.ru>
      Acked-by: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      c68e152b
    • S
      tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL event name · 534b0f9d
      Steven Rostedt (VMware) 提交于
      stable inclusion
      from linux-4.19.205
      commit 2d349b0a69edc4f7f09c543abd098ab3c7fe31c3
      
      --------------------------------
      
      [ Upstream commit 5acce0bf ]
      
      The following commands:
      
       # echo 'read_max u64 size;' > synthetic_events
       # echo 'hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)' > events/syscalls/sys_enter_read/trigger
      
      Causes:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP
       CPU: 4 PID: 1763 Comm: bash Not tainted 5.14.0-rc2-test+ #155
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01
      v03.03 07/14/2016
       RIP: 0010:strcmp+0xc/0x20
       Code: 75 f7 31 c0 0f b6 0c 06 88 0c 02 48 83 c0 01 84 c9 75 f1 4c 89 c0
      c3 0f 1f 80 00 00 00 00 31 c0 eb 08 48 83 c0 01 84 d2 74 0f <0f> b6 14 07
      3a 14 06 74 ef 19 c0 83 c8 01 c3 31 c0 c3 66 90 48 89
       RSP: 0018:ffffb5fdc0963ca8 EFLAGS: 00010246
       RAX: 0000000000000000 RBX: ffffffffb3a4e040 RCX: 0000000000000000
       RDX: 0000000000000000 RSI: ffff9714c0d0b640 RDI: 0000000000000000
       RBP: 0000000000000000 R08: 00000022986b7cde R09: ffffffffb3a4dff8
       R10: 0000000000000000 R11: 0000000000000000 R12: ffff9714c50603c8
       R13: 0000000000000000 R14: ffff97143fdf9e48 R15: ffff9714c01a2210
       FS:  00007f1fa6785740(0000) GS:ffff9714da400000(0000)
      knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000000 CR3: 000000002d863004 CR4: 00000000001706e0
       Call Trace:
        __find_event_file+0x4e/0x80
        action_create+0x6b7/0xeb0
        ? kstrdup+0x44/0x60
        event_hist_trigger_func+0x1a07/0x2130
        trigger_process_regex+0xbd/0x110
        event_trigger_write+0x71/0xd0
        vfs_write+0xe9/0x310
        ksys_write+0x68/0xe0
        do_syscall_64+0x3b/0x90
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f1fa6879e87
      
      The problem was the "trace(read_max,count)" where the "count" should be
      "$count" as "onmax()" only handles variables (although it really should be
      able to figure out that "count" is a field of sys_enter_read). But there's
      a path that does not find the variable and ends up passing a NULL for the
      event, which ends up getting passed to "strcmp()".
      
      Add a check for NULL to return and error on the command with:
      
       # cat error_log
        hist:syscalls:sys_enter_read: error: Couldn't create or find variable
        Command: hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)
                                      ^
      Link: https://lkml.kernel.org/r/20210808003011.4037f8d0@oasis.local.home
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: stable@vger.kernel.org
      Fixes: 50450603 tracing: Add 'onmax' hist trigger action support
      Reviewed-by: NTom Zanussi <zanussi@kernel.org>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      534b0f9d
    • S
      scsi: core: Avoid printing an error if target_alloc() returns -ENXIO · dd49b49c
      Sreekanth Reddy 提交于
      stable inclusion
      from linux-4.19.205
      commit 460add3104945704bfd2b92441b48a30b2ee9f1e
      
      --------------------------------
      
      [ Upstream commit 70edd2e6 ]
      
      Avoid printing a 'target allocation failed' error if the driver
      target_alloc() callback function returns -ENXIO. This return value
      indicates that the corresponding H:C:T:L entry is empty.
      
      Removing this error reduces the scan time if the user issues SCAN_WILD_CARD
      scan operation through sysfs parameter on a host with a lot of empty
      H:C:T:L entries.
      
      Avoiding the printk on -ENXIO matches the behavior of the other callback
      functions during scanning.
      
      Link: https://lore.kernel.org/r/20210726115402.1936-1-sreekanth.reddy@broadcom.comSigned-off-by: NSreekanth Reddy <sreekanth.reddy@broadcom.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      dd49b49c
    • Y
      scsi: scsi_dh_rdac: Avoid crash during rdac_bus_attach() · 0fce27d1
      Ye Bin 提交于
      stable inclusion
      from linux-4.19.205
      commit e25e7495d72649cb50b42865356bfe272b3a2a6d
      
      --------------------------------
      
      [ Upstream commit bc546c0c ]
      
      The following BUG_ON() was observed during RDAC scan:
      
      [595952.944297] kernel BUG at drivers/scsi/device_handler/scsi_dh_rdac.c:427!
      [595952.951143] Internal error: Oops - BUG: 0 [#1] SMP
      ......
      [595953.251065] Call trace:
      [595953.259054]  check_ownership+0xb0/0x118
      [595953.269794]  rdac_bus_attach+0x1f0/0x4b0
      [595953.273787]  scsi_dh_handler_attach+0x3c/0xe8
      [595953.278211]  scsi_dh_add_device+0xc4/0xe8
      [595953.282291]  scsi_sysfs_add_sdev+0x8c/0x2a8
      [595953.286544]  scsi_probe_and_add_lun+0x9fc/0xd00
      [595953.291142]  __scsi_scan_target+0x598/0x630
      [595953.295395]  scsi_scan_target+0x120/0x130
      [595953.299481]  fc_user_scan+0x1a0/0x1c0 [scsi_transport_fc]
      [595953.304944]  store_scan+0xb0/0x108
      [595953.308420]  dev_attr_store+0x44/0x60
      [595953.312160]  sysfs_kf_write+0x58/0x80
      [595953.315893]  kernfs_fop_write+0xe8/0x1f0
      [595953.319888]  __vfs_write+0x60/0x190
      [595953.323448]  vfs_write+0xac/0x1c0
      [595953.326836]  ksys_write+0x74/0xf0
      [595953.330221]  __arm64_sys_write+0x24/0x30
      
      Code is in check_ownership:
      
      	list_for_each_entry_rcu(tmp, &h->ctlr->dh_list, node) {
      		/* h->sdev should always be valid */
      		BUG_ON(!tmp->sdev);
      		tmp->sdev->access_state = access_state;
      	}
      
      	rdac_bus_attach
      		initialize_controller
      			list_add_rcu(&h->node, &h->ctlr->dh_list);
      			h->sdev = sdev;
      
      	rdac_bus_detach
      		list_del_rcu(&h->node);
      		h->sdev = NULL;
      
      Fix the race between rdac_bus_attach() and rdac_bus_detach() where h->sdev
      is NULL when processing the RDAC attach.
      
      Link: https://lore.kernel.org/r/20210113063103.2698953-1-yebin10@huawei.comReviewed-by: NBart Van Assche <bvanassche@acm.org>
      Signed-off-by: NYe Bin <yebin10@huawei.com>
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      0fce27d1
    • T
      x86/fpu: Make init_fpstate correct with optimized XSAVE · d2994844
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit e829367f47218de04587c2df3c4cb5ef87e35648
      
      --------------------------------
      
      commit f9dfb5e3 upstream.
      
      The XSAVE init code initializes all enabled and supported components with
      XRSTOR(S) to init state. Then it XSAVEs the state of the components back
      into init_fpstate which is used in several places to fill in the init state
      of components.
      
      This works correctly with XSAVE, but not with XSAVEOPT and XSAVES because
      those use the init optimization and skip writing state of components which
      are in init state. So init_fpstate.xsave still contains all zeroes after
      this operation.
      
      There are two ways to solve that:
      
         1) Use XSAVE unconditionally, but that requires to reshuffle the buffer when
            XSAVES is enabled because XSAVES uses compacted format.
      
         2) Save the components which are known to have a non-zero init state by other
            means.
      
      Looking deeper, #2 is the right thing to do because all components the
      kernel supports have all-zeroes init state except the legacy features (FP,
      SSE). Those cannot be hard coded because the states are not identical on all
      CPUs, but they can be saved with FXSAVE which avoids all conditionals.
      
      Use FXSAVE to save the legacy FP/SSE components in init_fpstate along with
      a BUILD_BUG_ON() which reminds developers to validate that a newly added
      component has all zeroes init state. As a bonus remove the now unused
      copy_xregs_to_kernel_booting() crutch.
      
      The XSAVE and reshuffle method can still be implemented in the unlikely
      case that components are added which have a non-zero init state and no
      other means to save them. For now, FXSAVE is just simple and good enough.
      
        [ bp: Fix a typo or two in the text. ]
      
      Fixes: 6bad06b7 ("x86, xsave: Use xsaveopt in context-switch path when supported")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NBorislav Petkov <bp@suse.de>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20210618143444.587311343@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      d2994844
    • S
      iommu/vt-d: Fix agaw for a supported 48 bit guest address width · 479309c5
      Saeed Mirzamohammadi 提交于
      stable inclusion
      from linux-4.19.205
      commit 6a9449e9568808930e7d4d83c33e320329113a67
      
      --------------------------------
      
      [ Upstream commit 327d5b2f ]
      
      The IOMMU driver calculates the guest addressability for a DMA request
      based on the value of the mgaw reported from the IOMMU. However, this
      is a fused value and as mentioned in the spec, the guest width
      should be calculated based on the minimum of supported adjusted guest
      address width (SAGAW) and MGAW.
      
      This is from specification:
      "Guest addressability for a given DMA request is limited to the
      minimum of the value reported through this field and the adjusted
      guest address width of the corresponding page-table structure.
      (Adjusted guest address widths supported by hardware are reported
      through the SAGAW field)."
      
      This causes domain initialization to fail and following
      errors appear for EHCI PCI driver:
      
      [    2.486393] ehci-pci 0000:01:00.4: EHCI Host Controller
      [    2.486624] ehci-pci 0000:01:00.4: new USB bus registered, assigned bus
      number 1
      [    2.489127] ehci-pci 0000:01:00.4: DMAR: Allocating domain failed
      [    2.489350] ehci-pci 0000:01:00.4: DMAR: 32bit DMA uses non-identity
      mapping
      [    2.489359] ehci-pci 0000:01:00.4: can't setup: -12
      [    2.489531] ehci-pci 0000:01:00.4: USB bus 1 deregistered
      [    2.490023] ehci-pci 0000:01:00.4: init 0000:01:00.4 fail, -12
      [    2.490358] ehci-pci: probe of 0000:01:00.4 failed with error -12
      
      This issue happens when the value of the sagaw corresponds to a
      48-bit agaw. This fix updates the calculation of the agaw based on
      the minimum of IOMMU's sagaw value and MGAW.
      
      This issue happens on the code path of getting a private domain for a
      device. A private domain was needed when the domain of an iommu group
      couldn't meet the requirement of a device. The IOMMU core has been
      evolved to eliminate the need for private domain, hence this code path
      has alreay been removed from the upstream since commit 327d5b2f
      ("iommu/vt-d: Allow 32bit devices to uses DMA domain"). Instead of back
      porting all patches that are required for removing the private domain,
      this simply fixes it in the affected stable kernel between v4.16 and v5.7.
      
      [baolu: The orignal patch could be found here
       https://lore.kernel.org/linux-iommu/20210412202736.70765-1-saeed.mirzamohammadi@oracle.com/.
       I added commit message according to Greg's comments at
       https://lore.kernel.org/linux-iommu/YHZ%2FT9x7Xjf1r6fI@kroah.com/.]
      
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Ashok Raj <ashok.raj@intel.com>
      Cc: stable@vger.kernel.org #v4.16+
      Signed-off-by: NSaeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
      Tested-by: NCamille Lu <camille.lu@hpe.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      479309c5
    • T
      PCI/MSI: Enforce MSI[X] entry updates to be visible · 256535c0
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 153cc7c9dfefe646c8b2a74eb925b6620b915154
      
      --------------------------------
      
      commit b9255a7c upstream.
      
      Nothing enforces the posted writes to be visible when the function
      returns. Flush them even if the flush might be redundant when the entry is
      masked already as the unmask will flush as well. This is either setup or a
      rare affinity change event so the extra flush is not the end of the world.
      
      While this is more a theoretical issue especially the logic in the X86
      specific msi_set_affinity() function relies on the assumption that the
      update has reached the hardware when the function returns.
      
      Again, as this never has been enforced the Fixes tag refers to a commit in:
         git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
      
      Fixes: f036d4ea5fa7 ("[PATCH] ia32 Message Signalled Interrupt support")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.515188147@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      256535c0
    • T
      PCI/MSI: Enforce that MSI-X table entry is masked for update · 1cca3beb
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit b590b85fc91979a97cbb4ab1bcf888aa245cd5e3
      
      --------------------------------
      
      commit da181dc9 upstream.
      
      The specification (PCIe r5.0, sec 6.1.4.5) states:
      
          For MSI-X, a function is permitted to cache Address and Data values
          from unmasked MSI-X Table entries. However, anytime software unmasks a
          currently masked MSI-X Table entry either by clearing its Mask bit or
          by clearing the Function Mask bit, the function must update any Address
          or Data values that it cached from that entry. If software changes the
          Address or Data value of an entry while the entry is unmasked, the
          result is undefined.
      
      The Linux kernel's MSI-X support never enforced that the entry is masked
      before the entry is modified hence the Fixes tag refers to a commit in:
            git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
      
      Enforce the entry to be masked across the update.
      
      There is no point in enforcing this to be handled at all possible call
      sites as this is just pointless code duplication and the common update
      function is the obvious place to enforce this.
      
      Fixes: f036d4ea5fa7 ("[PATCH] ia32 Message Signalled Interrupt support")
      Reported-by: NKevin Tian <kevin.tian@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.462096385@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      1cca3beb
    • T
      PCI/MSI: Mask all unused MSI-X entries · 2de6a011
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 3b570884c868c12e3184627ce4b4a167e9d6f018
      
      --------------------------------
      
      commit 7d5ec3d3 upstream.
      
      When MSI-X is enabled the ordering of calls is:
      
        msix_map_region();
        msix_setup_entries();
        pci_msi_setup_msi_irqs();
        msix_program_entries();
      
      This has a few interesting issues:
      
       1) msix_setup_entries() allocates the MSI descriptors and initializes them
          except for the msi_desc:masked member which is left zero initialized.
      
       2) pci_msi_setup_msi_irqs() allocates the interrupt descriptors and sets
          up the MSI interrupts which ends up in pci_write_msi_msg() unless the
          interrupt chip provides its own irq_write_msi_msg() function.
      
       3) msix_program_entries() does not do what the name suggests. It solely
          updates the entries array (if not NULL) and initializes the masked
          member for each MSI descriptor by reading the hardware state and then
          masks the entry.
      
      Obviously this has some issues:
      
       1) The uninitialized masked member of msi_desc prevents the enforcement
          of masking the entry in pci_write_msi_msg() depending on the cached
          masked bit. Aside of that half initialized data is a NONO in general
      
       2) msix_program_entries() only ensures that the actually allocated entries
          are masked. This is wrong as experimentation with crash testing and
          crash kernel kexec has shown.
      
          This limited testing unearthed that when the production kernel had more
          entries in use and unmasked when it crashed and the crash kernel
          allocated a smaller amount of entries, then a full scan of all entries
          found unmasked entries which were in use in the production kernel.
      
          This is obviously a device or emulation issue as the device reset
          should mask all MSI-X table entries, but obviously that's just part
          of the paper specification.
      
      Cure this by:
      
       1) Masking all table entries in hardware
       2) Initializing msi_desc::masked in msix_setup_entries()
       3) Removing the mask dance in msix_program_entries()
       4) Renaming msix_program_entries() to msix_update_entries() to
          reflect the purpose of that function.
      
      As the masking of unused entries has never been done the Fixes tag refers
      to a commit in:
         git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
      
      Fixes: f036d4ea5fa7 ("[PATCH] ia32 Message Signalled Interrupt support")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.403833459@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      2de6a011
    • T
      PCI/MSI: Protect msi_desc::masked for multi-MSI · a2734433
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 3c9534778d4cc2bd01e20d4dcffc55df0962aa12
      
      --------------------------------
      
      commit 77e89afc upstream.
      
      Multi-MSI uses a single MSI descriptor and there is a single mask register
      when the device supports per vector masking. To avoid reading back the mask
      register the value is cached in the MSI descriptor and updates are done by
      clearing and setting bits in the cache and writing it to the device.
      
      But nothing protects msi_desc::masked and the mask register from being
      modified concurrently on two different CPUs for two different Linux
      interrupts which belong to the same multi-MSI descriptor.
      
      Add a lock to struct device and protect any operation on the mask and the
      mask register with it.
      
      This makes the update of msi_desc::masked unconditional, but there is no
      place which requires a modification of the hardware register without
      updating the masked cache.
      
      msi_mask_irq() is now an empty wrapper which will be cleaned up in follow
      up changes.
      
      The problem goes way back to the initial support of multi-MSI, but picking
      the commit which introduced the mask cache is a valid cut off point
      (2.6.30).
      
      Fixes: f2440d9a ("PCI MSI: Refactor interrupt masking code")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.726833414@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      a2734433
    • T
      PCI/MSI: Use msi_mask_irq() in pci_msi_shutdown() · e6482181
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 1b36c30a9335db941423c05b49a8266a84a82f95
      
      --------------------------------
      
      commit d28d4ad2 upstream.
      
      No point in using the raw write function from shutdown. Preparatory change
      to introduce proper serialization for the msi_desc::masked cache.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.674391354@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      e6482181
    • T
      PCI/MSI: Correct misleading comments · e521a20d
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit c5b223cd04706589e5e6840e2ab7c4f879323ed9
      
      --------------------------------
      
      commit 689e6b53 upstream.
      
      The comments about preserving the cached state in pci_msi[x]_shutdown() are
      misleading as the MSI descriptors are freed right after those functions
      return. So there is nothing to restore. Preparatory change.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.621609423@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      e521a20d
    • T
      PCI/MSI: Do not set invalid bits in MSI mask · d7692543
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 22f4a36d086d74f7abe9c4eaf65204048cd84f9c
      
      --------------------------------
      
      commit 361fd373 upstream.
      
      msi_mask_irq() takes a mask and a flags argument. The mask argument is used
      to mask out bits from the cached mask and the flags argument to set bits.
      
      Some places invoke it with a flags argument which sets bits which are not
      used by the device, i.e. when the device supports up to 8 vectors a full
      unmask in some places sets the mask to 0xFFFFFF00. While devices probably
      do not care, it's still bad practice.
      
      Fixes: 7ba1930d ("PCI MSI: Unmask MSI if setup failed")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.568173099@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      d7692543
    • T
      PCI/MSI: Enable and mask MSI-X early · 006d934a
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 6aea847496c8c9a37a5df795c4fe42a0e5fcccc5
      
      --------------------------------
      
      commit 43855395 upstream.
      
      The ordering of MSI-X enable in hardware is dysfunctional:
      
       1) MSI-X is disabled in the control register
       2) Various setup functions
       3) pci_msi_setup_msi_irqs() is invoked which ends up accessing
          the MSI-X table entries
       4) MSI-X is enabled and masked in the control register with the
          comment that enabling is required for some hardware to access
          the MSI-X table
      
      Step #4 obviously contradicts #3. The history of this is an issue with the
      NIU hardware. When #4 was introduced the table access actually happened in
      msix_program_entries() which was invoked after enabling and masking MSI-X.
      
      This was changed in commit d71d6432 ("PCI/MSI: Kill redundant call of
      irq_set_msi_desc() for MSI-X interrupts") which removed the table write
      from msix_program_entries().
      
      Interestingly enough nobody noticed and either NIU still works or it did
      not get any testing with a kernel 3.19 or later.
      
      Nevertheless this is inconsistent and there is no reason why MSI-X can't be
      enabled and masked in the control register early on, i.e. move step #4
      above to step #1. This preserves the NIU workaround and has no side effects
      on other hardware.
      
      Fixes: d71d6432 ("PCI/MSI: Kill redundant call of irq_set_msi_desc() for MSI-X interrupts")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NAshok Raj <ashok.raj@intel.com>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.344136412@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      006d934a
    • B
      genirq/msi: Ensure deactivation on teardown · eaabd1aa
      Bixuan Cui 提交于
      stable inclusion
      from linux-4.19.205
      commit 504a4c1057151a1f1332fb3ce940134db8d6b885
      
      --------------------------------
      
      commit dbbc9357 upstream.
      
      msi_domain_alloc_irqs() invokes irq_domain_activate_irq(), but
      msi_domain_free_irqs() does not enforce deactivation before tearing down
      the interrupts.
      
      This happens when PCI/MSI interrupts are set up and never used before being
      torn down again, e.g. in error handling pathes. The only place which cleans
      that up is the error handling path in msi_domain_alloc_irqs().
      
      Move the cleanup from msi_domain_alloc_irqs() into msi_domain_free_irqs()
      to cure that.
      
      Fixes: f3b0946d ("genirq/msi: Make sure PCI MSIs are activated early")
      Signed-off-by: NBixuan Cui <cuibixuan@huawei.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210518033117.78104-1-cuibixuan@huawei.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      eaabd1aa
    • T
      x86/ioapic: Force affinity setup before startup · 5c126be8
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 697658a61db4f3aa213d76336ccf30e66e6c44ca
      
      --------------------------------
      
      commit 0c0e37dc upstream.
      
      The IO/APIC cannot handle interrupt affinity changes safely after startup
      other than from an interrupt handler. The startup sequence in the generic
      interrupt code violates that assumption.
      
      Mark the irq chip with the new IRQCHIP_AFFINITY_PRE_STARTUP flag so that
      the default interrupt setting happens before the interrupt is started up
      for the first time.
      
      Fixes: 18404756 ("genirq: Expose default irq affinity mask (take 3)")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.832143400@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      5c126be8
    • T
      x86/msi: Force affinity setup before startup · 297ac420
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit 354b210062b1e50ef284f97590011c2231316eaa
      
      --------------------------------
      
      commit ff363f48 upstream.
      
      The X86 MSI mechanism cannot handle interrupt affinity changes safely after
      startup other than from an interrupt handler, unless interrupt remapping is
      enabled. The startup sequence in the generic interrupt code violates that
      assumption.
      
      Mark the irq chips with the new IRQCHIP_AFFINITY_PRE_STARTUP flag so that
      the default interrupt setting happens before the interrupt is started up
      for the first time.
      
      While the interrupt remapping MSI chip does not require this, there is no
      point in treating it differently as this might spare an interrupt to a CPU
      which is not in the default affinity mask.
      
      For the non-remapping case go to the direct write path when the interrupt
      is not yet started similar to the not yet activated case.
      
      Fixes: 18404756 ("genirq: Expose default irq affinity mask (take 3)")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.886722080@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      297ac420
    • T
      genirq: Provide IRQCHIP_AFFINITY_PRE_STARTUP · e9b57276
      Thomas Gleixner 提交于
      stable inclusion
      from linux-4.19.205
      commit cab824f67d7e8f68288d615929dec02607e473ad
      
      --------------------------------
      
      commit 826da771 upstream.
      
      X86 IO/APIC and MSI interrupts (when used without interrupts remapping)
      require that the affinity setup on startup is done before the interrupt is
      enabled for the first time as the non-remapped operation mode cannot safely
      migrate enabled interrupts from arbitrary contexts. Provide a new irq chip
      flag which allows affected hardware to request this.
      
      This has to be opt-in because there have been reports in the past that some
      interrupt chips cannot handle affinity setting before startup.
      
      Fixes: 18404756 ("genirq: Expose default irq affinity mask (take 3)")
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NMarc Zyngier <maz@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20210729222542.779791738@linutronix.deSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Conflicts:
        include/linux/irq.h
      [yyl: adjust context]
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      e9b57276
    • N
      tcp_bbr: fix u32 wrap bug in round logic if bbr_init() called after 2B packets · 808541e9
      Neal Cardwell 提交于
      stable inclusion
      from linux-4.19.205
      commit 32b6627fec712fb75fbed272517c74814c00ccfc
      
      --------------------------------
      
      [ Upstream commit 6de035fe ]
      
      Currently if BBR congestion control is initialized after more than 2B
      packets have been delivered, depending on the phase of the
      tp->delivered counter the tracking of BBR round trips can get stuck.
      
      The bug arises because if tp->delivered is between 2^31 and 2^32 at
      the time the BBR congestion control module is initialized, then the
      initialization of bbr->next_rtt_delivered to 0 will cause the logic to
      believe that the end of the round trip is still billions of packets in
      the future. More specifically, the following check will fail
      repeatedly:
      
        !before(rs->prior_delivered, bbr->next_rtt_delivered)
      
      and thus the connection will take up to 2B packets delivered before
      that check will pass and the connection will set:
      
        bbr->round_start = 1;
      
      This could cause many mechanisms in BBR to fail to trigger, for
      example bbr_check_full_bw_reached() would likely never exit STARTUP.
      
      This bug is 5 years old and has not been observed, and as a practical
      matter this would likely rarely trigger, since it would require
      transferring at least 2B packets, or likely more than 3 terabytes of
      data, before switching congestion control algorithms to BBR.
      
      This patch is a stable candidate for kernels as far back as v4.9,
      when tcp_bbr.c was added.
      
      Fixes: 0f8782ea ("tcp_bbr: add BBR congestion control")
      Signed-off-by: NNeal Cardwell <ncardwell@google.com>
      Reviewed-by: NYuchung Cheng <ycheng@google.com>
      Reviewed-by: NKevin Yang <yyd@google.com>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20210811024056.235161-1-ncardwell@google.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      808541e9
    • Y
      net: bridge: fix memleak in br_add_if() · c9ea3933
      Yang Yingliang 提交于
      stable inclusion
      from linux-4.19.205
      commit f41237f60cb0202827432706c33faba3adadbfb5
      
      --------------------------------
      
      [ Upstream commit 519133de ]
      
      I got a memleak report:
      
      BUG: memory leak
      unreferenced object 0x607ee521a658 (size 240):
      comm "syz-executor.0", pid 955, jiffies 4294780569 (age 16.449s)
      hex dump (first 32 bytes, cpu 1):
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
      backtrace:
      [<00000000d830ea5a>] br_multicast_add_port+0x1c2/0x300 net/bridge/br_multicast.c:1693
      [<00000000274d9a71>] new_nbp net/bridge/br_if.c:435 [inline]
      [<00000000274d9a71>] br_add_if+0x670/0x1740 net/bridge/br_if.c:611
      [<0000000012ce888e>] do_set_master net/core/rtnetlink.c:2513 [inline]
      [<0000000012ce888e>] do_set_master+0x1aa/0x210 net/core/rtnetlink.c:2487
      [<0000000099d1cafc>] __rtnl_newlink+0x1095/0x13e0 net/core/rtnetlink.c:3457
      [<00000000a01facc0>] rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3488
      [<00000000acc9186c>] rtnetlink_rcv_msg+0x369/0xa10 net/core/rtnetlink.c:5550
      [<00000000d4aabb9c>] netlink_rcv_skb+0x134/0x3d0 net/netlink/af_netlink.c:2504
      [<00000000bc2e12a3>] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
      [<00000000bc2e12a3>] netlink_unicast+0x4a0/0x6a0 net/netlink/af_netlink.c:1340
      [<00000000e4dc2d0e>] netlink_sendmsg+0x789/0xc70 net/netlink/af_netlink.c:1929
      [<000000000d22c8b3>] sock_sendmsg_nosec net/socket.c:654 [inline]
      [<000000000d22c8b3>] sock_sendmsg+0x139/0x170 net/socket.c:674
      [<00000000e281417a>] ____sys_sendmsg+0x658/0x7d0 net/socket.c:2350
      [<00000000237aa2ab>] ___sys_sendmsg+0xf8/0x170 net/socket.c:2404
      [<000000004f2dc381>] __sys_sendmsg+0xd3/0x190 net/socket.c:2433
      [<0000000005feca6c>] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:47
      [<000000007304477d>] entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      On error path of br_add_if(), p->mcast_stats allocated in
      new_nbp() need be freed, or it will be leaked.
      
      Fixes: 1080ab95 ("net: bridge: add support for IGMP/MLD stats and export them via netlink")
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Acked-by: NNikolay Aleksandrov <nikolay@nvidia.com>
      Link: https://lore.kernel.org/r/20210809132023.978546-1-yangyingliang@huawei.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      c9ea3933
    • E
      net: igmp: fix data-race in igmp_ifc_timer_expire() · 43253564
      Eric Dumazet 提交于
      stable inclusion
      from linux-4.19.205
      commit fb5db3106036f4e21a63c0c6b08db4b4f18f157c
      
      --------------------------------
      
      [ Upstream commit 4a2b285e ]
      
      Fix the data-race reported by syzbot [1]
      Issue here is that igmp_ifc_timer_expire() can update in_dev->mr_ifc_count
      while another change just occured from another context.
      
      in_dev->mr_ifc_count is only 8bit wide, so the race had little
      consequences.
      
      [1]
      BUG: KCSAN: data-race in igmp_ifc_event / igmp_ifc_timer_expire
      
      write to 0xffff8881051e3062 of 1 bytes by task 12547 on cpu 0:
       igmp_ifc_event+0x1d5/0x290 net/ipv4/igmp.c:821
       igmp_group_added+0x462/0x490 net/ipv4/igmp.c:1356
       ____ip_mc_inc_group+0x3ff/0x500 net/ipv4/igmp.c:1461
       __ip_mc_join_group+0x24d/0x2c0 net/ipv4/igmp.c:2199
       ip_mc_join_group_ssm+0x20/0x30 net/ipv4/igmp.c:2218
       do_ip_setsockopt net/ipv4/ip_sockglue.c:1285 [inline]
       ip_setsockopt+0x1827/0x2a80 net/ipv4/ip_sockglue.c:1423
       tcp_setsockopt+0x8c/0xa0 net/ipv4/tcp.c:3657
       sock_common_setsockopt+0x5d/0x70 net/core/sock.c:3362
       __sys_setsockopt+0x18f/0x200 net/socket.c:2159
       __do_sys_setsockopt net/socket.c:2170 [inline]
       __se_sys_setsockopt net/socket.c:2167 [inline]
       __x64_sys_setsockopt+0x62/0x70 net/socket.c:2167
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      read to 0xffff8881051e3062 of 1 bytes by interrupt on cpu 1:
       igmp_ifc_timer_expire+0x706/0xa30 net/ipv4/igmp.c:808
       call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1419
       expire_timers+0x135/0x250 kernel/time/timer.c:1464
       __run_timers+0x358/0x420 kernel/time/timer.c:1732
       run_timer_softirq+0x19/0x30 kernel/time/timer.c:1745
       __do_softirq+0x12c/0x26e kernel/softirq.c:558
       invoke_softirq kernel/softirq.c:432 [inline]
       __irq_exit_rcu+0x9a/0xb0 kernel/softirq.c:636
       sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1100
       asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638
       console_unlock+0x8e8/0xb30 kernel/printk/printk.c:2646
       vprintk_emit+0x125/0x3d0 kernel/printk/printk.c:2174
       vprintk_default+0x22/0x30 kernel/printk/printk.c:2185
       vprintk+0x15a/0x170 kernel/printk/printk_safe.c:392
       printk+0x62/0x87 kernel/printk/printk.c:2216
       selinux_netlink_send+0x399/0x400 security/selinux/hooks.c:6041
       security_netlink_send+0x42/0x90 security/security.c:2070
       netlink_sendmsg+0x59e/0x7c0 net/netlink/af_netlink.c:1919
       sock_sendmsg_nosec net/socket.c:703 [inline]
       sock_sendmsg net/socket.c:723 [inline]
       ____sys_sendmsg+0x360/0x4d0 net/socket.c:2392
       ___sys_sendmsg net/socket.c:2446 [inline]
       __sys_sendmsg+0x1ed/0x270 net/socket.c:2475
       __do_sys_sendmsg net/socket.c:2484 [inline]
       __se_sys_sendmsg net/socket.c:2482 [inline]
       __x64_sys_sendmsg+0x42/0x50 net/socket.c:2482
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0x90 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      value changed: 0x01 -> 0x02
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 1 PID: 12539 Comm: syz-executor.1 Not tainted 5.14.0-rc4-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      43253564
    • D
      ACPI: NFIT: Fix support for virtual SPA ranges · 1231368b
      Dan Williams 提交于
      stable inclusion
      from linux-4.19.205
      commit c39e22fd3f7ce3af64140f560ea63b0c986a46db
      
      --------------------------------
      
      commit b93dfa6b upstream.
      
      Fix the NFIT parsing code to treat a 0 index in a SPA Range Structure as
      a special case and not match Region Mapping Structures that use 0 to
      indicate that they are not mapped. Without this fix some platform BIOS
      descriptions of "virtual disk" ranges do not result in the pmem driver
      attaching to the range.
      
      Details:
      In addition to typical persistent memory ranges, the ACPI NFIT may also
      convey "virtual" ranges. These ranges are indicated by a UUID in the SPA
      Range Structure of UUID_VOLATILE_VIRTUAL_DISK, UUID_VOLATILE_VIRTUAL_CD,
      UUID_PERSISTENT_VIRTUAL_DISK, or UUID_PERSISTENT_VIRTUAL_CD. The
      critical difference between virtual ranges and UUID_PERSISTENT_MEMORY,
      is that virtual do not support associations with Region Mapping
      Structures.  For this reason the "index" value of virtual SPA Range
      Structures is allowed to be 0. If a platform BIOS decides to represent
      NVDIMMs with disconnected "Region Mapping Structures" (range-index ==
      0), the kernel may falsely associate them with standalone ranges where
      the "SPA Range Structure Index" is also zero. When this happens the
      driver may falsely require labels where "virtual disks" are expected to
      be label-less. I.e. "label-less" is where the namespace-range ==
      region-range and the pmem driver attaches with no user action to create
      a namespace.
      
      Cc: Jacek Zloch <jacek.zloch@intel.com>
      Cc: Lukasz Sobieraj <lukasz.sobieraj@intel.com>
      Cc: "Lee, Chun-Yi" <jlee@suse.com>
      Cc: <stable@vger.kernel.org>
      Fixes: c2f32acd ("acpi, nfit: treat virtual ramdisk SPA as pmem region")
      Reported-by: NKrzysztof Rusocki <krzysztof.rusocki@intel.com>
      Reported-by: NDamian Bassa <damian.bassa@intel.com>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Link: https://lore.kernel.org/r/162870796589.2521182.1240403310175570220.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      1231368b
    • M
      ovl: prevent private clone if bind mount is not allowed · 591c8183
      Miklos Szeredi 提交于
      stable inclusion
      from linux-4.19.204
      commit 963d85d630dabe75a3cfde44a006fec3304d07b8
      
      --------------------------------
      
      commit 427215d8 upstream.
      
      Add the following checks from __do_loopback() to clone_private_mount() as
      well:
      
       - verify that the mount is in the current namespace
      
       - verify that there are no locked children
      Reported-by: NAlois Wohlschlager <alois1@gmx-topmail.de>
      Fixes: c771d683 ("vfs: introduce clone_private_mount()")
      Cc: <stable@vger.kernel.org> # v3.18
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      591c8183
    • M
      tracing: Reject string operand in the histogram expression · cb0c4fa9
      Masami Hiramatsu 提交于
      stable inclusion
      from linux-4.19.204
      commit 7c165d58effc19fdf68196d4ceebf940d5da777d
      
      --------------------------------
      
      commit a9d10ca4 upstream.
      
      Since the string type can not be the target of the addition / subtraction
      operation, it must be rejected. Without this fix, the string type silently
      converted to digits.
      
      Link: https://lkml.kernel.org/r/162742654278.290973.1523000673366456634.stgit@devnote2
      
      Cc: stable@vger.kernel.org
      Fixes: 100719dc ("tracing: Add simple expression support to hist triggers")
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      cb0c4fa9
    • Y
      reiserfs: add check for root_inode in reiserfs_fill_super · 26d2435f
      Yu Kuai 提交于
      stable inclusion
      from linux-4.19.203
      commit df2f583b63637f9f882ba604cf23e0336de82220
      
      --------------------------------
      
      [ Upstream commit 2acf15b9 ]
      
      Our syzcaller report a NULL pointer dereference:
      
      BUG: kernel NULL pointer dereference, address: 0000000000000000
      PGD 116e95067 P4D 116e95067 PUD 1080b5067 PMD 0
      Oops: 0010 [#1] SMP KASAN
      CPU: 7 PID: 592 Comm: a.out Not tainted 5.13.0-next-20210629-dirty #67
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_073836-buildvm-p4
      RIP: 0010:0x0
      Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
      RSP: 0018:ffff888114e779b8 EFLAGS: 00010246
      RAX: 0000000000000000 RBX: 1ffff110229cef39 RCX: ffffffffaa67e1aa
      RDX: 0000000000000000 RSI: ffff88810a58ee00 RDI: ffff8881233180b0
      RBP: ffffffffac38e9c0 R08: ffffffffaa67e17e R09: 0000000000000001
      R10: ffffffffb91c5557 R11: fffffbfff7238aaa R12: ffff88810a58ee00
      R13: ffff888114e77aa0 R14: 0000000000000000 R15: ffff8881233180b0
      FS:  00007f946163c480(0000) GS:ffff88839f1c0000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffffffffffffd6 CR3: 00000001099c1000 CR4: 00000000000006e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       __lookup_slow+0x116/0x2d0
       ? page_put_link+0x120/0x120
       ? __d_lookup+0xfc/0x320
       ? d_lookup+0x49/0x90
       lookup_one_len+0x13c/0x170
       ? __lookup_slow+0x2d0/0x2d0
       ? reiserfs_schedule_old_flush+0x31/0x130
       reiserfs_lookup_privroot+0x64/0x150
       reiserfs_fill_super+0x158c/0x1b90
       ? finish_unfinished+0xb10/0xb10
       ? bprintf+0xe0/0xe0
       ? __mutex_lock_slowpath+0x30/0x30
       ? __kasan_check_write+0x20/0x30
       ? up_write+0x51/0xb0
       ? set_blocksize+0x9f/0x1f0
       mount_bdev+0x27c/0x2d0
       ? finish_unfinished+0xb10/0xb10
       ? reiserfs_kill_sb+0x120/0x120
       get_super_block+0x19/0x30
       legacy_get_tree+0x76/0xf0
       vfs_get_tree+0x49/0x160
       ? capable+0x1d/0x30
       path_mount+0xacc/0x1380
       ? putname+0x97/0xd0
       ? finish_automount+0x450/0x450
       ? kmem_cache_free+0xf8/0x5a0
       ? putname+0x97/0xd0
       do_mount+0xe2/0x110
       ? path_mount+0x1380/0x1380
       ? copy_mount_options+0x69/0x140
       __x64_sys_mount+0xf0/0x190
       do_syscall_64+0x35/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      This is because 'root_inode' is initialized with wrong mode, and
      it's i_op is set to 'reiserfs_special_inode_operations'. Thus add
      check for 'root_inode' to fix the problem.
      
      Link: https://lore.kernel.org/r/20210702040743.1918552-1-yukuai3@huawei.comSigned-off-by: NYu Kuai <yukuai3@huawei.com>
      Signed-off-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      26d2435f
    • M
      serial: 8250: Mask out floating 16/32-bit bus bits · bcc84b74
      Maciej W. Rozycki 提交于
      stable inclusion
      from linux-4.19.203
      commit 2c39c32f92084736bc871c1ef096602eb1cc7b5b
      
      --------------------------------
      
      commit e5227c51 upstream.
      
      Make sure only actual 8 bits of the IIR register are used in determining
      the port type in `autoconfig'.
      
      The `serial_in' port accessor returns the `unsigned int' type, meaning
      that with UPIO_AU, UPIO_MEM16, UPIO_MEM32, and UPIO_MEM32BE access types
      more than 8 bits of data are returned, of which the high order bits will
      often come from bus lines that are left floating in the data phase.  For
      example with the MIPS Malta board's CBUS UART, where the registers are
      aligned on 8-byte boundaries and which uses 32-bit accesses, data as
      follows is returned:
      
      YAMON> dump -32 0xbf000900 0x40
      
      BF000900: 1F000942 1F000942 1F000900 1F000900  ...B...B........
      BF000910: 1F000901 1F000901 1F000900 1F000900  ................
      BF000920: 1F000900 1F000900 1F000960 1F000960  ...........`...`
      BF000930: 1F000900 1F000900 1F0009FF 1F0009FF  ................
      
      YAMON>
      
      Evidently high-order 24 bits return values previously driven in the
      address phase (the 3 highest order address bits used with the command
      above are masked out in the simple virtual address mapping used here and
      come out at zeros on the external bus), a common scenario with bus lines
      left floating, due to bus capacitance.
      
      Consequently when the value of IIR, mapped at 0x1f000910, is retrieved
      in `autoconfig', it comes out at 0x1f0009c1 and when it is right-shifted
      by 6 and then assigned to 8-bit `scratch' variable, the value calculated
      is 0x27, not one of 0, 1, 2, 3 expected in port type determination.
      
      Fix the issue then, by assigning the value returned from `serial_in' to
      `scratch' first, which masks out 24 high-order bits retrieved, and only
      then right-shift the resulting 8-bit data quantity, producing the value
      of 3 in this case, as expected.  Fix the same issue in `serial_dl_read'.
      
      The problem first appeared with Linux 2.6.9-rc3 which predates our repo
      history, but the origin could be identified with the old MIPS/Linux repo
      also at: <git://git.kernel.org/pub/scm/linux/kernel/git/ralf/linux.git>
      as commit e0d2356c0777 ("Merge with Linux 2.6.9-rc3."), where code in
      `serial_in' was updated with this case:
      
      +	case UPIO_MEM32:
      +		return readl(up->port.membase + offset);
      +
      
      which made it produce results outside the unsigned 8-bit range for the
      first time, though obviously it is system dependent what actual values
      appear in the high order bits retrieved and it may well have been zeros
      in the relevant positions with the system the change originally was
      intended for.  It is at that point that code in `autoconf' should have
      been updated accordingly, but clearly it was overlooked.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: stable@vger.kernel.org # v2.6.12+
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NMaciej W. Rozycki <macro@orcam.me.uk>
      Link: https://lore.kernel.org/r/alpine.DEB.2.21.2106260516220.37803@angie.orcam.me.ukSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      bcc84b74
    • T
      ext4: fix potential htree corruption when growing large_dir directories · 912fa436
      Theodore Ts'o 提交于
      stable inclusion
      from linux-4.19.203
      commit bc1954aa8a7e195ebd686a77e81c11863ce8edbf
      
      --------------------------------
      
      commit 877ba3f7 upstream.
      
      Commit b5776e75 ("ext4: fix potential htree index checksum
      corruption) removed a required restart when multiple levels of index
      nodes need to be split.  Fix this to avoid directory htree corruptions
      when using the large_dir feature.
      
      Cc: stable@kernel.org # v5.11
      Cc: Благодаренко Артём <artem.blagodarenko@gmail.com>
      Fixes: b5776e75 ("ext4: fix potential htree index checksum corruption)
      Reported-by: NDenis <denis@voxelsoft.com>
      Signed-off-by: NTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      912fa436