commit:     0482f30deff33ebeb64c76f62ded24b2f9b04a65
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  3 15:08:47 2022 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Thu Nov  3 15:08:47 2022 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=0482f30d

Linux patch 4.9.332

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

 0000_README              |    4 +
 1331_linux-4.9.332.patch | 1335 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1339 insertions(+)

diff --git a/0000_README b/0000_README
index 87dd59e8..d1f8d301 100644
--- a/0000_README
+++ b/0000_README
@@ -1371,6 +1371,10 @@ Patch:  1330_linux-4.9.331.patch
 From:   http://www.kernel.org
 Desc:   Linux 4.9.331
 
+Patch:  1331_linux-4.9.332.patch
+From:   http://www.kernel.org
+Desc:   Linux 4.9.332
+
 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/1331_linux-4.9.332.patch b/1331_linux-4.9.332.patch
new file mode 100644
index 00000000..bc72e2d7
--- /dev/null
+++ b/1331_linux-4.9.332.patch
@@ -0,0 +1,1335 @@
+diff --git a/Documentation/arm64/silicon-errata.txt 
b/Documentation/arm64/silicon-errata.txt
+index 47df2c25302ac..e6aced550e238 100644
+--- a/Documentation/arm64/silicon-errata.txt
++++ b/Documentation/arm64/silicon-errata.txt
+@@ -53,7 +53,9 @@ stable kernels.
+ | ARM            | Cortex-A57      | #832075         | ARM64_ERRATUM_832075   
     |
+ | ARM            | Cortex-A57      | #852523         | N/A                    
     |
+ | ARM            | Cortex-A57      | #834220         | ARM64_ERRATUM_834220   
     |
++| ARM            | Cortex-A57      | #1742098        | ARM64_ERRATUM_1742098  
     |
+ | ARM            | Cortex-A72      | #853709         | N/A                    
     |
++| ARM            | Cortex-A72      | #1655431        | ARM64_ERRATUM_1742098  
     |
+ | ARM            | Cortex-A55      | #1024718        | ARM64_ERRATUM_1024718  
     |
+ | ARM            | Cortex-A76      | #1188873        | ARM64_ERRATUM_1188873  
     |
+ | ARM            | MMU-500         | #841119,#826419 | N/A                    
     |
+diff --git a/Makefile b/Makefile
+index b9a0f8e5f09f0..c5d6b0b2bbb78 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 4
+ PATCHLEVEL = 9
+-SUBLEVEL = 331
++SUBLEVEL = 332
+ EXTRAVERSION =
+ NAME = Roaring Lionus
+ 
+diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
+index 2f39d9b3886e4..19d0cab60a390 100644
+--- a/arch/arc/include/asm/io.h
++++ b/arch/arc/include/asm/io.h
+@@ -35,7 +35,7 @@ static inline void ioport_unmap(void __iomem *addr)
+ {
+ }
+ 
+-extern void iounmap(const void __iomem *addr);
++extern void iounmap(const volatile void __iomem *addr);
+ 
+ #define ioremap_nocache(phy, sz)      ioremap(phy, sz)
+ #define ioremap_wc(phy, sz)           ioremap(phy, sz)
+diff --git a/arch/arc/mm/ioremap.c b/arch/arc/mm/ioremap.c
+index 9881bd740ccc1..0719b1280ef87 100644
+--- a/arch/arc/mm/ioremap.c
++++ b/arch/arc/mm/ioremap.c
+@@ -95,7 +95,7 @@ void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long 
size,
+ EXPORT_SYMBOL(ioremap_prot);
+ 
+ 
+-void iounmap(const void __iomem *addr)
++void iounmap(const volatile void __iomem *addr)
+ {
+       /* weird double cast to handle phys_addr_t > 32 bits */
+       if (arc_uncached_addr_space((phys_addr_t)(u32)addr))
+diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
+index 6d12c3b787771..3e0be8648ce77 100644
+--- a/arch/arm64/Kconfig
++++ b/arch/arm64/Kconfig
+@@ -455,6 +455,22 @@ config ARM64_ERRATUM_1188873
+ 
+         If unsure, say Y.
+ 
++config ARM64_ERRATUM_1742098
++      bool "Cortex-A57/A72: 1742098: ELR recorded incorrectly on interrupt 
taken between cryptographic instructions in a sequence"
++      depends on COMPAT
++      default y
++      help
++        This option removes the AES hwcap for aarch32 user-space to
++        workaround erratum 1742098 on Cortex-A57 and Cortex-A72.
++
++        Affected parts may corrupt the AES state if an interrupt is
++        taken between a pair of AES instructions. These instructions
++        are only present if the cryptography extensions are present.
++        All software should have a fallback implementation for CPUs
++        that don't implement the cryptography extensions.
++
++        If unsure, say Y.
++
+ config CAVIUM_ERRATUM_22375
+       bool "Cavium erratum 22375, 24313"
+       default y
+diff --git a/arch/arm64/include/asm/cpucaps.h 
b/arch/arm64/include/asm/cpucaps.h
+index 9935e55a3cc75..91d365d87694e 100644
+--- a/arch/arm64/include/asm/cpucaps.h
++++ b/arch/arm64/include/asm/cpucaps.h
+@@ -40,7 +40,8 @@
+ #define ARM64_MISMATCHED_CACHE_TYPE           19
+ #define ARM64_WORKAROUND_1188873              20
+ #define ARM64_SPECTRE_BHB                     21
++#define ARM64_WORKAROUND_1742098              22
+ 
+-#define ARM64_NCAPS                           22
++#define ARM64_NCAPS                           23
+ 
+ #endif /* __ASM_CPUCAPS_H */
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
+index f0cdf21b1006b..17208f1b10a93 100644
+--- a/arch/arm64/kernel/cpu_errata.c
++++ b/arch/arm64/kernel/cpu_errata.c
+@@ -448,6 +448,14 @@ static const struct midr_range 
arm64_bp_harden_smccc_cpus[] = {
+ 
+ #endif
+ 
++#ifdef CONFIG_ARM64_ERRATUM_1742098
++static struct midr_range broken_aarch32_aes[] = {
++      MIDR_RANGE(MIDR_CORTEX_A57, 0, 1, 0xf, 0xf),
++      MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
++      {},
++};
++#endif
++
+ const struct arm64_cpu_capabilities arm64_errata[] = {
+ #if   defined(CONFIG_ARM64_ERRATUM_826319) || \
+       defined(CONFIG_ARM64_ERRATUM_827319) || \
+@@ -567,6 +575,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
+               .cpu_enable = spectre_bhb_enable_mitigation,
+ #endif
+       },
++#ifdef CONFIG_ARM64_ERRATUM_1742098
++      {
++              .desc = "ARM erratum 1742098",
++              .capability = ARM64_WORKAROUND_1742098,
++              CAP_MIDR_RANGE_LIST(broken_aarch32_aes),
++              .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
++      },
++#endif
+       {
+       }
+ };
+diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
+index 9b7e7d2f236ee..0f62adbe1b075 100644
+--- a/arch/arm64/kernel/cpufeature.c
++++ b/arch/arm64/kernel/cpufeature.c
+@@ -28,6 +28,7 @@
+ #include <asm/cpu.h>
+ #include <asm/cpufeature.h>
+ #include <asm/cpu_ops.h>
++#include <asm/hwcap.h>
+ #include <asm/mmu_context.h>
+ #include <asm/processor.h>
+ #include <asm/sysreg.h>
+@@ -885,6 +886,14 @@ static void cpu_copy_el2regs(const struct 
arm64_cpu_capabilities *__unused)
+               write_sysreg(read_sysreg(tpidr_el1), tpidr_el2);
+ }
+ 
++static void elf_hwcap_fixup(void)
++{
++#ifdef CONFIG_ARM64_ERRATUM_1742098
++      if (cpus_have_const_cap(ARM64_WORKAROUND_1742098))
++              compat_elf_hwcap2 &= ~COMPAT_HWCAP2_AES;
++#endif /* ARM64_ERRATUM_1742098 */
++}
++
+ static const struct arm64_cpu_capabilities arm64_features[] = {
+       {
+               .desc = "GIC system register CPU interface",
+@@ -1304,8 +1313,10 @@ void __init setup_cpu_features(void)
+       mark_const_caps_ready();
+       setup_elf_hwcaps(arm64_elf_hwcaps);
+ 
+-      if (system_supports_32bit_el0())
++      if (system_supports_32bit_el0()) {
+               setup_elf_hwcaps(compat_elf_hwcaps);
++              elf_hwcap_fixup();
++      }
+ 
+       /* Advertise that we have computed the system capabilities */
+       set_sys_caps_initialised();
+diff --git a/arch/s390/include/asm/futex.h b/arch/s390/include/asm/futex.h
+index 8f8eec9e1198c..82e6aca8cf518 100644
+--- a/arch/s390/include/asm/futex.h
++++ b/arch/s390/include/asm/futex.h
+@@ -15,7 +15,8 @@
+               "3: jl    1b\n"                                         \
+               "   lhi   %0,0\n"                                       \
+               "4: sacf  768\n"                                        \
+-              EX_TABLE(0b,4b) EX_TABLE(2b,4b) EX_TABLE(3b,4b)         \
++              EX_TABLE(0b,4b) EX_TABLE(1b,4b)                         \
++              EX_TABLE(2b,4b) EX_TABLE(3b,4b)                         \
+               : "=d" (ret), "=&d" (oldval), "=&d" (newval),           \
+                 "=m" (*uaddr)                                         \
+               : "0" (-EFAULT), "d" (oparg), "a" (uaddr),              \
+diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
+index 10ce6533874f2..3a9a469fc2aa0 100644
+--- a/drivers/acpi/video_detect.c
++++ b/drivers/acpi/video_detect.c
+@@ -226,6 +226,70 @@ static const struct dmi_system_id 
video_detect_dmi_table[] = {
+               DMI_MATCH(DMI_BOARD_NAME, "PF5LUXG"),
+               },
+       },
++      /*
++       * More Tongfang devices with the same issue as the Clevo NL5xRU and
++       * NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description above.
++       */
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GKxNRxx",
++      .matches = {
++              DMI_MATCH(DMI_BOARD_NAME, "GKxNRxx"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GKxNRxx",
++      .matches = {
++              DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"),
++              DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A1650TI"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GKxNRxx",
++      .matches = {
++              DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"),
++              DMI_MATCH(DMI_BOARD_NAME, "POLARIS1501A2060"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GKxNRxx",
++      .matches = {
++              DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"),
++              DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A1650TI"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GKxNRxx",
++      .matches = {
++              DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"),
++              DMI_MATCH(DMI_BOARD_NAME, "POLARIS1701A2060"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GMxNGxx",
++      .matches = {
++              DMI_MATCH(DMI_BOARD_NAME, "GMxNGxx"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GMxZGxx",
++      .matches = {
++              DMI_MATCH(DMI_BOARD_NAME, "GMxZGxx"),
++              },
++      },
++      {
++      .callback = video_detect_force_native,
++      .ident = "TongFang GMxRGxx",
++      .matches = {
++              DMI_MATCH(DMI_BOARD_NAME, "GMxRGxx"),
++              },
++      },
+       /*
+        * These models have a working acpi_video backlight control, and using
+        * native backlight causes a regression where backlight does not work
+diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
+index 0cc08f892feae..c27cb0a997dbe 100644
+--- a/drivers/ata/ahci.h
++++ b/drivers/ata/ahci.h
+@@ -257,7 +257,7 @@ enum {
+       ICH_MAP                         = 0x90, /* ICH MAP register */
+ 
+       /* em constants */
+-      EM_MAX_SLOTS                    = 8,
++      EM_MAX_SLOTS                    = SATA_PMP_MAX_PORTS,
+       EM_MAX_RETRY                    = 5,
+ 
+       /* em_ctl bits */
+diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
+index 3f3a7db208ae5..07d7aa9f26aff 100644
+--- a/drivers/ata/ahci_imx.c
++++ b/drivers/ata/ahci_imx.c
+@@ -691,4 +691,4 @@ module_platform_driver(imx_ahci_driver);
+ MODULE_DESCRIPTION("Freescale i.MX AHCI SATA platform driver");
+ MODULE_AUTHOR("Richard Zhu <[email protected]>");
+ MODULE_LICENSE("GPL");
+-MODULE_ALIAS("ahci:imx");
++MODULE_ALIAS("platform:" DRV_NAME);
+diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
+index 48ab467267079..570560a66c176 100644
+--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
++++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
+@@ -289,6 +289,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
+       struct platform_device *pdev = hdmi->pdev;
+       int ret;
+ 
++      if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
++              DRM_DEV_ERROR(dev->dev, "too many bridges\n");
++              return -ENOSPC;
++      }
++
+       hdmi->dev = dev;
+       hdmi->encoder = encoder;
+ 
+diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
+index 353429b057337..905391ea55dab 100644
+--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
++++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
+@@ -71,8 +71,9 @@ static int mdp4_lvds_connector_get_modes(struct 
drm_connector *connector)
+       return ret;
+ }
+ 
+-static int mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
+-                               struct drm_display_mode *mode)
++static enum drm_mode_status
++mdp4_lvds_connector_mode_valid(struct drm_connector *connector,
++                             struct drm_display_mode *mode)
+ {
+       struct mdp4_lvds_connector *mdp4_lvds_connector =
+                       to_mdp4_lvds_connector(connector);
+diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
+index 8c993f95e3ba9..396a3c720b515 100644
+--- a/drivers/hid/hid-magicmouse.c
++++ b/drivers/hid/hid-magicmouse.c
+@@ -342,7 +342,7 @@ static int magicmouse_raw_event(struct hid_device *hdev,
+               magicmouse_raw_event(hdev, report, data + 2, data[1]);
+               magicmouse_raw_event(hdev, report, data + 2 + data[1],
+                       size - 2 - data[1]);
+-              break;
++              return 0;
+       default:
+               return 0;
+       }
+diff --git a/drivers/media/platform/vivid/vivid-core.c 
b/drivers/media/platform/vivid/vivid-core.c
+index 5464fefbaab9d..52d9dadbc49ab 100644
+--- a/drivers/media/platform/vivid/vivid-core.c
++++ b/drivers/media/platform/vivid/vivid-core.c
+@@ -302,6 +302,28 @@ static int vidioc_g_fbuf(struct file *file, void *fh, 
struct v4l2_framebuffer *a
+       return vivid_vid_out_g_fbuf(file, fh, a);
+ }
+ 
++/*
++ * Only support the framebuffer of one of the vivid instances.
++ * Anything else is rejected.
++ */
++bool vivid_validate_fb(const struct v4l2_framebuffer *a)
++{
++      struct vivid_dev *dev;
++      int i;
++
++      for (i = 0; i < n_devs; i++) {
++              dev = vivid_devs[i];
++              if (!dev || !dev->video_pbase)
++                      continue;
++              if ((unsigned long)a->base == dev->video_pbase &&
++                  a->fmt.width <= dev->display_width &&
++                  a->fmt.height <= dev->display_height &&
++                  a->fmt.bytesperline <= dev->display_byte_stride)
++                      return true;
++      }
++      return false;
++}
++
+ static int vidioc_s_fbuf(struct file *file, void *fh, const struct 
v4l2_framebuffer *a)
+ {
+       struct video_device *vdev = video_devdata(file);
+diff --git a/drivers/media/platform/vivid/vivid-core.h 
b/drivers/media/platform/vivid/vivid-core.h
+index a7daa40d0a496..2b661b4eb9ca3 100644
+--- a/drivers/media/platform/vivid/vivid-core.h
++++ b/drivers/media/platform/vivid/vivid-core.h
+@@ -561,4 +561,6 @@ static inline bool vivid_is_hdmi_out(const struct 
vivid_dev *dev)
+       return dev->output_type[dev->output] == HDMI;
+ }
+ 
++bool vivid_validate_fb(const struct v4l2_framebuffer *a);
++
+ #endif
+diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c 
b/drivers/media/platform/vivid/vivid-vid-cap.c
+index 82621260fc34b..198b26687b579 100644
+--- a/drivers/media/platform/vivid/vivid-vid-cap.c
++++ b/drivers/media/platform/vivid/vivid-vid-cap.c
+@@ -455,6 +455,12 @@ void vivid_update_format_cap(struct vivid_dev *dev, bool 
keep_controls)
+       tpg_reset_source(&dev->tpg, dev->src_rect.width, dev->src_rect.height, 
dev->field_cap);
+       dev->crop_cap = dev->src_rect;
+       dev->crop_bounds_cap = dev->src_rect;
++      if (dev->bitmap_cap &&
++          (dev->compose_cap.width != dev->crop_cap.width ||
++           dev->compose_cap.height != dev->crop_cap.height)) {
++              vfree(dev->bitmap_cap);
++              dev->bitmap_cap = NULL;
++      }
+       dev->compose_cap = dev->crop_cap;
+       if (V4L2_FIELD_HAS_T_OR_B(dev->field_cap))
+               dev->compose_cap.height /= 2;
+@@ -863,6 +869,8 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, 
struct v4l2_selection
+       struct vivid_dev *dev = video_drvdata(file);
+       struct v4l2_rect *crop = &dev->crop_cap;
+       struct v4l2_rect *compose = &dev->compose_cap;
++      unsigned orig_compose_w = compose->width;
++      unsigned orig_compose_h = compose->height;
+       unsigned factor = V4L2_FIELD_HAS_T_OR_B(dev->field_cap) ? 2 : 1;
+       int ret;
+ 
+@@ -979,17 +987,17 @@ int vivid_vid_cap_s_selection(struct file *file, void 
*fh, struct v4l2_selection
+                       s->r.height /= factor;
+               }
+               v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect);
+-              if (dev->bitmap_cap && (compose->width != s->r.width ||
+-                                      compose->height != s->r.height)) {
+-                      vfree(dev->bitmap_cap);
+-                      dev->bitmap_cap = NULL;
+-              }
+               *compose = s->r;
+               break;
+       default:
+               return -EINVAL;
+       }
+ 
++      if (dev->bitmap_cap && (compose->width != orig_compose_w ||
++                              compose->height != orig_compose_h)) {
++              vfree(dev->bitmap_cap);
++              dev->bitmap_cap = NULL;
++      }
+       tpg_s_crop_compose(&dev->tpg, crop, compose);
+       return 0;
+ }
+@@ -1232,7 +1240,14 @@ int vivid_vid_cap_s_fbuf(struct file *file, void *fh,
+               return -EINVAL;
+       if (a->fmt.bytesperline < (a->fmt.width * fmt->bit_depth[0]) / 8)
+               return -EINVAL;
+-      if (a->fmt.height * a->fmt.bytesperline < a->fmt.sizeimage)
++      if (a->fmt.bytesperline > a->fmt.sizeimage / a->fmt.height)
++              return -EINVAL;
++
++      /*
++       * Only support the framebuffer of one of the vivid instances.
++       * Anything else is rejected.
++       */
++      if (!vivid_validate_fb(a))
+               return -EINVAL;
+ 
+       dev->fb_vbase_cap = phys_to_virt((unsigned long)a->base);
+diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
+index 730a7c392c1db..12e04ac6a9ee1 100644
+--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
++++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
+@@ -171,6 +171,20 @@ bool v4l2_valid_dv_timings(const struct v4l2_dv_timings 
*t,
+           (bt->interlaced && !(caps & V4L2_DV_BT_CAP_INTERLACED)) ||
+           (!bt->interlaced && !(caps & V4L2_DV_BT_CAP_PROGRESSIVE)))
+               return false;
++
++      /* sanity checks for the blanking timings */
++      if (!bt->interlaced &&
++          (bt->il_vbackporch || bt->il_vsync || bt->il_vfrontporch))
++              return false;
++      if (bt->hfrontporch > 2 * bt->width ||
++          bt->hsync > 1024 || bt->hbackporch > 1024)
++              return false;
++      if (bt->vfrontporch > 4096 ||
++          bt->vsync > 128 || bt->vbackporch > 4096)
++              return false;
++      if (bt->interlaced && (bt->il_vfrontporch > 4096 ||
++          bt->il_vsync > 128 || bt->il_vbackporch > 4096))
++              return false;
+       return fnc == NULL || fnc(t, fnc_handle);
+ }
+ EXPORT_SYMBOL_GPL(v4l2_valid_dv_timings);
+diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
+index d56a3b6c2fb9d..edbd684b75916 100644
+--- a/drivers/mmc/core/sdio_bus.c
++++ b/drivers/mmc/core/sdio_bus.c
+@@ -263,7 +263,8 @@ static void sdio_release_func(struct device *dev)
+ {
+       struct sdio_func *func = dev_to_sdio_func(dev);
+ 
+-      sdio_free_func_cis(func);
++      if (!(func->card->quirks & MMC_QUIRK_NONSTD_SDIO))
++              sdio_free_func_cis(func);
+ 
+       kfree(func->info);
+       kfree(func->tmpbuf);
+diff --git a/drivers/net/can/mscan/mpc5xxx_can.c 
b/drivers/net/can/mscan/mpc5xxx_can.c
+index 2949a381a94dc..21993ba7ae2a9 100644
+--- a/drivers/net/can/mscan/mpc5xxx_can.c
++++ b/drivers/net/can/mscan/mpc5xxx_can.c
+@@ -336,14 +336,14 @@ static int mpc5xxx_can_probe(struct platform_device 
*ofdev)
+                                              &mscan_clksrc);
+       if (!priv->can.clock.freq) {
+               dev_err(&ofdev->dev, "couldn't get MSCAN clock properties\n");
+-              goto exit_free_mscan;
++              goto exit_put_clock;
+       }
+ 
+       err = register_mscandev(dev, mscan_clksrc);
+       if (err) {
+               dev_err(&ofdev->dev, "registering %s failed (err=%d)\n",
+                       DRV_NAME, err);
+-              goto exit_free_mscan;
++              goto exit_put_clock;
+       }
+ 
+       dev_info(&ofdev->dev, "MSCAN at 0x%p, irq %d, clock %d Hz\n",
+@@ -351,7 +351,9 @@ static int mpc5xxx_can_probe(struct platform_device *ofdev)
+ 
+       return 0;
+ 
+-exit_free_mscan:
++exit_put_clock:
++      if (data->put_clock)
++              data->put_clock(ofdev);
+       free_candev(dev);
+ exit_dispose_irq:
+       irq_dispose_mapping(irq);
+diff --git a/drivers/net/can/rcar/rcar_canfd.c 
b/drivers/net/can/rcar/rcar_canfd.c
+index a127c853a4e90..694a3354554fa 100644
+--- a/drivers/net/can/rcar/rcar_canfd.c
++++ b/drivers/net/can/rcar/rcar_canfd.c
+@@ -1079,7 +1079,7 @@ static irqreturn_t rcar_canfd_global_interrupt(int irq, 
void *dev_id)
+       struct rcar_canfd_global *gpriv = dev_id;
+       struct net_device *ndev;
+       struct rcar_canfd_channel *priv;
+-      u32 sts, gerfl;
++      u32 sts, cc, gerfl;
+       u32 ch, ridx;
+ 
+       /* Global error interrupts still indicate a condition specific
+@@ -1097,7 +1097,9 @@ static irqreturn_t rcar_canfd_global_interrupt(int irq, 
void *dev_id)
+ 
+               /* Handle Rx interrupts */
+               sts = rcar_canfd_read(priv->base, RCANFD_RFSTS(ridx));
+-              if (likely(sts & RCANFD_RFSTS_RFIF)) {
++              cc = rcar_canfd_read(priv->base, RCANFD_RFCC(ridx));
++              if (likely(sts & RCANFD_RFSTS_RFIF &&
++                         cc & RCANFD_RFCC_RFIE)) {
+                       if (napi_schedule_prep(&priv->napi)) {
+                               /* Disable Rx FIFO interrupts */
+                               rcar_canfd_clear_bit(priv->base,
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.c 
b/drivers/net/ethernet/hisilicon/hns/hnae.c
+index 66e7a5fd42497..87ce15a121358 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.c
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.c
+@@ -418,8 +418,10 @@ int hnae_ae_register(struct hnae_ae_dev *hdev, struct 
module *owner)
+       hdev->cls_dev.release = hnae_release;
+       (void)dev_set_name(&hdev->cls_dev, "hnae%d", hdev->id);
+       ret = device_register(&hdev->cls_dev);
+-      if (ret)
++      if (ret) {
++              put_device(&hdev->cls_dev);
+               return ret;
++      }
+ 
+       __module_get(THIS_MODULE);
+ 
+diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c 
b/drivers/net/ethernet/ibm/ehea/ehea_main.c
+index 6c70cba92df06..89f112d0c9f48 100644
+--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
++++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
+@@ -2937,6 +2937,7 @@ static struct device *ehea_register_port(struct 
ehea_port *port,
+       ret = of_device_register(&port->ofdev);
+       if (ret) {
+               pr_err("failed to register device. ret=%d\n", ret);
++              put_device(&port->ofdev.dev);
+               goto out;
+       }
+ 
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c 
b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+index f4569461dcb82..71105a6c231df 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
++++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+@@ -2263,10 +2263,17 @@ static int i40e_get_rss_hash_opts(struct i40e_pf *pf, 
struct ethtool_rxnfc *cmd)
+ 
+               if (cmd->flow_type == TCP_V4_FLOW ||
+                   cmd->flow_type == UDP_V4_FLOW) {
+-                      if (i_set & I40E_L3_SRC_MASK)
+-                              cmd->data |= RXH_IP_SRC;
+-                      if (i_set & I40E_L3_DST_MASK)
+-                              cmd->data |= RXH_IP_DST;
++                      if (hw->mac.type == I40E_MAC_X722) {
++                              if (i_set & I40E_X722_L3_SRC_MASK)
++                                      cmd->data |= RXH_IP_SRC;
++                              if (i_set & I40E_X722_L3_DST_MASK)
++                                      cmd->data |= RXH_IP_DST;
++                      } else {
++                              if (i_set & I40E_L3_SRC_MASK)
++                                      cmd->data |= RXH_IP_SRC;
++                              if (i_set & I40E_L3_DST_MASK)
++                                      cmd->data |= RXH_IP_DST;
++                      }
+               } else if (cmd->flow_type == TCP_V6_FLOW ||
+                         cmd->flow_type == UDP_V6_FLOW) {
+                       if (i_set & I40E_L3_V6_SRC_MASK)
+@@ -2419,12 +2426,15 @@ static int i40e_get_rxnfc(struct net_device *netdev, 
struct ethtool_rxnfc *cmd,
+ 
+ /**
+  * i40e_get_rss_hash_bits - Read RSS Hash bits from register
++ * @hw: hw structure
+  * @nfc: pointer to user request
+  * @i_setc bits currently set
+  *
+  * Returns value of bits to be set per user request
+  **/
+-static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc *nfc, u64 i_setc)
++static u64 i40e_get_rss_hash_bits(struct i40e_hw *hw,
++                                struct ethtool_rxnfc *nfc,
++                                u64 i_setc)
+ {
+       u64 i_set = i_setc;
+       u64 src_l3 = 0, dst_l3 = 0;
+@@ -2443,8 +2453,13 @@ static u64 i40e_get_rss_hash_bits(struct ethtool_rxnfc 
*nfc, u64 i_setc)
+               dst_l3 = I40E_L3_V6_DST_MASK;
+       } else if (nfc->flow_type == TCP_V4_FLOW ||
+                 nfc->flow_type == UDP_V4_FLOW) {
+-              src_l3 = I40E_L3_SRC_MASK;
+-              dst_l3 = I40E_L3_DST_MASK;
++              if (hw->mac.type == I40E_MAC_X722) {
++                      src_l3 = I40E_X722_L3_SRC_MASK;
++                      dst_l3 = I40E_X722_L3_DST_MASK;
++              } else {
++                      src_l3 = I40E_L3_SRC_MASK;
++                      dst_l3 = I40E_L3_DST_MASK;
++              }
+       } else {
+               /* Any other flow type are not supported here */
+               return i_set;
+@@ -2553,7 +2568,7 @@ static int i40e_set_rss_hash_opt(struct i40e_pf *pf, 
struct ethtool_rxnfc *nfc)
+                                              flow_pctype)) |
+                       ((u64)i40e_read_rx_ctl(hw, I40E_GLQF_HASH_INSET(1,
+                                              flow_pctype)) << 32);
+-              i_set = i40e_get_rss_hash_bits(nfc, i_setc);
++              i_set = i40e_get_rss_hash_bits(&pf->hw, nfc, i_setc);
+               i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(0, flow_pctype),
+                                 (u32)i_set);
+               i40e_write_rx_ctl(hw, I40E_GLQF_HASH_INSET(1, flow_pctype),
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h 
b/drivers/net/ethernet/intel/i40e/i40e_type.h
+index bd5f13bef83c7..a855de9ff1c1b 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
++++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
+@@ -1542,6 +1542,10 @@ struct i40e_lldp_variables {
+ #define I40E_PFQF_CTL_0_HASHLUTSIZE_512       0x00010000
+ 
+ /* INPUT SET MASK for RSS, flow director, and flexible payload */
++#define I40E_X722_L3_SRC_SHIFT                49
++#define I40E_X722_L3_SRC_MASK         (0x3ULL << I40E_X722_L3_SRC_SHIFT)
++#define I40E_X722_L3_DST_SHIFT                41
++#define I40E_X722_L3_DST_MASK         (0x3ULL << I40E_X722_L3_DST_SHIFT)
+ #define I40E_L3_SRC_SHIFT             47
+ #define I40E_L3_SRC_MASK              (0x3ULL << I40E_L3_SRC_SHIFT)
+ #define I40E_L3_V6_SRC_SHIFT          43
+diff --git a/drivers/net/ethernet/lantiq_etop.c 
b/drivers/net/ethernet/lantiq_etop.c
+index a167fd7ee13e0..1a2c1a309d223 100644
+--- a/drivers/net/ethernet/lantiq_etop.c
++++ b/drivers/net/ethernet/lantiq_etop.c
+@@ -488,7 +488,6 @@ ltq_etop_tx(struct sk_buff *skb, struct net_device *dev)
+       len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len;
+ 
+       if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) || ch->skb[ch->dma.desc]) {
+-              dev_kfree_skb_any(skb);
+               netdev_err(dev, "tx ring full\n");
+               netif_tx_stop_queue(txq);
+               return NETDEV_TX_BUSY;
+diff --git a/drivers/net/ethernet/micrel/ksz884x.c 
b/drivers/net/ethernet/micrel/ksz884x.c
+index 280e761d3a975..83c7345a04ef5 100644
+--- a/drivers/net/ethernet/micrel/ksz884x.c
++++ b/drivers/net/ethernet/micrel/ksz884x.c
+@@ -6932,7 +6932,7 @@ static int pcidev_init(struct pci_dev *pdev, const 
struct pci_device_id *id)
+       char banner[sizeof(version)];
+       struct ksz_switch *sw = NULL;
+ 
+-      result = pci_enable_device(pdev);
++      result = pcim_enable_device(pdev);
+       if (result)
+               return result;
+ 
+diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
+index 1f26f0ab155f2..3c33bd8d46790 100644
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -227,6 +227,15 @@ static const struct usb_device_id usb_quirk_list[] = {
+       /* Kingston DataTraveler 3.0 */
+       { USB_DEVICE(0x0951, 0x1666), .driver_info = USB_QUIRK_NO_LPM },
+ 
++      /* NVIDIA Jetson devices in Force Recovery mode */
++      { USB_DEVICE(0x0955, 0x7018), .driver_info = USB_QUIRK_RESET_RESUME },
++      { USB_DEVICE(0x0955, 0x7019), .driver_info = USB_QUIRK_RESET_RESUME },
++      { USB_DEVICE(0x0955, 0x7418), .driver_info = USB_QUIRK_RESET_RESUME },
++      { USB_DEVICE(0x0955, 0x7721), .driver_info = USB_QUIRK_RESET_RESUME },
++      { USB_DEVICE(0x0955, 0x7c18), .driver_info = USB_QUIRK_RESET_RESUME },
++      { USB_DEVICE(0x0955, 0x7e19), .driver_info = USB_QUIRK_RESET_RESUME },
++      { USB_DEVICE(0x0955, 0x7f21), .driver_info = USB_QUIRK_RESET_RESUME },
++
+       /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
+       { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
+ 
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_udc.c 
b/drivers/usb/gadget/udc/bdc/bdc_udc.c
+index aae7458d89869..8fbc2eacf04f3 100644
+--- a/drivers/usb/gadget/udc/bdc/bdc_udc.c
++++ b/drivers/usb/gadget/udc/bdc/bdc_udc.c
+@@ -156,6 +156,7 @@ static void bdc_uspc_disconnected(struct bdc *bdc, bool 
reinit)
+       bdc->delayed_status = false;
+       bdc->reinit = reinit;
+       bdc->test_mode = false;
++      usb_gadget_set_state(&bdc->gadget, USB_STATE_NOTATTACHED);
+ }
+ 
+ /* TNotify wkaeup timer */
+diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
+index 0850d587683ac..fcd2e904a5734 100644
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -954,15 +954,19 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int 
slot_id)
+               if (dev->eps[i].stream_info)
+                       xhci_free_stream_info(xhci,
+                                       dev->eps[i].stream_info);
+-              /* Endpoints on the TT/root port lists should have been removed
+-               * when usb_disable_device() was called for the device.
+-               * We can't drop them anyway, because the udev might have gone
+-               * away by this point, and we can't tell what speed it was.
++              /*
++               * Endpoints are normally deleted from the bandwidth list when
++               * endpoints are dropped, before device is freed.
++               * If host is dying or being removed then endpoints aren't
++               * dropped cleanly, so delete the endpoint from list here.
++               * Only applicable for hosts with software bandwidth checking.
+                */
+-              if (!list_empty(&dev->eps[i].bw_endpoint_list))
+-                      xhci_warn(xhci, "Slot %u endpoint %u "
+-                                      "not removed from BW list!\n",
+-                                      slot_id, i);
++
++              if (!list_empty(&dev->eps[i].bw_endpoint_list)) {
++                      list_del_init(&dev->eps[i].bw_endpoint_list);
++                      xhci_dbg(xhci, "Slot %u endpoint %u not removed from BW 
list!\n",
++                               slot_id, i);
++              }
+       }
+       /* If this is a hub, free the TT(s) from the TT list */
+       xhci_free_tt_info(xhci, dev, slot_id);
+diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c
+index f24eda5a6023e..899c8ca8257d8 100644
+--- a/drivers/video/fbdev/smscufx.c
++++ b/drivers/video/fbdev/smscufx.c
+@@ -100,7 +100,6 @@ struct ufx_data {
+       struct kref kref;
+       int fb_count;
+       bool virtualized; /* true when physical usb device not present */
+-      struct delayed_work free_framebuffer_work;
+       atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
+       atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
+       u8 *edid; /* null until we read edid from hw or get from sysfs */
+@@ -1120,15 +1119,24 @@ static void ufx_free(struct kref *kref)
+ {
+       struct ufx_data *dev = container_of(kref, struct ufx_data, kref);
+ 
+-      /* this function will wait for all in-flight urbs to complete */
+-      if (dev->urbs.count > 0)
+-              ufx_free_urb_list(dev);
++      kfree(dev);
++}
+ 
+-      pr_debug("freeing ufx_data %p", dev);
++static void ufx_ops_destory(struct fb_info *info)
++{
++      struct ufx_data *dev = info->par;
++      int node = info->node;
+ 
+-      kfree(dev);
++      /* Assume info structure is freed after this point */
++      framebuffer_release(info);
++
++      pr_debug("fb_info for /dev/fb%d has been freed", node);
++
++      /* release reference taken by kref_init in probe() */
++      kref_put(&dev->kref, ufx_free);
+ }
+ 
++
+ static void ufx_release_urb_work(struct work_struct *work)
+ {
+       struct urb_node *unode = container_of(work, struct urb_node,
+@@ -1137,14 +1145,9 @@ static void ufx_release_urb_work(struct work_struct 
*work)
+       up(&unode->dev->urbs.limit_sem);
+ }
+ 
+-static void ufx_free_framebuffer_work(struct work_struct *work)
++static void ufx_free_framebuffer(struct ufx_data *dev)
+ {
+-      struct ufx_data *dev = container_of(work, struct ufx_data,
+-                                          free_framebuffer_work.work);
+       struct fb_info *info = dev->info;
+-      int node = info->node;
+-
+-      unregister_framebuffer(info);
+ 
+       if (info->cmap.len != 0)
+               fb_dealloc_cmap(&info->cmap);
+@@ -1156,11 +1159,6 @@ static void ufx_free_framebuffer_work(struct 
work_struct *work)
+ 
+       dev->info = NULL;
+ 
+-      /* Assume info structure is freed after this point */
+-      framebuffer_release(info);
+-
+-      pr_debug("fb_info for /dev/fb%d has been freed", node);
+-
+       /* ref taken in probe() as part of registering framebfufer */
+       kref_put(&dev->kref, ufx_free);
+ }
+@@ -1172,11 +1170,13 @@ static int ufx_ops_release(struct fb_info *info, int 
user)
+ {
+       struct ufx_data *dev = info->par;
+ 
++      mutex_lock(&disconnect_mutex);
++
+       dev->fb_count--;
+ 
+       /* We can't free fb_info here - fbmem will touch it when we return */
+       if (dev->virtualized && (dev->fb_count == 0))
+-              schedule_delayed_work(&dev->free_framebuffer_work, HZ);
++              ufx_free_framebuffer(dev);
+ 
+       if ((dev->fb_count == 0) && (info->fbdefio)) {
+               fb_deferred_io_cleanup(info);
+@@ -1190,6 +1190,8 @@ static int ufx_ops_release(struct fb_info *info, int 
user)
+ 
+       kref_put(&dev->kref, ufx_free);
+ 
++      mutex_unlock(&disconnect_mutex);
++
+       return 0;
+ }
+ 
+@@ -1296,6 +1298,7 @@ static struct fb_ops ufx_ops = {
+       .fb_blank = ufx_ops_blank,
+       .fb_check_var = ufx_ops_check_var,
+       .fb_set_par = ufx_ops_set_par,
++      .fb_destroy = ufx_ops_destory,
+ };
+ 
+ /* Assumes &info->lock held by caller
+@@ -1687,9 +1690,6 @@ static int ufx_usb_probe(struct usb_interface *interface,
+               goto error;
+       }
+ 
+-      INIT_DELAYED_WORK(&dev->free_framebuffer_work,
+-                        ufx_free_framebuffer_work);
+-
+       retval = ufx_reg_read(dev, 0x3000, &id_rev);
+       check_warn_goto_error(retval, "error %d reading 0x3000 register from 
device", retval);
+       dev_dbg(dev->gdev, "ID_REV register value 0x%08x", id_rev);
+@@ -1768,10 +1768,12 @@ error:
+ static void ufx_usb_disconnect(struct usb_interface *interface)
+ {
+       struct ufx_data *dev;
++      struct fb_info *info;
+ 
+       mutex_lock(&disconnect_mutex);
+ 
+       dev = usb_get_intfdata(interface);
++      info = dev->info;
+ 
+       pr_debug("USB disconnect starting\n");
+ 
+@@ -1785,12 +1787,15 @@ static void ufx_usb_disconnect(struct usb_interface 
*interface)
+ 
+       /* if clients still have us open, will be freed on last close */
+       if (dev->fb_count == 0)
+-              schedule_delayed_work(&dev->free_framebuffer_work, 0);
++              ufx_free_framebuffer(dev);
+ 
+-      /* release reference taken by kref_init in probe() */
+-      kref_put(&dev->kref, ufx_free);
++      /* this function will wait for all in-flight urbs to complete */
++      if (dev->urbs.count > 0)
++              ufx_free_urb_list(dev);
+ 
+-      /* consider ufx_data freed */
++      pr_debug("freeing ufx_data %p", dev);
++
++      unregister_framebuffer(info);
+ 
+       mutex_unlock(&disconnect_mutex);
+ }
+diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
+index a6585854a85fc..23f3411809f02 100644
+--- a/drivers/xen/gntdev.c
++++ b/drivers/xen/gntdev.c
+@@ -361,8 +361,7 @@ static int map_grant_pages(struct grant_map *map)
+       for (i = 0; i < map->count; i++) {
+               if (map->map_ops[i].status == GNTST_okay) {
+                       map->unmap_ops[i].handle = map->map_ops[i].handle;
+-                      if (!use_ptemod)
+-                              alloced++;
++                      alloced++;
+               } else if (!err)
+                       err = -EINVAL;
+ 
+@@ -371,8 +370,7 @@ static int map_grant_pages(struct grant_map *map)
+ 
+               if (use_ptemod) {
+                       if (map->kmap_ops[i].status == GNTST_okay) {
+-                              if (map->map_ops[i].status == GNTST_okay)
+-                                      alloced++;
++                              alloced++;
+                               map->kunmap_ops[i].handle = 
map->kmap_ops[i].handle;
+                       } else if (!err)
+                               err = -EINVAL;
+@@ -388,20 +386,42 @@ static void __unmap_grant_pages_done(int result,
+       unsigned int i;
+       struct grant_map *map = data->data;
+       unsigned int offset = data->unmap_ops - map->unmap_ops;
++      int successful_unmaps = 0;
++      int live_grants;
+ 
+       for (i = 0; i < data->count; i++) {
++              if (map->unmap_ops[offset + i].status == GNTST_okay &&
++                  map->unmap_ops[offset + i].handle != -1)
++                      successful_unmaps++;
++
+               WARN_ON(map->unmap_ops[offset+i].status &&
+                       map->unmap_ops[offset+i].handle != -1);
+               pr_debug("unmap handle=%d st=%d\n",
+                       map->unmap_ops[offset+i].handle,
+                       map->unmap_ops[offset+i].status);
+               map->unmap_ops[offset+i].handle = -1;
++              if (use_ptemod) {
++                      if (map->kunmap_ops[offset + i].status == GNTST_okay &&
++                          map->kunmap_ops[offset + i].handle != -1)
++                              successful_unmaps++;
++
++                      WARN_ON(map->kunmap_ops[offset+i].status &&
++                              map->kunmap_ops[offset+i].handle != -1);
++                      pr_debug("kunmap handle=%u st=%d\n",
++                               map->kunmap_ops[offset+i].handle,
++                               map->kunmap_ops[offset+i].status);
++                      map->kunmap_ops[offset+i].handle = -1;
++              }
+       }
++
+       /*
+        * Decrease the live-grant counter.  This must happen after the loop to
+        * prevent premature reuse of the grants by gnttab_mmap().
+        */
+-      atomic_sub(data->count, &map->live_grants);
++      live_grants = atomic_sub_return(successful_unmaps, &map->live_grants);
++      if (WARN_ON(live_grants < 0))
++              pr_err("%s: live_grants became negative (%d) after unmapping %d 
pages!\n",
++                     __func__, live_grants, successful_unmaps);
+ 
+       /* Release reference taken by unmap_grant_pages */
+       gntdev_put_map(NULL, map);
+diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
+index cf4c636ff4da5..3388fe79de7b7 100644
+--- a/fs/kernfs/dir.c
++++ b/fs/kernfs/dir.c
+@@ -1410,8 +1410,11 @@ int kernfs_remove_by_name_ns(struct kernfs_node 
*parent, const char *name,
+       mutex_lock(&kernfs_mutex);
+ 
+       kn = kernfs_find_ns(parent, name, ns);
+-      if (kn)
++      if (kn) {
++              kernfs_get(kn);
+               __kernfs_remove(kn);
++              kernfs_put(kn);
++      }
+ 
+       mutex_unlock(&kernfs_mutex);
+ 
+diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
+index 8d887c75765cf..cfa7fa17f4eba 100644
+--- a/fs/ocfs2/namei.c
++++ b/fs/ocfs2/namei.c
+@@ -244,6 +244,7 @@ static int ocfs2_mknod(struct inode *dir,
+       handle_t *handle = NULL;
+       struct ocfs2_super *osb;
+       struct ocfs2_dinode *dirfe;
++      struct ocfs2_dinode *fe = NULL;
+       struct buffer_head *new_fe_bh = NULL;
+       struct inode *inode = NULL;
+       struct ocfs2_alloc_context *inode_ac = NULL;
+@@ -394,6 +395,7 @@ static int ocfs2_mknod(struct inode *dir,
+               goto leave;
+       }
+ 
++      fe = (struct ocfs2_dinode *) new_fe_bh->b_data;
+       if (S_ISDIR(mode)) {
+               status = ocfs2_fill_new_dir(osb, handle, dir, inode,
+                                           new_fe_bh, data_ac, meta_ac);
+@@ -459,8 +461,11 @@ static int ocfs2_mknod(struct inode *dir,
+ leave:
+       if (status < 0 && did_quota_inode)
+               dquot_free_inode(inode);
+-      if (handle)
++      if (handle) {
++              if (status < 0 && fe)
++                      ocfs2_set_links_count(fe, 0);
+               ocfs2_commit_trans(osb, handle);
++      }
+ 
+       ocfs2_inode_unlock(dir, 1);
+       if (did_block_signals)
+@@ -636,18 +641,9 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
+               return status;
+       }
+ 
+-      status = __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh,
++      return __ocfs2_mknod_locked(dir, inode, dev, new_fe_bh,
+                                   parent_fe_bh, handle, inode_ac,
+                                   fe_blkno, suballoc_loc, suballoc_bit);
+-      if (status < 0) {
+-              u64 bg_blkno = ocfs2_which_suballoc_group(fe_blkno, 
suballoc_bit);
+-              int tmp = ocfs2_free_suballoc_bits(handle, inode_ac->ac_inode,
+-                              inode_ac->ac_bh, suballoc_bit, bg_blkno, 1);
+-              if (tmp)
+-                      mlog_errno(tmp);
+-      }
+-
+-      return status;
+ }
+ 
+ static int ocfs2_mkdir(struct inode *dir,
+@@ -2028,8 +2024,11 @@ bail:
+                                       ocfs2_clusters_to_bytes(osb->sb, 1));
+       if (status < 0 && did_quota_inode)
+               dquot_free_inode(inode);
+-      if (handle)
++      if (handle) {
++              if (status < 0 && fe)
++                      ocfs2_set_links_count(fe, 0);
+               ocfs2_commit_trans(osb, handle);
++      }
+ 
+       ocfs2_inode_unlock(dir, 1);
+       if (did_block_signals)
+diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
+index 7f34d3c676483..4a38dc2a61e66 100644
+--- a/include/uapi/linux/videodev2.h
++++ b/include/uapi/linux/videodev2.h
+@@ -1318,7 +1318,8 @@ struct v4l2_bt_timings {
+       ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
+ #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
+       ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \
+-       (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch)
++       ((bt)->interlaced ? \
++        ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0))
+ #define V4L2_DV_BT_FRAME_HEIGHT(bt) \
+       ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
+ 
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c
+index 6bed5da45f8f6..b9128eaafffe3 100644
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -2104,11 +2104,11 @@ struct page *alloc_huge_page(struct vm_area_struct 
*vma,
+               page = __alloc_buddy_huge_page_with_mpol(h, vma, addr);
+               if (!page)
+                       goto out_uncharge_cgroup;
++              spin_lock(&hugetlb_lock);
+               if (!avoid_reserve && vma_has_reserves(vma, gbl_chg)) {
+                       SetPagePrivate(page);
+                       h->resv_huge_pages--;
+               }
+-              spin_lock(&hugetlb_lock);
+               list_move(&page->lru, &h->hugepage_activelist);
+               /* Fall through */
+       }
+diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
+index 2df34eb5d65f4..3fd2aafa9a9e4 100644
+--- a/net/atm/mpoa_proc.c
++++ b/net/atm/mpoa_proc.c
+@@ -219,11 +219,12 @@ static ssize_t proc_mpc_write(struct file *file, const 
char __user *buff,
+       if (!page)
+               return -ENOMEM;
+ 
+-      for (p = page, len = 0; len < nbytes; p++, len++) {
++      for (p = page, len = 0; len < nbytes; p++) {
+               if (get_user(*p, buff++)) {
+                       free_page((unsigned long)page);
+                       return -EFAULT;
+               }
++              len += 1;
+               if (*p == '\0' || *p == '\n')
+                       break;
+       }
+diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
+index aadd445ea88ac..d48fba155981c 100644
+--- a/net/ieee802154/socket.c
++++ b/net/ieee802154/socket.c
+@@ -516,8 +516,10 @@ static int dgram_bind(struct sock *sk, struct sockaddr 
*uaddr, int len)
+       if (err < 0)
+               goto out;
+ 
+-      if (addr->family != AF_IEEE802154)
++      if (addr->family != AF_IEEE802154) {
++              err = -EINVAL;
+               goto out;
++      }
+ 
+       ieee802154_addr_from_sa(&haddr, &addr->addr);
+       dev = ieee802154_get_dev(sock_net(sk), &haddr);
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
+index 9c7f716aab441..98ff1e34e04f0 100644
+--- a/net/ipv4/tcp_input.c
++++ b/net/ipv4/tcp_input.c
+@@ -2053,7 +2053,8 @@ void tcp_enter_loss(struct sock *sk)
+  */
+ static bool tcp_check_sack_reneging(struct sock *sk, int flag)
+ {
+-      if (flag & FLAG_SACK_RENEGING) {
++      if (flag & FLAG_SACK_RENEGING &&
++          flag & FLAG_SND_UNA_ADVANCED) {
+               struct tcp_sock *tp = tcp_sk(sk);
+               unsigned long delay = max(usecs_to_jiffies(tp->srtt_us >> 4),
+                                         msecs_to_jiffies(10));
+diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
+index 2f3cd09ee0df1..b464c711e9c0f 100644
+--- a/net/kcm/kcmsock.c
++++ b/net/kcm/kcmsock.c
+@@ -162,7 +162,8 @@ static void kcm_rcv_ready(struct kcm_sock *kcm)
+       /* Buffer limit is okay now, add to ready list */
+       list_add_tail(&kcm->wait_rx_list,
+                     &kcm->mux->kcm_rx_waiters);
+-      kcm->rx_wait = true;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_wait, true);
+ }
+ 
+ static void kcm_rfree(struct sk_buff *skb)
+@@ -178,7 +179,7 @@ static void kcm_rfree(struct sk_buff *skb)
+       /* For reading rx_wait and rx_psock without holding lock */
+       smp_mb__after_atomic();
+ 
+-      if (!kcm->rx_wait && !kcm->rx_psock &&
++      if (!READ_ONCE(kcm->rx_wait) && !READ_ONCE(kcm->rx_psock) &&
+           sk_rmem_alloc_get(sk) < sk->sk_rcvlowat) {
+               spin_lock_bh(&mux->rx_lock);
+               kcm_rcv_ready(kcm);
+@@ -237,7 +238,8 @@ try_again:
+               if (kcm_queue_rcv_skb(&kcm->sk, skb)) {
+                       /* Should mean socket buffer full */
+                       list_del(&kcm->wait_rx_list);
+-                      kcm->rx_wait = false;
++                      /* paired with lockless reads in kcm_rfree() */
++                      WRITE_ONCE(kcm->rx_wait, false);
+ 
+                       /* Commit rx_wait to read in kcm_free */
+                       smp_wmb();
+@@ -280,10 +282,12 @@ static struct kcm_sock *reserve_rx_kcm(struct kcm_psock 
*psock,
+       kcm = list_first_entry(&mux->kcm_rx_waiters,
+                              struct kcm_sock, wait_rx_list);
+       list_del(&kcm->wait_rx_list);
+-      kcm->rx_wait = false;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_wait, false);
+ 
+       psock->rx_kcm = kcm;
+-      kcm->rx_psock = psock;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_psock, psock);
+ 
+       spin_unlock_bh(&mux->rx_lock);
+ 
+@@ -310,7 +314,8 @@ static void unreserve_rx_kcm(struct kcm_psock *psock,
+       spin_lock_bh(&mux->rx_lock);
+ 
+       psock->rx_kcm = NULL;
+-      kcm->rx_psock = NULL;
++      /* paired with lockless reads in kcm_rfree() */
++      WRITE_ONCE(kcm->rx_psock, NULL);
+ 
+       /* Commit kcm->rx_psock before sk_rmem_alloc_get to sync with
+        * kcm_rfree
+@@ -1238,7 +1243,8 @@ static void kcm_recv_disable(struct kcm_sock *kcm)
+       if (!kcm->rx_psock) {
+               if (kcm->rx_wait) {
+                       list_del(&kcm->wait_rx_list);
+-                      kcm->rx_wait = false;
++                      /* paired with lockless reads in kcm_rfree() */
++                      WRITE_ONCE(kcm->rx_wait, false);
+               }
+ 
+               requeue_rx_msgs(mux, &kcm->sk.sk_receive_queue);
+@@ -1798,7 +1804,8 @@ static void kcm_done(struct kcm_sock *kcm)
+ 
+       if (kcm->rx_wait) {
+               list_del(&kcm->wait_rx_list);
+-              kcm->rx_wait = false;
++              /* paired with lockless reads in kcm_rfree() */
++              WRITE_ONCE(kcm->rx_wait, false);
+       }
+       /* Move any pending receive messages to other kcm sockets */
+       requeue_rx_msgs(mux, &sk->sk_receive_queue);
+diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
+index 060ccd0e14ce7..dc1a384bc1374 100644
+--- a/net/mac802154/rx.c
++++ b/net/mac802154/rx.c
+@@ -140,7 +140,7 @@ static int
+ ieee802154_parse_frame_start(struct sk_buff *skb, struct ieee802154_hdr *hdr)
+ {
+       int hlen;
+-      struct ieee802154_mac_cb *cb = mac_cb_init(skb);
++      struct ieee802154_mac_cb *cb = mac_cb(skb);
+ 
+       skb_reset_mac_header(skb);
+ 
+@@ -302,8 +302,9 @@ void
+ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)
+ {
+       struct ieee802154_local *local = hw_to_local(hw);
++      struct ieee802154_mac_cb *cb = mac_cb_init(skb);
+ 
+-      mac_cb(skb)->lqi = lqi;
++      cb->lqi = lqi;
+       skb->pkt_type = IEEE802154_RX_MSG;
+       skb_queue_tail(&local->skb_queue, skb);
+       tasklet_schedule(&local->tasklet);
+diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
+index 10423757e781b..56999d8528a4d 100644
+--- a/net/openvswitch/datapath.c
++++ b/net/openvswitch/datapath.c
+@@ -1556,7 +1556,8 @@ static void ovs_dp_reset_user_features(struct sk_buff 
*skb, struct genl_info *in
+       if (IS_ERR(dp))
+               return;
+ 
+-      WARN(dp->user_features, "Dropping previously announced user 
features\n");
++      pr_warn("%s: Dropping previously announced user features\n",
++              ovs_dp_name(dp));
+       dp->user_features = 0;
+ }
+ 
+diff --git a/sound/aoa/soundbus/i2sbus/core.c 
b/sound/aoa/soundbus/i2sbus/core.c
+index 000b585221063..2811e1f1e2fa9 100644
+--- a/sound/aoa/soundbus/i2sbus/core.c
++++ b/sound/aoa/soundbus/i2sbus/core.c
+@@ -148,6 +148,7 @@ static int i2sbus_get_and_fixup_rsrc(struct device_node 
*np, int index,
+       return rc;
+ }
+ 
++/* Returns 1 if added, 0 for otherwise; don't return a negative value! */
+ /* FIXME: look at device node refcounting */
+ static int i2sbus_add_dev(struct macio_dev *macio,
+                         struct i2sbus_control *control,
+@@ -213,7 +214,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
+        * either as the second one in that case is just a modem. */
+       if (!ok) {
+               kfree(dev);
+-              return -ENODEV;
++              return 0;
+       }
+ 
+       mutex_init(&dev->lock);
+@@ -302,6 +303,10 @@ static int i2sbus_add_dev(struct macio_dev *macio,
+ 
+       if (soundbus_add_one(&dev->sound)) {
+               printk(KERN_DEBUG "i2sbus: device registration error!\n");
++              if (dev->sound.ofdev.dev.kobj.state_initialized) {
++                      soundbus_dev_put(&dev->sound);
++                      return 0;
++              }
+               goto err;
+       }
+ 
+diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
+index a7f1e4ef3f887..4a420f4303a7f 100644
+--- a/sound/pci/ac97/ac97_codec.c
++++ b/sound/pci/ac97/ac97_codec.c
+@@ -1965,6 +1965,7 @@ static int snd_ac97_dev_register(struct snd_device 
*device)
+                    snd_ac97_get_short_name(ac97));
+       if ((err = device_register(&ac97->dev)) < 0) {
+               ac97_err(ac97, "Can't register ac97 bus\n");
++              put_device(&ac97->dev);
+               ac97->dev.bus = NULL;
+               return err;
+       }
+diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h
+index bcc648bf64780..28a6598a391e4 100644
+--- a/sound/pci/au88x0/au88x0.h
++++ b/sound/pci/au88x0/au88x0.h
+@@ -153,7 +153,7 @@ struct snd_vortex {
+ #ifndef CHIP_AU8810
+       stream_t dma_wt[NR_WT];
+       wt_voice_t wt_voice[NR_WT];     /* WT register cache. */
+-      char mixwt[(NR_WT / NR_WTPB) * 6];      /* WT mixin objects */
++      s8 mixwt[(NR_WT / NR_WTPB) * 6];        /* WT mixin objects */
+ #endif
+ 
+       /* Global resources */
+@@ -247,8 +247,8 @@ static int vortex_alsafmt_aspfmt(int alsafmt, vortex_t *v);
+ static void vortex_connect_default(vortex_t * vortex, int en);
+ static int vortex_adb_allocroute(vortex_t * vortex, int dma, int nr_ch,
+                                int dir, int type, int subdev);
+-static char vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out,
+-                                int restype);
++static int vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out,
++                               int restype);
+ #ifndef CHIP_AU8810
+ static int vortex_wt_allocroute(vortex_t * vortex, int dma, int nr_ch);
+ static void vortex_wt_connect(vortex_t * vortex, int en);
+diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
+index c308a4f705504..7af6ada4b3c01 100644
+--- a/sound/pci/au88x0/au88x0_core.c
++++ b/sound/pci/au88x0/au88x0_core.c
+@@ -2004,7 +2004,7 @@ static int resnum[VORTEX_RESOURCE_LAST] =
+  out: Mean checkout if != 0. Else mean Checkin resource.
+  restype: Indicates type of resource to be checked in or out.
+ */
+-static char
++static int
+ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype)
+ {
+       int i, qty = resnum[restype], resinuse = 0;
+diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
+index c5c6d360843aa..2ce79288375ec 100644
+--- a/sound/synth/emux/emux.c
++++ b/sound/synth/emux/emux.c
+@@ -138,15 +138,10 @@ EXPORT_SYMBOL(snd_emux_register);
+  */
+ int snd_emux_free(struct snd_emux *emu)
+ {
+-      unsigned long flags;
+-
+       if (! emu)
+               return -EINVAL;
+ 
+-      spin_lock_irqsave(&emu->voice_lock, flags);
+-      if (emu->timer_active)
+-              del_timer(&emu->tlist);
+-      spin_unlock_irqrestore(&emu->voice_lock, flags);
++      del_timer_sync(&emu->tlist);
+ 
+       snd_emux_proc_free(emu);
+       snd_emux_delete_virmidi(emu);
+diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
+index 55272fef3b508..d60a252577f0b 100644
+--- a/tools/iio/iio_utils.c
++++ b/tools/iio/iio_utils.c
+@@ -546,6 +546,10 @@ static int calc_digits(int num)
+ {
+       int count = 0;
+ 
++      /* It takes a digit to represent zero */
++      if (!num)
++              return 1;
++
+       while (num != 0) {
+               num /= 10;
+               count++;


Reply via email to