commit:     7b102a4aca0c94e96a635cb87635fd14908b1aa3
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  8 17:55:20 2022 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Tue Feb  8 17:55:20 2022 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7b102a4a

Linuxpatch 5.4.178

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

 0000_README              |    4 +
 1177_linux-5.4.178.patch | 1218 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1222 insertions(+)

diff --git a/0000_README b/0000_README
index d82773a6..0633c4d5 100644
--- a/0000_README
+++ b/0000_README
@@ -751,6 +751,10 @@ Patch:  1176_linux-5.4.177.patch
 From:   http://www.kernel.org
 Desc:   Linux 5.4.177
 
+Patch:  1177_linux-5.4.178.patch
+From:   http://www.kernel.org
+Desc:   Linux 5.4.178
+
 Patch:  1500_XATTR_USER_PREFIX.patch
 From:   https://bugs.gentoo.org/show_bug.cgi?id=470644
 Desc:   Support for namespace user.pax.* on tmpfs.

diff --git a/1177_linux-5.4.178.patch b/1177_linux-5.4.178.patch
new file mode 100644
index 00000000..078c0523
--- /dev/null
+++ b/1177_linux-5.4.178.patch
@@ -0,0 +1,1218 @@
+diff --git a/Makefile b/Makefile
+index 324939b64d7b7..6d33284664fef 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 5
+ PATCHLEVEL = 4
+-SUBLEVEL = 177
++SUBLEVEL = 178
+ EXTRAVERSION =
+ NAME = Kleptomaniac Octopus
+ 
+diff --git a/block/bio-integrity.c b/block/bio-integrity.c
+index c9dc2b17ce251..ec295be93ca0d 100644
+--- a/block/bio-integrity.c
++++ b/block/bio-integrity.c
+@@ -380,7 +380,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int 
bytes_done)
+       struct blk_integrity *bi = blk_get_integrity(bio->bi_disk);
+       unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);
+ 
+-      bip->bip_iter.bi_sector += bytes_done >> 9;
++      bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9);
+       bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);
+ }
+ 
+diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
+index 0be3d1b17f034..a09a5041e74c8 100644
+--- a/drivers/edac/altera_edac.c
++++ b/drivers/edac/altera_edac.c
+@@ -349,7 +349,7 @@ static int altr_sdram_probe(struct platform_device *pdev)
+       if (irq < 0) {
+               edac_printk(KERN_ERR, EDAC_MC,
+                           "No irq %d in DT\n", irq);
+-              return -ENODEV;
++              return irq;
+       }
+ 
+       /* Arria10 has a 2nd IRQ */
+diff --git a/drivers/edac/xgene_edac.c b/drivers/edac/xgene_edac.c
+index e4a1032ba0b58..cd9926e518967 100644
+--- a/drivers/edac/xgene_edac.c
++++ b/drivers/edac/xgene_edac.c
+@@ -1922,7 +1922,7 @@ static int xgene_edac_probe(struct platform_device *pdev)
+                       irq = platform_get_irq(pdev, i);
+                       if (irq < 0) {
+                               dev_err(&pdev->dev, "No IRQ resource\n");
+-                              rc = -EINVAL;
++                              rc = irq;
+                               goto out_err;
+                       }
+                       rc = devm_request_irq(&pdev->dev, irq,
+diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c 
b/drivers/gpu/drm/i915/display/intel_overlay.c
+index 29edfc3437163..aeb7cb651fa4f 100644
+--- a/drivers/gpu/drm/i915/display/intel_overlay.c
++++ b/drivers/gpu/drm/i915/display/intel_overlay.c
+@@ -913,6 +913,9 @@ static int check_overlay_dst(struct intel_overlay *overlay,
+       const struct intel_crtc_state *pipe_config =
+               overlay->crtc->config;
+ 
++      if (rec->dst_height == 0 || rec->dst_width == 0)
++              return -EINVAL;
++
+       if (rec->dst_x < pipe_config->pipe_src_w &&
+           rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w &&
+           rec->dst_y < pipe_config->pipe_src_h &&
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c 
b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
+index f3c30b2a788e8..8bff14ae16b0e 100644
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c
+@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size)
+               *addr += bios->imaged_addr;
+       }
+ 
+-      if (unlikely(*addr + size >= bios->size)) {
++      if (unlikely(*addr + size > bios->size)) {
+               nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr);
+               return false;
+       }
+diff --git a/drivers/infiniband/hw/mlx4/main.c 
b/drivers/infiniband/hw/mlx4/main.c
+index 48864269f042a..baa129a6c9127 100644
+--- a/drivers/infiniband/hw/mlx4/main.c
++++ b/drivers/infiniband/hw/mlx4/main.c
+@@ -3291,7 +3291,7 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void 
*ibdev_ptr,
+       case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:
+               ew = kmalloc(sizeof *ew, GFP_ATOMIC);
+               if (!ew)
+-                      break;
++                      return;
+ 
+               INIT_WORK(&ew->work, handle_port_mgmt_change_event);
+               memcpy(&ew->ib_eqe, eqe, sizeof *eqe);
+diff --git a/drivers/infiniband/sw/rdmavt/qp.c 
b/drivers/infiniband/sw/rdmavt/qp.c
+index d14ad523f96c8..a5152f097cb7a 100644
+--- a/drivers/infiniband/sw/rdmavt/qp.c
++++ b/drivers/infiniband/sw/rdmavt/qp.c
+@@ -3110,6 +3110,8 @@ do_write:
+       case IB_WR_ATOMIC_FETCH_AND_ADD:
+               if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC)))
+                       goto inv_err;
++              if (unlikely(wqe->atomic_wr.remote_addr & (sizeof(u64) - 1)))
++                      goto inv_err;
+               if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),
+                                         wqe->atomic_wr.remote_addr,
+                                         wqe->atomic_wr.rkey,
+diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
+index 4d8bc995b4503..eaa9863dd1e00 100644
+--- a/drivers/infiniband/sw/siw/siw.h
++++ b/drivers/infiniband/sw/siw/siw.h
+@@ -658,14 +658,9 @@ static inline struct siw_sqe *orq_get_current(struct 
siw_qp *qp)
+       return &qp->orq[qp->orq_get % qp->attrs.orq_size];
+ }
+ 
+-static inline struct siw_sqe *orq_get_tail(struct siw_qp *qp)
+-{
+-      return &qp->orq[qp->orq_put % qp->attrs.orq_size];
+-}
+-
+ static inline struct siw_sqe *orq_get_free(struct siw_qp *qp)
+ {
+-      struct siw_sqe *orq_e = orq_get_tail(qp);
++      struct siw_sqe *orq_e = &qp->orq[qp->orq_put % qp->attrs.orq_size];
+ 
+       if (READ_ONCE(orq_e->flags) == 0)
+               return orq_e;
+diff --git a/drivers/infiniband/sw/siw/siw_qp_rx.c 
b/drivers/infiniband/sw/siw/siw_qp_rx.c
+index c7c38f7fd29d6..5f94c716301fa 100644
+--- a/drivers/infiniband/sw/siw/siw_qp_rx.c
++++ b/drivers/infiniband/sw/siw/siw_qp_rx.c
+@@ -1153,11 +1153,12 @@ static int siw_check_tx_fence(struct siw_qp *qp)
+ 
+       spin_lock_irqsave(&qp->orq_lock, flags);
+ 
+-      rreq = orq_get_current(qp);
+-
+       /* free current orq entry */
++      rreq = orq_get_current(qp);
+       WRITE_ONCE(rreq->flags, 0);
+ 
++      qp->orq_get++;
++
+       if (qp->tx_ctx.orq_fence) {
+               if (unlikely(tx_waiting->wr_status != SIW_WR_QUEUED)) {
+                       pr_warn("siw: [QP %u]: fence resume: bad status %d\n",
+@@ -1165,10 +1166,12 @@ static int siw_check_tx_fence(struct siw_qp *qp)
+                       rv = -EPROTO;
+                       goto out;
+               }
+-              /* resume SQ processing */
++              /* resume SQ processing, if possible */
+               if (tx_waiting->sqe.opcode == SIW_OP_READ ||
+                   tx_waiting->sqe.opcode == SIW_OP_READ_LOCAL_INV) {
+-                      rreq = orq_get_tail(qp);
++
++                      /* SQ processing was stopped because of a full ORQ */
++                      rreq = orq_get_free(qp);
+                       if (unlikely(!rreq)) {
+                               pr_warn("siw: [QP %u]: no ORQE\n", qp_id(qp));
+                               rv = -EPROTO;
+@@ -1181,15 +1184,14 @@ static int siw_check_tx_fence(struct siw_qp *qp)
+                       resume_tx = 1;
+ 
+               } else if (siw_orq_empty(qp)) {
++                      /*
++                       * SQ processing was stopped by fenced work request.
++                       * Resume since all previous Read's are now completed.
++                       */
+                       qp->tx_ctx.orq_fence = 0;
+                       resume_tx = 1;
+-              } else {
+-                      pr_warn("siw: [QP %u]: fence resume: orq idx: %d:%d\n",
+-                              qp_id(qp), qp->orq_get, qp->orq_put);
+-                      rv = -EPROTO;
+               }
+       }
+-      qp->orq_get++;
+ out:
+       spin_unlock_irqrestore(&qp->orq_lock, flags);
+ 
+diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
+index 692401e941a77..7502fa84e2537 100644
+--- a/drivers/iommu/amd_iommu_init.c
++++ b/drivers/iommu/amd_iommu_init.c
+@@ -21,6 +21,7 @@
+ #include <linux/iommu.h>
+ #include <linux/kmemleak.h>
+ #include <linux/mem_encrypt.h>
++#include <linux/iopoll.h>
+ #include <asm/pci-direct.h>
+ #include <asm/iommu.h>
+ #include <asm/apic.h>
+@@ -759,6 +760,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)
+               status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
+               if (status & (MMIO_STATUS_GALOG_RUN_MASK))
+                       break;
++              udelay(10);
+       }
+ 
+       if (i >= LOOP_TIMEOUT)
+diff --git a/drivers/iommu/intel_irq_remapping.c 
b/drivers/iommu/intel_irq_remapping.c
+index 5dcc81b1df623..f3b299b5c1c06 100644
+--- a/drivers/iommu/intel_irq_remapping.c
++++ b/drivers/iommu/intel_irq_remapping.c
+@@ -570,9 +570,8 @@ static int intel_setup_irq_remapping(struct intel_iommu 
*iommu)
+                                           fn, &intel_ir_domain_ops,
+                                           iommu);
+       if (!iommu->ir_domain) {
+-              irq_domain_free_fwnode(fn);
+               pr_err("IR%d: failed to allocate irqdomain\n", iommu->seq_id);
+-              goto out_free_bitmap;
++              goto out_free_fwnode;
+       }
+       iommu->ir_msi_domain =
+               arch_create_remap_msi_irq_domain(iommu->ir_domain,
+@@ -596,7 +595,7 @@ static int intel_setup_irq_remapping(struct intel_iommu 
*iommu)
+ 
+               if (dmar_enable_qi(iommu)) {
+                       pr_err("Failed to enable queued invalidation\n");
+-                      goto out_free_bitmap;
++                      goto out_free_ir_domain;
+               }
+       }
+ 
+@@ -620,6 +619,14 @@ static int intel_setup_irq_remapping(struct intel_iommu 
*iommu)
+ 
+       return 0;
+ 
++out_free_ir_domain:
++      if (iommu->ir_msi_domain)
++              irq_domain_remove(iommu->ir_msi_domain);
++      iommu->ir_msi_domain = NULL;
++      irq_domain_remove(iommu->ir_domain);
++      iommu->ir_domain = NULL;
++out_free_fwnode:
++      irq_domain_free_fwnode(fn);
+ out_free_bitmap:
+       bitmap_free(bitmap);
+ out_free_pages:
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h 
b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
+index 292b880f3f9fc..3587b2e7843ef 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
+@@ -128,6 +128,7 @@
+ 
+ #define NUM_DWMAC100_DMA_REGS 9
+ #define NUM_DWMAC1000_DMA_REGS        23
++#define NUM_DWMAC4_DMA_REGS   27
+ 
+ void dwmac_enable_dma_transmission(void __iomem *ioaddr);
+ void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan);
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+index ce1346c14b05a..30b9393ae8f2f 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+@@ -21,10 +21,18 @@
+ #include "dwxgmac2.h"
+ 
+ #define REG_SPACE_SIZE        0x1060
++#define GMAC4_REG_SPACE_SIZE  0x116C
+ #define MAC100_ETHTOOL_NAME   "st_mac100"
+ #define GMAC_ETHTOOL_NAME     "st_gmac"
+ #define XGMAC_ETHTOOL_NAME    "st_xgmac"
+ 
++/* Same as DMA_CHAN_BASE_ADDR defined in dwmac4_dma.h
++ *
++ * It is here because dwmac_dma.h and dwmac4_dam.h can not be included at the
++ * same time due to the conflicting macro names.
++ */
++#define GMAC4_DMA_CHAN_BASE_ADDR  0x00001100
++
+ #define ETHTOOL_DMA_OFFSET    55
+ 
+ struct stmmac_stats {
+@@ -413,6 +421,8 @@ static int stmmac_ethtool_get_regs_len(struct net_device 
*dev)
+ 
+       if (priv->plat->has_xgmac)
+               return XGMAC_REGSIZE * 4;
++      else if (priv->plat->has_gmac4)
++              return GMAC4_REG_SPACE_SIZE;
+       return REG_SPACE_SIZE;
+ }
+ 
+@@ -425,8 +435,13 @@ static void stmmac_ethtool_gregs(struct net_device *dev,
+       stmmac_dump_mac_regs(priv, priv->hw, reg_space);
+       stmmac_dump_dma_regs(priv, priv->ioaddr, reg_space);
+ 
+-      if (!priv->plat->has_xgmac) {
+-              /* Copy DMA registers to where ethtool expects them */
++      /* Copy DMA registers to where ethtool expects them */
++      if (priv->plat->has_gmac4) {
++              /* GMAC4 dumps its DMA registers at its DMA_CHAN_BASE_ADDR */
++              memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
++                     &reg_space[GMAC4_DMA_CHAN_BASE_ADDR / 4],
++                     NUM_DWMAC4_DMA_REGS * 4);
++      } else if (!priv->plat->has_xgmac) {
+               memcpy(&reg_space[ETHTOOL_DMA_OFFSET],
+                      &reg_space[DMA_BUS_MODE / 4],
+                      NUM_DWMAC1000_DMA_REGS * 4);
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c 
b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+index e5d9007c8090b..8c14c99663941 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
+@@ -149,15 +149,20 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, 
u32 nsec,
+ 
+ static void get_systime(void __iomem *ioaddr, u64 *systime)
+ {
+-      u64 ns;
+-
+-      /* Get the TSSS value */
+-      ns = readl(ioaddr + PTP_STNSR);
+-      /* Get the TSS and convert sec time value to nanosecond */
+-      ns += readl(ioaddr + PTP_STSR) * 1000000000ULL;
++      u64 ns, sec0, sec1;
++
++      /* Get the TSS value */
++      sec1 = readl_relaxed(ioaddr + PTP_STSR);
++      do {
++              sec0 = sec1;
++              /* Get the TSSS value */
++              ns = readl_relaxed(ioaddr + PTP_STNSR);
++              /* Get the TSS value */
++              sec1 = readl_relaxed(ioaddr + PTP_STSR);
++      } while (sec0 != sec1);
+ 
+       if (systime)
+-              *systime = ns;
++              *systime = ns + (sec1 * 1000000000ULL);
+ }
+ 
+ const struct stmmac_hwtimestamp stmmac_ptp = {
+diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
+index 25dbea302fb6d..7c131a423cafa 100644
+--- a/drivers/net/ieee802154/ca8210.c
++++ b/drivers/net/ieee802154/ca8210.c
+@@ -1770,6 +1770,7 @@ static int ca8210_async_xmit_complete(
+                       status
+               );
+               if (status != MAC_TRANSACTION_OVERFLOW) {
++                      dev_kfree_skb_any(priv->tx_skb);
+                       ieee802154_wake_queue(priv->hw);
+                       return 0;
+               }
+diff --git a/drivers/net/ieee802154/mac802154_hwsim.c 
b/drivers/net/ieee802154/mac802154_hwsim.c
+index 2a78084aeaedb..1d181eff0c299 100644
+--- a/drivers/net/ieee802154/mac802154_hwsim.c
++++ b/drivers/net/ieee802154/mac802154_hwsim.c
+@@ -786,6 +786,7 @@ static int hwsim_add_one(struct genl_info *info, struct 
device *dev,
+               goto err_pib;
+       }
+ 
++      pib->channel = 13;
+       rcu_assign_pointer(phy->pib, pib);
+       phy->idx = idx;
+       INIT_LIST_HEAD(&phy->edges);
+diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
+index 8dc04e2590b18..383231b854642 100644
+--- a/drivers/net/ieee802154/mcr20a.c
++++ b/drivers/net/ieee802154/mcr20a.c
+@@ -976,8 +976,8 @@ static void mcr20a_hw_setup(struct mcr20a_local *lp)
+       dev_dbg(printdev(lp), "%s\n", __func__);
+ 
+       phy->symbol_duration = 16;
+-      phy->lifs_period = 40;
+-      phy->sifs_period = 12;
++      phy->lifs_period = 40 * phy->symbol_duration;
++      phy->sifs_period = 12 * phy->symbol_duration;
+ 
+       hw->flags = IEEE802154_HW_TX_OMIT_CKSUM |
+                       IEEE802154_HW_AFILT |
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
+index f233a6933a976..f729f55f6a174 100644
+--- a/drivers/net/macsec.c
++++ b/drivers/net/macsec.c
+@@ -3247,6 +3247,15 @@ static int macsec_newlink(struct net *net, struct 
net_device *dev,
+ 
+       macsec->real_dev = real_dev;
+ 
++      /* send_sci must be set to true when transmit sci explicitly is set */
++      if ((data && data[IFLA_MACSEC_SCI]) &&
++          (data && data[IFLA_MACSEC_INC_SCI])) {
++              u8 send_sci = !!nla_get_u8(data[IFLA_MACSEC_INC_SCI]);
++
++              if (!send_sci)
++                      return -EINVAL;
++      }
++
+       if (data && data[IFLA_MACSEC_ICV_LEN])
+               icv_len = nla_get_u8(data[IFLA_MACSEC_ICV_LEN]);
+       mtu = real_dev->mtu - icv_len - macsec_extra_len(true);
+diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c 
b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+index fa742535f6791..e4da3217e9398 100644
+--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+@@ -1261,16 +1261,18 @@ static int bcm2835_pinctrl_probe(struct 
platform_device *pdev)
+                                    sizeof(*girq->parents),
+                                    GFP_KERNEL);
+       if (!girq->parents) {
+-              pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
+-              return -ENOMEM;
++              err = -ENOMEM;
++              goto out_remove;
+       }
+ 
+       if (is_7211) {
+               pc->wake_irq = devm_kcalloc(dev, BCM2835_NUM_IRQS,
+                                           sizeof(*pc->wake_irq),
+                                           GFP_KERNEL);
+-              if (!pc->wake_irq)
+-                      return -ENOMEM;
++              if (!pc->wake_irq) {
++                      err = -ENOMEM;
++                      goto out_remove;
++              }
+       }
+ 
+       /*
+@@ -1294,8 +1296,10 @@ static int bcm2835_pinctrl_probe(struct platform_device 
*pdev)
+ 
+               len = strlen(dev_name(pc->dev)) + 16;
+               name = devm_kzalloc(pc->dev, len, GFP_KERNEL);
+-              if (!name)
+-                      return -ENOMEM;
++              if (!name) {
++                      err = -ENOMEM;
++                      goto out_remove;
++              }
+ 
+               snprintf(name, len, "%s:bank%d", dev_name(pc->dev), i);
+ 
+@@ -1314,11 +1318,14 @@ static int bcm2835_pinctrl_probe(struct 
platform_device *pdev)
+       err = gpiochip_add_data(&pc->gpio_chip, pc);
+       if (err) {
+               dev_err(dev, "could not add GPIO chip\n");
+-              pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
+-              return err;
++              goto out_remove;
+       }
+ 
+       return 0;
++
++out_remove:
++      pinctrl_remove_gpio_range(pc->pctl_dev, &pc->gpio_range);
++      return err;
+ }
+ 
+ static struct platform_driver bcm2835_pinctrl_driver = {
+diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c
+index 2ecd8752b088b..5add637c9ad23 100644
+--- a/drivers/rtc/rtc-mc146818-lib.c
++++ b/drivers/rtc/rtc-mc146818-lib.c
+@@ -83,7 +83,7 @@ unsigned int mc146818_get_time(struct rtc_time *time)
+       time->tm_year += real_year - 72;
+ #endif
+ 
+-      if (century > 20)
++      if (century > 19)
+               time->tm_year += (century - 19) * 100;
+ 
+       /*
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+index e6c3e7c070aaf..9ed109fb6b67b 100644
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+@@ -506,7 +506,8 @@ static int bnx2fc_l2_rcv_thread(void *arg)
+ 
+ static void bnx2fc_recv_frame(struct sk_buff *skb)
+ {
+-      u32 fr_len;
++      u64 crc_err;
++      u32 fr_len, fr_crc;
+       struct fc_lport *lport;
+       struct fcoe_rcv_info *fr;
+       struct fc_stats *stats;
+@@ -540,6 +541,11 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
+       skb_pull(skb, sizeof(struct fcoe_hdr));
+       fr_len = skb->len - sizeof(struct fcoe_crc_eof);
+ 
++      stats = per_cpu_ptr(lport->stats, get_cpu());
++      stats->RxFrames++;
++      stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
++      put_cpu();
++
+       fp = (struct fc_frame *)skb;
+       fc_frame_init(fp);
+       fr_dev(fp) = lport;
+@@ -622,16 +628,15 @@ static void bnx2fc_recv_frame(struct sk_buff *skb)
+               return;
+       }
+ 
+-      stats = per_cpu_ptr(lport->stats, smp_processor_id());
+-      stats->RxFrames++;
+-      stats->RxWords += fr_len / FCOE_WORD_TO_BYTE;
++      fr_crc = le32_to_cpu(fr_crc(fp));
+ 
+-      if (le32_to_cpu(fr_crc(fp)) !=
+-                      ~crc32(~0, skb->data, fr_len)) {
+-              if (stats->InvalidCRCCount < 5)
++      if (unlikely(fr_crc != ~crc32(~0, skb->data, fr_len))) {
++              stats = per_cpu_ptr(lport->stats, get_cpu());
++              crc_err = (stats->InvalidCRCCount++);
++              put_cpu();
++              if (crc_err < 5)
+                       printk(KERN_WARNING PFX "dropping frame with "
+                              "CRC error\n");
+-              stats->InvalidCRCCount++;
+               kfree_skb(skb);
+               return;
+       }
+diff --git a/drivers/soc/mediatek/mtk-scpsys.c 
b/drivers/soc/mediatek/mtk-scpsys.c
+index 71afa2a99b17f..75f25f08245fd 100644
+--- a/drivers/soc/mediatek/mtk-scpsys.c
++++ b/drivers/soc/mediatek/mtk-scpsys.c
+@@ -333,17 +333,12 @@ out:
+       return ret;
+ }
+ 
+-static int init_clks(struct platform_device *pdev, struct clk **clk)
++static void init_clks(struct platform_device *pdev, struct clk **clk)
+ {
+       int i;
+ 
+-      for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
++      for (i = CLK_NONE + 1; i < CLK_MAX; i++)
+               clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
+-              if (IS_ERR(clk[i]))
+-                      return PTR_ERR(clk[i]);
+-      }
+-
+-      return 0;
+ }
+ 
+ static struct scp *init_scp(struct platform_device *pdev,
+@@ -353,7 +348,7 @@ static struct scp *init_scp(struct platform_device *pdev,
+ {
+       struct genpd_onecell_data *pd_data;
+       struct resource *res;
+-      int i, j, ret;
++      int i, j;
+       struct scp *scp;
+       struct clk *clk[CLK_MAX];
+ 
+@@ -408,9 +403,7 @@ static struct scp *init_scp(struct platform_device *pdev,
+ 
+       pd_data->num_domains = num;
+ 
+-      ret = init_clks(pdev, clk);
+-      if (ret)
+-              return ERR_PTR(ret);
++      init_clks(pdev, clk);
+ 
+       for (i = 0; i < num; i++) {
+               struct scp_domain *scpd = &scp->domains[i];
+diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
+index 8a1176efa4c85..3755be04346a6 100644
+--- a/drivers/spi/spi-bcm-qspi.c
++++ b/drivers/spi/spi-bcm-qspi.c
+@@ -509,7 +509,7 @@ static void bcm_qspi_chip_select(struct bcm_qspi *qspi, 
int cs)
+       u32 rd = 0;
+       u32 wr = 0;
+ 
+-      if (qspi->base[CHIP_SELECT]) {
++      if (cs >= 0 && qspi->base[CHIP_SELECT]) {
+               rd = bcm_qspi_read(qspi, CHIP_SELECT, 0);
+               wr = (rd & ~0xff) | (1 << cs);
+               if (rd == wr)
+diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
+index 3c841ae0a3e91..c9c4c0f2e8b7a 100644
+--- a/drivers/spi/spi-meson-spicc.c
++++ b/drivers/spi/spi-meson-spicc.c
+@@ -527,6 +527,11 @@ static int meson_spicc_probe(struct platform_device *pdev)
+       writel_relaxed(0, spicc->base + SPICC_INTREG);
+ 
+       irq = platform_get_irq(pdev, 0);
++      if (irq < 0) {
++              ret = irq;
++              goto out_master;
++      }
++
+       ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,
+                              0, NULL, spicc);
+       if (ret) {
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index cafb773f78616..29d44f5d5212c 100644
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -533,7 +533,7 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
+       else
+               mdata->state = MTK_SPI_IDLE;
+ 
+-      if (!master->can_dma(master, master->cur_msg->spi, trans)) {
++      if (!master->can_dma(master, NULL, trans)) {
+               if (trans->rx_buf) {
+                       cnt = mdata->xfer_len / 4;
+                       ioread32_rep(mdata->base + SPI_RX_DATA_REG,
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
+index 2ee61596164be..a5041bf0d5db1 100644
+--- a/fs/btrfs/qgroup.c
++++ b/fs/btrfs/qgroup.c
+@@ -1105,9 +1105,24 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
+       struct btrfs_trans_handle *trans = NULL;
+       int ret = 0;
+ 
++      /*
++       * We need to have subvol_sem write locked, to prevent races between
++       * concurrent tasks trying to disable quotas, because we will unlock
++       * and relock qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes.
++       */
++      lockdep_assert_held_write(&fs_info->subvol_sem);
++
+       mutex_lock(&fs_info->qgroup_ioctl_lock);
+       if (!fs_info->quota_root)
+               goto out;
++
++      /*
++       * Request qgroup rescan worker to complete and wait for it. This wait
++       * must be done before transaction start for quota disable since it may
++       * deadlock with transaction by the qgroup rescan worker.
++       */
++      clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
++      btrfs_qgroup_wait_for_completion(fs_info, false);
+       mutex_unlock(&fs_info->qgroup_ioctl_lock);
+ 
+       /*
+@@ -1125,14 +1140,13 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
+       if (IS_ERR(trans)) {
+               ret = PTR_ERR(trans);
+               trans = NULL;
++              set_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
+               goto out;
+       }
+ 
+       if (!fs_info->quota_root)
+               goto out;
+ 
+-      clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags);
+-      btrfs_qgroup_wait_for_completion(fs_info, false);
+       spin_lock(&fs_info->qgroup_lock);
+       quota_root = fs_info->quota_root;
+       fs_info->quota_root = NULL;
+@@ -3304,6 +3318,9 @@ qgroup_rescan_init(struct btrfs_fs_info *fs_info, u64 
progress_objectid,
+                       btrfs_warn(fs_info,
+                       "qgroup rescan init failed, qgroup is not enabled");
+                       ret = -EINVAL;
++              } else if (!test_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags)) {
++                      /* Quota disable is in progress */
++                      ret = -EBUSY;
+               }
+ 
+               if (ret) {
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
+index cdb10e9fded65..8f665aa1d706e 100644
+--- a/fs/ext4/inline.c
++++ b/fs/ext4/inline.c
+@@ -1120,7 +1120,15 @@ static void ext4_restore_inline_data(handle_t *handle, 
struct inode *inode,
+                                    struct ext4_iloc *iloc,
+                                    void *buf, int inline_size)
+ {
+-      ext4_create_inline_data(handle, inode, inline_size);
++      int ret;
++
++      ret = ext4_create_inline_data(handle, inode, inline_size);
++      if (ret) {
++              ext4_msg(inode->i_sb, KERN_EMERG,
++                      "error restoring inline_data for inode -- potential 
data loss! (inode %lu, error %d)",
++                      inode->i_ino, ret);
++              return;
++      }
+       ext4_write_inline_data(inode, iloc, buf, 0, inline_size);
+       ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
+ }
+diff --git a/fs/fs_context.c b/fs/fs_context.c
+index a2367c7aef5b3..e492a83fa100e 100644
+--- a/fs/fs_context.c
++++ b/fs/fs_context.c
+@@ -258,7 +258,7 @@ static struct fs_context *alloc_fs_context(struct 
file_system_type *fs_type,
+       struct fs_context *fc;
+       int ret = -ENOMEM;
+ 
+-      fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL);
++      fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL_ACCOUNT);
+       if (!fc)
+               return ERR_PTR(-ENOMEM);
+ 
+@@ -686,7 +686,7 @@ const struct fs_context_operations legacy_fs_context_ops = 
{
+  */
+ static int legacy_init_fs_context(struct fs_context *fc)
+ {
+-      fc->fs_private = kzalloc(sizeof(struct legacy_fs_context), GFP_KERNEL);
++      fc->fs_private = kzalloc(sizeof(struct legacy_fs_context), 
GFP_KERNEL_ACCOUNT);
+       if (!fc->fs_private)
+               return -ENOMEM;
+       fc->ops = &legacy_fs_context_ops;
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
+index a48fcd4180c74..62eb78ac7437f 100644
+--- a/fs/nfsd/nfs4state.c
++++ b/fs/nfsd/nfs4state.c
+@@ -3941,8 +3941,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
+                       status = nfserr_clid_inuse;
+                       if (client_has_state(old)
+                                       && !same_creds(&unconf->cl_cred,
+-                                                      &old->cl_cred))
++                                                      &old->cl_cred)) {
++                              old = NULL;
+                               goto out;
++                      }
+                       status = mark_client_expired_locked(old);
+                       if (status) {
+                               old = NULL;
+diff --git a/kernel/audit.c b/kernel/audit.c
+index 146edff0c73ec..db8141866ceaa 100644
+--- a/kernel/audit.c
++++ b/kernel/audit.c
+@@ -535,20 +535,22 @@ static void kauditd_printk_skb(struct sk_buff *skb)
+ /**
+  * kauditd_rehold_skb - Handle a audit record send failure in the hold queue
+  * @skb: audit record
++ * @error: error code (unused)
+  *
+  * Description:
+  * This should only be used by the kauditd_thread when it fails to flush the
+  * hold queue.
+  */
+-static void kauditd_rehold_skb(struct sk_buff *skb)
++static void kauditd_rehold_skb(struct sk_buff *skb, __always_unused int error)
+ {
+-      /* put the record back in the queue at the same place */
+-      skb_queue_head(&audit_hold_queue, skb);
++      /* put the record back in the queue */
++      skb_queue_tail(&audit_hold_queue, skb);
+ }
+ 
+ /**
+  * kauditd_hold_skb - Queue an audit record, waiting for auditd
+  * @skb: audit record
++ * @error: error code
+  *
+  * Description:
+  * Queue the audit record, waiting for an instance of auditd.  When this
+@@ -558,19 +560,31 @@ static void kauditd_rehold_skb(struct sk_buff *skb)
+  * and queue it, if we have room.  If we want to hold on to the record, but we
+  * don't have room, record a record lost message.
+  */
+-static void kauditd_hold_skb(struct sk_buff *skb)
++static void kauditd_hold_skb(struct sk_buff *skb, int error)
+ {
+       /* at this point it is uncertain if we will ever send this to auditd so
+        * try to send the message via printk before we go any further */
+       kauditd_printk_skb(skb);
+ 
+       /* can we just silently drop the message? */
+-      if (!audit_default) {
+-              kfree_skb(skb);
+-              return;
++      if (!audit_default)
++              goto drop;
++
++      /* the hold queue is only for when the daemon goes away completely,
++       * not -EAGAIN failures; if we are in a -EAGAIN state requeue the
++       * record on the retry queue unless it's full, in which case drop it
++       */
++      if (error == -EAGAIN) {
++              if (!audit_backlog_limit ||
++                  skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
++                      skb_queue_tail(&audit_retry_queue, skb);
++                      return;
++              }
++              audit_log_lost("kauditd retry queue overflow");
++              goto drop;
+       }
+ 
+-      /* if we have room, queue the message */
++      /* if we have room in the hold queue, queue the message */
+       if (!audit_backlog_limit ||
+           skb_queue_len(&audit_hold_queue) < audit_backlog_limit) {
+               skb_queue_tail(&audit_hold_queue, skb);
+@@ -579,24 +593,32 @@ static void kauditd_hold_skb(struct sk_buff *skb)
+ 
+       /* we have no other options - drop the message */
+       audit_log_lost("kauditd hold queue overflow");
++drop:
+       kfree_skb(skb);
+ }
+ 
+ /**
+  * kauditd_retry_skb - Queue an audit record, attempt to send again to auditd
+  * @skb: audit record
++ * @error: error code (unused)
+  *
+  * Description:
+  * Not as serious as kauditd_hold_skb() as we still have a connected auditd,
+  * but for some reason we are having problems sending it audit records so
+  * queue the given record and attempt to resend.
+  */
+-static void kauditd_retry_skb(struct sk_buff *skb)
++static void kauditd_retry_skb(struct sk_buff *skb, __always_unused int error)
+ {
+-      /* NOTE: because records should only live in the retry queue for a
+-       * short period of time, before either being sent or moved to the hold
+-       * queue, we don't currently enforce a limit on this queue */
+-      skb_queue_tail(&audit_retry_queue, skb);
++      if (!audit_backlog_limit ||
++          skb_queue_len(&audit_retry_queue) < audit_backlog_limit) {
++              skb_queue_tail(&audit_retry_queue, skb);
++              return;
++      }
++
++      /* we have to drop the record, send it via printk as a last effort */
++      kauditd_printk_skb(skb);
++      audit_log_lost("kauditd retry queue overflow");
++      kfree_skb(skb);
+ }
+ 
+ /**
+@@ -634,7 +656,7 @@ static void auditd_reset(const struct auditd_connection 
*ac)
+       /* flush the retry queue to the hold queue, but don't touch the main
+        * queue since we need to process that normally for multicast */
+       while ((skb = skb_dequeue(&audit_retry_queue)))
+-              kauditd_hold_skb(skb);
++              kauditd_hold_skb(skb, -ECONNREFUSED);
+ }
+ 
+ /**
+@@ -708,16 +730,18 @@ static int kauditd_send_queue(struct sock *sk, u32 
portid,
+                             struct sk_buff_head *queue,
+                             unsigned int retry_limit,
+                             void (*skb_hook)(struct sk_buff *skb),
+-                            void (*err_hook)(struct sk_buff *skb))
++                            void (*err_hook)(struct sk_buff *skb, int error))
+ {
+       int rc = 0;
+-      struct sk_buff *skb;
++      struct sk_buff *skb = NULL;
++      struct sk_buff *skb_tail;
+       unsigned int failed = 0;
+ 
+       /* NOTE: kauditd_thread takes care of all our locking, we just use
+        *       the netlink info passed to us (e.g. sk and portid) */
+ 
+-      while ((skb = skb_dequeue(queue))) {
++      skb_tail = skb_peek_tail(queue);
++      while ((skb != skb_tail) && (skb = skb_dequeue(queue))) {
+               /* call the skb_hook for each skb we touch */
+               if (skb_hook)
+                       (*skb_hook)(skb);
+@@ -725,7 +749,7 @@ static int kauditd_send_queue(struct sock *sk, u32 portid,
+               /* can we send to anyone via unicast? */
+               if (!sk) {
+                       if (err_hook)
+-                              (*err_hook)(skb);
++                              (*err_hook)(skb, -ECONNREFUSED);
+                       continue;
+               }
+ 
+@@ -739,7 +763,7 @@ retry:
+                           rc == -ECONNREFUSED || rc == -EPERM) {
+                               sk = NULL;
+                               if (err_hook)
+-                                      (*err_hook)(skb);
++                                      (*err_hook)(skb, rc);
+                               if (rc == -EAGAIN)
+                                       rc = 0;
+                               /* continue to drain the queue */
+diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
+index 411be8b2e837e..ad9dffed8411d 100644
+--- a/kernel/cgroup/cpuset.c
++++ b/kernel/cgroup/cpuset.c
+@@ -1473,10 +1473,15 @@ static void update_sibling_cpumasks(struct cpuset 
*parent, struct cpuset *cs,
+       struct cpuset *sibling;
+       struct cgroup_subsys_state *pos_css;
+ 
++      percpu_rwsem_assert_held(&cpuset_rwsem);
++
+       /*
+        * Check all its siblings and call update_cpumasks_hier()
+        * if their use_parent_ecpus flag is set in order for them
+        * to use the right effective_cpus value.
++       *
++       * The update_cpumasks_hier() function may sleep. So we have to
++       * release the RCU read lock before calling it.
+        */
+       rcu_read_lock();
+       cpuset_for_each_child(sibling, pos_css, parent) {
+@@ -1484,8 +1489,13 @@ static void update_sibling_cpumasks(struct cpuset 
*parent, struct cpuset *cs,
+                       continue;
+               if (!sibling->use_parent_ecpus)
+                       continue;
++              if (!css_tryget_online(&sibling->css))
++                      continue;
+ 
++              rcu_read_unlock();
+               update_cpumasks_hier(sibling, tmp);
++              rcu_read_lock();
++              css_put(&sibling->css);
+       }
+       rcu_read_unlock();
+ }
+diff --git a/mm/kmemleak.c b/mm/kmemleak.c
+index 312942d784058..4a669c81f4e22 100644
+--- a/mm/kmemleak.c
++++ b/mm/kmemleak.c
+@@ -1399,7 +1399,8 @@ static void kmemleak_scan(void)
+ {
+       unsigned long flags;
+       struct kmemleak_object *object;
+-      int i;
++      struct zone *zone;
++      int __maybe_unused i;
+       int new_leaks = 0;
+ 
+       jiffies_last_scan = jiffies;
+@@ -1439,9 +1440,9 @@ static void kmemleak_scan(void)
+        * Struct page scanning for each node.
+        */
+       get_online_mems();
+-      for_each_online_node(i) {
+-              unsigned long start_pfn = node_start_pfn(i);
+-              unsigned long end_pfn = node_end_pfn(i);
++      for_each_populated_zone(zone) {
++              unsigned long start_pfn = zone->zone_start_pfn;
++              unsigned long end_pfn = zone_end_pfn(zone);
+               unsigned long pfn;
+ 
+               for (pfn = start_pfn; pfn < end_pfn; pfn++) {
+@@ -1450,8 +1451,8 @@ static void kmemleak_scan(void)
+                       if (!page)
+                               continue;
+ 
+-                      /* only scan pages belonging to this node */
+-                      if (page_to_nid(page) != i)
++                      /* only scan pages belonging to this zone */
++                      if (page_zone(page) != zone)
+                               continue;
+                       /* only scan if page is in use */
+                       if (page_count(page) == 0)
+diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
+index b2ba1d2556f14..e0df892b5c370 100644
+--- a/net/ieee802154/nl802154.c
++++ b/net/ieee802154/nl802154.c
+@@ -1457,7 +1457,7 @@ static int nl802154_send_key(struct sk_buff *msg, u32 
cmd, u32 portid,
+ 
+       hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
+       if (!hdr)
+-              return -1;
++              return -ENOBUFS;
+ 
+       if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
+               goto nla_put_failure;
+@@ -1650,7 +1650,7 @@ static int nl802154_send_device(struct sk_buff *msg, u32 
cmd, u32 portid,
+ 
+       hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
+       if (!hdr)
+-              return -1;
++              return -ENOBUFS;
+ 
+       if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
+               goto nla_put_failure;
+@@ -1828,7 +1828,7 @@ static int nl802154_send_devkey(struct sk_buff *msg, u32 
cmd, u32 portid,
+ 
+       hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
+       if (!hdr)
+-              return -1;
++              return -ENOBUFS;
+ 
+       if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
+               goto nla_put_failure;
+@@ -2004,7 +2004,7 @@ static int nl802154_send_seclevel(struct sk_buff *msg, 
u32 cmd, u32 portid,
+ 
+       hdr = nl802154hdr_put(msg, portid, seq, flags, cmd);
+       if (!hdr)
+-              return -1;
++              return -ENOBUFS;
+ 
+       if (nla_put_u32(msg, NL802154_ATTR_IFINDEX, dev->ifindex))
+               goto nla_put_failure;
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index d06205626cd54..c03448ea8a203 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -2122,6 +2122,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec 
*codec,
+ {
+       static const hda_nid_t conn1[] = { 0x0c };
+       static const struct coef_fw gb_x570_coefs[] = {
++              WRITE_COEF(0x07, 0x03c0),
+               WRITE_COEF(0x1a, 0x01c1),
+               WRITE_COEF(0x1b, 0x0202),
+               WRITE_COEF(0x43, 0x3005),
+@@ -2548,7 +2549,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", 
ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", 
ALC1220_FIXUP_GB_DUAL_CODECS),
+       SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", 
ALC1220_FIXUP_GB_X570),
+-      SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", 
ALC1220_FIXUP_CLEVO_P950),
++      SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", 
ALC1220_FIXUP_GB_X570),
++      SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", 
ALC1220_FIXUP_GB_X570),
+       SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
+       SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
+@@ -2623,6 +2625,7 @@ static const struct hda_model_fixup 
alc882_fixup_models[] = {
+       {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
+       {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
+       {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
++      {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
+       {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
+       {}
+ };
+@@ -8180,6 +8183,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", 
ALC294_FIXUP_ASUS_GU502_PINS),
+       SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", 
ALC289_FIXUP_ASUS_GA401),
+       SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", 
ALC289_FIXUP_ASUS_GA401),
++      SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
+       SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", 
ALC256_FIXUP_ASUS_AIO_GPIO2),
+       SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
+       SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
+diff --git a/sound/soc/codecs/cpcap.c b/sound/soc/codecs/cpcap.c
+index 1902689c5ea2c..acd88fe38cd4c 100644
+--- a/sound/soc/codecs/cpcap.c
++++ b/sound/soc/codecs/cpcap.c
+@@ -1541,6 +1541,8 @@ static int cpcap_codec_probe(struct platform_device 
*pdev)
+ {
+       struct device_node *codec_node =
+               of_get_child_by_name(pdev->dev.parent->of_node, "audio-codec");
++      if (!codec_node)
++              return -ENODEV;
+ 
+       pdev->dev.of_node = codec_node;
+ 
+diff --git a/sound/soc/codecs/max9759.c b/sound/soc/codecs/max9759.c
+index 00e9d4fd1651f..0c261335c8a16 100644
+--- a/sound/soc/codecs/max9759.c
++++ b/sound/soc/codecs/max9759.c
+@@ -64,7 +64,8 @@ static int speaker_gain_control_put(struct snd_kcontrol 
*kcontrol,
+       struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol);
+       struct max9759 *priv = snd_soc_component_get_drvdata(c);
+ 
+-      if (ucontrol->value.integer.value[0] > 3)
++      if (ucontrol->value.integer.value[0] < 0 ||
++          ucontrol->value.integer.value[0] > 3)
+               return -EINVAL;
+ 
+       priv->gain = ucontrol->value.integer.value[0];
+diff --git a/sound/soc/fsl/pcm030-audio-fabric.c 
b/sound/soc/fsl/pcm030-audio-fabric.c
+index af3c3b90c0aca..83b4a22bf15ac 100644
+--- a/sound/soc/fsl/pcm030-audio-fabric.c
++++ b/sound/soc/fsl/pcm030-audio-fabric.c
+@@ -93,16 +93,21 @@ static int pcm030_fabric_probe(struct platform_device *op)
+               dev_err(&op->dev, "platform_device_alloc() failed\n");
+ 
+       ret = platform_device_add(pdata->codec_device);
+-      if (ret)
++      if (ret) {
+               dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
++              platform_device_put(pdata->codec_device);
++      }
+ 
+       ret = snd_soc_register_card(card);
+-      if (ret)
++      if (ret) {
+               dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
++              platform_device_del(pdata->codec_device);
++              platform_device_put(pdata->codec_device);
++      }
+ 
+       platform_set_drvdata(op, pdata);
+-
+       return ret;
++
+ }
+ 
+ static int pcm030_fabric_remove(struct platform_device *op)
+diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
+index 95fc24580f85f..ef8fd331526b0 100644
+--- a/sound/soc/soc-ops.c
++++ b/sound/soc/soc-ops.c
+@@ -322,13 +322,27 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
+       if (sign_bit)
+               mask = BIT(sign_bit + 1) - 1;
+ 
+-      val = ((ucontrol->value.integer.value[0] + min) & mask);
++      val = ucontrol->value.integer.value[0];
++      if (mc->platform_max && val > mc->platform_max)
++              return -EINVAL;
++      if (val > max - min)
++              return -EINVAL;
++      if (val < 0)
++              return -EINVAL;
++      val = (val + min) & mask;
+       if (invert)
+               val = max - val;
+       val_mask = mask << shift;
+       val = val << shift;
+       if (snd_soc_volsw_is_stereo(mc)) {
+-              val2 = ((ucontrol->value.integer.value[1] + min) & mask);
++              val2 = ucontrol->value.integer.value[1];
++              if (mc->platform_max && val2 > mc->platform_max)
++                      return -EINVAL;
++              if (val2 > max - min)
++                      return -EINVAL;
++              if (val2 < 0)
++                      return -EINVAL;
++              val2 = (val2 + min) & mask;
+               if (invert)
+                       val2 = max - val2;
+               if (reg == reg2) {
+@@ -422,8 +436,15 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
+       int err = 0;
+       unsigned int val, val_mask, val2 = 0;
+ 
++      val = ucontrol->value.integer.value[0];
++      if (mc->platform_max && val > mc->platform_max)
++              return -EINVAL;
++      if (val > max - min)
++              return -EINVAL;
++      if (val < 0)
++              return -EINVAL;
+       val_mask = mask << shift;
+-      val = (ucontrol->value.integer.value[0] + min) & mask;
++      val = (val + min) & mask;
+       val = val << shift;
+ 
+       err = snd_soc_component_update_bits(component, reg, val_mask, val);
+@@ -889,6 +910,8 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
+       unsigned int i, regval, regmask;
+       int err;
+ 
++      if (val < mc->min || val > mc->max)
++              return -EINVAL;
+       if (invert)
+               val = max - val;
+       val &= mask;
+diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c 
b/sound/soc/xilinx/xlnx_formatter_pcm.c
+index 1f15c11782ec4..4caee57114b88 100644
+--- a/sound/soc/xilinx/xlnx_formatter_pcm.c
++++ b/sound/soc/xilinx/xlnx_formatter_pcm.c
+@@ -37,6 +37,7 @@
+ #define XLNX_AUD_XFER_COUNT   0x28
+ #define XLNX_AUD_CH_STS_START 0x2C
+ #define XLNX_BYTES_PER_CH     0x44
++#define XLNX_AUD_ALIGN_BYTES  64
+ 
+ #define AUD_STS_IOC_IRQ_MASK  BIT(31)
+ #define AUD_STS_CH_STS_MASK   BIT(29)
+@@ -370,12 +371,32 @@ static int xlnx_formatter_pcm_open(struct 
snd_pcm_substream *substream)
+       snd_soc_set_runtime_hwparams(substream, &xlnx_pcm_hardware);
+       runtime->private_data = stream_data;
+ 
+-      /* Resize the period size divisible by 64 */
++      /* Resize the period bytes as divisible by 64 */
+       err = snd_pcm_hw_constraint_step(runtime, 0,
+-                                       SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64);
++                                       SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
++                                       XLNX_AUD_ALIGN_BYTES);
+       if (err) {
+               dev_err(component->dev,
+-                      "unable to set constraint on period bytes\n");
++                      "Unable to set constraint on period bytes\n");
++              return err;
++      }
++
++      /* Resize the buffer bytes as divisible by 64 */
++      err = snd_pcm_hw_constraint_step(runtime, 0,
++                                       SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
++                                       XLNX_AUD_ALIGN_BYTES);
++      if (err) {
++              dev_err(component->dev,
++                      "Unable to set constraint on buffer bytes\n");
++              return err;
++      }
++
++      /* Set periods as integer multiple */
++      err = snd_pcm_hw_constraint_integer(runtime,
++                                          SNDRV_PCM_HW_PARAM_PERIODS);
++      if (err < 0) {
++              dev_err(component->dev,
++                      "Unable to set constraint on periods to be integer\n");
+               return err;
+       }
+ 
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
+index 01dee2074ab36..c29ccdf9e8bca 100644
+--- a/sound/usb/quirks-table.h
++++ b/sound/usb/quirks-table.h
+@@ -25,6 +25,16 @@
+       .idProduct = prod, \
+       .bInterfaceClass = USB_CLASS_VENDOR_SPEC
+ 
++/* A standard entry matching with vid/pid and the audio class/subclass */
++#define USB_AUDIO_DEVICE(vend, prod) \
++      .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
++                     USB_DEVICE_ID_MATCH_INT_CLASS | \
++                     USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
++      .idVendor = vend, \
++      .idProduct = prod, \
++      .bInterfaceClass = USB_CLASS_AUDIO, \
++      .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL
++
+ /* HP Thunderbolt Dock Audio Headset */
+ {
+       USB_DEVICE(0x03f0, 0x0269),
+diff --git a/tools/testing/selftests/futex/Makefile 
b/tools/testing/selftests/futex/Makefile
+index 12631f0076a10..11e157d7533b8 100644
+--- a/tools/testing/selftests/futex/Makefile
++++ b/tools/testing/selftests/futex/Makefile
+@@ -11,7 +11,7 @@ all:
+       @for DIR in $(SUBDIRS); do              \
+               BUILD_TARGET=$(OUTPUT)/$$DIR;   \
+               mkdir $$BUILD_TARGET  -p;       \
+-              make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
++              $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
+               if [ -e $$DIR/$(TEST_PROGS) ]; then \
+                       rsync -a $$DIR/$(TEST_PROGS) $$BUILD_TARGET/; \
+               fi \
+@@ -32,6 +32,6 @@ override define CLEAN
+       @for DIR in $(SUBDIRS); do              \
+               BUILD_TARGET=$(OUTPUT)/$$DIR;   \
+               mkdir $$BUILD_TARGET  -p;       \
+-              make OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
++              $(MAKE) OUTPUT=$$BUILD_TARGET -C $$DIR $@;\
+       done
+ endef

Reply via email to