commit:     7f7edc2ea3215794edee8c776b4ef1e234fb2f8d
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 24 12:08:31 2021 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Wed Mar 24 12:08:31 2021 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7f7edc2e

Linux patch 4.19.183

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

 0000_README               |    4 +
 1182_linux-4.19.183.patch | 1585 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1589 insertions(+)

diff --git a/0000_README b/0000_README
index edcc0c7..d06c180 100644
--- a/0000_README
+++ b/0000_README
@@ -767,6 +767,10 @@ Patch:  1181_linux-4.19.182.patch
 From:   https://www.kernel.org
 Desc:   Linux 4.19.182
 
+Patch:  1182_linux-4.19.183.patch
+From:   https://www.kernel.org
+Desc:   Linux 4.19.183
+
 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/1182_linux-4.19.183.patch b/1182_linux-4.19.183.patch
new file mode 100644
index 0000000..2fea81e
--- /dev/null
+++ b/1182_linux-4.19.183.patch
@@ -0,0 +1,1585 @@
+diff --git a/Makefile b/Makefile
+index 5956638e0f4d0..9347445b2027b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 4
+ PATCHLEVEL = 19
+-SUBLEVEL = 182
++SUBLEVEL = 183
+ EXTRAVERSION =
+ NAME = "People's Front"
+ 
+diff --git a/arch/powerpc/include/asm/cpu_has_feature.h 
b/arch/powerpc/include/asm/cpu_has_feature.h
+index 7897d16e09904..727d4b3219379 100644
+--- a/arch/powerpc/include/asm/cpu_has_feature.h
++++ b/arch/powerpc/include/asm/cpu_has_feature.h
+@@ -7,7 +7,7 @@
+ #include <linux/bug.h>
+ #include <asm/cputable.h>
+ 
+-static inline bool early_cpu_has_feature(unsigned long feature)
++static __always_inline bool early_cpu_has_feature(unsigned long feature)
+ {
+       return !!((CPU_FTRS_ALWAYS & feature) ||
+                 (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
+@@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long 
feature)
+       return static_branch_likely(&cpu_feature_keys[i]);
+ }
+ #else
+-static inline bool cpu_has_feature(unsigned long feature)
++static __always_inline bool cpu_has_feature(unsigned long feature)
+ {
+       return early_cpu_has_feature(feature);
+ }
+diff --git a/arch/powerpc/kernel/vmlinux.lds.S 
b/arch/powerpc/kernel/vmlinux.lds.S
+index 695432965f206..9b346f3d2814c 100644
+--- a/arch/powerpc/kernel/vmlinux.lds.S
++++ b/arch/powerpc/kernel/vmlinux.lds.S
+@@ -99,6 +99,7 @@ SECTIONS
+ #endif
+               /* careful! __ftr_alt_* sections need to be close to .text */
+               *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup 
__ftr_alt_* .ref.text);
++              NOINSTR_TEXT
+               SCHED_TEXT
+               CPUIDLE_TEXT
+               LOCK_TEXT
+diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
+index 79caeba8b6f08..b3279feff458b 100644
+--- a/arch/x86/events/intel/ds.c
++++ b/arch/x86/events/intel/ds.c
+@@ -1557,7 +1557,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs 
*iregs)
+                */
+               if (!pebs_status && cpuc->pebs_enabled &&
+                       !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
+-                      pebs_status = cpuc->pebs_enabled;
++                      pebs_status = p->status = cpuc->pebs_enabled;
+ 
+               bit = find_first_bit((unsigned long *)&pebs_status,
+                                       x86_pmu.max_pebs_events);
+diff --git a/arch/x86/include/asm/processor.h 
b/arch/x86/include/asm/processor.h
+index 0f750e7b24071..cc4bb218f1c60 100644
+--- a/arch/x86/include/asm/processor.h
++++ b/arch/x86/include/asm/processor.h
+@@ -521,15 +521,6 @@ static inline void arch_thread_struct_whitelist(unsigned 
long *offset,
+       *size = fpu_kernel_xstate_size;
+ }
+ 
+-/*
+- * Thread-synchronous status.
+- *
+- * This is different from the flags in that nobody else
+- * ever touches our thread-synchronous status, so we don't
+- * have to worry about atomic accesses.
+- */
+-#define TS_COMPAT             0x0002  /* 32bit syscall active (64BIT)*/
+-
+ /*
+  * Set IOPL bits in EFLAGS from given mask
+  */
+diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
+index 82b73b75d67ca..b5e4c357523e8 100644
+--- a/arch/x86/include/asm/thread_info.h
++++ b/arch/x86/include/asm/thread_info.h
+@@ -227,10 +227,31 @@ static inline int arch_within_stack_frames(const void * 
const stack,
+ 
+ #endif
+ 
++/*
++ * Thread-synchronous status.
++ *
++ * This is different from the flags in that nobody else
++ * ever touches our thread-synchronous status, so we don't
++ * have to worry about atomic accesses.
++ */
++#define TS_COMPAT             0x0002  /* 32bit syscall active (64BIT)*/
++
++#ifndef __ASSEMBLY__
+ #ifdef CONFIG_COMPAT
+ #define TS_I386_REGS_POKED    0x0004  /* regs poked by 32-bit ptracer */
++#define TS_COMPAT_RESTART     0x0008
++
++#define arch_set_restart_data arch_set_restart_data
++
++static inline void arch_set_restart_data(struct restart_block *restart)
++{
++      struct thread_info *ti = current_thread_info();
++      if (ti->status & TS_COMPAT)
++              ti->status |= TS_COMPAT_RESTART;
++      else
++              ti->status &= ~TS_COMPAT_RESTART;
++}
+ #endif
+-#ifndef __ASSEMBLY__
+ 
+ #ifdef CONFIG_X86_32
+ #define in_ia32_syscall() true
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
+index e891b33ccfe5f..da6b52c709641 100644
+--- a/arch/x86/kernel/apic/apic.c
++++ b/arch/x86/kernel/apic/apic.c
+@@ -2279,6 +2279,11 @@ static int cpuid_to_apicid[] = {
+       [0 ... NR_CPUS - 1] = -1,
+ };
+ 
++bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
++{
++      return phys_id == cpuid_to_apicid[cpu];
++}
++
+ #ifdef CONFIG_SMP
+ /**
+  * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary 
thread
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
+index 15234885e60bc..a89dac380243a 100644
+--- a/arch/x86/kernel/apic/io_apic.c
++++ b/arch/x86/kernel/apic/io_apic.c
+@@ -1043,6 +1043,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int 
ioapic, int pin,
+       if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
+               irq = mp_irqs[idx].srcbusirq;
+               legacy = mp_is_legacy_irq(irq);
++              /*
++               * IRQ2 is unusable for historical reasons on systems which
++               * have a legacy PIC. See the comment vs. IRQ2 further down.
++               *
++               * If this gets removed at some point then the related code
++               * in lapic_assign_system_vectors() needs to be adjusted as
++               * well.
++               */
++              if (legacy && irq == PIC_CASCADE_IR)
++                      return -EINVAL;
+       }
+ 
+       mutex_lock(&ioapic_mutex);
+diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
+index 44e647a65de88..16e908000550f 100644
+--- a/arch/x86/kernel/signal.c
++++ b/arch/x86/kernel/signal.c
+@@ -776,30 +776,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
+ 
+ static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
+ {
+-      /*
+-       * This function is fundamentally broken as currently
+-       * implemented.
+-       *
+-       * The idea is that we want to trigger a call to the
+-       * restart_block() syscall and that we want in_ia32_syscall(),
+-       * in_x32_syscall(), etc. to match whatever they were in the
+-       * syscall being restarted.  We assume that the syscall
+-       * instruction at (regs->ip - 2) matches whatever syscall
+-       * instruction we used to enter in the first place.
+-       *
+-       * The problem is that we can get here when ptrace pokes
+-       * syscall-like values into regs even if we're not in a syscall
+-       * at all.
+-       *
+-       * For now, we maintain historical behavior and guess based on
+-       * stored state.  We could do better by saving the actual
+-       * syscall arch in restart_block or (with caveats on x32) by
+-       * checking if regs->ip points to 'int $0x80'.  The current
+-       * behavior is incorrect if a tracer has a different bitness
+-       * than the tracee.
+-       */
+ #ifdef CONFIG_IA32_EMULATION
+-      if (current_thread_info()->status & (TS_COMPAT|TS_I386_REGS_POKED))
++      if (current_thread_info()->status & TS_COMPAT_RESTART)
+               return __NR_ia32_restart_syscall;
+ #endif
+ #ifdef CONFIG_X86_X32_ABI
+diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
+index b118b5a500c9a..2c99f93020bc9 100644
+--- a/drivers/base/power/runtime.c
++++ b/drivers/base/power/runtime.c
+@@ -304,22 +304,22 @@ static void rpm_put_suppliers(struct device *dev)
+ static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
+       __releases(&dev->power.lock) __acquires(&dev->power.lock)
+ {
+-      bool use_links = dev->power.links_count > 0;
+-      bool get = false;
+       int retval, idx;
+-      bool put;
++      bool use_links = dev->power.links_count > 0;
+ 
+       if (dev->power.irq_safe) {
+               spin_unlock(&dev->power.lock);
+-      } else if (!use_links) {
+-              spin_unlock_irq(&dev->power.lock);
+       } else {
+-              get = dev->power.runtime_status == RPM_RESUMING;
+-
+               spin_unlock_irq(&dev->power.lock);
+ 
+-              /* Resume suppliers if necessary. */
+-              if (get) {
++              /*
++               * Resume suppliers if necessary.
++               *
++               * The device's runtime PM status cannot change until this
++               * routine returns, so it is safe to read the status outside of
++               * the lock.
++               */
++              if (use_links && dev->power.runtime_status == RPM_RESUMING) {
+                       idx = device_links_read_lock();
+ 
+                       retval = rpm_get_suppliers(dev);
+@@ -334,36 +334,24 @@ static int __rpm_callback(int (*cb)(struct device *), 
struct device *dev)
+ 
+       if (dev->power.irq_safe) {
+               spin_lock(&dev->power.lock);
+-              return retval;
+-      }
+-
+-      spin_lock_irq(&dev->power.lock);
+-
+-      if (!use_links)
+-              return retval;
+-
+-      /*
+-       * If the device is suspending and the callback has returned success,
+-       * drop the usage counters of the suppliers that have been reference
+-       * counted on its resume.
+-       *
+-       * Do that if the resume fails too.
+-       */
+-      put = dev->power.runtime_status == RPM_SUSPENDING && !retval;
+-      if (put)
+-              __update_runtime_status(dev, RPM_SUSPENDED);
+-      else
+-              put = get && retval;
+-
+-      if (put) {
+-              spin_unlock_irq(&dev->power.lock);
+-
+-              idx = device_links_read_lock();
++      } else {
++              /*
++               * If the device is suspending and the callback has returned
++               * success, drop the usage counters of the suppliers that have
++               * been reference counted on its resume.
++               *
++               * Do that if resume fails too.
++               */
++              if (use_links
++                  && ((dev->power.runtime_status == RPM_SUSPENDING && !retval)
++                  || (dev->power.runtime_status == RPM_RESUMING && retval))) {
++                      idx = device_links_read_lock();
+ 
+-fail:
+-              rpm_put_suppliers(dev);
++ fail:
++                      rpm_put_suppliers(dev);
+ 
+-              device_links_read_unlock(idx);
++                      device_links_read_unlock(idx);
++              }
+ 
+               spin_lock_irq(&dev->power.lock);
+       }
+diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
+index 9421c1ec86f73..1dabd366ec0bc 100644
+--- a/drivers/iio/adc/Kconfig
++++ b/drivers/iio/adc/Kconfig
+@@ -658,6 +658,7 @@ config STM32_ADC_CORE
+       depends on ARCH_STM32 || COMPILE_TEST
+       depends on OF
+       depends on REGULATOR
++      depends on HAS_IOMEM
+       select IIO_BUFFER
+       select MFD_STM32_TIMERS
+       select IIO_STM32_TIMER_TRIGGER
+diff --git a/drivers/iio/adc/qcom-spmi-vadc.c 
b/drivers/iio/adc/qcom-spmi-vadc.c
+index 3680e0d474120..2640155b26443 100644
+--- a/drivers/iio/adc/qcom-spmi-vadc.c
++++ b/drivers/iio/adc/qcom-spmi-vadc.c
+@@ -606,7 +606,7 @@ static const struct vadc_channels vadc_chans[] = {
+       VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
+ 
+       VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
+-      VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
++      VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
+       VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
+       VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
+       VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
+diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
+index 5ddebede31a6f..33120ccff87ff 100644
+--- a/drivers/iio/gyro/mpu3050-core.c
++++ b/drivers/iio/gyro/mpu3050-core.c
+@@ -549,6 +549,8 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void 
*p)
+                                              MPU3050_FIFO_R,
+                                              &fifo_values[offset],
+                                              toread);
++                      if (ret)
++                              goto out_trigger_unlock;
+ 
+                       dev_dbg(mpu3050->dev,
+                               "%04x %04x %04x %04x %04x\n",
+diff --git a/drivers/iio/humidity/hid-sensor-humidity.c 
b/drivers/iio/humidity/hid-sensor-humidity.c
+index 4bc95f31c730e..d8c30d94d742e 100644
+--- a/drivers/iio/humidity/hid-sensor-humidity.c
++++ b/drivers/iio/humidity/hid-sensor-humidity.c
+@@ -28,7 +28,10 @@
+ struct hid_humidity_state {
+       struct hid_sensor_common common_attributes;
+       struct hid_sensor_hub_attribute_info humidity_attr;
+-      s32 humidity_data;
++      struct {
++              s32 humidity_data;
++              u64 timestamp __aligned(8);
++      } scan;
+       int scale_pre_decml;
+       int scale_post_decml;
+       int scale_precision;
+@@ -138,9 +141,8 @@ static int humidity_proc_event(struct 
hid_sensor_hub_device *hsdev,
+       struct hid_humidity_state *humid_st = iio_priv(indio_dev);
+ 
+       if (atomic_read(&humid_st->common_attributes.data_ready))
+-              iio_push_to_buffers_with_timestamp(indio_dev,
+-                                      &humid_st->humidity_data,
+-                                      iio_get_time_ns(indio_dev));
++              iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
++                                                 iio_get_time_ns(indio_dev));
+ 
+       return 0;
+ }
+@@ -155,7 +157,7 @@ static int humidity_capture_sample(struct 
hid_sensor_hub_device *hsdev,
+ 
+       switch (usage_id) {
+       case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY:
+-              humid_st->humidity_data = *(s32 *)raw_data;
++              humid_st->scan.humidity_data = *(s32 *)raw_data;
+ 
+               return 0;
+       default:
+diff --git a/drivers/iio/imu/adis16400_core.c 
b/drivers/iio/imu/adis16400_core.c
+index 46a569005a138..ec0f50ec813e9 100644
+--- a/drivers/iio/imu/adis16400_core.c
++++ b/drivers/iio/imu/adis16400_core.c
+@@ -288,8 +288,7 @@ static int adis16400_initial_setup(struct iio_dev 
*indio_dev)
+               if (ret)
+                       goto err_ret;
+ 
+-              ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
+-              if (ret != 1) {
++              if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) {
+                       ret = -EINVAL;
+                       goto err_ret;
+               }
+diff --git a/drivers/iio/light/hid-sensor-prox.c 
b/drivers/iio/light/hid-sensor-prox.c
+index cf5a0c242609d..3c25d6bb37648 100644
+--- a/drivers/iio/light/hid-sensor-prox.c
++++ b/drivers/iio/light/hid-sensor-prox.c
+@@ -37,6 +37,9 @@ struct prox_state {
+       struct hid_sensor_common common_attributes;
+       struct hid_sensor_hub_attribute_info prox_attr;
+       u32 human_presence;
++      int scale_pre_decml;
++      int scale_post_decml;
++      int scale_precision;
+ };
+ 
+ /* Channel definitions */
+@@ -107,8 +110,9 @@ static int prox_read_raw(struct iio_dev *indio_dev,
+               ret_type = IIO_VAL_INT;
+               break;
+       case IIO_CHAN_INFO_SCALE:
+-              *val = prox_state->prox_attr.units;
+-              ret_type = IIO_VAL_INT;
++              *val = prox_state->scale_pre_decml;
++              *val2 = prox_state->scale_post_decml;
++              ret_type = prox_state->scale_precision;
+               break;
+       case IIO_CHAN_INFO_OFFSET:
+               *val = hid_sensor_convert_exponent(
+@@ -248,6 +252,11 @@ static int prox_parse_report(struct platform_device *pdev,
+                       HID_USAGE_SENSOR_HUMAN_PRESENCE,
+                       &st->common_attributes.sensitivity);
+ 
++      st->scale_precision = hid_sensor_format_scale(
++                              hsdev->usage,
++                              &st->prox_attr,
++                              &st->scale_pre_decml, &st->scale_post_decml);
++
+       return ret;
+ }
+ 
+diff --git a/drivers/iio/temperature/hid-sensor-temperature.c 
b/drivers/iio/temperature/hid-sensor-temperature.c
+index b592fc4f007e4..d710a1a668170 100644
+--- a/drivers/iio/temperature/hid-sensor-temperature.c
++++ b/drivers/iio/temperature/hid-sensor-temperature.c
+@@ -28,7 +28,10 @@
+ struct temperature_state {
+       struct hid_sensor_common common_attributes;
+       struct hid_sensor_hub_attribute_info temperature_attr;
+-      s32 temperature_data;
++      struct {
++              s32 temperature_data;
++              u64 timestamp __aligned(8);
++      } scan;
+       int scale_pre_decml;
+       int scale_post_decml;
+       int scale_precision;
+@@ -45,7 +48,7 @@ static const struct iio_chan_spec temperature_channels[] = {
+                       BIT(IIO_CHAN_INFO_SAMP_FREQ) |
+                       BIT(IIO_CHAN_INFO_HYSTERESIS),
+       },
+-      IIO_CHAN_SOFT_TIMESTAMP(3),
++      IIO_CHAN_SOFT_TIMESTAMP(1),
+ };
+ 
+ /* Adjust channel real bits based on report descriptor */
+@@ -136,9 +139,8 @@ static int temperature_proc_event(struct 
hid_sensor_hub_device *hsdev,
+       struct temperature_state *temp_st = iio_priv(indio_dev);
+ 
+       if (atomic_read(&temp_st->common_attributes.data_ready))
+-              iio_push_to_buffers_with_timestamp(indio_dev,
+-                              &temp_st->temperature_data,
+-                              iio_get_time_ns(indio_dev));
++              iio_push_to_buffers_with_timestamp(indio_dev, &temp_st->scan,
++                                                 iio_get_time_ns(indio_dev));
+ 
+       return 0;
+ }
+@@ -153,7 +155,7 @@ static int temperature_capture_sample(struct 
hid_sensor_hub_device *hsdev,
+ 
+       switch (usage_id) {
+       case HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE:
+-              temp_st->temperature_data = *(s32 *)raw_data;
++              temp_st->scan.temperature_data = *(s32 *)raw_data;
+               return 0;
+       default:
+               return -EINVAL;
+diff --git a/drivers/misc/lkdtm/Makefile b/drivers/misc/lkdtm/Makefile
+index cce47a15a79f2..aeb960cb096d6 100644
+--- a/drivers/misc/lkdtm/Makefile
++++ b/drivers/misc/lkdtm/Makefile
+@@ -13,7 +13,7 @@ KCOV_INSTRUMENT_rodata.o     := n
+ 
+ OBJCOPYFLAGS :=
+ OBJCOPYFLAGS_rodata_objcopy.o := \
+-                      --rename-section .text=.rodata,alloc,readonly,load
++                      --rename-section 
.noinstr.text=.rodata,alloc,readonly,load
+ targets += rodata.o rodata_objcopy.o
+ $(obj)/rodata_objcopy.o: $(obj)/rodata.o FORCE
+       $(call if_changed,objcopy)
+diff --git a/drivers/misc/lkdtm/rodata.c b/drivers/misc/lkdtm/rodata.c
+index 58d180af72cf0..baacb876d1d94 100644
+--- a/drivers/misc/lkdtm/rodata.c
++++ b/drivers/misc/lkdtm/rodata.c
+@@ -5,7 +5,7 @@
+  */
+ #include "lkdtm.h"
+ 
+-void notrace lkdtm_rodata_do_nothing(void)
++void noinstr lkdtm_rodata_do_nothing(void)
+ {
+       /* Does nothing. We just want an architecture agnostic "return". */
+ }
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
+index 134e14e778f8e..8798274dc3ba7 100644
+--- a/drivers/nvme/host/rdma.c
++++ b/drivers/nvme/host/rdma.c
+@@ -644,8 +644,11 @@ static int nvme_rdma_alloc_io_queues(struct 
nvme_rdma_ctrl *ctrl)
+               return ret;
+ 
+       ctrl->ctrl.queue_count = nr_io_queues + 1;
+-      if (ctrl->ctrl.queue_count < 2)
+-              return 0;
++      if (ctrl->ctrl.queue_count < 2) {
++              dev_err(ctrl->ctrl.device,
++                      "unable to set any I/O queues\n");
++              return -ENOMEM;
++      }
+ 
+       dev_info(ctrl->ctrl.device,
+               "creating %d I/O queues.\n", nr_io_queues);
+diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
+index 2b492ad55f0e4..1a35d73c39c35 100644
+--- a/drivers/nvme/target/core.c
++++ b/drivers/nvme/target/core.c
+@@ -770,9 +770,20 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
+ {
+       lockdep_assert_held(&ctrl->lock);
+ 
+-      if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
+-          nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES ||
+-          nvmet_cc_mps(ctrl->cc) != 0 ||
++      /*
++       * Only I/O controllers should verify iosqes,iocqes.
++       * Strictly speaking, the spec says a discovery controller
++       * should verify iosqes,iocqes are zeroed, however that
++       * would break backwards compatibility, so don't enforce it.
++       */
++      if (ctrl->subsys->type != NVME_NQN_DISC &&
++          (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
++           nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) {
++              ctrl->csts = NVME_CSTS_CFS;
++              return;
++      }
++
++      if (nvmet_cc_mps(ctrl->cc) != 0 ||
+           nvmet_cc_ams(ctrl->cc) != 0 ||
+           nvmet_cc_css(ctrl->cc) != 0) {
+               ctrl->csts = NVME_CSTS_CFS;
+diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c 
b/drivers/pci/hotplug/rpadlpar_sysfs.c
+index cdbfa5df3a51f..dbfa0b55d31a5 100644
+--- a/drivers/pci/hotplug/rpadlpar_sysfs.c
++++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
+@@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct 
kobj_attribute *attr,
+       if (nbytes >= MAX_DRC_NAME_LEN)
+               return 0;
+ 
+-      memcpy(drc_name, buf, nbytes);
++      strscpy(drc_name, buf, nbytes + 1);
+ 
+       end = strchr(drc_name, '\n');
+-      if (!end)
+-              end = &drc_name[nbytes];
+-      *end = '\0';
++      if (end)
++              *end = '\0';
+ 
+       rc = dlpar_add_slot(drc_name);
+       if (rc)
+@@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj,
+       if (nbytes >= MAX_DRC_NAME_LEN)
+               return 0;
+ 
+-      memcpy(drc_name, buf, nbytes);
++      strscpy(drc_name, buf, nbytes + 1);
+ 
+       end = strchr(drc_name, '\n');
+-      if (!end)
+-              end = &drc_name[nbytes];
+-      *end = '\0';
++      if (end)
++              *end = '\0';
+ 
+       rc = dlpar_remove_slot(drc_name);
+       if (rc)
+diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c 
b/drivers/scsi/lpfc/lpfc_debugfs.c
+index f1951c432766d..2c70e311943ac 100644
+--- a/drivers/scsi/lpfc/lpfc_debugfs.c
++++ b/drivers/scsi/lpfc/lpfc_debugfs.c
+@@ -1843,7 +1843,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char 
__user *buf,
+       memset(dstbuf, 0, 33);
+       size = (nbytes < 32) ? nbytes : 32;
+       if (copy_from_user(dstbuf, buf, size))
+-              return 0;
++              return -EFAULT;
+ 
+       if (dent == phba->debug_InjErrLBA) {
+               if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f'))
+@@ -1851,7 +1851,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char 
__user *buf,
+       }
+ 
+       if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
+-              return 0;
++              return -EINVAL;
+ 
+       if (dent == phba->debug_writeGuard)
+               phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
+diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
+index 4cfcc73f39790..d85bb3ba8263f 100644
+--- a/drivers/usb/gadget/composite.c
++++ b/drivers/usb/gadget/composite.c
+@@ -1077,7 +1077,7 @@ static void collect_langs(struct usb_gadget_strings 
**sp, __le16 *buf)
+       while (*sp) {
+               s = *sp;
+               language = cpu_to_le16(s->language);
+-              for (tmp = buf; *tmp && tmp < &buf[126]; tmp++) {
++              for (tmp = buf; *tmp && tmp < &buf[USB_MAX_STRING_LEN]; tmp++) {
+                       if (*tmp == language)
+                               goto repeat;
+               }
+@@ -1152,7 +1152,7 @@ static int get_string(struct usb_composite_dev *cdev,
+                       collect_langs(sp, s->wData);
+               }
+ 
+-              for (len = 0; len <= 126 && s->wData[len]; len++)
++              for (len = 0; len <= USB_MAX_STRING_LEN && s->wData[len]; len++)
+                       continue;
+               if (!len)
+                       return -EINVAL;
+diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
+index 5b8b2ca4376cb..3d4710cc34bc1 100644
+--- a/drivers/usb/gadget/configfs.c
++++ b/drivers/usb/gadget/configfs.c
+@@ -109,21 +109,27 @@ struct gadget_config_name {
+       struct list_head list;
+ };
+ 
++#define USB_MAX_STRING_WITH_NULL_LEN  (USB_MAX_STRING_LEN+1)
++
+ static int usb_string_copy(const char *s, char **s_copy)
+ {
+       int ret;
+       char *str;
+       char *copy = *s_copy;
+       ret = strlen(s);
+-      if (ret > 126)
++      if (ret > USB_MAX_STRING_LEN)
+               return -EOVERFLOW;
+ 
+-      str = kstrdup(s, GFP_KERNEL);
+-      if (!str)
+-              return -ENOMEM;
++      if (copy) {
++              str = copy;
++      } else {
++              str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL);
++              if (!str)
++                      return -ENOMEM;
++      }
++      strcpy(str, s);
+       if (str[ret - 1] == '\n')
+               str[ret - 1] = '\0';
+-      kfree(copy);
+       *s_copy = str;
+       return 0;
+ }
+diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
+index 7c24d1ce10889..33f77e59aa6fb 100644
+--- a/drivers/usb/gadget/usbstring.c
++++ b/drivers/usb/gadget/usbstring.c
+@@ -55,9 +55,9 @@ usb_gadget_get_string (const struct usb_gadget_strings 
*table, int id, u8 *buf)
+               return -EINVAL;
+ 
+       /* string descriptors have length, tag, then UTF16-LE text */
+-      len = min ((size_t) 126, strlen (s->s));
++      len = min((size_t)USB_MAX_STRING_LEN, strlen(s->s));
+       len = utf8s_to_utf16s(s->s, len, UTF16_LITTLE_ENDIAN,
+-                      (wchar_t *) &buf[2], 126);
++                      (wchar_t *) &buf[2], USB_MAX_STRING_LEN);
+       if (len < 0)
+               return -EINVAL;
+       buf [0] = (len + 1) * 2;
+diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
+index 96cb0409dd893..737b765d0f6ea 100644
+--- a/drivers/usb/storage/transport.c
++++ b/drivers/usb/storage/transport.c
+@@ -651,6 +651,13 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, 
struct us_data *us)
+               need_auto_sense = 1;
+       }
+ 
++      /* Some devices (Kindle) require another command after SYNC CACHE */
++      if ((us->fflags & US_FL_SENSE_AFTER_SYNC) &&
++                      srb->cmnd[0] == SYNCHRONIZE_CACHE) {
++              usb_stor_dbg(us, "-- sense after SYNC CACHE\n");
++              need_auto_sense = 1;
++      }
++
+       /*
+        * If we have a failure, we're going to do a REQUEST_SENSE 
+        * automatically.  Note that we differentiate between a command
+diff --git a/drivers/usb/storage/unusual_devs.h 
b/drivers/usb/storage/unusual_devs.h
+index 88275842219ef..861153d294b67 100644
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -2211,6 +2211,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200,
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_NO_READ_DISC_INFO ),
+ 
++/*
++ * Reported by Matthias Schwarzott <[email protected]>
++ * The Amazon Kindle treats SYNCHRONIZE CACHE as an indication that
++ * the host may be finished with it, and automatically ejects its
++ * emulated media unless it receives another command within one second.
++ */
++UNUSUAL_DEV( 0x1949, 0x0004, 0x0000, 0x9999,
++              "Amazon",
++              "Kindle",
++              USB_SC_DEVICE, USB_PR_DEVICE, NULL,
++              US_FL_SENSE_AFTER_SYNC ),
++
+ /*
+  * Reported by Oliver Neukum <[email protected]>
+  * This device morphes spontaneously into another device if the access
+diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
+index 741852bd148ea..1bde09e5cb478 100644
+--- a/drivers/usb/usbip/vudc_sysfs.c
++++ b/drivers/usb/usbip/vudc_sysfs.c
+@@ -175,7 +175,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
+ 
+               udc->ud.tcp_socket = socket;
+               udc->ud.tcp_rx = tcp_rx;
+-              udc->ud.tcp_rx = tcp_tx;
++              udc->ud.tcp_tx = tcp_tx;
+               udc->ud.status = SDEV_ST_USED;
+ 
+               spin_unlock_irq(&udc->ud.lock);
+diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
+index 49db37b1f6e36..2bdd24425a683 100644
+--- a/fs/btrfs/ctree.c
++++ b/fs/btrfs/ctree.c
+@@ -1414,7 +1414,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
+                                  "failed to read tree block %llu from 
get_old_root",
+                                  logical);
+               } else {
++                      btrfs_tree_read_lock(old);
+                       eb = btrfs_clone_extent_buffer(old);
++                      btrfs_tree_read_unlock(old);
+                       free_extent_buffer(old);
+               }
+       } else if (old_root) {
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
+index 64d459ca76d06..8c6f619c9ee6a 100644
+--- a/fs/btrfs/inode.c
++++ b/fs/btrfs/inode.c
+@@ -9472,7 +9472,7 @@ int __init btrfs_init_cachep(void)
+ 
+       btrfs_free_space_bitmap_cachep = 
kmem_cache_create("btrfs_free_space_bitmap",
+                                                       PAGE_SIZE, PAGE_SIZE,
+-                                                      SLAB_RED_ZONE, NULL);
++                                                      SLAB_MEM_SPREAD, NULL);
+       if (!btrfs_free_space_bitmap_cachep)
+               goto fail;
+ 
+diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
+index 70412944b267d..59643acb6d679 100644
+--- a/fs/cifs/transport.c
++++ b/fs/cifs/transport.c
+@@ -891,9 +891,12 @@ compound_send_recv(const unsigned int xid, struct 
cifs_ses *ses,
+       /*
+        * Compounding is never used during session establish.
+        */
+-      if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
++      if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
++              mutex_lock(&ses->server->srv_mutex);
+               smb311_update_preauth_hash(ses, rqst[0].rq_iov,
+                                          rqst[0].rq_nvec);
++              mutex_unlock(&ses->server->srv_mutex);
++      }
+ 
+       if (timeout == CIFS_ASYNC_OP)
+               goto out;
+@@ -964,7 +967,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses 
*ses,
+                       .iov_base = resp_iov[0].iov_base,
+                       .iov_len = resp_iov[0].iov_len
+               };
++              mutex_lock(&ses->server->srv_mutex);
+               smb311_update_preauth_hash(ses, &iov, 1);
++              mutex_unlock(&ses->server->srv_mutex);
+       }
+ 
+ out:
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
+index 296ffe92e2503..1c6fd526ea978 100644
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -5266,7 +5266,7 @@ static int ext4_do_update_inode(handle_t *handle,
+       struct ext4_inode_info *ei = EXT4_I(inode);
+       struct buffer_head *bh = iloc->bh;
+       struct super_block *sb = inode->i_sb;
+-      int err = 0, rc, block;
++      int err = 0, block;
+       int need_datasync = 0, set_large_file = 0;
+       uid_t i_uid;
+       gid_t i_gid;
+@@ -5378,9 +5378,9 @@ static int ext4_do_update_inode(handle_t *handle,
+                                             bh->b_data);
+ 
+       BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
+-      rc = ext4_handle_dirty_metadata(handle, NULL, bh);
+-      if (!err)
+-              err = rc;
++      err = ext4_handle_dirty_metadata(handle, NULL, bh);
++      if (err)
++              goto out_brelse;
+       ext4_clear_inode_state(inode, EXT4_STATE_NEW);
+       if (set_large_file) {
+               BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access");
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
+index 0dde6385a1258..5f701d8dce478 100644
+--- a/fs/ext4/namei.c
++++ b/fs/ext4/namei.c
+@@ -3440,6 +3440,31 @@ static int ext4_setent(handle_t *handle, struct 
ext4_renament *ent,
+       return 0;
+ }
+ 
++static void ext4_resetent(handle_t *handle, struct ext4_renament *ent,
++                        unsigned ino, unsigned file_type)
++{
++      struct ext4_renament old = *ent;
++      int retval = 0;
++
++      /*
++       * old->de could have moved from under us during make indexed dir,
++       * so the old->de may no longer valid and need to find it again
++       * before reset old inode info.
++       */
++      old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL);
++      if (IS_ERR(old.bh))
++              retval = PTR_ERR(old.bh);
++      if (!old.bh)
++              retval = -ENOENT;
++      if (retval) {
++              ext4_std_error(old.dir->i_sb, retval);
++              return;
++      }
++
++      ext4_setent(handle, &old, ino, file_type);
++      brelse(old.bh);
++}
++
+ static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
+                                 const struct qstr *d_name)
+ {
+@@ -3736,8 +3761,8 @@ static int ext4_rename(struct inode *old_dir, struct 
dentry *old_dentry,
+ end_rename:
+       if (whiteout) {
+               if (retval) {
+-                      ext4_setent(handle, &old,
+-                              old.inode->i_ino, old_file_type);
++                      ext4_resetent(handle, &old,
++                                    old.inode->i_ino, old_file_type);
+                       drop_nlink(whiteout);
+               }
+               unlock_new_inode(whiteout);
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
+index 899567d74c2a9..4e95b4f8a2ad9 100644
+--- a/fs/ext4/xattr.c
++++ b/fs/ext4/xattr.c
+@@ -2419,7 +2419,7 @@ retry_inode:
+                                * external inode if possible.
+                                */
+                               if (ext4_has_feature_ea_inode(inode->i_sb) &&
+-                                  !i.in_inode) {
++                                  i.value_len && !i.in_inode) {
+                                       i.in_inode = 1;
+                                       goto retry_inode;
+                               }
+diff --git a/fs/select.c b/fs/select.c
+index 4a6b6e4b21cb9..11a7051075b4f 100644
+--- a/fs/select.c
++++ b/fs/select.c
+@@ -1003,10 +1003,9 @@ static long do_restart_poll(struct restart_block 
*restart_block)
+ 
+       ret = do_sys_poll(ufds, nfds, to);
+ 
+-      if (ret == -EINTR) {
+-              restart_block->fn = do_restart_poll;
+-              ret = -ERESTART_RESTARTBLOCK;
+-      }
++      if (ret == -EINTR)
++              ret = set_restart_fn(restart_block, do_restart_poll);
++
+       return ret;
+ }
+ 
+@@ -1028,7 +1027,6 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, 
unsigned int, nfds,
+               struct restart_block *restart_block;
+ 
+               restart_block = &current->restart_block;
+-              restart_block->fn = do_restart_poll;
+               restart_block->poll.ufds = ufds;
+               restart_block->poll.nfds = nfds;
+ 
+@@ -1039,7 +1037,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, 
unsigned int, nfds,
+               } else
+                       restart_block->poll.has_timeout = 0;
+ 
+-              ret = -ERESTART_RESTARTBLOCK;
++              ret = set_restart_fn(restart_block, do_restart_poll);
+       }
+       return ret;
+ }
+diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
+index 849cd8eb5ca06..ea5987bb0b84a 100644
+--- a/include/asm-generic/sections.h
++++ b/include/asm-generic/sections.h
+@@ -53,6 +53,9 @@ extern char __ctors_start[], __ctors_end[];
+ /* Start and end of .opd section - used for function descriptors. */
+ extern char __start_opd[], __end_opd[];
+ 
++/* Start and end of instrumentation protected text section */
++extern char __noinstr_text_start[], __noinstr_text_end[];
++
+ extern __visible const void __nosave_begin, __nosave_end;
+ 
+ /* Function descriptor handling (if any).  Override in asm/sections.h */
+diff --git a/include/asm-generic/vmlinux.lds.h 
b/include/asm-generic/vmlinux.lds.h
+index 2d632a74cc5e9..88484ee023ca3 100644
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -482,6 +482,15 @@
+               __security_initcall_end = .;                            \
+       }
+ 
++/*
++ * Non-instrumentable text section
++ */
++#define NOINSTR_TEXT                                                  \
++              ALIGN_FUNCTION();                                       \
++              __noinstr_text_start = .;                               \
++              *(.noinstr.text)                                        \
++              __noinstr_text_end = .;
++
+ /*
+  * .text section. Map to function alignment to avoid address changes
+  * during second ld run in second ld pass when generating System.map
+@@ -496,6 +505,7 @@
+               *(TEXT_MAIN .text.fixup)                                \
+               *(.text.unlikely .text.unlikely.*)                      \
+               *(.text.unknown .text.unknown.*)                        \
++              NOINSTR_TEXT                                            \
+               *(.text..refcount)                                      \
+               *(.ref.text)                                            \
+       MEM_KEEP(init.text*)                                            \
+diff --git a/include/linux/compiler.h b/include/linux/compiler.h
+index 6b6505e3b2c70..6a53300cbd1ed 100644
+--- a/include/linux/compiler.h
++++ b/include/linux/compiler.h
+@@ -129,11 +129,65 @@ void ftrace_likely_update(struct ftrace_likely_data *f, 
int val,
+       ".pushsection .discard.unreachable\n\t"                         \
+       ".long 999b - .\n\t"                                            \
+       ".popsection\n\t"
++
++#ifdef CONFIG_DEBUG_ENTRY
++/* Begin/end of an instrumentation safe region */
++#define instrumentation_begin() ({                                    \
++      asm volatile("%c0:\n\t"                                         \
++                   ".pushsection .discard.instr_begin\n\t"            \
++                   ".long %c0b - .\n\t"                               \
++                   ".popsection\n\t" : : "i" (__COUNTER__));          \
++})
++
++/*
++ * Because instrumentation_{begin,end}() can nest, objtool validation 
considers
++ * _begin() a +1 and _end() a -1 and computes a sum over the instructions.
++ * When the value is greater than 0, we consider instrumentation allowed.
++ *
++ * There is a problem with code like:
++ *
++ * noinstr void foo()
++ * {
++ *    instrumentation_begin();
++ *    ...
++ *    if (cond) {
++ *            instrumentation_begin();
++ *            ...
++ *            instrumentation_end();
++ *    }
++ *    bar();
++ *    instrumentation_end();
++ * }
++ *
++ * If instrumentation_end() would be an empty label, like all the other
++ * annotations, the inner _end(), which is at the end of a conditional block,
++ * would land on the instruction after the block.
++ *
++ * If we then consider the sum of the !cond path, we'll see that the call to
++ * bar() is with a 0-value, even though, we meant it to happen with a positive
++ * value.
++ *
++ * To avoid this, have _end() be a NOP instruction, this ensures it will be
++ * part of the condition block and does not escape.
++ */
++#define instrumentation_end() ({                                      \
++      asm volatile("%c0: nop\n\t"                                     \
++                   ".pushsection .discard.instr_end\n\t"              \
++                   ".long %c0b - .\n\t"                               \
++                   ".popsection\n\t" : : "i" (__COUNTER__));          \
++})
++#endif /* CONFIG_DEBUG_ENTRY */
++
+ #else
+ #define annotate_reachable()
+ #define annotate_unreachable()
+ #endif
+ 
++#ifndef instrumentation_begin
++#define instrumentation_begin()               do { } while(0)
++#define instrumentation_end()         do { } while(0)
++#endif
++
+ #ifndef ASM_UNREACHABLE
+ # define ASM_UNREACHABLE
+ #endif
+diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
+index 2b8ed70c4c774..c01100318b254 100644
+--- a/include/linux/compiler_types.h
++++ b/include/linux/compiler_types.h
+@@ -234,6 +234,12 @@ struct ftrace_likely_data {
+ #define notrace                       __attribute__((no_instrument_function))
+ #endif
+ 
++#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
++/* Section for code which can't be instrumented at all */
++#define noinstr                                                               
\
++      noinline notrace __attribute((__section__(".noinstr.text")))
++#endif
++
+ /*
+  * it doesn't make sense on ARM (currently the only user of __naked)
+  * to trace naked functions because then mcount is called without
+diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
+index 8d8821b3689a2..62dbecfe91328 100644
+--- a/include/linux/thread_info.h
++++ b/include/linux/thread_info.h
+@@ -11,6 +11,7 @@
+ #include <linux/types.h>
+ #include <linux/bug.h>
+ #include <linux/restart_block.h>
++#include <linux/errno.h>
+ 
+ #ifdef CONFIG_THREAD_INFO_IN_TASK
+ /*
+@@ -39,6 +40,18 @@ enum {
+ 
+ #ifdef __KERNEL__
+ 
++#ifndef arch_set_restart_data
++#define arch_set_restart_data(restart) do { } while (0)
++#endif
++
++static inline long set_restart_fn(struct restart_block *restart,
++                                      long (*fn)(struct restart_block *))
++{
++      restart->fn = fn;
++      arch_set_restart_data(restart);
++      return -ERESTART_RESTARTBLOCK;
++}
++
+ #ifndef THREAD_ALIGN
+ #define THREAD_ALIGN  THREAD_SIZE
+ #endif
+diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
+index a7f7ebdd3069e..0a958c7948324 100644
+--- a/include/linux/usb_usual.h
++++ b/include/linux/usb_usual.h
+@@ -86,6 +86,8 @@
+               /* lies about caching, so always sync */        \
+       US_FLAG(NO_SAME, 0x40000000)                            \
+               /* Cannot handle WRITE_SAME */                  \
++      US_FLAG(SENSE_AFTER_SYNC, 0x80000000)                   \
++              /* Do REQUEST_SENSE after SYNCHRONIZE_CACHE */  \
+ 
+ #define US_FLAG(name, value)  US_FL_##name = value ,
+ enum { US_DO_ALL_FLAGS };
+diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
+index d5a5caec8fbca..3f376688bd043 100644
+--- a/include/uapi/linux/usb/ch9.h
++++ b/include/uapi/linux/usb/ch9.h
+@@ -364,6 +364,9 @@ struct usb_config_descriptor {
+ 
+ /*-------------------------------------------------------------------------*/
+ 
++/* USB String descriptors can contain at most 126 characters. */
++#define USB_MAX_STRING_LEN    126
++
+ /* USB_DT_STRING: String descriptor */
+ struct usb_string_descriptor {
+       __u8  bLength;
+diff --git a/kernel/futex.c b/kernel/futex.c
+index 224adcdac6c19..7d0d8a45f9ae7 100644
+--- a/kernel/futex.c
++++ b/kernel/futex.c
+@@ -2857,14 +2857,13 @@ retry:
+               goto out;
+ 
+       restart = &current->restart_block;
+-      restart->fn = futex_wait_restart;
+       restart->futex.uaddr = uaddr;
+       restart->futex.val = val;
+       restart->futex.time = *abs_time;
+       restart->futex.bitset = bitset;
+       restart->futex.flags = flags | FLAGS_HAS_TIMEOUT;
+ 
+-      ret = -ERESTART_RESTARTBLOCK;
++      ret = set_restart_fn(restart, futex_wait_restart);
+ 
+ out:
+       if (to) {
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
+index 3b66c77670d9b..c377dbb869f80 100644
+--- a/kernel/irq/manage.c
++++ b/kernel/irq/manage.c
+@@ -987,11 +987,15 @@ irq_forced_thread_fn(struct irq_desc *desc, struct 
irqaction *action)
+       irqreturn_t ret;
+ 
+       local_bh_disable();
++      if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
++              local_irq_disable();
+       ret = action->thread_fn(action->irq, action->dev_id);
+       if (ret == IRQ_HANDLED)
+               atomic_inc(&desc->threads_handled);
+ 
+       irq_finalize_oneshot(desc, action);
++      if (!IS_ENABLED(CONFIG_PREEMPT_RT_BASE))
++              local_irq_enable();
+       local_bh_enable();
+       return ret;
+ }
+diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
+index 9eece67f29f34..6a2ba39889bd0 100644
+--- a/kernel/time/alarmtimer.c
++++ b/kernel/time/alarmtimer.c
+@@ -822,9 +822,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, 
int flags,
+       if (flags == TIMER_ABSTIME)
+               return -ERESTARTNOHAND;
+ 
+-      restart->fn = alarm_timer_nsleep_restart;
+       restart->nanosleep.clockid = type;
+       restart->nanosleep.expires = exp;
++      set_restart_fn(restart, alarm_timer_nsleep_restart);
+       return ret;
+ }
+ 
+diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
+index ccde4dc8462cc..0e04b24cec818 100644
+--- a/kernel/time/hrtimer.c
++++ b/kernel/time/hrtimer.c
+@@ -1771,9 +1771,9 @@ long hrtimer_nanosleep(const struct timespec64 *rqtp,
+       }
+ 
+       restart = &current->restart_block;
+-      restart->fn = hrtimer_nanosleep_restart;
+       restart->nanosleep.clockid = t.timer.base->clockid;
+       restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer);
++      set_restart_fn(restart, hrtimer_nanosleep_restart);
+ out:
+       destroy_hrtimer_on_stack(&t.timer);
+       return ret;
+diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
+index d62d7ae5201c5..bfaa44a80c034 100644
+--- a/kernel/time/posix-cpu-timers.c
++++ b/kernel/time/posix-cpu-timers.c
+@@ -1371,8 +1371,8 @@ static int posix_cpu_nsleep(const clockid_t which_clock, 
int flags,
+               if (flags & TIMER_ABSTIME)
+                       return -ERESTARTNOHAND;
+ 
+-              restart_block->fn = posix_cpu_nsleep_restart;
+               restart_block->nanosleep.clockid = which_clock;
++              set_restart_fn(restart_block, posix_cpu_nsleep_restart);
+       }
+       return error;
+ }
+diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
+index 8f3e1f0a1781d..0c7cacd854e06 100644
+--- a/net/qrtr/qrtr.c
++++ b/net/qrtr/qrtr.c
+@@ -271,7 +271,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const 
void *data, size_t len)
+       if (len == 0 || len & 3)
+               return -EINVAL;
+ 
+-      skb = netdev_alloc_skb(NULL, len);
++      skb = __netdev_alloc_skb(NULL, len, GFP_ATOMIC | __GFP_NOWARN);
+       if (!skb)
+               return -ENOMEM;
+ 
+diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
+index d65f8d35de87e..11d393c047728 100644
+--- a/net/sunrpc/svc.c
++++ b/net/sunrpc/svc.c
+@@ -1330,7 +1330,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec 
*argv, struct kvec *resv)
+ 
+  sendit:
+       if (svc_authorise(rqstp))
+-              goto close;
++              goto close_xprt;
+       return 1;               /* Caller can now send it */
+ 
+  dropit:
+@@ -1339,6 +1339,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec 
*argv, struct kvec *resv)
+       return 0;
+ 
+  close:
++      svc_authorise(rqstp);
++close_xprt:
+       if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
+               svc_close_xprt(rqstp->rq_xprt);
+       dprintk("svc: svc_process close\n");
+@@ -1347,7 +1349,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec 
*argv, struct kvec *resv)
+ err_short_len:
+       svc_printk(rqstp, "short len %zd, dropping request\n",
+                       argv->iov_len);
+-      goto close;
++      goto close_xprt;
+ 
+ err_bad_rpc:
+       serv->sv_stats->rpcbadfmt++;
+diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
+index 709c082dc9059..4b56b949a4637 100644
+--- a/net/sunrpc/svc_xprt.c
++++ b/net/sunrpc/svc_xprt.c
+@@ -1052,7 +1052,7 @@ static int svc_close_list(struct svc_serv *serv, struct 
list_head *xprt_list, st
+       struct svc_xprt *xprt;
+       int ret = 0;
+ 
+-      spin_lock(&serv->sv_lock);
++      spin_lock_bh(&serv->sv_lock);
+       list_for_each_entry(xprt, xprt_list, xpt_list) {
+               if (xprt->xpt_net != net)
+                       continue;
+@@ -1060,7 +1060,7 @@ static int svc_close_list(struct svc_serv *serv, struct 
list_head *xprt_list, st
+               set_bit(XPT_CLOSE, &xprt->xpt_flags);
+               svc_xprt_enqueue(xprt);
+       }
+-      spin_unlock(&serv->sv_lock);
++      spin_unlock_bh(&serv->sv_lock);
+       return ret;
+ }
+ 
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c 
b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+index d183d4aee822c..cf2272a90f133 100644
+--- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
++++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
+@@ -308,9 +308,9 @@ xprt_setup_rdma_bc(struct xprt_create *args)
+       xprt->timeout = &xprt_rdma_bc_timeout;
+       xprt_set_bound(xprt);
+       xprt_set_connected(xprt);
+-      xprt->bind_timeout = RPCRDMA_BIND_TO;
+-      xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
+-      xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO;
++      xprt->bind_timeout = 0;
++      xprt->reestablish_timeout = 0;
++      xprt->idle_timeout = 0;
+ 
+       xprt->prot = XPRT_TRANSPORT_BC_RDMA;
+       xprt->tsh_size = 0;
+diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
+index 91a80036c05d5..7c693bd775c1b 100644
+--- a/scripts/mod/modpost.c
++++ b/scripts/mod/modpost.c
+@@ -895,7 +895,7 @@ static void check_section(const char *modname, struct 
elf_info *elf,
+ 
+ #define DATA_SECTIONS ".data", ".data.rel"
+ #define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \
+-              ".kprobes.text", ".cpuidle.text"
++              ".kprobes.text", ".cpuidle.text", ".noinstr.text"
+ #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \
+               ".fixup", ".entry.text", ".exception.text", ".text.*", \
+               ".coldtext"
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
+index 0a196be90b2e5..b9f7b23ae3789 100644
+--- a/sound/pci/hda/hda_generic.c
++++ b/sound/pci/hda/hda_generic.c
+@@ -4029,7 +4029,7 @@ int snd_hda_gen_add_micmute_led(struct hda_codec *codec,
+ 
+       spec->micmute_led.led_mode = MICMUTE_LED_FOLLOW_MUTE;
+       spec->micmute_led.capture = 0;
+-      spec->micmute_led.led_value = 0;
++      spec->micmute_led.led_value = -1;
+       spec->micmute_led.old_hook = spec->cap_sync_hook;
+       spec->micmute_led.update = hook;
+       spec->cap_sync_hook = update_micmute_led;
+diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
+index 3bd57c02e6fd8..0b35b84abb611 100644
+--- a/sound/soc/codecs/ak4458.c
++++ b/sound/soc/codecs/ak4458.c
+@@ -642,6 +642,7 @@ static const struct of_device_id ak4458_of_match[] = {
+       { .compatible = "asahi-kasei,ak4458", },
+       { },
+ };
++MODULE_DEVICE_TABLE(of, ak4458_of_match);
+ 
+ static struct i2c_driver ak4458_i2c_driver = {
+       .driver = {
+diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c
+index 448bb90c9c8e0..73c418517f8d4 100644
+--- a/sound/soc/codecs/ak5558.c
++++ b/sound/soc/codecs/ak5558.c
+@@ -396,6 +396,7 @@ static const struct of_device_id ak5558_i2c_dt_ids[] = {
+       { .compatible = "asahi-kasei,ak5558"},
+       { }
+ };
++MODULE_DEVICE_TABLE(of, ak5558_i2c_dt_ids);
+ 
+ static struct i2c_driver ak5558_i2c_driver = {
+       .driver = {
+diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
+index 0e2bdad373d66..d6a1573b457af 100644
+--- a/sound/soc/fsl/fsl_ssi.c
++++ b/sound/soc/fsl/fsl_ssi.c
+@@ -873,6 +873,7 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream 
*substream,
+ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
+ {
+       u32 strcr = 0, scr = 0, stcr, srcr, mask;
++      unsigned int slots;
+ 
+       ssi->dai_fmt = fmt;
+ 
+@@ -904,10 +905,11 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, 
unsigned int fmt)
+                       return -EINVAL;
+               }
+ 
++              slots = ssi->slots ? : 2;
+               regmap_update_bits(ssi->regs, REG_SSI_STCCR,
+-                                 SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(2));
++                                 SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots));
+               regmap_update_bits(ssi->regs, REG_SSI_SRCCR,
+-                                 SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(2));
++                                 SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots));
+ 
+               /* Data on rising edge of bclk, frame low, 1clk before data */
+               strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP | SSI_STCR_TEFS;
+diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
+index 7c17f17ea2cd2..7f91b6013ddc7 100644
+--- a/tools/build/Makefile.feature
++++ b/tools/build/Makefile.feature
+@@ -31,8 +31,11 @@ FEATURE_TESTS_BASIC :=                  \
+         backtrace                       \
+         dwarf                           \
+         dwarf_getlocations              \
++        eventfd                         \
+         fortify-source                  \
+         sync-compare-and-swap           \
++        get_current_dir_name            \
++        gettid                                \
+         glibc                           \
+         gtk2                            \
+         gtk2-infobar                    \
+diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
+index c4845b66b9baa..6df574750bc9c 100644
+--- a/tools/build/feature/Makefile
++++ b/tools/build/feature/Makefile
+@@ -5,8 +5,10 @@ FILES=                                          \
+          test-bionic.bin                        \
+          test-dwarf.bin                         \
+          test-dwarf_getlocations.bin            \
++         test-eventfd.bin                       \
+          test-fortify-source.bin                \
+          test-sync-compare-and-swap.bin         \
++         test-get_current_dir_name.bin          \
+          test-glibc.bin                         \
+          test-gtk2.bin                          \
+          test-gtk2-infobar.bin                  \
+@@ -52,6 +54,7 @@ FILES=                                          \
+          test-get_cpuid.bin                     \
+          test-sdt.bin                           \
+          test-cxx.bin                           \
++         test-gettid.bin                      \
+          test-jvmti.bin                               \
+          test-sched_getcpu.bin                        \
+          test-setns.bin                               \
+@@ -99,6 +102,12 @@ $(OUTPUT)test-bionic.bin:
+ $(OUTPUT)test-libelf.bin:
+       $(BUILD) -lelf
+ 
++$(OUTPUT)test-eventfd.bin:
++      $(BUILD)
++
++$(OUTPUT)test-get_current_dir_name.bin:
++      $(BUILD)
++
+ $(OUTPUT)test-glibc.bin:
+       $(BUILD)
+ 
+@@ -254,6 +263,9 @@ $(OUTPUT)test-sdt.bin:
+ $(OUTPUT)test-cxx.bin:
+       $(BUILDXX) -std=gnu++11
+ 
++$(OUTPUT)test-gettid.bin:
++      $(BUILD)
++
+ $(OUTPUT)test-jvmti.bin:
+       $(BUILD)
+ 
+diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
+index 8dc20a61341f6..8282bbe547c4e 100644
+--- a/tools/build/feature/test-all.c
++++ b/tools/build/feature/test-all.c
+@@ -34,6 +34,14 @@
+ # include "test-libelf-mmap.c"
+ #undef main
+ 
++#define main main_test_get_current_dir_name
++# include "test-get_current_dir_name.c"
++#undef main
++
++#define main main_test_gettid
++# include "test-gettid.c"
++#undef main
++
+ #define main main_test_glibc
+ # include "test-glibc.c"
+ #undef main
+@@ -46,6 +54,10 @@
+ # include "test-dwarf_getlocations.c"
+ #undef main
+ 
++#define main main_test_eventfd
++# include "test-eventfd.c"
++#undef main
++
+ #define main main_test_libelf_getphdrnum
+ # include "test-libelf-getphdrnum.c"
+ #undef main
+@@ -174,9 +186,12 @@ int main(int argc, char *argv[])
+       main_test_hello();
+       main_test_libelf();
+       main_test_libelf_mmap();
++      main_test_get_current_dir_name();
++      main_test_gettid();
+       main_test_glibc();
+       main_test_dwarf();
+       main_test_dwarf_getlocations();
++      main_test_eventfd();
+       main_test_libelf_getphdrnum();
+       main_test_libelf_gelf_getnote();
+       main_test_libelf_getshdrstrndx();
+diff --git a/tools/build/feature/test-eventfd.c 
b/tools/build/feature/test-eventfd.c
+new file mode 100644
+index 0000000000000..f4de7ef00ccb6
+--- /dev/null
++++ b/tools/build/feature/test-eventfd.c
+@@ -0,0 +1,9 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <[email protected]>
++
++#include <sys/eventfd.h>
++
++int main(void)
++{
++      return eventfd(0, EFD_NONBLOCK);
++}
+diff --git a/tools/build/feature/test-get_current_dir_name.c 
b/tools/build/feature/test-get_current_dir_name.c
+new file mode 100644
+index 0000000000000..573000f932124
+--- /dev/null
++++ b/tools/build/feature/test-get_current_dir_name.c
+@@ -0,0 +1,10 @@
++// SPDX-License-Identifier: GPL-2.0
++#define _GNU_SOURCE
++#include <unistd.h>
++#include <stdlib.h>
++
++int main(void)
++{
++      free(get_current_dir_name());
++      return 0;
++}
+diff --git a/tools/build/feature/test-gettid.c 
b/tools/build/feature/test-gettid.c
+new file mode 100644
+index 0000000000000..ef24e42d3f1b8
+--- /dev/null
++++ b/tools/build/feature/test-gettid.c
+@@ -0,0 +1,11 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <[email protected]>
++#define _GNU_SOURCE
++#include <unistd.h>
++
++int main(void)
++{
++      return gettid();
++}
++
++#undef _GNU_SOURCE
+diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
+index ae0c5bee80140..a328beb9f505c 100644
+--- a/tools/perf/Makefile.config
++++ b/tools/perf/Makefile.config
+@@ -310,6 +310,18 @@ ifndef NO_BIONIC
+   endif
+ endif
+ 
++ifeq ($(feature-eventfd), 1)
++  CFLAGS += -DHAVE_EVENTFD
++endif
++
++ifeq ($(feature-get_current_dir_name), 1)
++  CFLAGS += -DHAVE_GET_CURRENT_DIR_NAME
++endif
++
++ifeq ($(feature-gettid), 1)
++  CFLAGS += -DHAVE_GETTID
++endif
++
+ ifdef NO_LIBELF
+   NO_DWARF := 1
+   NO_DEMANGLE := 1
+diff --git a/tools/perf/jvmti/jvmti_agent.c b/tools/perf/jvmti/jvmti_agent.c
+index f7eb63cbbc655..88108598d6e94 100644
+--- a/tools/perf/jvmti/jvmti_agent.c
++++ b/tools/perf/jvmti/jvmti_agent.c
+@@ -45,10 +45,12 @@
+ static char jit_path[PATH_MAX];
+ static void *marker_addr;
+ 
++#ifndef HAVE_GETTID
+ static inline pid_t gettid(void)
+ {
+       return (pid_t)syscall(__NR_gettid);
+ }
++#endif
+ 
+ static int get_e_machine(struct jitheader *hdr)
+ {
+diff --git a/tools/perf/util/Build b/tools/perf/util/Build
+index 7efe15b9618d0..4eaac6aaaefef 100644
+--- a/tools/perf/util/Build
++++ b/tools/perf/util/Build
+@@ -10,6 +10,7 @@ libperf-y += evlist.o
+ libperf-y += evsel.o
+ libperf-y += evsel_fprintf.o
+ libperf-y += find_bit.o
++libperf-y += get_current_dir_name.o
+ libperf-y += kallsyms.o
+ libperf-y += levenshtein.o
+ libperf-y += llvm-utils.o
+diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
+index 432b8560cf51c..e7bd19c384aed 100644
+--- a/tools/perf/util/expr.y
++++ b/tools/perf/util/expr.y
+@@ -10,7 +10,8 @@
+ #define MAXIDLEN 256
+ %}
+ 
+-%pure-parser
++%define api.pure full
++
+ %parse-param { double *final_val }
+ %parse-param { struct parse_ctx *ctx }
+ %parse-param { const char **pp }
+diff --git a/tools/perf/util/get_current_dir_name.c 
b/tools/perf/util/get_current_dir_name.c
+new file mode 100644
+index 0000000000000..267aa609a5823
+--- /dev/null
++++ b/tools/perf/util/get_current_dir_name.c
+@@ -0,0 +1,18 @@
++// SPDX-License-Identifier: GPL-2.0
++// Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <[email protected]>
++//
++#ifndef HAVE_GET_CURRENT_DIR_NAME
++#include "util.h"
++#include <unistd.h>
++#include <stdlib.h>
++#include <stdlib.h>
++
++/* Android's 'bionic' library, for one, doesn't have this */
++
++char *get_current_dir_name(void)
++{
++      char pwd[PATH_MAX];
++
++      return getcwd(pwd, sizeof(pwd)) == NULL ? NULL : strdup(pwd);
++}
++#endif // HAVE_GET_CURRENT_DIR_NAME
+diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
+index da8fe57691b8c..8d7578be708a2 100644
+--- a/tools/perf/util/parse-events.y
++++ b/tools/perf/util/parse-events.y
+@@ -1,4 +1,4 @@
+-%pure-parser
++%define api.pure full
+ %parse-param {void *_parse_state}
+ %parse-param {void *scanner}
+ %lex-param {void* scanner}
+diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
+index 8c01b2cfdb1ad..2efec9e77753b 100644
+--- a/tools/perf/util/util.h
++++ b/tools/perf/util/util.h
+@@ -57,6 +57,10 @@ int fetch_kernel_version(unsigned int *puint,
+ 
+ const char *perf_tip(const char *dirpath);
+ 
++#ifndef HAVE_GET_CURRENT_DIR_NAME
++char *get_current_dir_name(void);
++#endif
++
+ #ifndef HAVE_SCHED_GETCPU_SUPPORT
+ int sched_getcpu(void);
+ #endif

Reply via email to