From dc13e7ec4fa0890563615f3519b57f89423291d4 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Mon, 1 Feb 2021 09:33:35 +0100 Subject: [PATCH] Add upstream patches --- config/kernel/linux-odroidxu4-current.config | 2 +- .../odroidxu4-current/patch-5.4.91-92.patch | 756 ++++++ .../odroidxu4-current/patch-5.4.92-93.patch | 2413 +++++++++++++++++ .../odroidxu4-current/patch-5.4.93-94.patch | 1065 ++++++++ 4 files changed, 4235 insertions(+), 1 deletion(-) create mode 100644 patch/kernel/odroidxu4-current/patch-5.4.91-92.patch create mode 100644 patch/kernel/odroidxu4-current/patch-5.4.92-93.patch create mode 100644 patch/kernel/odroidxu4-current/patch-5.4.93-94.patch diff --git a/config/kernel/linux-odroidxu4-current.config b/config/kernel/linux-odroidxu4-current.config index fe6cc00b2..275af67f4 100644 --- a/config/kernel/linux-odroidxu4-current.config +++ b/config/kernel/linux-odroidxu4-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 5.4.88 Kernel Configuration +# Linux/arm 5.4.94 Kernel Configuration # # diff --git a/patch/kernel/odroidxu4-current/patch-5.4.91-92.patch b/patch/kernel/odroidxu4-current/patch-5.4.91-92.patch new file mode 100644 index 000000000..65ab41d4d --- /dev/null +++ b/patch/kernel/odroidxu4-current/patch-5.4.91-92.patch @@ -0,0 +1,756 @@ +diff --git a/Makefile b/Makefile +index a5edbd4f34145..5bae2206a35e7 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 91 ++SUBLEVEL = 92 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +index 6988bbf2576f5..9a77b70ad601b 100644 +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +@@ -4790,8 +4790,6 @@ static void mvpp2_phylink_validate(struct phylink_config *config, + + phylink_set(mask, Autoneg); + phylink_set_port_modes(mask); +- phylink_set(mask, Pause); +- phylink_set(mask, Asym_Pause); + + switch (state->interface) { + case PHY_INTERFACE_MODE_10GKR: +diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +index 71c90c8a9e943..c3fc1cc4bb2b9 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +@@ -19,7 +19,7 @@ + #define MLXSW_THERMAL_ASIC_TEMP_NORM 75000 /* 75C */ + #define MLXSW_THERMAL_ASIC_TEMP_HIGH 85000 /* 85C */ + #define MLXSW_THERMAL_ASIC_TEMP_HOT 105000 /* 105C */ +-#define MLXSW_THERMAL_ASIC_TEMP_CRIT 110000 /* 110C */ ++#define MLXSW_THERMAL_ASIC_TEMP_CRIT 140000 /* 140C */ + #define MLXSW_THERMAL_HYSTERESIS_TEMP 5000 /* 5C */ + #define MLXSW_THERMAL_MODULE_TEMP_SHIFT (MLXSW_THERMAL_HYSTERESIS_TEMP * 2) + #define MLXSW_THERMAL_ZONE_MAX_NAME 16 +@@ -177,6 +177,12 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core, + if (err) + return err; + ++ if (crit_temp > emerg_temp) { ++ dev_warn(dev, "%s : Critical threshold %d is above emergency threshold %d\n", ++ tz->tzdev->type, crit_temp, emerg_temp); ++ return 0; ++ } ++ + /* According to the system thermal requirements, the thermal zones are + * defined with four trip points. The critical and emergency + * temperature thresholds, provided by QSFP module are set as "active" +@@ -191,11 +197,8 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core, + tz->trips[MLXSW_THERMAL_TEMP_TRIP_NORM].temp = crit_temp; + tz->trips[MLXSW_THERMAL_TEMP_TRIP_HIGH].temp = crit_temp; + tz->trips[MLXSW_THERMAL_TEMP_TRIP_HOT].temp = emerg_temp; +- if (emerg_temp > crit_temp) +- tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp + ++ tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp + + MLXSW_THERMAL_MODULE_TEMP_SHIFT; +- else +- tz->trips[MLXSW_THERMAL_TEMP_TRIP_CRIT].temp = emerg_temp; + + return 0; + } +diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +index c692a41e45480..25b6f2ee2beb8 100644 +--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c ++++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +@@ -564,11 +564,6 @@ static const struct net_device_ops netxen_netdev_ops = { + .ndo_set_features = netxen_set_features, + }; + +-static inline bool netxen_function_zero(struct pci_dev *pdev) +-{ +- return (PCI_FUNC(pdev->devfn) == 0) ? true : false; +-} +- + static inline void netxen_set_interrupt_mode(struct netxen_adapter *adapter, + u32 mode) + { +@@ -664,7 +659,7 @@ static int netxen_setup_intr(struct netxen_adapter *adapter) + netxen_initialize_interrupt_registers(adapter); + netxen_set_msix_bit(pdev, 0); + +- if (netxen_function_zero(pdev)) { ++ if (adapter->portnum == 0) { + if (!netxen_setup_msi_interrupts(adapter, num_msix)) + netxen_set_interrupt_mode(adapter, NETXEN_MSI_MODE); + else +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 18c5a9bb6759c..ce5d3e9e5dff4 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -3739,6 +3739,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) + { + struct stmmac_priv *priv = netdev_priv(dev); + int txfifosz = priv->plat->tx_fifo_size; ++ const int mtu = new_mtu; + + if (txfifosz == 0) + txfifosz = priv->dma_cap.tx_fifo_size; +@@ -3756,7 +3757,7 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) + if ((txfifosz < new_mtu) || (new_mtu > BUF_SIZE_16KiB)) + return -EINVAL; + +- dev->mtu = new_mtu; ++ dev->mtu = mtu; + + netdev_update_features(dev); + +diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c +index 6fa7a009a24a4..f9b359d4e2939 100644 +--- a/drivers/net/usb/rndis_host.c ++++ b/drivers/net/usb/rndis_host.c +@@ -387,7 +387,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) + reply_len = sizeof *phym; + retval = rndis_query(dev, intf, u.buf, + RNDIS_OID_GEN_PHYSICAL_MEDIUM, +- 0, (void **) &phym, &reply_len); ++ reply_len, (void **)&phym, &reply_len); + if (retval != 0 || !phym) { + /* OID is optional so don't fail here. */ + phym_unspec = cpu_to_le32(RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED); +diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c +index 590a49e847626..418d62e945544 100644 +--- a/drivers/scsi/lpfc/lpfc_nportdisc.c ++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c +@@ -286,7 +286,7 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) + * This routine is only called if we are SLI3, direct connect pt2pt + * mode and the remote NPort issues the PLOGI after link up. + */ +-void ++static void + lpfc_defer_pt2pt_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *link_mbox) + { + LPFC_MBOXQ_t *login_mbox; +@@ -340,7 +340,7 @@ lpfc_defer_pt2pt_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *link_mbox) + * This routine is only called if we are SLI4, acting in target + * mode and the remote NPort issues the PLOGI after link up. + **/ +-void ++static void + lpfc_defer_acc_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) + { + struct lpfc_vport *vport = pmb->vport; +diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c +index 82a0ee09cbe14..1d0c335b0bf88 100644 +--- a/drivers/spi/spi-cadence.c ++++ b/drivers/spi/spi-cadence.c +@@ -115,6 +115,7 @@ struct cdns_spi { + void __iomem *regs; + struct clk *ref_clk; + struct clk *pclk; ++ unsigned int clk_rate; + u32 speed_hz; + const u8 *txbuf; + u8 *rxbuf; +@@ -250,7 +251,7 @@ static void cdns_spi_config_clock_freq(struct spi_device *spi, + u32 ctrl_reg, baud_rate_val; + unsigned long frequency; + +- frequency = clk_get_rate(xspi->ref_clk); ++ frequency = xspi->clk_rate; + + ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); + +@@ -558,8 +559,9 @@ static int cdns_spi_probe(struct platform_device *pdev) + master->auto_runtime_pm = true; + master->mode_bits = SPI_CPOL | SPI_CPHA; + ++ xspi->clk_rate = clk_get_rate(xspi->ref_clk); + /* Set to default valid value */ +- master->max_speed_hz = clk_get_rate(xspi->ref_clk) / 4; ++ master->max_speed_hz = xspi->clk_rate / 4; + xspi->speed_hz = master->max_speed_hz; + + master->bits_per_word_mask = SPI_BPW_MASK(8); +diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c +index 5ed7c9e017fb1..1e770d6739050 100644 +--- a/drivers/spi/spi-npcm-fiu.c ++++ b/drivers/spi/spi-npcm-fiu.c +@@ -677,8 +677,7 @@ static int npcm_fiu_probe(struct platform_device *pdev) + struct npcm_fiu_spi *fiu; + void __iomem *regbase; + struct resource *res; +- int ret; +- int id; ++ int id, ret; + + ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); + if (!ctrl) +@@ -738,9 +737,9 @@ static int npcm_fiu_probe(struct platform_device *pdev) + + ret = devm_spi_register_master(dev, ctrl); + if (ret) +- return ret; ++ clk_disable_unprepare(fiu->clk); + +- return 0; ++ return ret; + } + + static int npcm_fiu_remove(struct platform_device *pdev) +diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c +index 5eb62240c7f87..833f51282accc 100644 +--- a/drivers/usb/host/ohci-hcd.c ++++ b/drivers/usb/host/ohci-hcd.c +@@ -102,7 +102,7 @@ static void io_watchdog_func(struct timer_list *t); + + + /* Some boards misreport power switching/overcurrent */ +-static bool distrust_firmware = true; ++static bool distrust_firmware; + module_param (distrust_firmware, bool, 0); + MODULE_PARM_DESC (distrust_firmware, + "true to distrust firmware power/overcurrent setup"); +diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c +index c6070e70dd73d..9c9422e9fac4d 100644 +--- a/drivers/xen/privcmd.c ++++ b/drivers/xen/privcmd.c +@@ -724,14 +724,15 @@ static long privcmd_ioctl_restrict(struct file *file, void __user *udata) + return 0; + } + +-static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) ++static long privcmd_ioctl_mmap_resource(struct file *file, ++ struct privcmd_mmap_resource __user *udata) + { + struct privcmd_data *data = file->private_data; + struct mm_struct *mm = current->mm; + struct vm_area_struct *vma; + struct privcmd_mmap_resource kdata; + xen_pfn_t *pfns = NULL; +- struct xen_mem_acquire_resource xdata; ++ struct xen_mem_acquire_resource xdata = { }; + int rc; + + if (copy_from_user(&kdata, udata, sizeof(kdata))) +@@ -741,6 +742,22 @@ static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) + if (data->domid != DOMID_INVALID && data->domid != kdata.dom) + return -EPERM; + ++ /* Both fields must be set or unset */ ++ if (!!kdata.addr != !!kdata.num) ++ return -EINVAL; ++ ++ xdata.domid = kdata.dom; ++ xdata.type = kdata.type; ++ xdata.id = kdata.id; ++ ++ if (!kdata.addr && !kdata.num) { ++ /* Query the size of the resource. */ ++ rc = HYPERVISOR_memory_op(XENMEM_acquire_resource, &xdata); ++ if (rc) ++ return rc; ++ return __put_user(xdata.nr_frames, &udata->num); ++ } ++ + down_write(&mm->mmap_sem); + + vma = find_vma(mm, kdata.addr); +@@ -775,10 +792,6 @@ static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata) + } else + vma->vm_private_data = PRIV_VMA_LOCKED; + +- memset(&xdata, 0, sizeof(xdata)); +- xdata.domid = kdata.dom; +- xdata.type = kdata.type; +- xdata.id = kdata.id; + xdata.frame = kdata.idx; + xdata.nr_frames = kdata.num; + set_xen_guest_handle(xdata.frame_list, pfns); +diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c +index 86e5658651f10..8f077e66e613f 100644 +--- a/fs/nfsd/nfs3xdr.c ++++ b/fs/nfsd/nfs3xdr.c +@@ -857,9 +857,14 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, + if (isdotent(name, namlen)) { + if (namlen == 2) { + dchild = dget_parent(dparent); +- /* filesystem root - cannot return filehandle for ".." */ ++ /* ++ * Don't return filehandle for ".." if we're at ++ * the filesystem or export root: ++ */ + if (dchild == dparent) + goto out; ++ if (dparent == exp->ex_path.dentry) ++ goto out; + } else + dchild = dget(dparent); + } else +diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h +index d8fab3ecf5120..180b52419136f 100644 +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -12,6 +12,12 @@ + + #if GCC_VERSION < 40600 + # error Sorry, your compiler is too old - please upgrade it. ++#elif defined(CONFIG_ARM64) && GCC_VERSION < 50100 ++/* ++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293 ++ * https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk ++ */ ++# error Sorry, your version of GCC is too old - please use 5.1 or newer. + #endif + + /* +diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h +index 4cad0e784b286..b81f9e1d74b0a 100644 +--- a/include/linux/elfcore.h ++++ b/include/linux/elfcore.h +@@ -58,6 +58,7 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse + } + #endif + ++#if defined(CONFIG_UM) || defined(CONFIG_IA64) + /* + * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out + * extra segments containing the gate DSO contents. Dumping its +@@ -72,5 +73,26 @@ elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset); + extern int + elf_core_write_extra_data(struct coredump_params *cprm); + extern size_t elf_core_extra_data_size(void); ++#else ++static inline Elf_Half elf_core_extra_phdrs(void) ++{ ++ return 0; ++} ++ ++static inline int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset) ++{ ++ return 1; ++} ++ ++static inline int elf_core_write_extra_data(struct coredump_params *cprm) ++{ ++ return 1; ++} ++ ++static inline size_t elf_core_extra_data_size(void) ++{ ++ return 0; ++} ++#endif + + #endif /* _LINUX_ELFCORE_H */ +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h +index 68139cc2f3ca3..6493c98c86317 100644 +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -1480,6 +1480,11 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb) + skb->next = NULL; + } + ++/* Iterate through singly-linked GSO fragments of an skb. */ ++#define skb_list_walk_safe(first, skb, next_skb) \ ++ for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \ ++ (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL) ++ + static inline void skb_list_del_init(struct sk_buff *skb) + { + __list_del_entry(&skb->list); +diff --git a/kernel/Makefile b/kernel/Makefile +index f2cc0d118a0bc..6aef13053a5c4 100644 +--- a/kernel/Makefile ++++ b/kernel/Makefile +@@ -93,7 +93,6 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o + obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o + obj-$(CONFIG_TRACEPOINTS) += tracepoint.o + obj-$(CONFIG_LATENCYTOP) += latencytop.o +-obj-$(CONFIG_ELFCORE) += elfcore.o + obj-$(CONFIG_FUNCTION_TRACER) += trace/ + obj-$(CONFIG_TRACING) += trace/ + obj-$(CONFIG_TRACE_CLOCK) += trace/ +diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c +index b701af27a7799..5a8b4dfdb1419 100644 +--- a/kernel/bpf/cgroup.c ++++ b/kernel/bpf/cgroup.c +@@ -1057,12 +1057,13 @@ int __cgroup_bpf_run_filter_setsockopt(struct sock *sk, int *level, + if (ctx.optlen != 0) { + *optlen = ctx.optlen; + *kernel_optval = ctx.optval; ++ /* export and don't free sockopt buf */ ++ return 0; + } + } + + out: +- if (ret) +- sockopt_free_buf(&ctx); ++ sockopt_free_buf(&ctx); + return ret; + } + EXPORT_SYMBOL(__cgroup_bpf_run_filter_setsockopt); +diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c +index 5e28718928cad..a77d2814cac5d 100644 +--- a/kernel/bpf/helpers.c ++++ b/kernel/bpf/helpers.c +@@ -105,7 +105,7 @@ BPF_CALL_2(bpf_map_peek_elem, struct bpf_map *, map, void *, value) + } + + const struct bpf_func_proto bpf_map_peek_elem_proto = { +- .func = bpf_map_pop_elem, ++ .func = bpf_map_peek_elem, + .gpl_only = false, + .ret_type = RET_INTEGER, + .arg1_type = ARG_CONST_MAP_PTR, +diff --git a/kernel/elfcore.c b/kernel/elfcore.c +deleted file mode 100644 +index 57fb4dcff4349..0000000000000 +--- a/kernel/elfcore.c ++++ /dev/null +@@ -1,26 +0,0 @@ +-// SPDX-License-Identifier: GPL-2.0 +-#include +-#include +-#include +-#include +-#include +- +-Elf_Half __weak elf_core_extra_phdrs(void) +-{ +- return 0; +-} +- +-int __weak elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset) +-{ +- return 1; +-} +- +-int __weak elf_core_write_extra_data(struct coredump_params *cprm) +-{ +- return 1; +-} +- +-size_t __weak elf_core_extra_data_size(void) +-{ +- return 0; +-} +diff --git a/net/core/filter.c b/net/core/filter.c +index b040b7bf28582..2fa10fdcf6b1d 100644 +--- a/net/core/filter.c ++++ b/net/core/filter.c +@@ -1475,7 +1475,7 @@ struct bpf_prog *__get_filter(struct sock_fprog *fprog, struct sock *sk) + + if (copy_from_user(prog->insns, fprog->filter, fsize)) { + __bpf_prog_free(prog); +- return ERR_PTR(-EFAULT); ++ return ERR_PTR(-EINVAL); + } + + prog->len = fprog->len; +diff --git a/net/core/skbuff.c b/net/core/skbuff.c +index 49d923c227a21..961cb5a88c958 100644 +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -496,13 +496,17 @@ EXPORT_SYMBOL(__netdev_alloc_skb); + struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, + gfp_t gfp_mask) + { +- struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); ++ struct napi_alloc_cache *nc; + struct sk_buff *skb; + void *data; + + len += NET_SKB_PAD + NET_IP_ALIGN; + +- if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) || ++ /* If requested length is either too small or too big, ++ * we use kmalloc() for skb->head allocation. ++ */ ++ if (len <= SKB_WITH_OVERHEAD(1024) || ++ len > SKB_WITH_OVERHEAD(PAGE_SIZE) || + (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { + skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE); + if (!skb) +@@ -510,6 +514,7 @@ struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, + goto skb_success; + } + ++ nc = this_cpu_ptr(&napi_alloc_cache); + len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + len = SKB_DATA_ALIGN(len); + +diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c +index 40829111fe00c..273c921751e49 100644 +--- a/net/core/sock_reuseport.c ++++ b/net/core/sock_reuseport.c +@@ -302,7 +302,7 @@ select_by_hash: + i = j = reciprocal_scale(hash, socks); + while (reuse->socks[i]->sk_state == TCP_ESTABLISHED) { + i++; +- if (i >= reuse->num_socks) ++ if (i >= socks) + i = 0; + if (i == j) + goto out; +diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c +index 0fd1c2aa13615..e9ecbb57df455 100644 +--- a/net/dcb/dcbnl.c ++++ b/net/dcb/dcbnl.c +@@ -1765,6 +1765,8 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, + fn = &reply_funcs[dcb->cmd]; + if (!fn->cb) + return -EOPNOTSUPP; ++ if (fn->type == RTM_SETDCB && !netlink_capable(skb, CAP_NET_ADMIN)) ++ return -EPERM; + + if (!tb[DCB_ATTR_IFNAME]) + return -EINVAL; +diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c +index 5c967764041f4..00210e55b4cd1 100644 +--- a/net/ipv4/esp4.c ++++ b/net/ipv4/esp4.c +@@ -272,7 +272,6 @@ static int esp_output_udp_encap(struct xfrm_state *x, struct sk_buff *skb, struc + int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) + { + u8 *tail; +- u8 *vaddr; + int nfrags; + int esph_offset; + struct page *page; +@@ -314,14 +313,10 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info * + page = pfrag->page; + get_page(page); + +- vaddr = kmap_atomic(page); +- +- tail = vaddr + pfrag->offset; ++ tail = page_address(page) + pfrag->offset; + + esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto); + +- kunmap_atomic(vaddr); +- + nfrags = skb_shinfo(skb)->nr_frags; + + __skb_fill_page_desc(skb, nfrags, page, pfrag->offset, +diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c +index a3b403ba8f8f0..7a739f16d82b2 100644 +--- a/net/ipv6/esp6.c ++++ b/net/ipv6/esp6.c +@@ -226,7 +226,6 @@ static void esp_output_fill_trailer(u8 *tail, int tfclen, int plen, __u8 proto) + int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp) + { + u8 *tail; +- u8 *vaddr; + int nfrags; + struct page *page; + struct sk_buff *trailer; +@@ -259,14 +258,10 @@ int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info + page = pfrag->page; + get_page(page); + +- vaddr = kmap_atomic(page); +- +- tail = vaddr + pfrag->offset; ++ tail = page_address(page) + pfrag->offset; + + esp_output_fill_trailer(tail, esp->tfclen, esp->plen, esp->proto); + +- kunmap_atomic(vaddr); +- + nfrags = skb_shinfo(skb)->nr_frags; + + __skb_fill_page_desc(skb, nfrags, page, pfrag->offset, +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index 78d495581d696..7a80c42fcce2f 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -124,8 +124,43 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * + return -EINVAL; + } + ++static int ++ip6_finish_output_gso_slowpath_drop(struct net *net, struct sock *sk, ++ struct sk_buff *skb, unsigned int mtu) ++{ ++ struct sk_buff *segs, *nskb; ++ netdev_features_t features; ++ int ret = 0; ++ ++ /* Please see corresponding comment in ip_finish_output_gso ++ * describing the cases where GSO segment length exceeds the ++ * egress MTU. ++ */ ++ features = netif_skb_features(skb); ++ segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); ++ if (IS_ERR_OR_NULL(segs)) { ++ kfree_skb(skb); ++ return -ENOMEM; ++ } ++ ++ consume_skb(skb); ++ ++ skb_list_walk_safe(segs, segs, nskb) { ++ int err; ++ ++ skb_mark_not_on_list(segs); ++ err = ip6_fragment(net, sk, segs, ip6_finish_output2); ++ if (err && ret == 0) ++ ret = err; ++ } ++ ++ return ret; ++} ++ + static int __ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff *skb) + { ++ unsigned int mtu; ++ + #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) + /* Policy lookup after SNAT yielded a new policy */ + if (skb_dst(skb)->xfrm) { +@@ -134,7 +169,11 @@ static int __ip6_finish_output(struct net *net, struct sock *sk, struct sk_buff + } + #endif + +- if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || ++ mtu = ip6_skb_dst_mtu(skb); ++ if (skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu)) ++ return ip6_finish_output_gso_slowpath_drop(net, sk, skb, mtu); ++ ++ if ((skb->len > mtu && !skb_is_gso(skb)) || + dst_allfrag(skb_dst(skb)) || + (IP6CB(skb)->frag_max_size && skb->len > IP6CB(skb)->frag_max_size)) + return ip6_fragment(net, sk, skb, ip6_finish_output2); +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c +index 2872f7a00e863..de4c871787e2f 100644 +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -1597,8 +1597,11 @@ static int ipip6_newlink(struct net *src_net, struct net_device *dev, + } + + #ifdef CONFIG_IPV6_SIT_6RD +- if (ipip6_netlink_6rd_parms(data, &ip6rd)) ++ if (ipip6_netlink_6rd_parms(data, &ip6rd)) { + err = ipip6_tunnel_update_6rd(nt, &ip6rd); ++ if (err < 0) ++ unregister_netdevice_queue(dev, NULL); ++ } + #endif + + return err; +diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c +index 30a0c7c6224b3..da0e285302f9d 100644 +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -657,7 +657,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) + if (!skip_hw && tx->key && + tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) + info->control.hw_key = &tx->key->conf; +- } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta && ++ } else if (ieee80211_is_data_present(hdr->frame_control) && tx->sta && + test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) { + return TX_DROP; + } +@@ -3773,7 +3773,7 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw, + * get immediately moved to the back of the list on the next + * call to ieee80211_next_txq(). + */ +- if (txqi->txq.sta && ++ if (txqi->txq.sta && local->airtime_flags && + wiphy_ext_feature_isset(local->hw.wiphy, + NL80211_EXT_FEATURE_AIRTIME_FAIRNESS)) + list_add(&txqi->schedule_order, +diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c +index 6cace43b217ee..916d1f455b218 100644 +--- a/net/rxrpc/input.c ++++ b/net/rxrpc/input.c +@@ -431,7 +431,7 @@ static void rxrpc_input_data(struct rxrpc_call *call, struct sk_buff *skb) + return; + } + +- if (call->state == RXRPC_CALL_SERVER_RECV_REQUEST) { ++ if (state == RXRPC_CALL_SERVER_RECV_REQUEST) { + unsigned long timo = READ_ONCE(call->next_req_timo); + unsigned long now, expect_req_by; + +diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c +index 85a9ff8cd236a..2b26c4d229a5a 100644 +--- a/net/rxrpc/key.c ++++ b/net/rxrpc/key.c +@@ -1110,7 +1110,7 @@ static long rxrpc_read(const struct key *key, + default: /* we have a ticket we can't encode */ + pr_err("Unsupported key token type (%u)\n", + token->security_index); +- continue; ++ return -ENOPKG; + } + + _debug("token[%u]: toksize=%u", ntoks, toksize); +@@ -1225,7 +1225,9 @@ static long rxrpc_read(const struct key *key, + break; + + default: +- break; ++ pr_err("Unsupported key token type (%u)\n", ++ token->security_index); ++ return -ENOPKG; + } + + ASSERTCMP((unsigned long)xdr - (unsigned long)oldxdr, ==, +diff --git a/net/sctp/socket.c b/net/sctp/socket.c +index 1fcc13f6073ef..41abfff6a6a3d 100644 +--- a/net/sctp/socket.c ++++ b/net/sctp/socket.c +@@ -1319,7 +1319,7 @@ static int __sctp_setsockopt_connectx(struct sock *sk, + + kaddrs = memdup_user(addrs, addrs_size); + if (IS_ERR(kaddrs)) +- return PTR_ERR(kaddrs); ++ return PTR_ERR(kaddrs) == -EFAULT ? -EINVAL : PTR_ERR(kaddrs); + + /* Allow security module to validate connectx addresses. */ + err = security_sctp_bind_connect(sk, SCTP_SOCKOPT_CONNECTX, +diff --git a/net/tipc/link.c b/net/tipc/link.c +index a9d8a81e80cfd..f25010261a9e0 100644 +--- a/net/tipc/link.c ++++ b/net/tipc/link.c +@@ -939,9 +939,7 @@ void tipc_link_reset(struct tipc_link *l) + int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, + struct sk_buff_head *xmitq) + { +- struct tipc_msg *hdr = buf_msg(skb_peek(list)); + unsigned int maxwin = l->window; +- int imp = msg_importance(hdr); + unsigned int mtu = l->mtu; + u16 ack = l->rcv_nxt - 1; + u16 seqno = l->snd_nxt; +@@ -950,8 +948,14 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, + struct sk_buff_head *backlogq = &l->backlogq; + struct sk_buff *skb, *_skb, **tskb; + int pkt_cnt = skb_queue_len(list); ++ struct tipc_msg *hdr; + int rc = 0; ++ int imp; ++ ++ if (pkt_cnt <= 0) ++ return 0; + ++ hdr = buf_msg(skb_peek(list)); + if (unlikely(msg_size(hdr) > mtu)) { + pr_warn("Too large msg, purging xmit list %d %d %d %d %d!\n", + skb_queue_len(list), msg_user(hdr), +@@ -960,6 +964,7 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list, + return -EMSGSIZE; + } + ++ imp = msg_importance(hdr); + /* Allow oversubscription of one data msg per source at congestion */ + if (unlikely(l->backlog[imp].len >= l->backlog[imp].limit)) { + if (imp == TIPC_SYSTEM_IMPORTANCE) { diff --git a/patch/kernel/odroidxu4-current/patch-5.4.92-93.patch b/patch/kernel/odroidxu4-current/patch-5.4.92-93.patch new file mode 100644 index 000000000..b35e765de --- /dev/null +++ b/patch/kernel/odroidxu4-current/patch-5.4.92-93.patch @@ -0,0 +1,2413 @@ +diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt +index 74ba077e99e56..a19ae163c0589 100644 +--- a/Documentation/admin-guide/kernel-parameters.txt ++++ b/Documentation/admin-guide/kernel-parameters.txt +@@ -5452,6 +5452,10 @@ + This option is obsoleted by the "nopv" option, which + has equivalent effect for XEN platform. + ++ xen_no_vector_callback ++ [KNL,X86,XEN] Disable the vector callback for Xen ++ event channel interrupts. ++ + xen_scrub_pages= [XEN] + Boolean option to control scrubbing pages before giving them back + to Xen, for use by other domains. Can be also changed at runtime +diff --git a/Makefile b/Makefile +index 5bae2206a35e7..f8462f8d8a151 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 92 ++SUBLEVEL = 93 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c +index dd6804a64f1a0..f45bff158fc20 100644 +--- a/arch/arm/xen/enlighten.c ++++ b/arch/arm/xen/enlighten.c +@@ -371,7 +371,7 @@ static int __init xen_guest_init(void) + } + gnttab_init(); + if (!xen_initial_domain()) +- xenbus_probe(NULL); ++ xenbus_probe(); + + /* + * Making sure board specific code will not set up ops for +diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h +index 9543b5e0534d2..6e0f48ddfc656 100644 +--- a/arch/arm64/include/asm/atomic.h ++++ b/arch/arm64/include/asm/atomic.h +@@ -17,7 +17,7 @@ + #include + + #define ATOMIC_OP(op) \ +-static inline void arch_##op(int i, atomic_t *v) \ ++static __always_inline void arch_##op(int i, atomic_t *v) \ + { \ + __lse_ll_sc_body(op, i, v); \ + } +@@ -32,7 +32,7 @@ ATOMIC_OP(atomic_sub) + #undef ATOMIC_OP + + #define ATOMIC_FETCH_OP(name, op) \ +-static inline int arch_##op##name(int i, atomic_t *v) \ ++static __always_inline int arch_##op##name(int i, atomic_t *v) \ + { \ + return __lse_ll_sc_body(op##name, i, v); \ + } +@@ -56,7 +56,7 @@ ATOMIC_FETCH_OPS(atomic_sub_return) + #undef ATOMIC_FETCH_OPS + + #define ATOMIC64_OP(op) \ +-static inline void arch_##op(long i, atomic64_t *v) \ ++static __always_inline void arch_##op(long i, atomic64_t *v) \ + { \ + __lse_ll_sc_body(op, i, v); \ + } +@@ -71,7 +71,7 @@ ATOMIC64_OP(atomic64_sub) + #undef ATOMIC64_OP + + #define ATOMIC64_FETCH_OP(name, op) \ +-static inline long arch_##op##name(long i, atomic64_t *v) \ ++static __always_inline long arch_##op##name(long i, atomic64_t *v) \ + { \ + return __lse_ll_sc_body(op##name, i, v); \ + } +@@ -94,7 +94,7 @@ ATOMIC64_FETCH_OPS(atomic64_sub_return) + #undef ATOMIC64_FETCH_OP + #undef ATOMIC64_FETCH_OPS + +-static inline long arch_atomic64_dec_if_positive(atomic64_t *v) ++static __always_inline long arch_atomic64_dec_if_positive(atomic64_t *v) + { + return __lse_ll_sc_body(atomic64_dec_if_positive, v); + } +diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S +index 4def51c12e1bf..a4e576019d79c 100644 +--- a/arch/powerpc/kernel/vmlinux.lds.S ++++ b/arch/powerpc/kernel/vmlinux.lds.S +@@ -210,6 +210,12 @@ SECTIONS + .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { + _sinittext = .; + INIT_TEXT ++ ++ /* ++ *.init.text might be RO so we must ensure this section ends on ++ * a page boundary. ++ */ ++ . = ALIGN(PAGE_SIZE); + _einittext = .; + #ifdef CONFIG_PPC64 + *(.tramp.ftrace.init); +@@ -223,21 +229,9 @@ SECTIONS + EXIT_TEXT + } + +- .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { +- INIT_DATA +- } +- +- .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { +- INIT_SETUP(16) +- } ++ . = ALIGN(PAGE_SIZE); + +- .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { +- INIT_CALLS +- } +- +- .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { +- CON_INITCALL +- } ++ INIT_DATA_SECTION(16) + + . = ALIGN(8); + __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { +@@ -265,9 +259,6 @@ SECTIONS + __stop___fw_ftr_fixup = .; + } + #endif +- .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { +- INIT_RAM_FS +- } + + PERCPU_SECTION(L1_CACHE_BYTES) + +diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts +index 88cfcb96bf233..cc04e66752aac 100644 +--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts ++++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts +@@ -83,6 +83,7 @@ + phy-mode = "gmii"; + phy-handle = <&phy0>; + phy0: ethernet-phy@0 { ++ compatible = "ethernet-phy-id0007.0771"; + reg = <0>; + }; + }; +diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig +index 420a0dbef3866..3c656fe97e583 100644 +--- a/arch/riscv/configs/defconfig ++++ b/arch/riscv/configs/defconfig +@@ -62,6 +62,8 @@ CONFIG_HW_RANDOM=y + CONFIG_HW_RANDOM_VIRTIO=y + CONFIG_SPI=y + CONFIG_SPI_SIFIVE=y ++CONFIG_GPIOLIB=y ++CONFIG_GPIO_SIFIVE=y + # CONFIG_PTP_1588_CLOCK is not set + CONFIG_DRM=y + CONFIG_DRM_RADEON=y +diff --git a/arch/riscv/kernel/time.c b/arch/riscv/kernel/time.c +index 6a53c02e9c734..8aa70b519e04f 100644 +--- a/arch/riscv/kernel/time.c ++++ b/arch/riscv/kernel/time.c +@@ -4,6 +4,7 @@ + * Copyright (C) 2017 SiFive + */ + ++#include + #include + #include + #include +@@ -24,5 +25,7 @@ void __init time_init(void) + riscv_timebase = prop; + + lpj_fine = riscv_timebase / HZ; ++ ++ of_clk_init(NULL); + timer_probe(); + } +diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig +index d0de378beefe5..7d54f284ce10f 100644 +--- a/arch/sh/drivers/dma/Kconfig ++++ b/arch/sh/drivers/dma/Kconfig +@@ -63,8 +63,7 @@ config PVR2_DMA + + config G2_DMA + tristate "G2 Bus DMA support" +- depends on SH_DREAMCAST +- select SH_DMA_API ++ depends on SH_DREAMCAST && SH_DMA_API + help + This enables support for the DMA controller for the Dreamcast's + G2 bus. Drivers that want this will generally enable this on +diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h +index b774c52e5411f..06e767bca0c14 100644 +--- a/arch/x86/include/asm/fpu/api.h ++++ b/arch/x86/include/asm/fpu/api.h +@@ -16,14 +16,25 @@ + * Use kernel_fpu_begin/end() if you intend to use FPU in kernel context. It + * disables preemption so be careful if you intend to use it for long periods + * of time. +- * If you intend to use the FPU in softirq you need to check first with ++ * If you intend to use the FPU in irq/softirq you need to check first with + * irq_fpu_usable() if it is possible. + */ +-extern void kernel_fpu_begin(void); ++ ++/* Kernel FPU states to initialize in kernel_fpu_begin_mask() */ ++#define KFPU_387 _BITUL(0) /* 387 state will be initialized */ ++#define KFPU_MXCSR _BITUL(1) /* MXCSR will be initialized */ ++ ++extern void kernel_fpu_begin_mask(unsigned int kfpu_mask); + extern void kernel_fpu_end(void); + extern bool irq_fpu_usable(void); + extern void fpregs_mark_activate(void); + ++/* Code that is unaware of kernel_fpu_begin_mask() can use this */ ++static inline void kernel_fpu_begin(void) ++{ ++ kernel_fpu_begin_mask(KFPU_387 | KFPU_MXCSR); ++} ++ + /* + * Use fpregs_lock() while editing CPU's FPU registers or fpu->state. + * A context switch will (and softirq might) save CPU's FPU registers to +diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h +index 4b14d2318251e..f3459df117aa8 100644 +--- a/arch/x86/include/asm/topology.h ++++ b/arch/x86/include/asm/topology.h +@@ -110,6 +110,8 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu); + #define topology_die_id(cpu) (cpu_data(cpu).cpu_die_id) + #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) + ++extern unsigned int __max_die_per_package; ++ + #ifdef CONFIG_SMP + #define topology_die_cpumask(cpu) (per_cpu(cpu_die_map, cpu)) + #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) +@@ -118,8 +120,6 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu); + extern unsigned int __max_logical_packages; + #define topology_max_packages() (__max_logical_packages) + +-extern unsigned int __max_die_per_package; +- + static inline int topology_max_die_per_package(void) + { + return __max_die_per_package; +diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c +index 52373921af2eb..753f3dfbc9c91 100644 +--- a/arch/x86/kernel/cpu/amd.c ++++ b/arch/x86/kernel/cpu/amd.c +@@ -545,12 +545,12 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) + u32 ecx; + + ecx = cpuid_ecx(0x8000001e); +- nodes_per_socket = ((ecx >> 8) & 7) + 1; ++ __max_die_per_package = nodes_per_socket = ((ecx >> 8) & 7) + 1; + } else if (boot_cpu_has(X86_FEATURE_NODEID_MSR)) { + u64 value; + + rdmsrl(MSR_FAM10H_NODE_ID, value); +- nodes_per_socket = ((value >> 3) & 7) + 1; ++ __max_die_per_package = nodes_per_socket = ((value >> 3) & 7) + 1; + } + + if (!boot_cpu_has(X86_FEATURE_AMD_SSBD) && +diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c +index ee48c3fc8a65e..24da5ee4f0220 100644 +--- a/arch/x86/kernel/cpu/topology.c ++++ b/arch/x86/kernel/cpu/topology.c +@@ -25,10 +25,10 @@ + #define BITS_SHIFT_NEXT_LEVEL(eax) ((eax) & 0x1f) + #define LEVEL_MAX_SIBLINGS(ebx) ((ebx) & 0xffff) + +-#ifdef CONFIG_SMP + unsigned int __max_die_per_package __read_mostly = 1; + EXPORT_SYMBOL(__max_die_per_package); + ++#ifdef CONFIG_SMP + /* + * Check if given CPUID extended toplogy "leaf" is implemented + */ +diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c +index cd8839027f66d..8c9b202f3e6db 100644 +--- a/arch/x86/kernel/fpu/core.c ++++ b/arch/x86/kernel/fpu/core.c +@@ -82,7 +82,7 @@ bool irq_fpu_usable(void) + } + EXPORT_SYMBOL(irq_fpu_usable); + +-void kernel_fpu_begin(void) ++void kernel_fpu_begin_mask(unsigned int kfpu_mask) + { + preempt_disable(); + +@@ -102,13 +102,14 @@ void kernel_fpu_begin(void) + } + __cpu_invalidate_fpregs_state(); + +- if (boot_cpu_has(X86_FEATURE_XMM)) ++ /* Put sane initial values into the control registers. */ ++ if (likely(kfpu_mask & KFPU_MXCSR) && boot_cpu_has(X86_FEATURE_XMM)) + ldmxcsr(MXCSR_DEFAULT); + +- if (boot_cpu_has(X86_FEATURE_FPU)) ++ if (unlikely(kfpu_mask & KFPU_387) && boot_cpu_has(X86_FEATURE_FPU)) + asm volatile ("fninit"); + } +-EXPORT_SYMBOL_GPL(kernel_fpu_begin); ++EXPORT_SYMBOL_GPL(kernel_fpu_begin_mask); + + void kernel_fpu_end(void) + { +diff --git a/arch/x86/lib/mmx_32.c b/arch/x86/lib/mmx_32.c +index 4321fa02e18df..419365c48b2ad 100644 +--- a/arch/x86/lib/mmx_32.c ++++ b/arch/x86/lib/mmx_32.c +@@ -26,6 +26,16 @@ + #include + #include + ++/* ++ * Use KFPU_387. MMX instructions are not affected by MXCSR, ++ * but both AMD and Intel documentation states that even integer MMX ++ * operations will result in #MF if an exception is pending in FCW. ++ * ++ * EMMS is not needed afterwards because, after calling kernel_fpu_end(), ++ * any subsequent user of the 387 stack will reinitialize it using ++ * KFPU_387. ++ */ ++ + void *_mmx_memcpy(void *to, const void *from, size_t len) + { + void *p; +@@ -37,7 +47,7 @@ void *_mmx_memcpy(void *to, const void *from, size_t len) + p = to; + i = len >> 6; /* len/64 */ + +- kernel_fpu_begin(); ++ kernel_fpu_begin_mask(KFPU_387); + + __asm__ __volatile__ ( + "1: prefetch (%0)\n" /* This set is 28 bytes */ +@@ -127,7 +137,7 @@ static void fast_clear_page(void *page) + { + int i; + +- kernel_fpu_begin(); ++ kernel_fpu_begin_mask(KFPU_387); + + __asm__ __volatile__ ( + " pxor %%mm0, %%mm0\n" : : +@@ -160,7 +170,7 @@ static void fast_copy_page(void *to, void *from) + { + int i; + +- kernel_fpu_begin(); ++ kernel_fpu_begin_mask(KFPU_387); + + /* + * maybe the prefetch stuff can go before the expensive fnsave... +@@ -247,7 +257,7 @@ static void fast_clear_page(void *page) + { + int i; + +- kernel_fpu_begin(); ++ kernel_fpu_begin_mask(KFPU_387); + + __asm__ __volatile__ ( + " pxor %%mm0, %%mm0\n" : : +@@ -282,7 +292,7 @@ static void fast_copy_page(void *to, void *from) + { + int i; + +- kernel_fpu_begin(); ++ kernel_fpu_begin_mask(KFPU_387); + + __asm__ __volatile__ ( + "1: prefetch (%0)\n" +diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c +index e138f7de52d20..6024fafed1642 100644 +--- a/arch/x86/xen/enlighten_hvm.c ++++ b/arch/x86/xen/enlighten_hvm.c +@@ -175,6 +175,8 @@ static int xen_cpu_dead_hvm(unsigned int cpu) + return 0; + } + ++static bool no_vector_callback __initdata; ++ + static void __init xen_hvm_guest_init(void) + { + if (xen_pv_domain()) +@@ -194,7 +196,7 @@ static void __init xen_hvm_guest_init(void) + + xen_panic_handler_init(); + +- if (xen_feature(XENFEAT_hvm_callback_vector)) ++ if (!no_vector_callback && xen_feature(XENFEAT_hvm_callback_vector)) + xen_have_vector_callback = 1; + + xen_hvm_smp_init(); +@@ -220,6 +222,13 @@ static __init int xen_parse_nopv(char *arg) + } + early_param("xen_nopv", xen_parse_nopv); + ++static __init int xen_parse_no_vector_callback(char *arg) ++{ ++ no_vector_callback = true; ++ return 0; ++} ++early_param("xen_no_vector_callback", xen_parse_no_vector_callback); ++ + bool __init xen_hvm_need_lapic(void) + { + if (xen_pv_domain()) +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c +index 6c8c9509e03d1..8887a72712d4b 100644 +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -587,6 +587,8 @@ static int acpi_get_device_data(acpi_handle handle, struct acpi_device **device, + if (!device) + return -EINVAL; + ++ *device = NULL; ++ + status = acpi_get_data_full(handle, acpi_scan_drop_device, + (void **)device, callback); + if (ACPI_FAILURE(status) || !*device) { +diff --git a/drivers/base/core.c b/drivers/base/core.c +index c5edb00938f69..a119479fe3f42 100644 +--- a/drivers/base/core.c ++++ b/drivers/base/core.c +@@ -106,6 +106,16 @@ int device_links_read_lock_held(void) + #endif + #endif /* !CONFIG_SRCU */ + ++static bool device_is_ancestor(struct device *dev, struct device *target) ++{ ++ while (target->parent) { ++ target = target->parent; ++ if (dev == target) ++ return true; ++ } ++ return false; ++} ++ + /** + * device_is_dependent - Check if one device depends on another one + * @dev: Device to check dependencies for. +@@ -119,7 +129,12 @@ static int device_is_dependent(struct device *dev, void *target) + struct device_link *link; + int ret; + +- if (dev == target) ++ /* ++ * The "ancestors" check is needed to catch the case when the target ++ * device has not been completely initialized yet and it is still ++ * missing from the list of children of its parent device. ++ */ ++ if (dev == target || device_is_ancestor(dev, target)) + return 1; + + ret = device_for_each_child(dev, target, device_is_dependent); +diff --git a/drivers/clk/tegra/clk-tegra30.c b/drivers/clk/tegra/clk-tegra30.c +index 7b4c6a488527d..501929d9f70ed 100644 +--- a/drivers/clk/tegra/clk-tegra30.c ++++ b/drivers/clk/tegra/clk-tegra30.c +@@ -1263,6 +1263,8 @@ static struct tegra_clk_init_table init_table[] __initdata = { + { TEGRA30_CLK_I2S3_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_I2S4_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, + { TEGRA30_CLK_VIMCLK_SYNC, TEGRA30_CLK_CLK_MAX, 24000000, 0 }, ++ { TEGRA30_CLK_HDA, TEGRA30_CLK_PLL_P, 102000000, 0 }, ++ { TEGRA30_CLK_HDA2CODEC_2X, TEGRA30_CLK_PLL_P, 48000000, 0 }, + /* must be the last entry */ + { TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0 }, + }; +diff --git a/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h b/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +index 74a9fe8e0cfb9..8c54f0be51bab 100644 +--- a/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h ++++ b/drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +@@ -44,7 +44,7 @@ enum psp_gfx_crtl_cmd_id + GFX_CTRL_CMD_ID_DISABLE_INT = 0x00060000, /* disable PSP-to-Gfx interrupt */ + GFX_CTRL_CMD_ID_MODE1_RST = 0x00070000, /* trigger the Mode 1 reset */ + GFX_CTRL_CMD_ID_GBR_IH_SET = 0x00080000, /* set Gbr IH_RB_CNTL registers */ +- GFX_CTRL_CMD_ID_CONSUME_CMD = 0x000A0000, /* send interrupt to psp for updating write pointer of vf */ ++ GFX_CTRL_CMD_ID_CONSUME_CMD = 0x00090000, /* send interrupt to psp for updating write pointer of vf */ + GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING = 0x000C0000, /* destroy GPCOM ring */ + + GFX_CTRL_CMD_ID_MAX = 0x000F0000, /* max command ID */ +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +index a549c7c717ddc..f0b001b3af578 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +@@ -113,7 +113,7 @@ int amdgpu_dm_crtc_configure_crc_source(struct drm_crtc *crtc, + mutex_lock(&adev->dm.dc_lock); + + /* Enable CRTC CRC generation if necessary. */ +- if (dm_is_crc_source_crtc(source)) { ++ if (dm_is_crc_source_crtc(source) || source == AMDGPU_DM_PIPE_CRC_SOURCE_NONE) { + if (!dc_stream_configure_crc(stream_state->ctx->dc, + stream_state, enable, enable)) { + ret = -EINVAL; +diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c +index 2dd2cd87cdbb3..5e906ea6df67d 100644 +--- a/drivers/gpu/drm/drm_atomic_helper.c ++++ b/drivers/gpu/drm/drm_atomic_helper.c +@@ -2948,7 +2948,7 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set, + + ret = handle_conflicting_encoders(state, true); + if (ret) +- return ret; ++ goto fail; + + ret = drm_atomic_commit(state); + +diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c +index 4b5c7b0ed7148..8fdb271354061 100644 +--- a/drivers/gpu/drm/drm_syncobj.c ++++ b/drivers/gpu/drm/drm_syncobj.c +@@ -326,19 +326,18 @@ int drm_syncobj_find_fence(struct drm_file *file_private, + return -ENOENT; + + *fence = drm_syncobj_fence_get(syncobj); +- drm_syncobj_put(syncobj); + + if (*fence) { + ret = dma_fence_chain_find_seqno(fence, point); + if (!ret) +- return 0; ++ goto out; + dma_fence_put(*fence); + } else { + ret = -EINVAL; + } + + if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)) +- return ret; ++ goto out; + + memset(&wait, 0, sizeof(wait)); + wait.task = current; +@@ -370,6 +369,9 @@ int drm_syncobj_find_fence(struct drm_file *file_private, + if (wait.node.next) + drm_syncobj_remove_wait(syncobj, &wait); + ++out: ++ drm_syncobj_put(syncobj); ++ + return ret; + } + EXPORT_SYMBOL(drm_syncobj_find_fence); +diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c +index 2fa491f826824..398068b173891 100644 +--- a/drivers/gpu/drm/i915/gt/intel_lrc.c ++++ b/drivers/gpu/drm/i915/gt/intel_lrc.c +@@ -2245,6 +2245,9 @@ err: + static void lrc_destroy_wa_ctx(struct intel_engine_cs *engine) + { + i915_vma_unpin_and_release(&engine->wa_ctx.vma, 0); ++ ++ /* Called on error unwind, clear all flags to prevent further use */ ++ memset(&engine->wa_ctx, 0, sizeof(engine->wa_ctx)); + } + + typedef u32 *(*wa_bb_func_t)(struct intel_engine_cs *engine, u32 *batch); +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c +index ee2b1e1199e09..daa79d39201f9 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c +@@ -132,7 +132,7 @@ nv50_dmac_destroy(struct nv50_dmac *dmac) + + int + nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, +- const s32 *oclass, u8 head, void *data, u32 size, u64 syncbuf, ++ const s32 *oclass, u8 head, void *data, u32 size, s64 syncbuf, + struct nv50_dmac *dmac) + { + struct nouveau_cli *cli = (void *)device->object.client; +@@ -167,7 +167,7 @@ nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, + if (ret) + return ret; + +- if (!syncbuf) ++ if (syncbuf < 0) + return 0; + + ret = nvif_object_init(&dmac->base.user, 0xf0000000, NV_DMA_IN_MEMORY, +diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.h b/drivers/gpu/drm/nouveau/dispnv50/disp.h +index 7c41b0599d1ac..284068fa6d007 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/disp.h ++++ b/drivers/gpu/drm/nouveau/dispnv50/disp.h +@@ -70,7 +70,7 @@ struct nv50_dmac { + + int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, + const s32 *oclass, u8 head, void *data, u32 size, +- u64 syncbuf, struct nv50_dmac *dmac); ++ s64 syncbuf, struct nv50_dmac *dmac); + void nv50_dmac_destroy(struct nv50_dmac *); + + u32 *evo_wait(struct nv50_dmac *, int nr); +diff --git a/drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c b/drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c +index f7dbd965e4e72..b49a212af4d8d 100644 +--- a/drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c ++++ b/drivers/gpu/drm/nouveau/dispnv50/wimmc37b.c +@@ -68,7 +68,7 @@ wimmc37b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm, + int ret; + + ret = nv50_dmac_create(&drm->client.device, &disp->disp->object, +- &oclass, 0, &args, sizeof(args), 0, ++ &oclass, 0, &args, sizeof(args), -1, + &wndw->wimm); + if (ret) { + NV_ERROR(drm, "wimm%04x allocation failed: %d\n", oclass, ret); +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c +index 7deb81b6dbac6..4b571cc6bc70f 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/shadow.c +@@ -75,7 +75,7 @@ shadow_image(struct nvkm_bios *bios, int idx, u32 offset, struct shadow *mthd) + nvkm_debug(subdev, "%08x: type %02x, %d bytes\n", + image.base, image.type, image.size); + +- if (!shadow_fetch(bios, mthd, image.size)) { ++ if (!shadow_fetch(bios, mthd, image.base + image.size)) { + nvkm_debug(subdev, "%08x: fetch failed\n", image.base); + return 0; + } +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c +index edb6148cbca04..d0e80ad526845 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c +@@ -33,7 +33,7 @@ static void + gm200_i2c_aux_fini(struct gm200_i2c_aux *aux) + { + struct nvkm_device *device = aux->base.pad->i2c->subdev.device; +- nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00310000, 0x00000000); ++ nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00710000, 0x00000000); + } + + static int +@@ -54,10 +54,10 @@ gm200_i2c_aux_init(struct gm200_i2c_aux *aux) + AUX_ERR(&aux->base, "begin idle timeout %08x", ctrl); + return -EBUSY; + } +- } while (ctrl & 0x03010000); ++ } while (ctrl & 0x07010000); + + /* set some magic, and wait up to 1ms for it to appear */ +- nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00300000, ureq); ++ nvkm_mask(device, 0x00d954 + (aux->ch * 0x50), 0x00700000, ureq); + timeout = 1000; + do { + ctrl = nvkm_rd32(device, 0x00d954 + (aux->ch * 0x50)); +@@ -67,7 +67,7 @@ gm200_i2c_aux_init(struct gm200_i2c_aux *aux) + gm200_i2c_aux_fini(aux); + return -EBUSY; + } +- } while ((ctrl & 0x03000000) != urep); ++ } while ((ctrl & 0x07000000) != urep); + + return 0; + } +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c +index d80dbc8f09b20..55a4ea4393c62 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c +@@ -22,6 +22,7 @@ + * Authors: Ben Skeggs + */ + #include "priv.h" ++#include + + static void + gf100_ibus_intr_hub(struct nvkm_subdev *ibus, int i) +@@ -31,7 +32,6 @@ gf100_ibus_intr_hub(struct nvkm_subdev *ibus, int i) + u32 data = nvkm_rd32(device, 0x122124 + (i * 0x0400)); + u32 stat = nvkm_rd32(device, 0x122128 + (i * 0x0400)); + nvkm_debug(ibus, "HUB%d: %06x %08x (%08x)\n", i, addr, data, stat); +- nvkm_mask(device, 0x122128 + (i * 0x0400), 0x00000200, 0x00000000); + } + + static void +@@ -42,7 +42,6 @@ gf100_ibus_intr_rop(struct nvkm_subdev *ibus, int i) + u32 data = nvkm_rd32(device, 0x124124 + (i * 0x0400)); + u32 stat = nvkm_rd32(device, 0x124128 + (i * 0x0400)); + nvkm_debug(ibus, "ROP%d: %06x %08x (%08x)\n", i, addr, data, stat); +- nvkm_mask(device, 0x124128 + (i * 0x0400), 0x00000200, 0x00000000); + } + + static void +@@ -53,7 +52,6 @@ gf100_ibus_intr_gpc(struct nvkm_subdev *ibus, int i) + u32 data = nvkm_rd32(device, 0x128124 + (i * 0x0400)); + u32 stat = nvkm_rd32(device, 0x128128 + (i * 0x0400)); + nvkm_debug(ibus, "GPC%d: %06x %08x (%08x)\n", i, addr, data, stat); +- nvkm_mask(device, 0x128128 + (i * 0x0400), 0x00000200, 0x00000000); + } + + void +@@ -90,6 +88,12 @@ gf100_ibus_intr(struct nvkm_subdev *ibus) + intr1 &= ~stat; + } + } ++ ++ nvkm_mask(device, 0x121c4c, 0x0000003f, 0x00000002); ++ nvkm_msec(device, 2000, ++ if (!(nvkm_rd32(device, 0x121c4c) & 0x0000003f)) ++ break; ++ ); + } + + static int +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c +index 9025ed1bd2a99..4caf3ef087e1d 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c +@@ -22,6 +22,7 @@ + * Authors: Ben Skeggs + */ + #include "priv.h" ++#include + + static void + gk104_ibus_intr_hub(struct nvkm_subdev *ibus, int i) +@@ -31,7 +32,6 @@ gk104_ibus_intr_hub(struct nvkm_subdev *ibus, int i) + u32 data = nvkm_rd32(device, 0x122124 + (i * 0x0800)); + u32 stat = nvkm_rd32(device, 0x122128 + (i * 0x0800)); + nvkm_debug(ibus, "HUB%d: %06x %08x (%08x)\n", i, addr, data, stat); +- nvkm_mask(device, 0x122128 + (i * 0x0800), 0x00000200, 0x00000000); + } + + static void +@@ -42,7 +42,6 @@ gk104_ibus_intr_rop(struct nvkm_subdev *ibus, int i) + u32 data = nvkm_rd32(device, 0x124124 + (i * 0x0800)); + u32 stat = nvkm_rd32(device, 0x124128 + (i * 0x0800)); + nvkm_debug(ibus, "ROP%d: %06x %08x (%08x)\n", i, addr, data, stat); +- nvkm_mask(device, 0x124128 + (i * 0x0800), 0x00000200, 0x00000000); + } + + static void +@@ -53,7 +52,6 @@ gk104_ibus_intr_gpc(struct nvkm_subdev *ibus, int i) + u32 data = nvkm_rd32(device, 0x128124 + (i * 0x0800)); + u32 stat = nvkm_rd32(device, 0x128128 + (i * 0x0800)); + nvkm_debug(ibus, "GPC%d: %06x %08x (%08x)\n", i, addr, data, stat); +- nvkm_mask(device, 0x128128 + (i * 0x0800), 0x00000200, 0x00000000); + } + + void +@@ -90,6 +88,12 @@ gk104_ibus_intr(struct nvkm_subdev *ibus) + intr1 &= ~stat; + } + } ++ ++ nvkm_mask(device, 0x12004c, 0x0000003f, 0x00000002); ++ nvkm_msec(device, 2000, ++ if (!(nvkm_rd32(device, 0x12004c) & 0x0000003f)) ++ break; ++ ); + } + + static int +diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +index ee11ccaf0563c..cb51e248cb41b 100644 +--- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c ++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +@@ -316,9 +316,9 @@ nvkm_mmu_vram(struct nvkm_mmu *mmu) + { + struct nvkm_device *device = mmu->subdev.device; + struct nvkm_mm *mm = &device->fb->ram->vram; +- const u32 sizeN = nvkm_mm_heap_size(mm, NVKM_RAM_MM_NORMAL); +- const u32 sizeU = nvkm_mm_heap_size(mm, NVKM_RAM_MM_NOMAP); +- const u32 sizeM = nvkm_mm_heap_size(mm, NVKM_RAM_MM_MIXED); ++ const u64 sizeN = nvkm_mm_heap_size(mm, NVKM_RAM_MM_NORMAL); ++ const u64 sizeU = nvkm_mm_heap_size(mm, NVKM_RAM_MM_NOMAP); ++ const u64 sizeM = nvkm_mm_heap_size(mm, NVKM_RAM_MM_MIXED); + u8 type = NVKM_MEM_KIND * !!mmu->func->kind; + u8 heap = NVKM_MEM_VRAM; + int heapM, heapN, heapU; +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index 2aa810665a78c..33183933337af 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -393,6 +393,7 @@ + #define USB_DEVICE_ID_TOSHIBA_CLICK_L9W 0x0401 + #define USB_DEVICE_ID_HP_X2 0x074d + #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 ++#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 + + #define USB_VENDOR_ID_ELECOM 0x056e + #define USB_DEVICE_ID_ELECOM_BM084 0x0061 +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c +index b2da8476d0d30..ec08895e7b1dc 100644 +--- a/drivers/hid/hid-input.c ++++ b/drivers/hid/hid-input.c +@@ -322,6 +322,8 @@ static const struct hid_device_id hid_battery_quirks[] = { + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, + USB_DEVICE_ID_LOGITECH_DINOVO_EDGE_KBD), + HID_BATTERY_QUIRK_IGNORE }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN), ++ HID_BATTERY_QUIRK_IGNORE }, + {} + }; + +diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c +index 54d811fdcdb44..e5550a5bf49d0 100644 +--- a/drivers/hid/hid-logitech-dj.c ++++ b/drivers/hid/hid-logitech-dj.c +@@ -1862,6 +1862,10 @@ static const struct hid_device_id logi_dj_receivers[] = { + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, + 0xc531), + .driver_data = recvr_type_gaming_hidpp}, ++ { /* Logitech G602 receiver (0xc537) */ ++ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, ++ 0xc537), ++ .driver_data = recvr_type_gaming_hidpp}, + { /* Logitech lightspeed receiver (0xc539) */ + HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, + USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1), +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c +index 128d8f4319b9f..d91e6679afb18 100644 +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -2084,6 +2084,10 @@ static const struct hid_device_id mt_devices[] = { + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, + USB_VENDOR_ID_SYNAPTICS, 0xce08) }, + ++ { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, ++ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, ++ USB_VENDOR_ID_SYNAPTICS, 0xce09) }, ++ + /* TopSeed panels */ + { .driver_data = MT_CLS_TOPSEED, + MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, +diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c +index 21fdf0b935166..d7d99acac52f2 100644 +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -258,6 +258,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, ++ { ++ /* Alder Lake-P */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x51a6), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, + { + /* Emmitsburg PCH */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1bcc), +diff --git a/drivers/hwtracing/stm/heartbeat.c b/drivers/hwtracing/stm/heartbeat.c +index 3e7df1c0477f7..81d7b21d31ec2 100644 +--- a/drivers/hwtracing/stm/heartbeat.c ++++ b/drivers/hwtracing/stm/heartbeat.c +@@ -64,7 +64,7 @@ static void stm_heartbeat_unlink(struct stm_source_data *data) + + static int stm_heartbeat_init(void) + { +- int i, ret = -ENOMEM; ++ int i, ret; + + if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX) + return -EINVAL; +@@ -72,8 +72,10 @@ static int stm_heartbeat_init(void) + for (i = 0; i < nr_devs; i++) { + stm_heartbeat[i].data.name = + kasprintf(GFP_KERNEL, "heartbeat.%d", i); +- if (!stm_heartbeat[i].data.name) ++ if (!stm_heartbeat[i].data.name) { ++ ret = -ENOMEM; + goto fail_unregister; ++ } + + stm_heartbeat[i].data.nr_chans = 1; + stm_heartbeat[i].data.link = stm_heartbeat_link; +diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c +index d9607905dc2f1..845eda70b8cab 100644 +--- a/drivers/i2c/busses/i2c-octeon-core.c ++++ b/drivers/i2c/busses/i2c-octeon-core.c +@@ -347,7 +347,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, + if (result) + return result; + if (recv_len && i == 0) { +- if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) ++ if (data[i] > I2C_SMBUS_BLOCK_MAX) + return -EPROTO; + length += data[i]; + } +diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c b/drivers/i2c/busses/i2c-tegra-bpmp.c +index ec7a7e917eddb..c0c7d01473f2b 100644 +--- a/drivers/i2c/busses/i2c-tegra-bpmp.c ++++ b/drivers/i2c/busses/i2c-tegra-bpmp.c +@@ -80,7 +80,7 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out) + flags &= ~I2C_M_RECV_LEN; + } + +- return (flags != 0) ? -EINVAL : 0; ++ return 0; + } + + /** +diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c +index c64e6898ff20a..d1ffc8cb08ed6 100644 +--- a/drivers/iio/dac/ad5504.c ++++ b/drivers/iio/dac/ad5504.c +@@ -188,9 +188,9 @@ static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev, + return ret; + + if (pwr_down) +- st->pwr_down_mask |= (1 << chan->channel); +- else + st->pwr_down_mask &= ~(1 << chan->channel); ++ else ++ st->pwr_down_mask |= (1 << chan->channel); + + ret = ad5504_spi_write(st, AD5504_ADDR_CTRL, + AD5504_DAC_PWRDWN_MODE(st->pwr_down_mode) | +diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c +index 95d4fd8f7a968..0bbb0b2d0dd5f 100644 +--- a/drivers/irqchip/irq-mips-cpu.c ++++ b/drivers/irqchip/irq-mips-cpu.c +@@ -197,6 +197,13 @@ static int mips_cpu_ipi_alloc(struct irq_domain *domain, unsigned int virq, + if (ret) + return ret; + ++ ret = irq_domain_set_hwirq_and_chip(domain->parent, virq + i, hwirq, ++ &mips_mt_cpu_irq_controller, ++ NULL); ++ ++ if (ret) ++ return ret; ++ + ret = irq_set_irq_type(virq + i, IRQ_TYPE_LEVEL_HIGH); + if (ret) + return ret; +diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c +index a2ebc75af8c79..4714aa936b2a2 100644 +--- a/drivers/lightnvm/core.c ++++ b/drivers/lightnvm/core.c +@@ -849,11 +849,10 @@ static int nvm_bb_chunk_sense(struct nvm_dev *dev, struct ppa_addr ppa) + rqd.ppa_addr = generic_to_dev_addr(dev, ppa); + + ret = nvm_submit_io_sync_raw(dev, &rqd); ++ __free_page(page); + if (ret) + return ret; + +- __free_page(page); +- + return rqd.error; + } + +diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig +index aa98953f4462e..7dd6e98257c72 100644 +--- a/drivers/md/Kconfig ++++ b/drivers/md/Kconfig +@@ -565,6 +565,7 @@ config DM_INTEGRITY + select BLK_DEV_INTEGRITY + select DM_BUFIO + select CRYPTO ++ select CRYPTO_SKCIPHER + select ASYNC_XOR + ---help--- + This device-mapper target emulates a block device that has +diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c +index 25efe382e78fa..57f66f2ad98dc 100644 +--- a/drivers/md/dm-integrity.c ++++ b/drivers/md/dm-integrity.c +@@ -4059,6 +4059,12 @@ try_smaller_buffer: + r = -ENOMEM; + goto bad; + } ++ } else { ++ if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING)) { ++ ti->error = "Recalculate can only be specified with internal_hash"; ++ r = -EINVAL; ++ goto bad; ++ } + } + + ic->bufio = dm_bufio_client_create(ic->meta_dev ? ic->meta_dev->bdev : ic->dev->bdev, +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c +index 6dd56afa048c2..98be040cf958c 100644 +--- a/drivers/md/dm-table.c ++++ b/drivers/md/dm-table.c +@@ -428,14 +428,23 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, + { + int r; + dev_t dev; ++ unsigned int major, minor; ++ char dummy; + struct dm_dev_internal *dd; + struct dm_table *t = ti->table; + + BUG_ON(!t); + +- dev = dm_get_dev_t(path); +- if (!dev) +- return -ENODEV; ++ if (sscanf(path, "%u:%u%c", &major, &minor, &dummy) == 2) { ++ /* Extract the major/minor numbers */ ++ dev = MKDEV(major, minor); ++ if (MAJOR(dev) != major || MINOR(dev) != minor) ++ return -EOVERFLOW; ++ } else { ++ dev = dm_get_dev_t(path); ++ if (!dev) ++ return -ENODEV; ++ } + + dd = find_device(&t->devices, dev); + if (!dd) { +diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c +index 81b8d5ede484e..9cee10e44e2fc 100644 +--- a/drivers/mmc/core/queue.c ++++ b/drivers/mmc/core/queue.c +@@ -370,8 +370,10 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) + "merging was advertised but not possible"); + blk_queue_max_segments(mq->queue, mmc_get_max_segments(host)); + +- if (mmc_card_mmc(card)) ++ if (mmc_card_mmc(card) && card->ext_csd.data_sector_size) { + block_size = card->ext_csd.data_sector_size; ++ WARN_ON(block_size != 512 && block_size != 4096); ++ } + + blk_queue_logical_block_size(mq->queue, block_size); + /* +diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c +index 4703cd540c7fd..5f57e78e5f13f 100644 +--- a/drivers/mmc/host/sdhci-xenon.c ++++ b/drivers/mmc/host/sdhci-xenon.c +@@ -167,7 +167,12 @@ static void xenon_reset_exit(struct sdhci_host *host, + /* Disable tuning request and auto-retuning again */ + xenon_retune_setup(host); + +- xenon_set_acg(host, true); ++ /* ++ * The ACG should be turned off at the early init time, in order ++ * to solve a possible issues with the 1.8V regulator stabilization. ++ * The feature is enabled in later stage. ++ */ ++ xenon_set_acg(host, false); + + xenon_set_sdclk_off_idle(host, sdhc_id, false); + +diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c +index 5b8791135de13..247aeacb3a440 100644 +--- a/drivers/net/can/dev.c ++++ b/drivers/net/can/dev.c +@@ -567,11 +567,11 @@ static void can_restart(struct net_device *dev) + } + cf->can_id |= CAN_ERR_RESTARTED; + +- netif_rx_ni(skb); +- + stats->rx_packets++; + stats->rx_bytes += cf->can_dlc; + ++ netif_rx_ni(skb); ++ + restart: + netdev_dbg(dev, "restarted\n"); + priv->can_stats.restarts++; +diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c +index dee3e689b54da..96bbdef672bc9 100644 +--- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c ++++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c +@@ -512,11 +512,11 @@ static int pcan_usb_fd_decode_canmsg(struct pcan_usb_fd_if *usb_if, + else + memcpy(cfd->data, rm->d, cfd->len); + +- peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(rm->ts_low)); +- + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += cfd->len; + ++ peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(rm->ts_low)); ++ + return 0; + } + +@@ -578,11 +578,11 @@ static int pcan_usb_fd_decode_status(struct pcan_usb_fd_if *usb_if, + if (!skb) + return -ENOMEM; + +- peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(sm->ts_low)); +- + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += cf->can_dlc; + ++ peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(sm->ts_low)); ++ + return 0; + } + +diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c +index d6ba9426be4de..b1baa4ac1d537 100644 +--- a/drivers/net/can/vxcan.c ++++ b/drivers/net/can/vxcan.c +@@ -39,6 +39,7 @@ static netdev_tx_t vxcan_xmit(struct sk_buff *skb, struct net_device *dev) + struct net_device *peer; + struct canfd_frame *cfd = (struct canfd_frame *)skb->data; + struct net_device_stats *peerstats, *srcstats = &dev->stats; ++ u8 len; + + if (can_dropped_invalid_skb(dev, skb)) + return NETDEV_TX_OK; +@@ -61,12 +62,13 @@ static netdev_tx_t vxcan_xmit(struct sk_buff *skb, struct net_device *dev) + skb->dev = peer; + skb->ip_summed = CHECKSUM_UNNECESSARY; + ++ len = cfd->len; + if (netif_rx_ni(skb) == NET_RX_SUCCESS) { + srcstats->tx_packets++; +- srcstats->tx_bytes += cfd->len; ++ srcstats->tx_bytes += len; + peerstats = &peer->stats; + peerstats->rx_packets++; +- peerstats->rx_bytes += cfd->len; ++ peerstats->rx_bytes += len; + } + + out_unlock: +diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c +index 4bd66ba72c03c..0b1223f360d97 100644 +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -1330,7 +1330,7 @@ int b53_vlan_prepare(struct dsa_switch *ds, int port, + if ((is5325(dev) || is5365(dev)) && vlan->vid_begin == 0) + return -EOPNOTSUPP; + +- if (vlan->vid_end > dev->num_vlans) ++ if (vlan->vid_end >= dev->num_vlans) + return -ERANGE; + + b53_enable_vlan(dev, true, ds->vlan_filtering); +diff --git a/drivers/net/dsa/mv88e6xxx/global1_vtu.c b/drivers/net/dsa/mv88e6xxx/global1_vtu.c +index c51c01345223d..fcfda1a1cecfc 100644 +--- a/drivers/net/dsa/mv88e6xxx/global1_vtu.c ++++ b/drivers/net/dsa/mv88e6xxx/global1_vtu.c +@@ -351,6 +351,10 @@ int mv88e6250_g1_vtu_getnext(struct mv88e6xxx_chip *chip, + if (err) + return err; + ++ err = mv88e6185_g1_stu_data_read(chip, entry); ++ if (err) ++ return err; ++ + /* VTU DBNum[3:0] are located in VTU Operation 3:0 + * VTU DBNum[5:4] are located in VTU Operation 9:8 + */ +diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c +index da1fd0e08c36e..6030c90d50ccb 100644 +--- a/drivers/net/ethernet/mscc/ocelot.c ++++ b/drivers/net/ethernet/mscc/ocelot.c +@@ -1716,10 +1716,8 @@ static int ocelot_netdevice_event(struct notifier_block *unused, + struct net_device *dev = netdev_notifier_info_to_dev(ptr); + int ret = 0; + +- if (!ocelot_netdevice_dev_check(dev)) +- return 0; +- + if (event == NETDEV_PRECHANGEUPPER && ++ ocelot_netdevice_dev_check(dev) && + netif_is_lag_master(info->upper_dev)) { + struct netdev_lag_upper_info *lag_upper_info = info->upper_info; + struct netlink_ext_ack *extack; +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 8aa1b1bda96d1..18f86e441570c 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -2640,10 +2640,10 @@ static int sh_eth_close(struct net_device *ndev) + /* Free all the skbuffs in the Rx queue and the DMA buffer. */ + sh_eth_ring_free(ndev); + +- pm_runtime_put_sync(&mdp->pdev->dev); +- + mdp->is_opened = 0; + ++ pm_runtime_put(&mdp->pdev->dev); ++ + return 0; + } + +diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c +index bb07024d22edc..0a745769e7127 100644 +--- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c ++++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c +@@ -334,7 +334,7 @@ FUNC_GROUP_DECL(RMII4, F24, E23, E24, E25, C25, C24, B26, B25, B24); + + #define D22 40 + SIG_EXPR_LIST_DECL_SESG(D22, SD1CLK, SD1, SIG_DESC_SET(SCU414, 8)); +-SIG_EXPR_LIST_DECL_SEMG(D22, PWM8, PWM8G0, PWM8, SIG_DESC_SET(SCU414, 8)); ++SIG_EXPR_LIST_DECL_SEMG(D22, PWM8, PWM8G0, PWM8, SIG_DESC_SET(SCU4B4, 8)); + PIN_DECL_2(D22, GPIOF0, SD1CLK, PWM8); + GROUP_DECL(PWM8G0, D22); + +diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c +index 8bd0a078bfc47..61e7d938d4c5c 100644 +--- a/drivers/pinctrl/pinctrl-ingenic.c ++++ b/drivers/pinctrl/pinctrl-ingenic.c +@@ -1378,7 +1378,7 @@ static inline bool ingenic_gpio_get_value(struct ingenic_gpio_chip *jzgc, + static void ingenic_gpio_set_value(struct ingenic_gpio_chip *jzgc, + u8 offset, int value) + { +- if (jzgc->jzpc->version >= ID_JZ4760) ++ if (jzgc->jzpc->version >= ID_JZ4770) + ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_PAT0, offset, !!value); + else + ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, offset, !!value); +@@ -1389,7 +1389,7 @@ static void irq_set_type(struct ingenic_gpio_chip *jzgc, + { + u8 reg1, reg2; + +- if (jzgc->jzpc->version >= ID_JZ4760) { ++ if (jzgc->jzpc->version >= ID_JZ4770) { + reg1 = JZ4760_GPIO_PAT1; + reg2 = JZ4760_GPIO_PAT0; + } else { +@@ -1464,7 +1464,7 @@ static void ingenic_gpio_irq_enable(struct irq_data *irqd) + struct ingenic_gpio_chip *jzgc = gpiochip_get_data(gc); + int irq = irqd->hwirq; + +- if (jzgc->jzpc->version >= ID_JZ4760) ++ if (jzgc->jzpc->version >= ID_JZ4770) + ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_INT, irq, true); + else + ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, true); +@@ -1480,7 +1480,7 @@ static void ingenic_gpio_irq_disable(struct irq_data *irqd) + + ingenic_gpio_irq_mask(irqd); + +- if (jzgc->jzpc->version >= ID_JZ4760) ++ if (jzgc->jzpc->version >= ID_JZ4770) + ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_INT, irq, false); + else + ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_SELECT, irq, false); +@@ -1505,7 +1505,7 @@ static void ingenic_gpio_irq_ack(struct irq_data *irqd) + irq_set_type(jzgc, irq, IRQ_TYPE_LEVEL_HIGH); + } + +- if (jzgc->jzpc->version >= ID_JZ4760) ++ if (jzgc->jzpc->version >= ID_JZ4770) + ingenic_gpio_set_bit(jzgc, JZ4760_GPIO_FLAG, irq, false); + else + ingenic_gpio_set_bit(jzgc, JZ4740_GPIO_DATA, irq, true); +@@ -1562,7 +1562,7 @@ static void ingenic_gpio_irq_handler(struct irq_desc *desc) + + chained_irq_enter(irq_chip, desc); + +- if (jzgc->jzpc->version >= ID_JZ4760) ++ if (jzgc->jzpc->version >= ID_JZ4770) + flag = ingenic_gpio_read_reg(jzgc, JZ4760_GPIO_FLAG); + else + flag = ingenic_gpio_read_reg(jzgc, JZ4740_GPIO_FLAG); +@@ -1643,7 +1643,7 @@ static int ingenic_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) + struct ingenic_pinctrl *jzpc = jzgc->jzpc; + unsigned int pin = gc->base + offset; + +- if (jzpc->version >= ID_JZ4760) ++ if (jzpc->version >= ID_JZ4770) + return ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_INT) || + ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1); + +@@ -1676,7 +1676,7 @@ static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc, + ingenic_shadow_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, func & 0x2); + ingenic_shadow_config_pin(jzpc, pin, JZ4760_GPIO_PAT0, func & 0x1); + ingenic_shadow_config_pin_load(jzpc, pin); +- } else if (jzpc->version >= ID_JZ4760) { ++ } else if (jzpc->version >= ID_JZ4770) { + ingenic_config_pin(jzpc, pin, JZ4760_GPIO_INT, false); + ingenic_config_pin(jzpc, pin, GPIO_MSK, false); + ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, func & 0x2); +@@ -1684,7 +1684,7 @@ static int ingenic_pinmux_set_pin_fn(struct ingenic_pinctrl *jzpc, + } else { + ingenic_config_pin(jzpc, pin, JZ4740_GPIO_FUNC, true); + ingenic_config_pin(jzpc, pin, JZ4740_GPIO_TRIG, func & 0x2); +- ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, func > 0); ++ ingenic_config_pin(jzpc, pin, JZ4740_GPIO_SELECT, func & 0x1); + } + + return 0; +@@ -1734,7 +1734,7 @@ static int ingenic_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, + ingenic_shadow_config_pin(jzpc, pin, GPIO_MSK, true); + ingenic_shadow_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, input); + ingenic_shadow_config_pin_load(jzpc, pin); +- } else if (jzpc->version >= ID_JZ4760) { ++ } else if (jzpc->version >= ID_JZ4770) { + ingenic_config_pin(jzpc, pin, JZ4760_GPIO_INT, false); + ingenic_config_pin(jzpc, pin, GPIO_MSK, true); + ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PAT1, input); +@@ -1764,7 +1764,7 @@ static int ingenic_pinconf_get(struct pinctrl_dev *pctldev, + unsigned int offt = pin / PINS_PER_GPIO_CHIP; + bool pull; + +- if (jzpc->version >= ID_JZ4760) ++ if (jzpc->version >= ID_JZ4770) + pull = !ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PEN); + else + pull = !ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_PULL_DIS); +@@ -1796,7 +1796,7 @@ static int ingenic_pinconf_get(struct pinctrl_dev *pctldev, + static void ingenic_set_bias(struct ingenic_pinctrl *jzpc, + unsigned int pin, bool enabled) + { +- if (jzpc->version >= ID_JZ4760) ++ if (jzpc->version >= ID_JZ4770) + ingenic_config_pin(jzpc, pin, JZ4760_GPIO_PEN, !enabled); + else + ingenic_config_pin(jzpc, pin, JZ4740_GPIO_PULL_DIS, !enabled); +diff --git a/drivers/platform/x86/i2c-multi-instantiate.c b/drivers/platform/x86/i2c-multi-instantiate.c +index ffb8d5d1eb5ff..f85a5c720507b 100644 +--- a/drivers/platform/x86/i2c-multi-instantiate.c ++++ b/drivers/platform/x86/i2c-multi-instantiate.c +@@ -166,13 +166,29 @@ static const struct i2c_inst_data bsg2150_data[] = { + {} + }; + +-static const struct i2c_inst_data int3515_data[] = { +- { "tps6598x", IRQ_RESOURCE_APIC, 0 }, +- { "tps6598x", IRQ_RESOURCE_APIC, 1 }, +- { "tps6598x", IRQ_RESOURCE_APIC, 2 }, +- { "tps6598x", IRQ_RESOURCE_APIC, 3 }, +- {} +-}; ++/* ++ * Device with _HID INT3515 (TI PD controllers) has some unresolved interrupt ++ * issues. The most common problem seen is interrupt flood. ++ * ++ * There are at least two known causes. Firstly, on some boards, the ++ * I2CSerialBus resource index does not match the Interrupt resource, i.e. they ++ * are not one-to-one mapped like in the array below. Secondly, on some boards ++ * the IRQ line from the PD controller is not actually connected at all. But the ++ * interrupt flood is also seen on some boards where those are not a problem, so ++ * there are some other problems as well. ++ * ++ * Because of the issues with the interrupt, the device is disabled for now. If ++ * you wish to debug the issues, uncomment the below, and add an entry for the ++ * INT3515 device to the i2c_multi_instance_ids table. ++ * ++ * static const struct i2c_inst_data int3515_data[] = { ++ * { "tps6598x", IRQ_RESOURCE_APIC, 0 }, ++ * { "tps6598x", IRQ_RESOURCE_APIC, 1 }, ++ * { "tps6598x", IRQ_RESOURCE_APIC, 2 }, ++ * { "tps6598x", IRQ_RESOURCE_APIC, 3 }, ++ * { } ++ * }; ++ */ + + /* + * Note new device-ids must also be added to i2c_multi_instantiate_ids in +@@ -181,7 +197,6 @@ static const struct i2c_inst_data int3515_data[] = { + static const struct acpi_device_id i2c_multi_inst_acpi_ids[] = { + { "BSG1160", (unsigned long)bsg1160_data }, + { "BSG2150", (unsigned long)bsg2150_data }, +- { "INT3515", (unsigned long)int3515_data }, + { } + }; + MODULE_DEVICE_TABLE(acpi, i2c_multi_inst_acpi_ids); +diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c +index 7598cd46cf606..5b81bafa5c165 100644 +--- a/drivers/platform/x86/ideapad-laptop.c ++++ b/drivers/platform/x86/ideapad-laptop.c +@@ -92,6 +92,7 @@ struct ideapad_private { + struct dentry *debug; + unsigned long cfg; + bool has_hw_rfkill_switch; ++ bool has_touchpad_switch; + const char *fnesc_guid; + }; + +@@ -535,7 +536,9 @@ static umode_t ideapad_is_visible(struct kobject *kobj, + } else if (attr == &dev_attr_fn_lock.attr) { + supported = acpi_has_method(priv->adev->handle, "HALS") && + acpi_has_method(priv->adev->handle, "SALS"); +- } else ++ } else if (attr == &dev_attr_touchpad.attr) ++ supported = priv->has_touchpad_switch; ++ else + supported = true; + + return supported ? attr->mode : 0; +@@ -867,6 +870,9 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv) + { + unsigned long value; + ++ if (!priv->has_touchpad_switch) ++ return; ++ + /* Without reading from EC touchpad LED doesn't switch state */ + if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { + /* Some IdeaPads don't really turn off touchpad - they only +@@ -989,6 +995,9 @@ static int ideapad_acpi_add(struct platform_device *pdev) + priv->platform_device = pdev; + priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list); + ++ /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ ++ priv->has_touchpad_switch = !acpi_dev_present("ELAN0634", NULL, -1); ++ + ret = ideapad_sysfs_init(priv); + if (ret) + return ret; +@@ -1006,6 +1015,10 @@ static int ideapad_acpi_add(struct platform_device *pdev) + if (!priv->has_hw_rfkill_switch) + write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1); + ++ /* The same for Touchpad */ ++ if (!priv->has_touchpad_switch) ++ write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1); ++ + for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) + if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg)) + ideapad_register_rfkill(priv, i); +diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c +index bc8b0098d4f32..37035dca469cf 100644 +--- a/drivers/platform/x86/intel-vbtn.c ++++ b/drivers/platform/x86/intel-vbtn.c +@@ -191,12 +191,6 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { + DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"), + }, + }, +- { +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), +- DMI_MATCH(DMI_PRODUCT_NAME, "HP Stream x360 Convertible PC 11"), +- }, +- }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c +index 4a23dd8b7f9aa..b9c1f722f1ded 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -8174,11 +8174,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance, + goto out; + } + ++ /* always store 64 bits regardless of addressing */ + sense_ptr = (void *)cmd->frame + ioc->sense_off; +- if (instance->consistent_mask_64bit) +- put_unaligned_le64(sense_handle, sense_ptr); +- else +- put_unaligned_le32(sense_handle, sense_ptr); ++ put_unaligned_le64(sense_handle, sense_ptr); + } + + /* +diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c +index 35c96ea2653be..fdd966fea7f6a 100644 +--- a/drivers/scsi/qedi/qedi_main.c ++++ b/drivers/scsi/qedi/qedi_main.c +@@ -2175,7 +2175,7 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, + chap_name); + break; + case ISCSI_BOOT_TGT_CHAP_SECRET: +- rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, ++ rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, + chap_secret); + break; + case ISCSI_BOOT_TGT_REV_CHAP_NAME: +@@ -2183,7 +2183,7 @@ qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type, + mchap_name); + break; + case ISCSI_BOOT_TGT_REV_CHAP_SECRET: +- rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, ++ rc = sprintf(buf, "%.*s\n", NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, + mchap_secret); + break; + case ISCSI_BOOT_TGT_FLAGS: +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c +index 6a2f8bacfacea..f55249766d224 100644 +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -934,8 +934,10 @@ static blk_status_t sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd) + } + } + +- if (sdp->no_write_same) ++ if (sdp->no_write_same) { ++ rq->rq_flags |= RQF_QUIET; + return BLK_STS_TARGET; ++ } + + if (sdkp->ws16 || lba > 0xffffffff || nr_blocks > 0xffff) + return sd_setup_write_same16_cmnd(cmd, false); +diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c +index b888117f4ecd3..476ef8044ae59 100644 +--- a/drivers/scsi/ufs/ufshcd.c ++++ b/drivers/scsi/ufs/ufshcd.c +@@ -5980,19 +5980,16 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd) + { + struct Scsi_Host *host; + struct ufs_hba *hba; +- unsigned int tag; + u32 pos; + int err; +- u8 resp = 0xF; +- struct ufshcd_lrb *lrbp; ++ u8 resp = 0xF, lun; + unsigned long flags; + + host = cmd->device->host; + hba = shost_priv(host); +- tag = cmd->request->tag; + +- lrbp = &hba->lrb[tag]; +- err = ufshcd_issue_tm_cmd(hba, lrbp->lun, 0, UFS_LOGICAL_RESET, &resp); ++ lun = ufshcd_scsi_to_upiu_lun(cmd->device->lun); ++ err = ufshcd_issue_tm_cmd(hba, lun, 0, UFS_LOGICAL_RESET, &resp); + if (err || resp != UPIU_TASK_MANAGEMENT_FUNC_COMPL) { + if (!err) + err = resp; +@@ -6001,7 +5998,7 @@ static int ufshcd_eh_device_reset_handler(struct scsi_cmnd *cmd) + + /* clear the commands that were pending for corresponding LUN */ + for_each_set_bit(pos, &hba->outstanding_reqs, hba->nutrs) { +- if (hba->lrb[pos].lun == lrbp->lun) { ++ if (hba->lrb[pos].lun == lun) { + err = ufshcd_clear_cmd(hba, pos); + if (err) + break; +diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c +index 4e9a590712cb2..e006f40ffdc04 100644 +--- a/drivers/tty/serial/mvebu-uart.c ++++ b/drivers/tty/serial/mvebu-uart.c +@@ -648,6 +648,14 @@ static void wait_for_xmitr(struct uart_port *port) + (val & STAT_TX_RDY(port)), 1, 10000); + } + ++static void wait_for_xmite(struct uart_port *port) ++{ ++ u32 val; ++ ++ readl_poll_timeout_atomic(port->membase + UART_STAT, val, ++ (val & STAT_TX_EMP), 1, 10000); ++} ++ + static void mvebu_uart_console_putchar(struct uart_port *port, int ch) + { + wait_for_xmitr(port); +@@ -675,7 +683,7 @@ static void mvebu_uart_console_write(struct console *co, const char *s, + + uart_console_write(port, s, count, mvebu_uart_console_putchar); + +- wait_for_xmitr(port); ++ wait_for_xmite(port); + + if (ier) + writel(ier, port->membase + UART_CTRL(port)); +diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c +index b4343c6aa6512..6a2dc823ea828 100644 +--- a/drivers/tty/serial/sifive.c ++++ b/drivers/tty/serial/sifive.c +@@ -973,6 +973,7 @@ static int sifive_serial_probe(struct platform_device *pdev) + /* Set up clock divider */ + ssp->clkin_rate = clk_get_rate(ssp->clk); + ssp->baud_rate = SIFIVE_DEFAULT_BAUD_RATE; ++ ssp->port.uartclk = ssp->baud_rate * 16; + __ssp_update_div(ssp); + + platform_set_drvdata(pdev, ssp); +diff --git a/drivers/usb/gadget/udc/aspeed-vhub/epn.c b/drivers/usb/gadget/udc/aspeed-vhub/epn.c +index 7475c74aa5c5e..66d8884615f0e 100644 +--- a/drivers/usb/gadget/udc/aspeed-vhub/epn.c ++++ b/drivers/usb/gadget/udc/aspeed-vhub/epn.c +@@ -420,7 +420,10 @@ static void ast_vhub_stop_active_req(struct ast_vhub_ep *ep, + u32 state, reg, loops; + + /* Stop DMA activity */ +- writel(0, ep->epn.regs + AST_VHUB_EP_DMA_CTLSTAT); ++ if (ep->epn.desc_mode) ++ writel(VHUB_EP_DMA_CTRL_RESET, ep->epn.regs + AST_VHUB_EP_DMA_CTLSTAT); ++ else ++ writel(0, ep->epn.regs + AST_VHUB_EP_DMA_CTLSTAT); + + /* Wait for it to complete */ + for (loops = 0; loops < 1000; loops++) { +diff --git a/drivers/usb/gadget/udc/bdc/Kconfig b/drivers/usb/gadget/udc/bdc/Kconfig +index 3e88c7670b2ed..fb01ff47b64cf 100644 +--- a/drivers/usb/gadget/udc/bdc/Kconfig ++++ b/drivers/usb/gadget/udc/bdc/Kconfig +@@ -17,7 +17,7 @@ if USB_BDC_UDC + comment "Platform Support" + config USB_BDC_PCI + tristate "BDC support for PCIe based platforms" +- depends on USB_PCI ++ depends on USB_PCI && BROKEN + default USB_BDC_UDC + help + Enable support for platforms which have BDC connected through PCIe, such as Lego3 FPGA platform. +diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c +index 0e7820158aaa9..e41f67cd3d469 100644 +--- a/drivers/usb/gadget/udc/core.c ++++ b/drivers/usb/gadget/udc/core.c +@@ -1477,10 +1477,13 @@ static ssize_t soft_connect_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t n) + { + struct usb_udc *udc = container_of(dev, struct usb_udc, dev); ++ ssize_t ret; + ++ mutex_lock(&udc_lock); + if (!udc->driver) { + dev_err(dev, "soft-connect without a gadget driver\n"); +- return -EOPNOTSUPP; ++ ret = -EOPNOTSUPP; ++ goto out; + } + + if (sysfs_streq(buf, "connect")) { +@@ -1491,10 +1494,14 @@ static ssize_t soft_connect_store(struct device *dev, + usb_gadget_udc_stop(udc); + } else { + dev_err(dev, "unsupported command '%s'\n", buf); +- return -EINVAL; ++ ret = -EINVAL; ++ goto out; + } + +- return n; ++ ret = n; ++out: ++ mutex_unlock(&udc_lock); ++ return ret; + } + static DEVICE_ATTR_WO(soft_connect); + +diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c +index 0e5c56e065591..5c6ce1ef3f4b0 100644 +--- a/drivers/usb/host/ehci-hcd.c ++++ b/drivers/usb/host/ehci-hcd.c +@@ -574,6 +574,7 @@ static int ehci_run (struct usb_hcd *hcd) + struct ehci_hcd *ehci = hcd_to_ehci (hcd); + u32 temp; + u32 hcc_params; ++ int rc; + + hcd->uses_new_polling = 1; + +@@ -629,9 +630,20 @@ static int ehci_run (struct usb_hcd *hcd) + down_write(&ehci_cf_port_reset_rwsem); + ehci->rh_state = EHCI_RH_RUNNING; + ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); ++ ++ /* Wait until HC become operational */ + ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ + msleep(5); ++ rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, 0, 100 * 1000); ++ + up_write(&ehci_cf_port_reset_rwsem); ++ ++ if (rc) { ++ ehci_err(ehci, "USB %x.%x, controller refused to start: %d\n", ++ ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), rc); ++ return rc; ++ } ++ + ehci->last_periodic_enable = ktime_get_real(); + + temp = HC_VERSION(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); +diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c +index 087402aec5cbe..9f9ab5ccea889 100644 +--- a/drivers/usb/host/ehci-hub.c ++++ b/drivers/usb/host/ehci-hub.c +@@ -345,6 +345,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) + + unlink_empty_async_suspended(ehci); + ++ /* Some Synopsys controllers mistakenly leave IAA turned on */ ++ ehci_writel(ehci, STS_IAA, &ehci->regs->status); ++ + /* Any IAA cycle that started before the suspend is now invalid */ + end_iaa_cycle(ehci); + ehci_handle_start_intr_unlinks(ehci); +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c +index 49894541ea9a5..52e156c018042 100644 +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -2918,6 +2918,8 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring, + trb->field[0] = cpu_to_le32(field1); + trb->field[1] = cpu_to_le32(field2); + trb->field[2] = cpu_to_le32(field3); ++ /* make sure TRB is fully written before giving it to the controller */ ++ wmb(); + trb->field[3] = cpu_to_le32(field4); + + trace_xhci_queue_trb(ring, trb); +diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c +index b8e24ccba9f3e..6087b1fa530f8 100644 +--- a/drivers/usb/host/xhci-tegra.c ++++ b/drivers/usb/host/xhci-tegra.c +@@ -562,6 +562,13 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra, + enable); + if (err < 0) + break; ++ ++ /* ++ * wait 500us for LFPS detector to be disabled before ++ * sending ACK ++ */ ++ if (!enable) ++ usleep_range(500, 1000); + } + + if (err < 0) { +diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c +index 26df84c45db4e..7b94a6c316643 100644 +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -1988,16 +1988,6 @@ static struct irq_chip xen_percpu_chip __read_mostly = { + .irq_ack = ack_dynirq, + }; + +-int xen_set_callback_via(uint64_t via) +-{ +- struct xen_hvm_param a; +- a.domid = DOMID_SELF; +- a.index = HVM_PARAM_CALLBACK_IRQ; +- a.value = via; +- return HYPERVISOR_hvm_op(HVMOP_set_param, &a); +-} +-EXPORT_SYMBOL_GPL(xen_set_callback_via); +- + #ifdef CONFIG_XEN_PVHVM + /* Vector callbacks are better than PCI interrupts to receive event + * channel notifications because we can receive vector callbacks on any +diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c +index 5e30602fdbad8..c45646450135f 100644 +--- a/drivers/xen/platform-pci.c ++++ b/drivers/xen/platform-pci.c +@@ -149,7 +149,6 @@ static int platform_pci_probe(struct pci_dev *pdev, + ret = gnttab_init(); + if (ret) + goto grant_out; +- xenbus_probe(NULL); + return 0; + grant_out: + gnttab_free_auto_xlat_frames(); +diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h +index 88516a8a9f932..a9bb5f91082d3 100644 +--- a/drivers/xen/xenbus/xenbus.h ++++ b/drivers/xen/xenbus/xenbus.h +@@ -115,6 +115,7 @@ int xenbus_probe_node(struct xen_bus_type *bus, + const char *type, + const char *nodename); + int xenbus_probe_devices(struct xen_bus_type *bus); ++void xenbus_probe(void); + + void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); + +diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c +index eb5151fc8efab..e5fda0256feb3 100644 +--- a/drivers/xen/xenbus/xenbus_comms.c ++++ b/drivers/xen/xenbus/xenbus_comms.c +@@ -57,16 +57,8 @@ DEFINE_MUTEX(xs_response_mutex); + static int xenbus_irq; + static struct task_struct *xenbus_task; + +-static DECLARE_WORK(probe_work, xenbus_probe); +- +- + static irqreturn_t wake_waiting(int irq, void *unused) + { +- if (unlikely(xenstored_ready == 0)) { +- xenstored_ready = 1; +- schedule_work(&probe_work); +- } +- + wake_up(&xb_waitq); + return IRQ_HANDLED; + } +diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c +index e6d0903459e11..14ccf13ab8fa1 100644 +--- a/drivers/xen/xenbus/xenbus_probe.c ++++ b/drivers/xen/xenbus/xenbus_probe.c +@@ -683,29 +683,76 @@ void unregister_xenstore_notifier(struct notifier_block *nb) + } + EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); + +-void xenbus_probe(struct work_struct *unused) ++void xenbus_probe(void) + { + xenstored_ready = 1; + ++ /* ++ * In the HVM case, xenbus_init() deferred its call to ++ * xs_init() in case callbacks were not operational yet. ++ * So do it now. ++ */ ++ if (xen_store_domain_type == XS_HVM) ++ xs_init(); ++ + /* Notify others that xenstore is up */ + blocking_notifier_call_chain(&xenstore_chain, 0, NULL); + } +-EXPORT_SYMBOL_GPL(xenbus_probe); + +-static int __init xenbus_probe_initcall(void) ++/* ++ * Returns true when XenStore init must be deferred in order to ++ * allow the PCI platform device to be initialised, before we ++ * can actually have event channel interrupts working. ++ */ ++static bool xs_hvm_defer_init_for_callback(void) + { +- if (!xen_domain()) +- return -ENODEV; ++#ifdef CONFIG_XEN_PVHVM ++ return xen_store_domain_type == XS_HVM && ++ !xen_have_vector_callback; ++#else ++ return false; ++#endif ++} + +- if (xen_initial_domain() || xen_hvm_domain()) +- return 0; ++static int __init xenbus_probe_initcall(void) ++{ ++ /* ++ * Probe XenBus here in the XS_PV case, and also XS_HVM unless we ++ * need to wait for the platform PCI device to come up. ++ */ ++ if (xen_store_domain_type == XS_PV || ++ (xen_store_domain_type == XS_HVM && ++ !xs_hvm_defer_init_for_callback())) ++ xenbus_probe(); + +- xenbus_probe(NULL); + return 0; + } +- + device_initcall(xenbus_probe_initcall); + ++int xen_set_callback_via(uint64_t via) ++{ ++ struct xen_hvm_param a; ++ int ret; ++ ++ a.domid = DOMID_SELF; ++ a.index = HVM_PARAM_CALLBACK_IRQ; ++ a.value = via; ++ ++ ret = HYPERVISOR_hvm_op(HVMOP_set_param, &a); ++ if (ret) ++ return ret; ++ ++ /* ++ * If xenbus_probe_initcall() deferred the xenbus_probe() ++ * due to the callback not functioning yet, we can do it now. ++ */ ++ if (!xenstored_ready && xs_hvm_defer_init_for_callback()) ++ xenbus_probe(); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(xen_set_callback_via); ++ + /* Set up event channel for xenstored which is run as a local process + * (this is normally used only in dom0) + */ +@@ -818,11 +865,17 @@ static int __init xenbus_init(void) + break; + } + +- /* Initialize the interface to xenstore. */ +- err = xs_init(); +- if (err) { +- pr_warn("Error initializing xenstore comms: %i\n", err); +- goto out_error; ++ /* ++ * HVM domains may not have a functional callback yet. In that ++ * case let xs_init() be called from xenbus_probe(), which will ++ * get invoked at an appropriate time. ++ */ ++ if (xen_store_domain_type != XS_HVM) { ++ err = xs_init(); ++ if (err) { ++ pr_warn("Error initializing xenstore comms: %i\n", err); ++ goto out_error; ++ } + } + + if ((xen_store_domain_type != XS_LOCAL) && +diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c +index ace49a999ecec..59e7a2ad440fc 100644 +--- a/fs/btrfs/block-group.c ++++ b/fs/btrfs/block-group.c +@@ -2497,7 +2497,8 @@ again: + * Go through delayed refs for all the stuff we've just kicked off + * and then loop back (just once) + */ +- ret = btrfs_run_delayed_refs(trans, 0); ++ if (!ret) ++ ret = btrfs_run_delayed_refs(trans, 0); + if (!ret && loops == 0) { + loops++; + spin_lock(&cur_trans->dirty_bgs_lock); +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c +index c0dd839e99b79..6317394f02b86 100644 +--- a/fs/btrfs/extent-tree.c ++++ b/fs/btrfs/extent-tree.c +@@ -5390,7 +5390,15 @@ int btrfs_drop_snapshot(struct btrfs_root *root, + goto out_free; + } + +- trans = btrfs_start_transaction(tree_root, 0); ++ /* ++ * Use join to avoid potential EINTR from transaction ++ * start. See wait_reserve_ticket and the whole ++ * reservation callchain. ++ */ ++ if (for_reloc) ++ trans = btrfs_join_transaction(tree_root); ++ else ++ trans = btrfs_start_transaction(tree_root, 0); + if (IS_ERR(trans)) { + err = PTR_ERR(trans); + goto out_free; +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c +index 903136ceac34a..ecdefa7262d2b 100644 +--- a/fs/btrfs/send.c ++++ b/fs/btrfs/send.c +@@ -5519,6 +5519,21 @@ static int clone_range(struct send_ctx *sctx, + break; + offset += clone_len; + clone_root->offset += clone_len; ++ ++ /* ++ * If we are cloning from the file we are currently processing, ++ * and using the send root as the clone root, we must stop once ++ * the current clone offset reaches the current eof of the file ++ * at the receiver, otherwise we would issue an invalid clone ++ * operation (source range going beyond eof) and cause the ++ * receiver to fail. So if we reach the current eof, bail out ++ * and fallback to a regular write. ++ */ ++ if (clone_root->root == sctx->send_root && ++ clone_root->ino == sctx->cur_ino && ++ clone_root->offset >= sctx->cur_inode_next_write_offset) ++ break; ++ + data_offset += clone_len; + next: + path->slots[0]++; +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c +index 67ffbe92944c6..db3b17bca11f5 100644 +--- a/fs/btrfs/volumes.c ++++ b/fs/btrfs/volumes.c +@@ -4409,6 +4409,8 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info) + btrfs_warn(fs_info, + "balance: cannot set exclusive op status, resume manually"); + ++ btrfs_release_path(path); ++ + mutex_lock(&fs_info->balance_mutex); + BUG_ON(fs_info->balance_ctl); + spin_lock(&fs_info->balance_lock); +diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c +index 6d6de183915b5..4ffbf8f965814 100644 +--- a/fs/cifs/transport.c ++++ b/fs/cifs/transport.c +@@ -339,7 +339,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst, + if (ssocket == NULL) + return -EAGAIN; + +- if (signal_pending(current)) { ++ if (fatal_signal_pending(current)) { + cifs_dbg(FYI, "signal pending before send request\n"); + return -ERESTARTSYS; + } +@@ -431,7 +431,7 @@ unmask: + + if (signal_pending(current) && (total_len != send_length)) { + cifs_dbg(FYI, "signal is pending after attempt to send\n"); +- rc = -EINTR; ++ rc = -ERESTARTSYS; + } + + /* uncork it */ +diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h +index dd90c9792909d..0e7316a86240b 100644 +--- a/include/asm-generic/bitops/atomic.h ++++ b/include/asm-generic/bitops/atomic.h +@@ -11,19 +11,19 @@ + * See Documentation/atomic_bitops.txt for details. + */ + +-static inline void set_bit(unsigned int nr, volatile unsigned long *p) ++static __always_inline void set_bit(unsigned int nr, volatile unsigned long *p) + { + p += BIT_WORD(nr); + atomic_long_or(BIT_MASK(nr), (atomic_long_t *)p); + } + +-static inline void clear_bit(unsigned int nr, volatile unsigned long *p) ++static __always_inline void clear_bit(unsigned int nr, volatile unsigned long *p) + { + p += BIT_WORD(nr); + atomic_long_andnot(BIT_MASK(nr), (atomic_long_t *)p); + } + +-static inline void change_bit(unsigned int nr, volatile unsigned long *p) ++static __always_inline void change_bit(unsigned int nr, volatile unsigned long *p) + { + p += BIT_WORD(nr); + atomic_long_xor(BIT_MASK(nr), (atomic_long_t *)p); +diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h +index c71eb294da954..6c8f8e5e33c3d 100644 +--- a/include/net/inet_connection_sock.h ++++ b/include/net/inet_connection_sock.h +@@ -83,6 +83,8 @@ struct inet_connection_sock_af_ops { + * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options) + * @icsk_ack: Delayed ACK control data + * @icsk_mtup; MTU probing control data ++ * @icsk_probes_tstamp: Probe timestamp (cleared by non-zero window ack) ++ * @icsk_user_timeout: TCP_USER_TIMEOUT value + */ + struct inet_connection_sock { + /* inet_sock has to be the first member! */ +@@ -133,6 +135,7 @@ struct inet_connection_sock { + + u32 probe_timestamp; + } icsk_mtup; ++ u32 icsk_probes_tstamp; + u32 icsk_user_timeout; + + u64 icsk_ca_priv[104 / sizeof(u64)]; +diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h +index eba01ab5a55e0..fe9a9fa2ebc45 100644 +--- a/include/xen/xenbus.h ++++ b/include/xen/xenbus.h +@@ -187,7 +187,7 @@ void xs_suspend_cancel(void); + + struct work_struct; + +-void xenbus_probe(struct work_struct *); ++void xenbus_probe(void); + + #define XENBUS_IS_ERR_READ(str) ({ \ + if (!IS_ERR(str) && strlen(str) == 0) { \ +diff --git a/mm/kasan/init.c b/mm/kasan/init.c +index ce45c491ebcdb..ee21e1c1150c6 100644 +--- a/mm/kasan/init.c ++++ b/mm/kasan/init.c +@@ -388,9 +388,10 @@ static void kasan_remove_pmd_table(pmd_t *pmd, unsigned long addr, + + if (kasan_pte_table(*pmd)) { + if (IS_ALIGNED(addr, PMD_SIZE) && +- IS_ALIGNED(next, PMD_SIZE)) ++ IS_ALIGNED(next, PMD_SIZE)) { + pmd_clear(pmd); +- continue; ++ continue; ++ } + } + pte = pte_offset_kernel(pmd, addr); + kasan_remove_pte_table(pte, addr, next); +@@ -413,9 +414,10 @@ static void kasan_remove_pud_table(pud_t *pud, unsigned long addr, + + if (kasan_pmd_table(*pud)) { + if (IS_ALIGNED(addr, PUD_SIZE) && +- IS_ALIGNED(next, PUD_SIZE)) ++ IS_ALIGNED(next, PUD_SIZE)) { + pud_clear(pud); +- continue; ++ continue; ++ } + } + pmd = pmd_offset(pud, addr); + pmd_base = pmd_offset(pud, 0); +@@ -439,9 +441,10 @@ static void kasan_remove_p4d_table(p4d_t *p4d, unsigned long addr, + + if (kasan_pud_table(*p4d)) { + if (IS_ALIGNED(addr, P4D_SIZE) && +- IS_ALIGNED(next, P4D_SIZE)) ++ IS_ALIGNED(next, P4D_SIZE)) { + p4d_clear(p4d); +- continue; ++ continue; ++ } + } + pud = pud_offset(p4d, addr); + kasan_remove_pud_table(pud, addr, next); +@@ -473,9 +476,10 @@ void kasan_remove_zero_shadow(void *start, unsigned long size) + + if (kasan_p4d_table(*pgd)) { + if (IS_ALIGNED(addr, PGDIR_SIZE) && +- IS_ALIGNED(next, PGDIR_SIZE)) ++ IS_ALIGNED(next, PGDIR_SIZE)) { + pgd_clear(pgd); +- continue; ++ continue; ++ } + } + + p4d = p4d_offset(pgd, addr); +@@ -499,7 +503,6 @@ int kasan_add_zero_shadow(void *start, unsigned long size) + + ret = kasan_populate_early_shadow(shadow_start, shadow_end); + if (ret) +- kasan_remove_zero_shadow(shadow_start, +- size >> KASAN_SHADOW_SCALE_SHIFT); ++ kasan_remove_zero_shadow(start, size); + return ret; + } +diff --git a/net/core/dev.c b/net/core/dev.c +index 20c7fd7b8b4bc..ec66d13d2bdad 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -8692,6 +8692,11 @@ static netdev_features_t netdev_fix_features(struct net_device *dev, + } + } + ++ if ((features & NETIF_F_HW_TLS_RX) && !(features & NETIF_F_RXCSUM)) { ++ netdev_dbg(dev, "Dropping TLS RX HW offload feature since no RXCSUM feature.\n"); ++ features &= ~NETIF_F_HW_TLS_RX; ++ } ++ + return features; + } + +diff --git a/net/core/skbuff.c b/net/core/skbuff.c +index 961cb5a88c958..45117fa299837 100644 +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -431,7 +431,11 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, + + len += NET_SKB_PAD; + +- if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) || ++ /* If requested length is either too small or too big, ++ * we use kmalloc() for skb->head allocation. ++ */ ++ if (len <= SKB_WITH_OVERHEAD(1024) || ++ len > SKB_WITH_OVERHEAD(PAGE_SIZE) || + (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { + skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE); + if (!skb) +diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c +index 9745c52f49ca4..ac5c4f6cdefee 100644 +--- a/net/ipv4/inet_connection_sock.c ++++ b/net/ipv4/inet_connection_sock.c +@@ -840,6 +840,7 @@ struct sock *inet_csk_clone_lock(const struct sock *sk, + newicsk->icsk_retransmits = 0; + newicsk->icsk_backoff = 0; + newicsk->icsk_probes_out = 0; ++ newicsk->icsk_probes_tstamp = 0; + + /* Deinitialize accept_queue to trap illegal accesses. */ + memset(&newicsk->icsk_accept_queue, 0, sizeof(newicsk->icsk_accept_queue)); +diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c +index cc23f1ce239c2..8cd3224d913e0 100644 +--- a/net/ipv4/netfilter/ipt_rpfilter.c ++++ b/net/ipv4/netfilter/ipt_rpfilter.c +@@ -76,7 +76,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) + flow.daddr = iph->saddr; + flow.saddr = rpfilter_get_saddr(iph->daddr); + flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0; +- flow.flowi4_tos = RT_TOS(iph->tos); ++ flow.flowi4_tos = iph->tos & IPTOS_RT_MASK; + flow.flowi4_scope = RT_SCOPE_UNIVERSE; + flow.flowi4_oif = l3mdev_master_ifindex_rcu(xt_in(par)); + +diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c +index d3ced6a39bcf1..6ddec8a23942b 100644 +--- a/net/ipv4/tcp.c ++++ b/net/ipv4/tcp.c +@@ -2627,6 +2627,7 @@ int tcp_disconnect(struct sock *sk, int flags) + icsk->icsk_backoff = 0; + tp->snd_cwnd = 2; + icsk->icsk_probes_out = 0; ++ icsk->icsk_probes_tstamp = 0; + icsk->icsk_rto = TCP_TIMEOUT_INIT; + tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; + tp->snd_cwnd = TCP_INIT_CWND; +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index adace90f49fac..7411a43134629 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -3286,6 +3286,7 @@ static void tcp_ack_probe(struct sock *sk) + return; + if (!after(TCP_SKB_CB(head)->end_seq, tcp_wnd_end(tp))) { + icsk->icsk_backoff = 0; ++ icsk->icsk_probes_tstamp = 0; + inet_csk_clear_xmit_timer(sk, ICSK_TIME_PROBE0); + /* Socket must be waked up by subsequent tcp_data_snd_check(). + * This function is not for random using! +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c +index 87a5037a9cb3e..04acdca4bb0d5 100644 +--- a/net/ipv4/tcp_ipv4.c ++++ b/net/ipv4/tcp_ipv4.c +@@ -1657,6 +1657,7 @@ int tcp_v4_early_demux(struct sk_buff *skb) + bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) + { + u32 limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf); ++ u32 tail_gso_size, tail_gso_segs; + struct skb_shared_info *shinfo; + const struct tcphdr *th; + struct tcphdr *thtail; +@@ -1664,6 +1665,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) + unsigned int hdrlen; + bool fragstolen; + u32 gso_segs; ++ u32 gso_size; + int delta; + + /* In case all data was pulled from skb frags (in __pskb_pull_tail()), +@@ -1689,13 +1691,6 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) + */ + th = (const struct tcphdr *)skb->data; + hdrlen = th->doff * 4; +- shinfo = skb_shinfo(skb); +- +- if (!shinfo->gso_size) +- shinfo->gso_size = skb->len - hdrlen; +- +- if (!shinfo->gso_segs) +- shinfo->gso_segs = 1; + + tail = sk->sk_backlog.tail; + if (!tail) +@@ -1718,6 +1713,15 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) + goto no_coalesce; + + __skb_pull(skb, hdrlen); ++ ++ shinfo = skb_shinfo(skb); ++ gso_size = shinfo->gso_size ?: skb->len; ++ gso_segs = shinfo->gso_segs ?: 1; ++ ++ shinfo = skb_shinfo(tail); ++ tail_gso_size = shinfo->gso_size ?: (tail->len - hdrlen); ++ tail_gso_segs = shinfo->gso_segs ?: 1; ++ + if (skb_try_coalesce(tail, skb, &fragstolen, &delta)) { + TCP_SKB_CB(tail)->end_seq = TCP_SKB_CB(skb)->end_seq; + +@@ -1744,11 +1748,8 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) + } + + /* Not as strict as GRO. We only need to carry mss max value */ +- skb_shinfo(tail)->gso_size = max(shinfo->gso_size, +- skb_shinfo(tail)->gso_size); +- +- gso_segs = skb_shinfo(tail)->gso_segs + shinfo->gso_segs; +- skb_shinfo(tail)->gso_segs = min_t(u32, gso_segs, 0xFFFF); ++ shinfo->gso_size = max(gso_size, tail_gso_size); ++ shinfo->gso_segs = min_t(u32, gso_segs + tail_gso_segs, 0xFFFF); + + sk->sk_backlog.len += delta; + __NET_INC_STATS(sock_net(sk), +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index 5e311e6a31d51..5da6ffce390c2 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -3835,6 +3835,7 @@ void tcp_send_probe0(struct sock *sk) + /* Cancel probe timer, if it is not required. */ + icsk->icsk_probes_out = 0; + icsk->icsk_backoff = 0; ++ icsk->icsk_probes_tstamp = 0; + return; + } + +diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c +index dd5a6317a8018..7fcd116fbd378 100644 +--- a/net/ipv4/tcp_timer.c ++++ b/net/ipv4/tcp_timer.c +@@ -344,6 +344,7 @@ static void tcp_probe_timer(struct sock *sk) + + if (tp->packets_out || !skb) { + icsk->icsk_probes_out = 0; ++ icsk->icsk_probes_tstamp = 0; + return; + } + +@@ -355,13 +356,12 @@ static void tcp_probe_timer(struct sock *sk) + * corresponding system limit. We also implement similar policy when + * we use RTO to probe window in tcp_retransmit_timer(). + */ +- if (icsk->icsk_user_timeout) { +- u32 elapsed = tcp_model_timeout(sk, icsk->icsk_probes_out, +- tcp_probe0_base(sk)); +- +- if (elapsed >= icsk->icsk_user_timeout) +- goto abort; +- } ++ if (!icsk->icsk_probes_tstamp) ++ icsk->icsk_probes_tstamp = tcp_jiffies32; ++ else if (icsk->icsk_user_timeout && ++ (s32)(tcp_jiffies32 - icsk->icsk_probes_tstamp) >= ++ msecs_to_jiffies(icsk->icsk_user_timeout)) ++ goto abort; + + max_probes = sock_net(sk)->ipv4.sysctl_tcp_retries2; + if (sock_flag(sk, SOCK_DEAD)) { +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index c7ff200d0bd41..994a150ae3e90 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -2495,7 +2495,8 @@ int udp_v4_early_demux(struct sk_buff *skb) + */ + if (!inet_sk(sk)->inet_daddr && in_dev) + return ip_mc_validate_source(skb, iph->daddr, +- iph->saddr, iph->tos, ++ iph->saddr, ++ iph->tos & IPTOS_RT_MASK, + skb->dev, in_dev, &itag); + } + return 0; +diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c +index 635b2482fa204..52feab2baeee5 100644 +--- a/net/ipv6/addrconf.c ++++ b/net/ipv6/addrconf.c +@@ -2452,8 +2452,9 @@ static void addrconf_add_mroute(struct net_device *dev) + .fc_ifindex = dev->ifindex, + .fc_dst_len = 8, + .fc_flags = RTF_UP, +- .fc_type = RTN_UNICAST, ++ .fc_type = RTN_MULTICAST, + .fc_nlinfo.nl_net = dev_net(dev), ++ .fc_protocol = RTPROT_KERNEL, + }; + + ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0); +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c +index 61e95029c18f5..c9399e81c5059 100644 +--- a/net/sched/cls_tcindex.c ++++ b/net/sched/cls_tcindex.c +@@ -366,9 +366,13 @@ tcindex_set_parms(struct net *net, struct tcf_proto *tp, unsigned long base, + if (tb[TCA_TCINDEX_MASK]) + cp->mask = nla_get_u16(tb[TCA_TCINDEX_MASK]); + +- if (tb[TCA_TCINDEX_SHIFT]) ++ if (tb[TCA_TCINDEX_SHIFT]) { + cp->shift = nla_get_u32(tb[TCA_TCINDEX_SHIFT]); +- ++ if (cp->shift > 16) { ++ err = -EINVAL; ++ goto errout; ++ } ++ } + if (!cp->hash) { + /* Hash not specified, use perfect hash if the upper limit + * of the hashing index is below the threshold. +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c +index 50794125bf024..b65a405f607b2 100644 +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -409,7 +409,8 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, + { + struct qdisc_rate_table *rtab; + +- if (tab == NULL || r->rate == 0 || r->cell_log == 0 || ++ if (tab == NULL || r->rate == 0 || ++ r->cell_log == 0 || r->cell_log >= 32 || + nla_len(tab) != TC_RTAB_SIZE) { + NL_SET_ERR_MSG(extack, "Invalid rate table parameters for searching"); + return NULL; +diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c +index 11554d0412f06..1b8409ec2c97f 100644 +--- a/sound/core/seq/oss/seq_oss_synth.c ++++ b/sound/core/seq/oss/seq_oss_synth.c +@@ -611,7 +611,8 @@ snd_seq_oss_synth_make_info(struct seq_oss_devinfo *dp, int dev, struct synth_in + + if (info->is_midi) { + struct midi_info minf; +- snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf); ++ if (snd_seq_oss_midi_make_info(dp, info->midi_mapped, &minf)) ++ return -ENXIO; + inf->synth_type = SYNTH_TYPE_MIDI; + inf->synth_subtype = 0; + inf->nr_voices = 16; +diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c +index 0ab40a8a68fb5..834367dd54e1b 100644 +--- a/sound/pci/hda/patch_via.c ++++ b/sound/pci/hda/patch_via.c +@@ -113,6 +113,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec) + spec->codec_type = VT1708S; + spec->gen.indep_hp = 1; + spec->gen.keep_eapd_on = 1; ++ spec->gen.dac_min_mute = 1; + spec->gen.pcm_playback_hook = via_playback_pcm_hook; + spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; + codec->power_save_node = 1; +diff --git a/sound/soc/intel/boards/haswell.c b/sound/soc/intel/boards/haswell.c +index 3dadf9bff796a..cf47fd9cd506b 100644 +--- a/sound/soc/intel/boards/haswell.c ++++ b/sound/soc/intel/boards/haswell.c +@@ -206,6 +206,7 @@ static struct platform_driver haswell_audio = { + .probe = haswell_audio_probe, + .driver = { + .name = "haswell-audio", ++ .pm = &snd_soc_pm_ops, + }, + }; + +diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh +index 4811067d9b053..4e19a1c00ddd8 100755 +--- a/tools/testing/selftests/net/fib_tests.sh ++++ b/tools/testing/selftests/net/fib_tests.sh +@@ -1055,7 +1055,6 @@ ipv6_addr_metric_test() + + check_route6 "2001:db8:104::1 dev dummy2 proto kernel metric 260" + log_test $? 0 "Set metric with peer route on local side" +- log_test $? 0 "User specified metric on local address" + check_route6 "2001:db8:104::2 dev dummy2 proto kernel metric 260" + log_test $? 0 "Set metric with peer route on peer side" + diff --git a/patch/kernel/odroidxu4-current/patch-5.4.93-94.patch b/patch/kernel/odroidxu4-current/patch-5.4.93-94.patch new file mode 100644 index 000000000..e14ba30e6 --- /dev/null +++ b/patch/kernel/odroidxu4-current/patch-5.4.93-94.patch @@ -0,0 +1,1065 @@ +diff --git a/Documentation/admin-guide/device-mapper/dm-integrity.rst b/Documentation/admin-guide/device-mapper/dm-integrity.rst +index a30aa91b5fbe9..3463883844c0b 100644 +--- a/Documentation/admin-guide/device-mapper/dm-integrity.rst ++++ b/Documentation/admin-guide/device-mapper/dm-integrity.rst +@@ -177,6 +177,12 @@ bitmap_flush_interval:number + The bitmap flush interval in milliseconds. The metadata buffers + are synchronized when this interval expires. + ++legacy_recalculate ++ Allow recalculating of volumes with HMAC keys. This is disabled by ++ default for security reasons - an attacker could modify the volume, ++ set recalc_sector to zero, and the kernel would not detect the ++ modification. ++ + + The journal mode (D/J), buffer_sectors, journal_watermark, commit_time can + be changed when reloading the target (load an inactive table and swap the +diff --git a/Makefile b/Makefile +index f8462f8d8a151..ad1b8dc6e462a 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 4 +-SUBLEVEL = 93 ++SUBLEVEL = 94 + EXTRAVERSION = + NAME = Kleptomaniac Octopus + +diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h +index 08df42e4db96c..51d867cf146c1 100644 +--- a/arch/arm64/include/asm/memory.h ++++ b/arch/arm64/include/asm/memory.h +@@ -178,7 +178,6 @@ extern u64 vabits_actual; + #include + #include + +-extern s64 physvirt_offset; + extern s64 memstart_addr; + /* PHYS_OFFSET - the physical address of the start of memory. */ + #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; }) +@@ -254,7 +253,7 @@ static inline const void *__tag_set(const void *addr, u8 tag) + */ + #define __is_lm_address(addr) (!(((u64)addr) & BIT(vabits_actual - 1))) + +-#define __lm_to_phys(addr) (((addr) + physvirt_offset)) ++#define __lm_to_phys(addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET) + #define __kimg_to_phys(addr) ((addr) - kimage_voffset) + + #define __virt_to_phys_nodebug(x) ({ \ +@@ -272,7 +271,7 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x); + #define __phys_addr_symbol(x) __pa_symbol_nodebug(x) + #endif /* CONFIG_DEBUG_VIRTUAL */ + +-#define __phys_to_virt(x) ((unsigned long)((x) - physvirt_offset)) ++#define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET) + #define __phys_to_kimg(x) ((unsigned long)((x) + kimage_voffset)) + + /* +diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h +index 69dfc340e71b1..8c420f916fe2e 100644 +--- a/arch/arm64/include/asm/pgtable.h ++++ b/arch/arm64/include/asm/pgtable.h +@@ -23,6 +23,8 @@ + #define VMALLOC_START (MODULES_END) + #define VMALLOC_END (- PUD_SIZE - VMEMMAP_SIZE - SZ_64K) + ++#define vmemmap ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT)) ++ + #define FIRST_USER_ADDRESS 0UL + + #ifndef __ASSEMBLY__ +@@ -33,8 +35,6 @@ + #include + #include + +-extern struct page *vmemmap; +- + extern void __pte_error(const char *file, int line, unsigned long val); + extern void __pmd_error(const char *file, int line, unsigned long val); + extern void __pud_error(const char *file, int line, unsigned long val); +diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c +index 45c00a54909c9..602bd19630ff8 100644 +--- a/arch/arm64/mm/init.c ++++ b/arch/arm64/mm/init.c +@@ -50,12 +50,6 @@ + s64 memstart_addr __ro_after_init = -1; + EXPORT_SYMBOL(memstart_addr); + +-s64 physvirt_offset __ro_after_init; +-EXPORT_SYMBOL(physvirt_offset); +- +-struct page *vmemmap __ro_after_init; +-EXPORT_SYMBOL(vmemmap); +- + phys_addr_t arm64_dma_phys_limit __ro_after_init; + + #ifdef CONFIG_KEXEC_CORE +@@ -321,20 +315,6 @@ void __init arm64_memblock_init(void) + memstart_addr = round_down(memblock_start_of_DRAM(), + ARM64_MEMSTART_ALIGN); + +- physvirt_offset = PHYS_OFFSET - PAGE_OFFSET; +- +- vmemmap = ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT)); +- +- /* +- * If we are running with a 52-bit kernel VA config on a system that +- * does not support it, we have to offset our vmemmap and physvirt_offset +- * s.t. we avoid the 52-bit portion of the direct linear map +- */ +- if (IS_ENABLED(CONFIG_ARM64_VA_BITS_52) && (vabits_actual != 52)) { +- vmemmap += (_PAGE_OFFSET(48) - _PAGE_OFFSET(52)) >> PAGE_SHIFT; +- physvirt_offset = PHYS_OFFSET - _PAGE_OFFSET(48); +- } +- + /* + * Remove the memory that we will not be able to cover with the + * linear mapping. Take care not to clip the kernel which may be +@@ -349,6 +329,16 @@ void __init arm64_memblock_init(void) + memblock_remove(0, memstart_addr); + } + ++ /* ++ * If we are running with a 52-bit kernel VA config on a system that ++ * does not support it, we have to place the available physical ++ * memory in the 48-bit addressable part of the linear region, i.e., ++ * we have to move it upward. Since memstart_addr represents the ++ * physical address of PAGE_OFFSET, we have to *subtract* from it. ++ */ ++ if (IS_ENABLED(CONFIG_ARM64_VA_BITS_52) && (vabits_actual != 52)) ++ memstart_addr -= _PAGE_OFFSET(48) - _PAGE_OFFSET(52); ++ + /* + * Apply the memory limit if it was set. Since the kernel may be loaded + * high up in memory, add back the kernel region that must be accessible +diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c +index 3985d6e1c17dc..89a053b1d2799 100644 +--- a/drivers/gpio/gpio-mvebu.c ++++ b/drivers/gpio/gpio-mvebu.c +@@ -657,9 +657,8 @@ static void mvebu_pwm_get_state(struct pwm_chip *chip, + + spin_lock_irqsave(&mvpwm->lock, flags); + +- val = (unsigned long long) +- readl_relaxed(mvebu_pwmreg_blink_on_duration(mvpwm)); +- val *= NSEC_PER_SEC; ++ u = readl_relaxed(mvebu_pwmreg_blink_on_duration(mvpwm)); ++ val = (unsigned long long) u * NSEC_PER_SEC; + do_div(val, mvpwm->clk_rate); + if (val > UINT_MAX) + state->duty_cycle = UINT_MAX; +@@ -668,21 +667,17 @@ static void mvebu_pwm_get_state(struct pwm_chip *chip, + else + state->duty_cycle = 1; + +- val = (unsigned long long) +- readl_relaxed(mvebu_pwmreg_blink_off_duration(mvpwm)); ++ val = (unsigned long long) u; /* on duration */ ++ /* period = on + off duration */ ++ val += readl_relaxed(mvebu_pwmreg_blink_off_duration(mvpwm)); + val *= NSEC_PER_SEC; + do_div(val, mvpwm->clk_rate); +- if (val < state->duty_cycle) { ++ if (val > UINT_MAX) ++ state->period = UINT_MAX; ++ else if (val) ++ state->period = val; ++ else + state->period = 1; +- } else { +- val -= state->duty_cycle; +- if (val > UINT_MAX) +- state->period = UINT_MAX; +- else if (val) +- state->period = val; +- else +- state->period = 1; +- } + + regmap_read(mvchip->regs, GPIO_BLINK_EN_OFF + mvchip->offset, &u); + if (u) +diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c +index 9e852b4bbf92b..73dafa60080f1 100644 +--- a/drivers/hid/wacom_sys.c ++++ b/drivers/hid/wacom_sys.c +@@ -147,9 +147,9 @@ static int wacom_wac_pen_serial_enforce(struct hid_device *hdev, + } + + if (flush) +- wacom_wac_queue_flush(hdev, &wacom_wac->pen_fifo); ++ wacom_wac_queue_flush(hdev, wacom_wac->pen_fifo); + else if (insert) +- wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo, ++ wacom_wac_queue_insert(hdev, wacom_wac->pen_fifo, + raw_data, report_size); + + return insert && !flush; +@@ -1280,7 +1280,7 @@ static void wacom_devm_kfifo_release(struct device *dev, void *res) + static int wacom_devm_kfifo_alloc(struct wacom *wacom) + { + struct wacom_wac *wacom_wac = &wacom->wacom_wac; +- struct kfifo_rec_ptr_2 *pen_fifo = &wacom_wac->pen_fifo; ++ struct kfifo_rec_ptr_2 *pen_fifo; + int error; + + pen_fifo = devres_alloc(wacom_devm_kfifo_release, +@@ -1297,6 +1297,7 @@ static int wacom_devm_kfifo_alloc(struct wacom *wacom) + } + + devres_add(&wacom->hdev->dev, pen_fifo); ++ wacom_wac->pen_fifo = pen_fifo; + + return 0; + } +diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h +index da612b6e9c779..195910dd2154e 100644 +--- a/drivers/hid/wacom_wac.h ++++ b/drivers/hid/wacom_wac.h +@@ -342,7 +342,7 @@ struct wacom_wac { + struct input_dev *pen_input; + struct input_dev *touch_input; + struct input_dev *pad_input; +- struct kfifo_rec_ptr_2 pen_fifo; ++ struct kfifo_rec_ptr_2 *pen_fifo; + int pid; + int num_contacts_left; + u8 bt_features; +diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c +index 57f66f2ad98dc..c967c2cdba870 100644 +--- a/drivers/md/dm-integrity.c ++++ b/drivers/md/dm-integrity.c +@@ -254,6 +254,7 @@ struct dm_integrity_c { + bool journal_uptodate; + bool just_formatted; + bool recalculate_flag; ++ bool legacy_recalculate; + + struct alg_spec internal_hash_alg; + struct alg_spec journal_crypt_alg; +@@ -381,6 +382,14 @@ static int dm_integrity_failed(struct dm_integrity_c *ic) + return READ_ONCE(ic->failed); + } + ++static bool dm_integrity_disable_recalculate(struct dm_integrity_c *ic) ++{ ++ if ((ic->internal_hash_alg.key || ic->journal_mac_alg.key) && ++ !ic->legacy_recalculate) ++ return true; ++ return false; ++} ++ + static commit_id_t dm_integrity_commit_id(struct dm_integrity_c *ic, unsigned i, + unsigned j, unsigned char seq) + { +@@ -2998,6 +3007,7 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type, + arg_count += !!ic->internal_hash_alg.alg_string; + arg_count += !!ic->journal_crypt_alg.alg_string; + arg_count += !!ic->journal_mac_alg.alg_string; ++ arg_count += ic->legacy_recalculate; + DMEMIT("%s %llu %u %c %u", ic->dev->name, (unsigned long long)ic->start, + ic->tag_size, ic->mode, arg_count); + if (ic->meta_dev) +@@ -3017,6 +3027,8 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type, + DMEMIT(" sectors_per_bit:%llu", (unsigned long long)ic->sectors_per_block << ic->log2_blocks_per_bitmap_bit); + DMEMIT(" bitmap_flush_interval:%u", jiffies_to_msecs(ic->bitmap_flush_interval)); + } ++ if (ic->legacy_recalculate) ++ DMEMIT(" legacy_recalculate"); + + #define EMIT_ALG(a, n) \ + do { \ +@@ -3625,7 +3637,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) + unsigned extra_args; + struct dm_arg_set as; + static const struct dm_arg _args[] = { +- {0, 15, "Invalid number of feature args"}, ++ {0, 14, "Invalid number of feature args"}, + }; + unsigned journal_sectors, interleave_sectors, buffer_sectors, journal_watermark, sync_msec; + bool should_write_sb; +@@ -3769,6 +3781,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv) + goto bad; + } else if (!strcmp(opt_string, "recalculate")) { + ic->recalculate_flag = true; ++ } else if (!strcmp(opt_string, "legacy_recalculate")) { ++ ic->legacy_recalculate = true; + } else { + r = -EINVAL; + ti->error = "Invalid argument"; +@@ -4067,6 +4081,14 @@ try_smaller_buffer: + } + } + ++ if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING) && ++ le64_to_cpu(ic->sb->recalc_sector) < ic->provided_data_sectors && ++ dm_integrity_disable_recalculate(ic)) { ++ ti->error = "Recalculating with HMAC is disabled for security reasons - if you really need it, use the argument \"legacy_recalculate\""; ++ r = -EOPNOTSUPP; ++ goto bad; ++ } ++ + ic->bufio = dm_bufio_client_create(ic->meta_dev ? ic->meta_dev->bdev : ic->dev->bdev, + 1U << (SECTOR_SHIFT + ic->log2_buffer_sectors), 1, 0, NULL, NULL); + if (IS_ERR(ic->bufio)) { +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c +index be06b26d6ca03..7adecfd0c1e99 100644 +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -490,8 +490,8 @@ build_preauth_ctxt(struct smb2_preauth_neg_context *pneg_ctxt) + pneg_ctxt->ContextType = SMB2_PREAUTH_INTEGRITY_CAPABILITIES; + pneg_ctxt->DataLength = cpu_to_le16(38); + pneg_ctxt->HashAlgorithmCount = cpu_to_le16(1); +- pneg_ctxt->SaltLength = cpu_to_le16(SMB311_SALT_SIZE); +- get_random_bytes(pneg_ctxt->Salt, SMB311_SALT_SIZE); ++ pneg_ctxt->SaltLength = cpu_to_le16(SMB311_LINUX_CLIENT_SALT_SIZE); ++ get_random_bytes(pneg_ctxt->Salt, SMB311_LINUX_CLIENT_SALT_SIZE); + pneg_ctxt->HashAlgorithms = SMB2_PREAUTH_INTEGRITY_SHA512; + } + +@@ -617,6 +617,9 @@ static void decode_preauth_context(struct smb2_preauth_neg_context *ctxt) + if (len < MIN_PREAUTH_CTXT_DATA_LEN) { + printk_once(KERN_WARNING "server sent bad preauth context\n"); + return; ++ } else if (len < MIN_PREAUTH_CTXT_DATA_LEN + le16_to_cpu(ctxt->SaltLength)) { ++ pr_warn_once("server sent invalid SaltLength\n"); ++ return; + } + if (le16_to_cpu(ctxt->HashAlgorithmCount) != 1) + printk_once(KERN_WARNING "illegal SMB3 hash algorithm count\n"); +diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h +index f264e1d36fe16..2482978f09486 100644 +--- a/fs/cifs/smb2pdu.h ++++ b/fs/cifs/smb2pdu.h +@@ -271,12 +271,20 @@ struct smb2_neg_context { + /* Followed by array of data */ + } __packed; + +-#define SMB311_SALT_SIZE 32 ++#define SMB311_LINUX_CLIENT_SALT_SIZE 32 + /* Hash Algorithm Types */ + #define SMB2_PREAUTH_INTEGRITY_SHA512 cpu_to_le16(0x0001) + #define SMB2_PREAUTH_HASH_SIZE 64 + +-#define MIN_PREAUTH_CTXT_DATA_LEN (SMB311_SALT_SIZE + 6) ++/* ++ * SaltLength that the server send can be zero, so the only three required ++ * fields (all __le16) end up six bytes total, so the minimum context data len ++ * in the response is six bytes which accounts for ++ * ++ * HashAlgorithmCount, SaltLength, and 1 HashAlgorithm. ++ */ ++#define MIN_PREAUTH_CTXT_DATA_LEN 6 ++ + struct smb2_preauth_neg_context { + __le16 ContextType; /* 1 */ + __le16 DataLength; +@@ -284,7 +292,7 @@ struct smb2_preauth_neg_context { + __le16 HashAlgorithmCount; /* 1 */ + __le16 SaltLength; + __le16 HashAlgorithms; /* HashAlgorithms[0] since only one defined */ +- __u8 Salt[SMB311_SALT_SIZE]; ++ __u8 Salt[SMB311_LINUX_CLIENT_SALT_SIZE]; + } __packed; + + /* Encryption Algorithms Ciphers */ +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index 3bac525f0439d..539d95bd364d4 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -5209,7 +5209,7 @@ static int other_inode_match(struct inode * inode, unsigned long ino, + (inode->i_state & I_DIRTY_TIME)) { + struct ext4_inode_info *ei = EXT4_I(inode); + +- inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED); ++ inode->i_state &= ~I_DIRTY_TIME; + spin_unlock(&inode->i_lock); + + spin_lock(&ei->i_raw_lock); +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c +index 5f6400ba82c00..a2cf2db0d3def 100644 +--- a/fs/fs-writeback.c ++++ b/fs/fs-writeback.c +@@ -1238,7 +1238,7 @@ static bool inode_dirtied_after(struct inode *inode, unsigned long t) + */ + static int move_expired_inodes(struct list_head *delaying_queue, + struct list_head *dispatch_queue, +- int flags, unsigned long dirtied_before) ++ unsigned long dirtied_before) + { + LIST_HEAD(tmp); + struct list_head *pos, *node; +@@ -1254,8 +1254,6 @@ static int move_expired_inodes(struct list_head *delaying_queue, + list_move(&inode->i_io_list, &tmp); + moved++; + spin_lock(&inode->i_lock); +- if (flags & EXPIRE_DIRTY_ATIME) +- inode->i_state |= I_DIRTY_TIME_EXPIRED; + inode->i_state |= I_SYNC_QUEUED; + spin_unlock(&inode->i_lock); + if (sb_is_blkdev_sb(inode->i_sb)) +@@ -1303,11 +1301,11 @@ static void queue_io(struct bdi_writeback *wb, struct wb_writeback_work *work, + + assert_spin_locked(&wb->list_lock); + list_splice_init(&wb->b_more_io, &wb->b_io); +- moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, 0, dirtied_before); ++ moved = move_expired_inodes(&wb->b_dirty, &wb->b_io, dirtied_before); + if (!work->for_sync) + time_expire_jif = jiffies - dirtytime_expire_interval * HZ; + moved += move_expired_inodes(&wb->b_dirty_time, &wb->b_io, +- EXPIRE_DIRTY_ATIME, time_expire_jif); ++ time_expire_jif); + if (moved) + wb_io_lists_populated(wb); + trace_writeback_queue_io(wb, work, dirtied_before, moved); +@@ -1475,26 +1473,26 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) + ret = err; + } + ++ /* ++ * If the inode has dirty timestamps and we need to write them, call ++ * mark_inode_dirty_sync() to notify the filesystem about it and to ++ * change I_DIRTY_TIME into I_DIRTY_SYNC. ++ */ ++ if ((inode->i_state & I_DIRTY_TIME) && ++ (wbc->sync_mode == WB_SYNC_ALL || wbc->for_sync || ++ time_after(jiffies, inode->dirtied_time_when + ++ dirtytime_expire_interval * HZ))) { ++ trace_writeback_lazytime(inode); ++ mark_inode_dirty_sync(inode); ++ } ++ + /* + * Some filesystems may redirty the inode during the writeback + * due to delalloc, clear dirty metadata flags right before + * write_inode() + */ + spin_lock(&inode->i_lock); +- + dirty = inode->i_state & I_DIRTY; +- if (inode->i_state & I_DIRTY_TIME) { +- if ((dirty & I_DIRTY_INODE) || +- wbc->sync_mode == WB_SYNC_ALL || +- unlikely(inode->i_state & I_DIRTY_TIME_EXPIRED) || +- unlikely(time_after(jiffies, +- (inode->dirtied_time_when + +- dirtytime_expire_interval * HZ)))) { +- dirty |= I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED; +- trace_writeback_lazytime(inode); +- } +- } else +- inode->i_state &= ~I_DIRTY_TIME_EXPIRED; + inode->i_state &= ~dirty; + + /* +@@ -1515,8 +1513,6 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) + + spin_unlock(&inode->i_lock); + +- if (dirty & I_DIRTY_TIME) +- mark_inode_dirty_sync(inode); + /* Don't write the inode if only I_DIRTY_PAGES was set */ + if (dirty & ~I_DIRTY_PAGES) { + int err = write_inode(inode, wbc); +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 4127ea027a14d..478df7e10767a 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -2226,7 +2226,8 @@ restart: + /* Ensure we clear previously set non-block flag */ + req->rw.ki_flags &= ~IOCB_NOWAIT; + +- if (req->fs != current->fs && current->fs != old_fs_struct) { ++ if ((req->fs && req->fs != current->fs) || ++ (!req->fs && current->fs != old_fs_struct)) { + task_lock(current); + if (req->fs) + current->fs = req->fs; +@@ -2351,7 +2352,7 @@ out: + mmput(cur_mm); + } + revert_creds(old_cred); +- if (old_fs_struct) { ++ if (old_fs_struct != current->fs) { + task_lock(current); + current->fs = old_fs_struct; + task_unlock(current); +diff --git a/fs/xfs/libxfs/xfs_trans_inode.c b/fs/xfs/libxfs/xfs_trans_inode.c +index 6c7354abd0aea..0ba7368b9a5f0 100644 +--- a/fs/xfs/libxfs/xfs_trans_inode.c ++++ b/fs/xfs/libxfs/xfs_trans_inode.c +@@ -100,9 +100,9 @@ xfs_trans_log_inode( + * to log the timestamps, or will clear already cleared fields in the + * worst case. + */ +- if (inode->i_state & (I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED)) { ++ if (inode->i_state & I_DIRTY_TIME) { + spin_lock(&inode->i_lock); +- inode->i_state &= ~(I_DIRTY_TIME | I_DIRTY_TIME_EXPIRED); ++ inode->i_state &= ~I_DIRTY_TIME; + spin_unlock(&inode->i_lock); + } + +diff --git a/include/linux/fs.h b/include/linux/fs.h +index 4c82683e034a7..ef118b8ba6993 100644 +--- a/include/linux/fs.h ++++ b/include/linux/fs.h +@@ -2161,7 +2161,6 @@ static inline void init_sync_kiocb(struct kiocb *kiocb, struct file *filp) + #define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP) + #define I_LINKABLE (1 << 10) + #define I_DIRTY_TIME (1 << 11) +-#define I_DIRTY_TIME_EXPIRED (1 << 12) + #define I_WB_SWITCH (1 << 13) + #define I_OVL_INUSE (1 << 14) + #define I_CREATING (1 << 15) +diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h +index a8af22e469ce5..011e8faa608b9 100644 +--- a/include/trace/events/writeback.h ++++ b/include/trace/events/writeback.h +@@ -20,7 +20,6 @@ + {I_CLEAR, "I_CLEAR"}, \ + {I_SYNC, "I_SYNC"}, \ + {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ +- {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \ + {I_REFERENCED, "I_REFERENCED"} \ + ) + +diff --git a/kernel/futex.c b/kernel/futex.c +index b6dec5f79370c..042c2707e9131 100644 +--- a/kernel/futex.c ++++ b/kernel/futex.c +@@ -857,6 +857,29 @@ static struct futex_pi_state *alloc_pi_state(void) + return pi_state; + } + ++static void pi_state_update_owner(struct futex_pi_state *pi_state, ++ struct task_struct *new_owner) ++{ ++ struct task_struct *old_owner = pi_state->owner; ++ ++ lockdep_assert_held(&pi_state->pi_mutex.wait_lock); ++ ++ if (old_owner) { ++ raw_spin_lock(&old_owner->pi_lock); ++ WARN_ON(list_empty(&pi_state->list)); ++ list_del_init(&pi_state->list); ++ raw_spin_unlock(&old_owner->pi_lock); ++ } ++ ++ if (new_owner) { ++ raw_spin_lock(&new_owner->pi_lock); ++ WARN_ON(!list_empty(&pi_state->list)); ++ list_add(&pi_state->list, &new_owner->pi_state_list); ++ pi_state->owner = new_owner; ++ raw_spin_unlock(&new_owner->pi_lock); ++ } ++} ++ + static void get_pi_state(struct futex_pi_state *pi_state) + { + WARN_ON_ONCE(!refcount_inc_not_zero(&pi_state->refcount)); +@@ -879,17 +902,11 @@ static void put_pi_state(struct futex_pi_state *pi_state) + * and has cleaned up the pi_state already + */ + if (pi_state->owner) { +- struct task_struct *owner; + unsigned long flags; + + raw_spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); +- owner = pi_state->owner; +- if (owner) { +- raw_spin_lock(&owner->pi_lock); +- list_del_init(&pi_state->list); +- raw_spin_unlock(&owner->pi_lock); +- } +- rt_mutex_proxy_unlock(&pi_state->pi_mutex, owner); ++ pi_state_update_owner(pi_state, NULL); ++ rt_mutex_proxy_unlock(&pi_state->pi_mutex); + raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); + } + +@@ -1035,7 +1052,8 @@ static inline void exit_pi_state_list(struct task_struct *curr) { } + * FUTEX_OWNER_DIED bit. See [4] + * + * [10] There is no transient state which leaves owner and user space +- * TID out of sync. ++ * TID out of sync. Except one error case where the kernel is denied ++ * write access to the user address, see fixup_pi_state_owner(). + * + * + * Serialization and lifetime rules: +@@ -1614,26 +1632,15 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_pi_state *pi_ + ret = -EINVAL; + } + +- if (ret) +- goto out_unlock; +- +- /* +- * This is a point of no return; once we modify the uval there is no +- * going back and subsequent operations must not fail. +- */ +- +- raw_spin_lock(&pi_state->owner->pi_lock); +- WARN_ON(list_empty(&pi_state->list)); +- list_del_init(&pi_state->list); +- raw_spin_unlock(&pi_state->owner->pi_lock); +- +- raw_spin_lock(&new_owner->pi_lock); +- WARN_ON(!list_empty(&pi_state->list)); +- list_add(&pi_state->list, &new_owner->pi_state_list); +- pi_state->owner = new_owner; +- raw_spin_unlock(&new_owner->pi_lock); +- +- postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q); ++ if (!ret) { ++ /* ++ * This is a point of no return; once we modified the uval ++ * there is no going back and subsequent operations must ++ * not fail. ++ */ ++ pi_state_update_owner(pi_state, new_owner); ++ postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q); ++ } + + out_unlock: + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); +@@ -2456,18 +2463,13 @@ static void unqueue_me_pi(struct futex_q *q) + spin_unlock(q->lock_ptr); + } + +-static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, +- struct task_struct *argowner) ++static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, ++ struct task_struct *argowner) + { ++ u32 uval, uninitialized_var(curval), newval, newtid; + struct futex_pi_state *pi_state = q->pi_state; +- u32 uval, uninitialized_var(curval), newval; + struct task_struct *oldowner, *newowner; +- u32 newtid; +- int ret, err = 0; +- +- lockdep_assert_held(q->lock_ptr); +- +- raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); ++ int err = 0; + + oldowner = pi_state->owner; + +@@ -2501,14 +2503,12 @@ retry: + * We raced against a concurrent self; things are + * already fixed up. Nothing to do. + */ +- ret = 0; +- goto out_unlock; ++ return 0; + } + + if (__rt_mutex_futex_trylock(&pi_state->pi_mutex)) { +- /* We got the lock after all, nothing to fix. */ +- ret = 0; +- goto out_unlock; ++ /* We got the lock. pi_state is correct. Tell caller. */ ++ return 1; + } + + /* +@@ -2535,8 +2535,7 @@ retry: + * We raced against a concurrent self; things are + * already fixed up. Nothing to do. + */ +- ret = 0; +- goto out_unlock; ++ return 1; + } + newowner = argowner; + } +@@ -2566,22 +2565,9 @@ retry: + * We fixed up user space. Now we need to fix the pi_state + * itself. + */ +- if (pi_state->owner != NULL) { +- raw_spin_lock(&pi_state->owner->pi_lock); +- WARN_ON(list_empty(&pi_state->list)); +- list_del_init(&pi_state->list); +- raw_spin_unlock(&pi_state->owner->pi_lock); +- } ++ pi_state_update_owner(pi_state, newowner); + +- pi_state->owner = newowner; +- +- raw_spin_lock(&newowner->pi_lock); +- WARN_ON(!list_empty(&pi_state->list)); +- list_add(&pi_state->list, &newowner->pi_state_list); +- raw_spin_unlock(&newowner->pi_lock); +- raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); +- +- return 0; ++ return argowner == current; + + /* + * In order to reschedule or handle a page fault, we need to drop the +@@ -2602,17 +2588,16 @@ handle_err: + + switch (err) { + case -EFAULT: +- ret = fault_in_user_writeable(uaddr); ++ err = fault_in_user_writeable(uaddr); + break; + + case -EAGAIN: + cond_resched(); +- ret = 0; ++ err = 0; + break; + + default: + WARN_ON_ONCE(1); +- ret = err; + break; + } + +@@ -2622,17 +2607,44 @@ handle_err: + /* + * Check if someone else fixed it for us: + */ +- if (pi_state->owner != oldowner) { +- ret = 0; +- goto out_unlock; +- } ++ if (pi_state->owner != oldowner) ++ return argowner == current; + +- if (ret) +- goto out_unlock; ++ /* Retry if err was -EAGAIN or the fault in succeeded */ ++ if (!err) ++ goto retry; + +- goto retry; ++ /* ++ * fault_in_user_writeable() failed so user state is immutable. At ++ * best we can make the kernel state consistent but user state will ++ * be most likely hosed and any subsequent unlock operation will be ++ * rejected due to PI futex rule [10]. ++ * ++ * Ensure that the rtmutex owner is also the pi_state owner despite ++ * the user space value claiming something different. There is no ++ * point in unlocking the rtmutex if current is the owner as it ++ * would need to wait until the next waiter has taken the rtmutex ++ * to guarantee consistent state. Keep it simple. Userspace asked ++ * for this wreckaged state. ++ * ++ * The rtmutex has an owner - either current or some other ++ * task. See the EAGAIN loop above. ++ */ ++ pi_state_update_owner(pi_state, rt_mutex_owner(&pi_state->pi_mutex)); + +-out_unlock: ++ return err; ++} ++ ++static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, ++ struct task_struct *argowner) ++{ ++ struct futex_pi_state *pi_state = q->pi_state; ++ int ret; ++ ++ lockdep_assert_held(q->lock_ptr); ++ ++ raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); ++ ret = __fixup_pi_state_owner(uaddr, q, argowner); + raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); + return ret; + } +@@ -2656,8 +2668,6 @@ static long futex_wait_restart(struct restart_block *restart); + */ + static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) + { +- int ret = 0; +- + if (locked) { + /* + * Got the lock. We might not be the anticipated owner if we +@@ -2668,8 +2678,8 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) + * stable state, anything else needs more attention. + */ + if (q->pi_state->owner != current) +- ret = fixup_pi_state_owner(uaddr, q, current); +- goto out; ++ return fixup_pi_state_owner(uaddr, q, current); ++ return 1; + } + + /* +@@ -2680,24 +2690,17 @@ static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) + * Another speculative read; pi_state->owner == current is unstable + * but needs our attention. + */ +- if (q->pi_state->owner == current) { +- ret = fixup_pi_state_owner(uaddr, q, NULL); +- goto out; +- } ++ if (q->pi_state->owner == current) ++ return fixup_pi_state_owner(uaddr, q, NULL); + + /* + * Paranoia check. If we did not take the lock, then we should not be +- * the owner of the rt_mutex. ++ * the owner of the rt_mutex. Warn and establish consistent state. + */ +- if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) { +- printk(KERN_ERR "fixup_owner: ret = %d pi-mutex: %p " +- "pi-state %p\n", ret, +- q->pi_state->pi_mutex.owner, +- q->pi_state->owner); +- } ++ if (WARN_ON_ONCE(rt_mutex_owner(&q->pi_state->pi_mutex) == current)) ++ return fixup_pi_state_owner(uaddr, q, current); + +-out: +- return ret ? ret : locked; ++ return 0; + } + + /** +@@ -2909,7 +2912,6 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, + ktime_t *time, int trylock) + { + struct hrtimer_sleeper timeout, *to; +- struct futex_pi_state *pi_state = NULL; + struct task_struct *exiting = NULL; + struct rt_mutex_waiter rt_waiter; + struct futex_hash_bucket *hb; +@@ -3046,23 +3048,9 @@ no_block: + if (res) + ret = (res < 0) ? res : 0; + +- /* +- * If fixup_owner() faulted and was unable to handle the fault, unlock +- * it and return the fault to userspace. +- */ +- if (ret && (rt_mutex_owner(&q.pi_state->pi_mutex) == current)) { +- pi_state = q.pi_state; +- get_pi_state(pi_state); +- } +- + /* Unqueue and drop the lock */ + unqueue_me_pi(&q); + +- if (pi_state) { +- rt_mutex_futex_unlock(&pi_state->pi_mutex); +- put_pi_state(pi_state); +- } +- + goto out_put_key; + + out_unlock_put_key: +@@ -3328,7 +3316,6 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + u32 __user *uaddr2) + { + struct hrtimer_sleeper timeout, *to; +- struct futex_pi_state *pi_state = NULL; + struct rt_mutex_waiter rt_waiter; + struct futex_hash_bucket *hb; + union futex_key key2 = FUTEX_KEY_INIT; +@@ -3406,16 +3393,17 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + if (q.pi_state && (q.pi_state->owner != current)) { + spin_lock(q.lock_ptr); + ret = fixup_pi_state_owner(uaddr2, &q, current); +- if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) { +- pi_state = q.pi_state; +- get_pi_state(pi_state); +- } + /* + * Drop the reference to the pi state which + * the requeue_pi() code acquired for us. + */ + put_pi_state(q.pi_state); + spin_unlock(q.lock_ptr); ++ /* ++ * Adjust the return value. It's either -EFAULT or ++ * success (1) but the caller expects 0 for success. ++ */ ++ ret = ret < 0 ? ret : 0; + } + } else { + struct rt_mutex *pi_mutex; +@@ -3446,25 +3434,10 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, + if (res) + ret = (res < 0) ? res : 0; + +- /* +- * If fixup_pi_state_owner() faulted and was unable to handle +- * the fault, unlock the rt_mutex and return the fault to +- * userspace. +- */ +- if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) { +- pi_state = q.pi_state; +- get_pi_state(pi_state); +- } +- + /* Unqueue and drop the lock. */ + unqueue_me_pi(&q); + } + +- if (pi_state) { +- rt_mutex_futex_unlock(&pi_state->pi_mutex); +- put_pi_state(pi_state); +- } +- + if (ret == -EINTR) { + /* + * We've already been requeued, but cannot restart by calling +diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c +index 2874bf5561620..734698aec5f9e 100644 +--- a/kernel/locking/rtmutex.c ++++ b/kernel/locking/rtmutex.c +@@ -1718,8 +1718,7 @@ void rt_mutex_init_proxy_locked(struct rt_mutex *lock, + * possible because it belongs to the pi_state which is about to be freed + * and it is not longer visible to other tasks. + */ +-void rt_mutex_proxy_unlock(struct rt_mutex *lock, +- struct task_struct *proxy_owner) ++void rt_mutex_proxy_unlock(struct rt_mutex *lock) + { + debug_rt_mutex_proxy_unlock(lock); + rt_mutex_set_owner(lock, NULL); +diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h +index d1d62f942be22..ca6fb489007b6 100644 +--- a/kernel/locking/rtmutex_common.h ++++ b/kernel/locking/rtmutex_common.h +@@ -133,8 +133,7 @@ enum rtmutex_chainwalk { + extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock); + extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock, + struct task_struct *proxy_owner); +-extern void rt_mutex_proxy_unlock(struct rt_mutex *lock, +- struct task_struct *proxy_owner); ++extern void rt_mutex_proxy_unlock(struct rt_mutex *lock); + extern void rt_mutex_init_waiter(struct rt_mutex_waiter *waiter); + extern int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, + struct rt_mutex_waiter *waiter, +diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c +index 077877ed54f73..7283741666538 100644 +--- a/kernel/trace/ring_buffer.c ++++ b/kernel/trace/ring_buffer.c +@@ -4448,6 +4448,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu) + + if (!cpumask_test_cpu(cpu, buffer->cpumask)) + return; ++ /* prevent another thread from changing buffer sizes */ ++ mutex_lock(&buffer->mutex); + + atomic_inc(&buffer->resize_disabled); + atomic_inc(&cpu_buffer->record_disabled); +@@ -4471,6 +4473,8 @@ void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu) + + atomic_dec(&cpu_buffer->record_disabled); + atomic_dec(&buffer->resize_disabled); ++ ++ mutex_unlock(&buffer->mutex); + } + EXPORT_SYMBOL_GPL(ring_buffer_reset_cpu); + +diff --git a/mm/slub.c b/mm/slub.c +index 8b3ef45a0f103..e622e8f4c2ac4 100644 +--- a/mm/slub.c ++++ b/mm/slub.c +@@ -5819,10 +5819,8 @@ static int sysfs_slab_add(struct kmem_cache *s) + + s->kobj.kset = kset; + err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, "%s", name); +- if (err) { +- kobject_put(&s->kobj); ++ if (err) + goto out; +- } + + err = sysfs_create_group(&s->kobj, &slab_attr_group); + if (err) +diff --git a/tools/build/Makefile b/tools/build/Makefile +index 727050c40f096..8a55378e8b7ce 100644 +--- a/tools/build/Makefile ++++ b/tools/build/Makefile +@@ -15,10 +15,6 @@ endef + $(call allow-override,CC,$(CROSS_COMPILE)gcc) + $(call allow-override,LD,$(CROSS_COMPILE)ld) + +-HOSTCC ?= gcc +-HOSTLD ?= ld +-HOSTAR ?= ar +- + export HOSTCC HOSTLD HOSTAR + + ifeq ($(V),1) +diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile +index f591c4d1b6fe2..9ae4a10438ee3 100644 +--- a/tools/objtool/Makefile ++++ b/tools/objtool/Makefile +@@ -3,15 +3,6 @@ include ../scripts/Makefile.include + include ../scripts/Makefile.arch + + # always use the host compiler +-ifneq ($(LLVM),) +-HOSTAR ?= llvm-ar +-HOSTCC ?= clang +-HOSTLD ?= ld.lld +-else +-HOSTAR ?= ar +-HOSTCC ?= gcc +-HOSTLD ?= ld +-endif + AR = $(HOSTAR) + CC = $(HOSTCC) + LD = $(HOSTLD) +diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf +index 902c792f326a5..961f5e4fd6566 100644 +--- a/tools/perf/Makefile.perf ++++ b/tools/perf/Makefile.perf +@@ -163,10 +163,6 @@ endef + + LD += $(EXTRA_LDFLAGS) + +-HOSTCC ?= gcc +-HOSTLD ?= ld +-HOSTAR ?= ar +- + PKG_CONFIG = $(CROSS_COMPILE)pkg-config + LLVM_CONFIG ?= llvm-config + +diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config +index 54a2857c2510a..331f6d30f4726 100644 +--- a/tools/power/acpi/Makefile.config ++++ b/tools/power/acpi/Makefile.config +@@ -54,7 +54,6 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM} + CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- + CROSS_COMPILE ?= $(CROSS) + LD = $(CC) +-HOSTCC = gcc + + # check if compiler option is supported + cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} +diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include +index 6d2f3a1b22493..812fc97bb1a97 100644 +--- a/tools/scripts/Makefile.include ++++ b/tools/scripts/Makefile.include +@@ -59,6 +59,16 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld) + $(call allow-override,CXX,$(CROSS_COMPILE)g++) + $(call allow-override,STRIP,$(CROSS_COMPILE)strip) + ++ifneq ($(LLVM),) ++HOSTAR ?= llvm-ar ++HOSTCC ?= clang ++HOSTLD ?= ld.lld ++else ++HOSTAR ?= ar ++HOSTCC ?= gcc ++HOSTLD ?= ld ++endif ++ + ifeq ($(CC_NO_CLANG), 1) + EXTRA_WARNINGS += -Wstrict-aliasing=3 + endif