commit:     70dca92c5946e33e43279219d6b567a7093187b9
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 15 20:05:14 2021 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sun Aug 15 20:05:14 2021 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=70dca92c

Linux patch 5.10.59

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README              |   4 +
 1058_linux-5.10.59.patch | 711 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 715 insertions(+)

diff --git a/0000_README b/0000_README
index 2552ce8..4078503 100644
--- a/0000_README
+++ b/0000_README
@@ -275,6 +275,10 @@ Patch:  1057_linux-5.10.58.patch
 From:   http://www.kernel.org
 Desc:   Linux 5.10.58
 
+Patch:  1058_linux-5.10.59.patch
+From:   http://www.kernel.org
+Desc:   Linux 5.10.59
+
 Patch:  1500_XATTR_USER_PREFIX.patch
 From:   https://bugs.gentoo.org/show_bug.cgi?id=470644
 Desc:   Support for namespace user.pax.* on tmpfs.

diff --git a/1058_linux-5.10.59.patch b/1058_linux-5.10.59.patch
new file mode 100644
index 0000000..7187305
--- /dev/null
+++ b/1058_linux-5.10.59.patch
@@ -0,0 +1,711 @@
+diff --git a/Makefile b/Makefile
+index 232dee1140c11..df86b39267cee 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 5
+ PATCHLEVEL = 10
+-SUBLEVEL = 58
++SUBLEVEL = 59
+ EXTRAVERSION =
+ NAME = Dare mighty things
+ 
+diff --git a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi 
b/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi
+index 597388f871272..bc4bb5dd8bae9 100644
+--- a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi
++++ b/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi
+@@ -271,12 +271,12 @@
+ &ehci0 {
+       dr_mode = "otg";
+       status = "okay";
+-      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
++      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>, <&usb2_clksel>, 
<&versaclock5 3>;
+ };
+ 
+ &ehci1 {
+       status = "okay";
+-      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
++      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>, <&usb2_clksel>, 
<&versaclock5 3>;
+ };
+ 
+ &hdmi0 {
+diff --git a/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi 
b/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi
+index 289cf711307d6..e3773b05c403b 100644
+--- a/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi
++++ b/arch/arm64/boot/dts/renesas/beacon-renesom-som.dtsi
+@@ -295,8 +295,10 @@
+       status = "okay";
+ };
+ 
+-&usb_extal_clk {
+-      clock-frequency = <50000000>;
++&usb2_clksel {
++      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>,
++                <&versaclock5 3>, <&usb3s0_clk>;
++      status = "okay";
+ };
+ 
+ &usb3s0_clk {
+diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi 
b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
+index db091fa751151..c58a0846db502 100644
+--- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
++++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi
+@@ -836,6 +836,21 @@
+                       status = "disabled";
+               };
+ 
++              usb2_clksel: clock-controller@e6590630 {
++                      compatible = "renesas,r8a774a1-rcar-usb2-clock-sel",
++                                   "renesas,rcar-gen3-usb2-clock-sel";
++                      reg = <0 0xe6590630 0 0x02>;
++                      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>,
++                               <&usb_extal_clk>, <&usb3s0_clk>;
++                      clock-names = "ehci_ohci", "hs-usb-if",
++                                    "usb_extal", "usb_xtal";
++                      #clock-cells = <0>;
++                      power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>;
++                      resets = <&cpg 703>, <&cpg 704>;
++                      reset-names = "ehci_ohci", "hs-usb-if";
++                      status = "disabled";
++              };
++
+               usb_dmac0: dma-controller@e65a0000 {
+                       compatible = "renesas,r8a774a1-usb-dmac",
+                                    "renesas,usb-dmac";
+diff --git a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi 
b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi
+index 39a1a26ffb546..9ebf6e58ba31c 100644
+--- a/arch/arm64/boot/dts/renesas/r8a774b1.dtsi
++++ b/arch/arm64/boot/dts/renesas/r8a774b1.dtsi
+@@ -709,6 +709,21 @@
+                       status = "disabled";
+               };
+ 
++              usb2_clksel: clock-controller@e6590630 {
++                      compatible = "renesas,r8a774b1-rcar-usb2-clock-sel",
++                                   "renesas,rcar-gen3-usb2-clock-sel";
++                      reg = <0 0xe6590630 0 0x02>;
++                      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>,
++                               <&usb_extal_clk>, <&usb3s0_clk>;
++                      clock-names = "ehci_ohci", "hs-usb-if",
++                                    "usb_extal", "usb_xtal";
++                      #clock-cells = <0>;
++                      power-domains = <&sysc R8A774B1_PD_ALWAYS_ON>;
++                      resets = <&cpg 703>, <&cpg 704>;
++                      reset-names = "ehci_ohci", "hs-usb-if";
++                      status = "disabled";
++              };
++
+               usb_dmac0: dma-controller@e65a0000 {
+                       compatible = "renesas,r8a774b1-usb-dmac",
+                                    "renesas,usb-dmac";
+diff --git a/arch/arm64/boot/dts/renesas/r8a774e1.dtsi 
b/arch/arm64/boot/dts/renesas/r8a774e1.dtsi
+index c29643442e91f..708258696b4f4 100644
+--- a/arch/arm64/boot/dts/renesas/r8a774e1.dtsi
++++ b/arch/arm64/boot/dts/renesas/r8a774e1.dtsi
+@@ -890,6 +890,21 @@
+                       status = "disabled";
+               };
+ 
++              usb2_clksel: clock-controller@e6590630 {
++                      compatible = "renesas,r8a774e1-rcar-usb2-clock-sel",
++                                   "renesas,rcar-gen3-usb2-clock-sel";
++                      reg = <0 0xe6590630 0 0x02>;
++                      clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>,
++                               <&usb_extal_clk>, <&usb3s0_clk>;
++                      clock-names = "ehci_ohci", "hs-usb-if",
++                                    "usb_extal", "usb_xtal";
++                      #clock-cells = <0>;
++                      power-domains = <&sysc R8A774E1_PD_ALWAYS_ON>;
++                      resets = <&cpg 703>, <&cpg 704>;
++                      reset-names = "ehci_ohci", "hs-usb-if";
++                      status = "disabled";
++              };
++
+               usb_dmac0: dma-controller@e65a0000 {
+                       compatible = "renesas,r8a774e1-usb-dmac",
+                                    "renesas,usb-dmac";
+diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
+index 01547bdbfb061..6c82ef22985d9 100644
+--- a/arch/x86/kvm/svm/sev.c
++++ b/arch/x86/kvm/svm/sev.c
+@@ -124,7 +124,7 @@ static void sev_asid_free(int asid)
+ 
+       for_each_possible_cpu(cpu) {
+               sd = per_cpu(svm_data, cpu);
+-              sd->sev_vmcbs[pos] = NULL;
++              sd->sev_vmcbs[asid] = NULL;
+       }
+ 
+       mutex_unlock(&sev_bitmap_lock);
+diff --git a/drivers/firmware/broadcom/tee_bnxt_fw.c 
b/drivers/firmware/broadcom/tee_bnxt_fw.c
+index ed10da5313e86..a5bf4c3f6dc74 100644
+--- a/drivers/firmware/broadcom/tee_bnxt_fw.c
++++ b/drivers/firmware/broadcom/tee_bnxt_fw.c
+@@ -212,10 +212,9 @@ static int tee_bnxt_fw_probe(struct device *dev)
+ 
+       pvt_data.dev = dev;
+ 
+-      fw_shm_pool = tee_shm_alloc(pvt_data.ctx, MAX_SHM_MEM_SZ,
+-                                  TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
++      fw_shm_pool = tee_shm_alloc_kernel_buf(pvt_data.ctx, MAX_SHM_MEM_SZ);
+       if (IS_ERR(fw_shm_pool)) {
+-              dev_err(pvt_data.dev, "tee_shm_alloc failed\n");
++              dev_err(pvt_data.dev, "tee_shm_alloc_kernel_buf failed\n");
+               err = PTR_ERR(fw_shm_pool);
+               goto out_sess;
+       }
+@@ -242,6 +241,14 @@ static int tee_bnxt_fw_remove(struct device *dev)
+       return 0;
+ }
+ 
++static void tee_bnxt_fw_shutdown(struct device *dev)
++{
++      tee_shm_free(pvt_data.fw_shm_pool);
++      tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
++      tee_client_close_context(pvt_data.ctx);
++      pvt_data.ctx = NULL;
++}
++
+ static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
+       {UUID_INIT(0x6272636D, 0x2019, 0x0716,
+                   0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)},
+@@ -257,6 +264,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
+               .bus            = &tee_bus_type,
+               .probe          = tee_bnxt_fw_probe,
+               .remove         = tee_bnxt_fw_remove,
++              .shutdown       = tee_bnxt_fw_shutdown,
+       },
+ };
+ 
+diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c 
b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+index 0c26f5bcc523a..962831cdde4db 100644
+--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+@@ -1191,9 +1191,8 @@ static int xemaclite_of_probe(struct platform_device 
*ofdev)
+       }
+ 
+       dev_info(dev,
+-               "Xilinx EmacLite at 0x%08X mapped to 0x%08X, irq=%d\n",
+-               (unsigned int __force)ndev->mem_start,
+-               (unsigned int __force)lp->base_addr, ndev->irq);
++               "Xilinx EmacLite at 0x%08X mapped to 0x%p, irq=%d\n",
++               (unsigned int __force)ndev->mem_start, lp->base_addr, 
ndev->irq);
+       return 0;
+ 
+ error:
+diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
+index 7d005896a0f93..f7a13529e4add 100644
+--- a/drivers/net/ppp/ppp_generic.c
++++ b/drivers/net/ppp/ppp_generic.c
+@@ -283,7 +283,7 @@ static struct channel *ppp_find_channel(struct ppp_net 
*pn, int unit);
+ static int ppp_connect_channel(struct channel *pch, int unit);
+ static int ppp_disconnect_channel(struct channel *pch);
+ static void ppp_destroy_channel(struct channel *pch);
+-static int unit_get(struct idr *p, void *ptr);
++static int unit_get(struct idr *p, void *ptr, int min);
+ static int unit_set(struct idr *p, void *ptr, int n);
+ static void unit_put(struct idr *p, int n);
+ static void *unit_find(struct idr *p, int n);
+@@ -1045,9 +1045,20 @@ static int ppp_unit_register(struct ppp *ppp, int unit, 
bool ifname_is_set)
+       mutex_lock(&pn->all_ppp_mutex);
+ 
+       if (unit < 0) {
+-              ret = unit_get(&pn->units_idr, ppp);
++              ret = unit_get(&pn->units_idr, ppp, 0);
+               if (ret < 0)
+                       goto err;
++              if (!ifname_is_set) {
++                      while (1) {
++                              snprintf(ppp->dev->name, IFNAMSIZ, "ppp%i", 
ret);
++                              if (!__dev_get_by_name(ppp->ppp_net, 
ppp->dev->name))
++                                      break;
++                              unit_put(&pn->units_idr, ret);
++                              ret = unit_get(&pn->units_idr, ppp, ret + 1);
++                              if (ret < 0)
++                                      goto err;
++                      }
++              }
+       } else {
+               /* Caller asked for a specific unit number. Fail with -EEXIST
+                * if unavailable. For backward compatibility, return -EEXIST
+@@ -3378,9 +3389,9 @@ static int unit_set(struct idr *p, void *ptr, int n)
+ }
+ 
+ /* get new free unit number and associate pointer with it */
+-static int unit_get(struct idr *p, void *ptr)
++static int unit_get(struct idr *p, void *ptr, int min)
+ {
+-      return idr_alloc(p, ptr, 0, 0, GFP_KERNEL);
++      return idr_alloc(p, ptr, min, 0, GFP_KERNEL);
+ }
+ 
+ /* put unit number back to a pool */
+diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c
+index 1231ce56e7123..f8f1594bea435 100644
+--- a/drivers/tee/optee/call.c
++++ b/drivers/tee/optee/call.c
+@@ -181,7 +181,7 @@ static struct tee_shm *get_msg_arg(struct tee_context 
*ctx, size_t num_params,
+       struct optee_msg_arg *ma;
+ 
+       shm = tee_shm_alloc(ctx, OPTEE_MSG_GET_ARG_SIZE(num_params),
+-                          TEE_SHM_MAPPED);
++                          TEE_SHM_MAPPED | TEE_SHM_PRIV);
+       if (IS_ERR(shm))
+               return shm;
+ 
+diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
+index 7b17248f1527c..823a81d8ff0ed 100644
+--- a/drivers/tee/optee/core.c
++++ b/drivers/tee/optee/core.c
+@@ -278,7 +278,8 @@ static void optee_release(struct tee_context *ctx)
+       if (!ctxdata)
+               return;
+ 
+-      shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), TEE_SHM_MAPPED);
++      shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg),
++                          TEE_SHM_MAPPED | TEE_SHM_PRIV);
+       if (!IS_ERR(shm)) {
+               arg = tee_shm_get_va(shm, 0);
+               /*
+diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
+index 6cbb3643c6c48..9dbdd783d6f2d 100644
+--- a/drivers/tee/optee/rpc.c
++++ b/drivers/tee/optee/rpc.c
+@@ -313,7 +313,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct 
tee_context *ctx,
+               shm = cmd_alloc_suppl(ctx, sz);
+               break;
+       case OPTEE_MSG_RPC_SHM_TYPE_KERNEL:
+-              shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED);
++              shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
+               break;
+       default:
+               arg->ret = TEEC_ERROR_BAD_PARAMETERS;
+@@ -501,7 +501,8 @@ void optee_handle_rpc(struct tee_context *ctx, struct 
optee_rpc_param *param,
+ 
+       switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
+       case OPTEE_SMC_RPC_FUNC_ALLOC:
+-              shm = tee_shm_alloc(ctx, param->a1, TEE_SHM_MAPPED);
++              shm = tee_shm_alloc(ctx, param->a1,
++                                  TEE_SHM_MAPPED | TEE_SHM_PRIV);
+               if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
+                       reg_pair_from_64(&param->a1, &param->a2, pa);
+                       reg_pair_from_64(&param->a4, &param->a5,
+diff --git a/drivers/tee/optee/shm_pool.c b/drivers/tee/optee/shm_pool.c
+index da06ce9b9313e..c41a9a501a6e9 100644
+--- a/drivers/tee/optee/shm_pool.c
++++ b/drivers/tee/optee/shm_pool.c
+@@ -27,7 +27,11 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
+       shm->paddr = page_to_phys(page);
+       shm->size = PAGE_SIZE << order;
+ 
+-      if (shm->flags & TEE_SHM_DMA_BUF) {
++      /*
++       * Shared memory private to the OP-TEE driver doesn't need
++       * to be registered with OP-TEE.
++       */
++      if (!(shm->flags & TEE_SHM_PRIV)) {
+               unsigned int nr_pages = 1 << order, i;
+               struct page **pages;
+ 
+@@ -60,7 +64,7 @@ err:
+ static void pool_op_free(struct tee_shm_pool_mgr *poolm,
+                        struct tee_shm *shm)
+ {
+-      if (shm->flags & TEE_SHM_DMA_BUF)
++      if (!(shm->flags & TEE_SHM_PRIV))
+               optee_shm_unregister(shm->ctx, shm);
+ 
+       free_pages((unsigned long)shm->kaddr, get_order(shm->size));
+diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
+index c65e44707cd69..8a9384a64f3e2 100644
+--- a/drivers/tee/tee_shm.c
++++ b/drivers/tee/tee_shm.c
+@@ -117,7 +117,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, 
size_t size, u32 flags)
+               return ERR_PTR(-EINVAL);
+       }
+ 
+-      if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF))) {
++      if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF | TEE_SHM_PRIV))) {
+               dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags);
+               return ERR_PTR(-EINVAL);
+       }
+@@ -207,7 +207,7 @@ EXPORT_SYMBOL_GPL(tee_shm_alloc);
+  */
+ struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size)
+ {
+-      return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
++      return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED);
+ }
+ EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf);
+ 
+diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
+index 71ec3025686fe..e87cf3a00fa4b 100644
+--- a/drivers/usb/host/ehci-pci.c
++++ b/drivers/usb/host/ehci-pci.c
+@@ -297,6 +297,9 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
+       if (pdev->vendor == PCI_VENDOR_ID_STMICRO
+           && pdev->device == PCI_DEVICE_ID_STMICRO_USB_HOST)
+               ;       /* ConneXT has no sbrn register */
++      else if (pdev->vendor == PCI_VENDOR_ID_HUAWEI
++                       && pdev->device == 0xa239)
++              ;       /* HUAWEI Kunpeng920 USB EHCI has no sbrn register */
+       else
+               pci_read_config_byte(pdev, 0x60, &ehci->sbrn);
+ 
+diff --git a/fs/namespace.c b/fs/namespace.c
+index c7fbb50a5aaa5..175312428cdf6 100644
+--- a/fs/namespace.c
++++ b/fs/namespace.c
+@@ -1919,6 +1919,20 @@ void drop_collected_mounts(struct vfsmount *mnt)
+       namespace_unlock();
+ }
+ 
++static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
++{
++      struct mount *child;
++
++      list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
++              if (!is_subdir(child->mnt_mountpoint, dentry))
++                      continue;
++
++              if (child->mnt.mnt_flags & MNT_LOCKED)
++                      return true;
++      }
++      return false;
++}
++
+ /**
+  * clone_private_mount - create a private clone of a path
+  *
+@@ -1933,10 +1947,19 @@ struct vfsmount *clone_private_mount(const struct path 
*path)
+       struct mount *old_mnt = real_mount(path->mnt);
+       struct mount *new_mnt;
+ 
++      down_read(&namespace_sem);
+       if (IS_MNT_UNBINDABLE(old_mnt))
+-              return ERR_PTR(-EINVAL);
++              goto invalid;
++
++      if (!check_mnt(old_mnt))
++              goto invalid;
++
++      if (has_locked_children(old_mnt, path->dentry))
++              goto invalid;
+ 
+       new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
++      up_read(&namespace_sem);
++
+       if (IS_ERR(new_mnt))
+               return ERR_CAST(new_mnt);
+ 
+@@ -1944,6 +1967,10 @@ struct vfsmount *clone_private_mount(const struct path 
*path)
+       new_mnt->mnt_ns = MNT_NS_INTERNAL;
+ 
+       return &new_mnt->mnt;
++
++invalid:
++      up_read(&namespace_sem);
++      return ERR_PTR(-EINVAL);
+ }
+ EXPORT_SYMBOL_GPL(clone_private_mount);
+ 
+@@ -2295,19 +2322,6 @@ static int do_change_type(struct path *path, int 
ms_flags)
+       return err;
+ }
+ 
+-static bool has_locked_children(struct mount *mnt, struct dentry *dentry)
+-{
+-      struct mount *child;
+-      list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
+-              if (!is_subdir(child->mnt_mountpoint, dentry))
+-                      continue;
+-
+-              if (child->mnt.mnt_flags & MNT_LOCKED)
+-                      return true;
+-      }
+-      return false;
+-}
+-
+ static struct mount *__do_loopback(struct path *old_path, int recurse)
+ {
+       struct mount *mnt = ERR_PTR(-EINVAL), *old = real_mount(old_path->mnt);
+diff --git a/fs/vboxsf/dir.c b/fs/vboxsf/dir.c
+index 4d569f14a8d80..0664787f2b74f 100644
+--- a/fs/vboxsf/dir.c
++++ b/fs/vboxsf/dir.c
+@@ -253,7 +253,7 @@ static int vboxsf_dir_instantiate(struct inode *parent, 
struct dentry *dentry,
+ }
+ 
+ static int vboxsf_dir_create(struct inode *parent, struct dentry *dentry,
+-                           umode_t mode, int is_dir)
++                           umode_t mode, bool is_dir, bool excl, u64 
*handle_ret)
+ {
+       struct vboxsf_inode *sf_parent_i = VBOXSF_I(parent);
+       struct vboxsf_sbi *sbi = VBOXSF_SBI(parent->i_sb);
+@@ -261,10 +261,12 @@ static int vboxsf_dir_create(struct inode *parent, 
struct dentry *dentry,
+       int err;
+ 
+       params.handle = SHFL_HANDLE_NIL;
+-      params.create_flags = SHFL_CF_ACT_CREATE_IF_NEW |
+-                            SHFL_CF_ACT_FAIL_IF_EXISTS |
+-                            SHFL_CF_ACCESS_READWRITE |
+-                            (is_dir ? SHFL_CF_DIRECTORY : 0);
++      params.create_flags = SHFL_CF_ACT_CREATE_IF_NEW | 
SHFL_CF_ACCESS_READWRITE;
++      if (is_dir)
++              params.create_flags |= SHFL_CF_DIRECTORY;
++      if (excl)
++              params.create_flags |= SHFL_CF_ACT_FAIL_IF_EXISTS;
++
+       params.info.attr.mode = (mode & 0777) |
+                               (is_dir ? SHFL_TYPE_DIRECTORY : SHFL_TYPE_FILE);
+       params.info.attr.additional = SHFLFSOBJATTRADD_NOTHING;
+@@ -276,28 +278,32 @@ static int vboxsf_dir_create(struct inode *parent, 
struct dentry *dentry,
+       if (params.result != SHFL_FILE_CREATED)
+               return -EPERM;
+ 
+-      vboxsf_close(sbi->root, params.handle);
+-
+       err = vboxsf_dir_instantiate(parent, dentry, &params.info);
+       if (err)
+-              return err;
++              goto out;
+ 
+       /* parent directory access/change time changed */
+       sf_parent_i->force_restat = 1;
+ 
+-      return 0;
++out:
++      if (err == 0 && handle_ret)
++              *handle_ret = params.handle;
++      else
++              vboxsf_close(sbi->root, params.handle);
++
++      return err;
+ }
+ 
+ static int vboxsf_dir_mkfile(struct inode *parent, struct dentry *dentry,
+                            umode_t mode, bool excl)
+ {
+-      return vboxsf_dir_create(parent, dentry, mode, 0);
++      return vboxsf_dir_create(parent, dentry, mode, false, excl, NULL);
+ }
+ 
+ static int vboxsf_dir_mkdir(struct inode *parent, struct dentry *dentry,
+                           umode_t mode)
+ {
+-      return vboxsf_dir_create(parent, dentry, mode, 1);
++      return vboxsf_dir_create(parent, dentry, mode, true, true, NULL);
+ }
+ 
+ static int vboxsf_dir_unlink(struct inode *parent, struct dentry *dentry)
+diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
+index 9d0c454d23cd6..63b550403317a 100644
+--- a/include/linux/mmzone.h
++++ b/include/linux/mmzone.h
+@@ -445,7 +445,7 @@ struct zone {
+        */
+       long lowmem_reserve[MAX_NR_ZONES];
+ 
+-#ifdef CONFIG_NUMA
++#ifdef CONFIG_NEED_MULTIPLE_NODES
+       int node;
+ #endif
+       struct pglist_data      *zone_pgdat;
+@@ -896,7 +896,7 @@ static inline bool populated_zone(struct zone *zone)
+       return zone->present_pages;
+ }
+ 
+-#ifdef CONFIG_NUMA
++#ifdef CONFIG_NEED_MULTIPLE_NODES
+ static inline int zone_to_nid(struct zone *zone)
+ {
+       return zone->node;
+diff --git a/include/linux/security.h b/include/linux/security.h
+index 39642626a707c..7ef74d01b8e74 100644
+--- a/include/linux/security.h
++++ b/include/linux/security.h
+@@ -120,6 +120,7 @@ enum lockdown_reason {
+       LOCKDOWN_MMIOTRACE,
+       LOCKDOWN_DEBUGFS,
+       LOCKDOWN_XMON_WR,
++      LOCKDOWN_BPF_WRITE_USER,
+       LOCKDOWN_INTEGRITY_MAX,
+       LOCKDOWN_KCORE,
+       LOCKDOWN_KPROBES,
+diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h
+index 9b24cc3d3024f..459e9a76d7e6f 100644
+--- a/include/linux/tee_drv.h
++++ b/include/linux/tee_drv.h
+@@ -27,6 +27,7 @@
+ #define TEE_SHM_USER_MAPPED   BIT(4)  /* Memory mapped in user space */
+ #define TEE_SHM_POOL          BIT(5)  /* Memory allocated from pool */
+ #define TEE_SHM_KERNEL_MAPPED BIT(6)  /* Memory mapped in kernel space */
++#define TEE_SHM_PRIV          BIT(7)  /* Memory private to TEE driver */
+ 
+ struct device;
+ struct tee_device;
+diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
+index 216329c23f18a..ba644760f5076 100644
+--- a/kernel/trace/bpf_trace.c
++++ b/kernel/trace/bpf_trace.c
+@@ -1272,12 +1272,13 @@ bpf_tracing_func_proto(enum bpf_func_id func_id, const 
struct bpf_prog *prog)
+               return &bpf_get_numa_node_id_proto;
+       case BPF_FUNC_perf_event_read:
+               return &bpf_perf_event_read_proto;
+-      case BPF_FUNC_probe_write_user:
+-              return bpf_get_probe_write_proto();
+       case BPF_FUNC_current_task_under_cgroup:
+               return &bpf_current_task_under_cgroup_proto;
+       case BPF_FUNC_get_prandom_u32:
+               return &bpf_get_prandom_u32_proto;
++      case BPF_FUNC_probe_write_user:
++              return security_locked_down(LOCKDOWN_BPF_WRITE_USER) < 0 ?
++                     NULL : bpf_get_probe_write_proto();
+       case BPF_FUNC_probe_read_user:
+               return &bpf_probe_read_user_proto;
+       case BPF_FUNC_probe_read_kernel:
+diff --git a/security/security.c b/security/security.c
+index a28045dc9e7f6..1c696bce8e1c9 100644
+--- a/security/security.c
++++ b/security/security.c
+@@ -58,6 +58,7 @@ const char *const 
lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = {
+       [LOCKDOWN_MMIOTRACE] = "unsafe mmio",
+       [LOCKDOWN_DEBUGFS] = "debugfs access",
+       [LOCKDOWN_XMON_WR] = "xmon write access",
++      [LOCKDOWN_BPF_WRITE_USER] = "use of bpf to write user RAM",
+       [LOCKDOWN_INTEGRITY_MAX] = "integrity",
+       [LOCKDOWN_KCORE] = "/proc/kcore access",
+       [LOCKDOWN_KPROBES] = "use of kprobes",
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
+index b36c8d94d4dab..c5ef5182fcf19 100644
+--- a/sound/core/pcm_native.c
++++ b/sound/core/pcm_native.c
+@@ -251,7 +251,10 @@ static bool hw_support_mmap(struct snd_pcm_substream 
*substream)
+ 
+       switch (substream->dma_buffer.dev.type) {
+       case SNDRV_DMA_TYPE_UNKNOWN:
+-              return false;
++              /* we can't know the device, so just assume that the driver does
++               * everything right
++               */
++              return true;
+       case SNDRV_DMA_TYPE_CONTINUOUS:
+       case SNDRV_DMA_TYPE_VMALLOC:
+               return true;
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 4556ce9a4b158..beb5fb03e3884 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -8357,6 +8357,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", 
ALC245_FIXUP_HP_X360_AMP),
++      SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", 
ALC236_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", 
ALC285_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", 
ALC285_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", 
ALC285_FIXUP_HP_GPIO_LED),
+@@ -8389,6 +8390,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+       SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
+       SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", 
ALC294_FIXUP_ASUS_DUAL_SPK),
++      SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", 
ALC294_FIXUP_ASUS_DUAL_SPK),
+       SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", 
ALC294_FIXUP_ASUS_GX502_PINS),
+       SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", 
ALC256_FIXUP_ASUS_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", 
ALC256_FIXUP_ASUS_HEADSET_MIC),
+diff --git a/tools/testing/selftests/resctrl/resctrl.h 
b/tools/testing/selftests/resctrl/resctrl.h
+index 9dcc96e1ad3d7..36da6136af968 100644
+--- a/tools/testing/selftests/resctrl/resctrl.h
++++ b/tools/testing/selftests/resctrl/resctrl.h
+@@ -28,10 +28,6 @@
+ #define RESCTRL_PATH          "/sys/fs/resctrl"
+ #define PHYS_ID_PATH          "/sys/devices/system/cpu/cpu"
+ #define CBM_MASK_PATH         "/sys/fs/resctrl/info"
+-#define L3_PATH                       "/sys/fs/resctrl/info/L3"
+-#define MB_PATH                       "/sys/fs/resctrl/info/MB"
+-#define L3_MON_PATH           "/sys/fs/resctrl/info/L3_MON"
+-#define L3_MON_FEATURES_PATH  "/sys/fs/resctrl/info/L3_MON/mon_features"
+ 
+ #define PARENT_EXIT(err_msg)                  \
+       do {                                    \
+@@ -83,7 +79,7 @@ int remount_resctrlfs(bool mum_resctrlfs);
+ int get_resource_id(int cpu_no, int *resource_id);
+ int umount_resctrlfs(void);
+ int validate_bw_report_request(char *bw_report);
+-bool validate_resctrl_feature_request(const char *resctrl_val);
++bool validate_resctrl_feature_request(char *resctrl_val);
+ char *fgrep(FILE *inf, const char *str);
+ int taskset_benchmark(pid_t bm_pid, int cpu_no);
+ void run_benchmark(int signum, siginfo_t *info, void *ucontext);
+diff --git a/tools/testing/selftests/resctrl/resctrlfs.c 
b/tools/testing/selftests/resctrl/resctrlfs.c
+index b57170f53861d..4174e48e06d1e 100644
+--- a/tools/testing/selftests/resctrl/resctrlfs.c
++++ b/tools/testing/selftests/resctrl/resctrlfs.c
+@@ -616,56 +616,26 @@ char *fgrep(FILE *inf, const char *str)
+  * validate_resctrl_feature_request - Check if requested feature is valid.
+  * @resctrl_val:      Requested feature
+  *
+- * Return: True if the feature is supported, else false
++ * Return: 0 on success, non-zero on failure
+  */
+-bool validate_resctrl_feature_request(const char *resctrl_val)
++bool validate_resctrl_feature_request(char *resctrl_val)
+ {
+-      struct stat statbuf;
++      FILE *inf = fopen("/proc/cpuinfo", "r");
+       bool found = false;
+       char *res;
+-      FILE *inf;
+ 
+-      if (!resctrl_val)
++      if (!inf)
+               return false;
+ 
+-      if (remount_resctrlfs(false))
+-              return false;
++      res = fgrep(inf, "flags");
+ 
+-      if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) {
+-              if (!stat(L3_PATH, &statbuf))
+-                      return true;
+-      } else if (!strncmp(resctrl_val, MBA_STR, sizeof(MBA_STR))) {
+-              if (!stat(MB_PATH, &statbuf))
+-                      return true;
+-      } else if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR)) ||
+-                 !strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) {
+-              if (!stat(L3_MON_PATH, &statbuf)) {
+-                      inf = fopen(L3_MON_FEATURES_PATH, "r");
+-                      if (!inf)
+-                              return false;
+-
+-                      if (!strncmp(resctrl_val, CMT_STR, sizeof(CMT_STR))) {
+-                              res = fgrep(inf, "llc_occupancy");
+-                              if (res) {
+-                                      found = true;
+-                                      free(res);
+-                              }
+-                      }
+-
+-                      if (!strncmp(resctrl_val, MBM_STR, sizeof(MBM_STR))) {
+-                              res = fgrep(inf, "mbm_total_bytes");
+-                              if (res) {
+-                                      free(res);
+-                                      res = fgrep(inf, "mbm_local_bytes");
+-                                      if (res) {
+-                                              found = true;
+-                                              free(res);
+-                                      }
+-                              }
+-                      }
+-                      fclose(inf);
+-              }
++      if (res) {
++              char *s = strchr(res, ':');
++
++              found = s && !strstr(s, resctrl_val);
++              free(res);
+       }
++      fclose(inf);
+ 
+       return found;
+ }

Reply via email to