commit:     b61923c1f9b749e03c8b4fb6c33781bef22137de
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 17 11:39:16 2018 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Mon Dec 17 11:39:16 2018 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b61923c1

proj/linux-patches: Linux patch 4.9.146

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

 0000_README              |    4 +
 1145_linux-4.9.146.patch | 1528 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1532 insertions(+)

diff --git a/0000_README b/0000_README
index 23dcff1..4c5f483 100644
--- a/0000_README
+++ b/0000_README
@@ -623,6 +623,10 @@ Patch:  1144_linux-4.9.145.patch
 From:   http://www.kernel.org
 Desc:   Linux 4.9.145
 
+Patch:  1145_linux-4.9.146.patch
+From:   http://www.kernel.org
+Desc:   Linux 4.9.146
+
 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/1145_linux-4.9.146.patch b/1145_linux-4.9.146.patch
new file mode 100644
index 0000000..bafcc7f
--- /dev/null
+++ b/1145_linux-4.9.146.patch
@@ -0,0 +1,1528 @@
+diff --git a/Makefile b/Makefile
+index 1499c7ba2874..0a150d2b3353 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 4
+ PATCHLEVEL = 9
+-SUBLEVEL = 145
++SUBLEVEL = 146
+ EXTRAVERSION =
+ NAME = Roaring Lionus
+ 
+diff --git a/arch/arm/boot/dts/logicpd-som-lv.dtsi 
b/arch/arm/boot/dts/logicpd-som-lv.dtsi
+index e262fa9ef334..876ed5f2922c 100644
+--- a/arch/arm/boot/dts/logicpd-som-lv.dtsi
++++ b/arch/arm/boot/dts/logicpd-som-lv.dtsi
+@@ -122,7 +122,7 @@
+ };
+ 
+ &mmc3 {
+-      interrupts-extended = <&intc 94 &omap3_pmx_core2 0x46>;
++      interrupts-extended = <&intc 94 &omap3_pmx_core 0x136>;
+       pinctrl-0 = <&mmc3_pins &wl127x_gpio>;
+       pinctrl-names = "default";
+       vmmc-supply = <&wl12xx_vmmc>;
+diff --git a/arch/arm/mach-omap1/board-ams-delta.c 
b/arch/arm/mach-omap1/board-ams-delta.c
+index 6613a6ff5dbc..c4b634c54fbd 100644
+--- a/arch/arm/mach-omap1/board-ams-delta.c
++++ b/arch/arm/mach-omap1/board-ams-delta.c
+@@ -511,6 +511,9 @@ static void modem_pm(struct uart_port *port, unsigned int 
state, unsigned old)
+ {
+       struct modem_private_data *priv = port->private_data;
+ 
++      if (!priv)
++              return;
++
+       if (IS_ERR(priv->regulator))
+               return;
+ 
+diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
+index 30768003f854..8c505284bc0c 100644
+--- a/arch/arm/mach-omap2/prm44xx.c
++++ b/arch/arm/mach-omap2/prm44xx.c
+@@ -344,7 +344,7 @@ static void omap44xx_prm_reconfigure_io_chain(void)
+  * to occur, WAKEUPENABLE bits must be set in the pad mux registers, and
+  * omap44xx_prm_reconfigure_io_chain() must be called.  No return value.
+  */
+-static void __init omap44xx_prm_enable_io_wakeup(void)
++static void omap44xx_prm_enable_io_wakeup(void)
+ {
+       s32 inst = omap4_prmst_get_prm_dev_inst();
+ 
+diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
+index 037c2a253ae4..1238e7ef1170 100644
+--- a/arch/s390/kernel/perf_cpum_cf.c
++++ b/arch/s390/kernel/perf_cpum_cf.c
+@@ -344,6 +344,8 @@ static int __hw_perf_event_init(struct perf_event *event)
+               break;
+ 
+       case PERF_TYPE_HARDWARE:
++              if (is_sampling_event(event))   /* No sampling support */
++                      return -ENOENT;
+               ev = attr->config;
+               /* Count user space (problem-state) only */
+               if (!attr->exclude_user && attr->exclude_kernel) {
+diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
+index 69a81a7daa24..c8630569e392 100644
+--- a/arch/x86/kvm/lapic.c
++++ b/arch/x86/kvm/lapic.c
+@@ -57,7 +57,7 @@
+ #define APIC_BUS_CYCLE_NS 1
+ 
+ /* #define apic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) */
+-#define apic_debug(fmt, arg...)
++#define apic_debug(fmt, arg...) do {} while (0)
+ 
+ /* 14 is the version for Xeon and Pentium 8.4.8*/
+ #define APIC_VERSION                  (0x14UL | ((KVM_APIC_LVT_NUM - 1) << 
16))
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
+index 8888d894bf39..011050820608 100644
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -1077,7 +1077,7 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx);
+ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx);
+ static int alloc_identity_pagetable(struct kvm *kvm);
+ static void vmx_update_msr_bitmap(struct kvm_vcpu *vcpu);
+-static void __always_inline vmx_disable_intercept_for_msr(unsigned long 
*msr_bitmap,
++static __always_inline void vmx_disable_intercept_for_msr(unsigned long 
*msr_bitmap,
+                                                         u32 msr, int type);
+ 
+ static DEFINE_PER_CPU(struct vmcs *, vmxarea);
+@@ -4872,7 +4872,7 @@ static void free_vpid(int vpid)
+       spin_unlock(&vmx_vpid_lock);
+ }
+ 
+-static void __always_inline vmx_disable_intercept_for_msr(unsigned long 
*msr_bitmap,
++static __always_inline void vmx_disable_intercept_for_msr(unsigned long 
*msr_bitmap,
+                                                         u32 msr, int type)
+ {
+       int f = sizeof(unsigned long);
+@@ -4907,7 +4907,7 @@ static void __always_inline 
vmx_disable_intercept_for_msr(unsigned long *msr_bit
+       }
+ }
+ 
+-static void __always_inline vmx_enable_intercept_for_msr(unsigned long 
*msr_bitmap,
++static __always_inline void vmx_enable_intercept_for_msr(unsigned long 
*msr_bitmap,
+                                                        u32 msr, int type)
+ {
+       int f = sizeof(unsigned long);
+@@ -4942,7 +4942,7 @@ static void __always_inline 
vmx_enable_intercept_for_msr(unsigned long *msr_bitm
+       }
+ }
+ 
+-static void __always_inline vmx_set_intercept_for_msr(unsigned long 
*msr_bitmap,
++static __always_inline void vmx_set_intercept_for_msr(unsigned long 
*msr_bitmap,
+                                                     u32 msr, int type, bool 
value)
+ {
+       if (value)
+diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
+index 57205016b04a..201874b96dd6 100644
+--- a/drivers/gpu/drm/ast/ast_mode.c
++++ b/drivers/gpu/drm/ast/ast_mode.c
+@@ -954,9 +954,21 @@ static int get_clock(void *i2c_priv)
+ {
+       struct ast_i2c_chan *i2c = i2c_priv;
+       struct ast_private *ast = i2c->dev->dev_private;
+-      uint32_t val;
++      uint32_t val, val2, count, pass;
++
++      count = 0;
++      pass = 0;
++      val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4) 
& 0x01;
++      do {
++              val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 
0x10) >> 4) & 0x01;
++              if (val == val2) {
++                      pass++;
++              } else {
++                      pass = 0;
++                      val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 
0xb7, 0x10) >> 4) & 0x01;
++              }
++      } while ((pass < 5) && (count++ < 0x10000));
+ 
+-      val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x10) >> 4;
+       return val & 1 ? 1 : 0;
+ }
+ 
+@@ -964,9 +976,21 @@ static int get_data(void *i2c_priv)
+ {
+       struct ast_i2c_chan *i2c = i2c_priv;
+       struct ast_private *ast = i2c->dev->dev_private;
+-      uint32_t val;
++      uint32_t val, val2, count, pass;
++
++      count = 0;
++      pass = 0;
++      val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5) 
& 0x01;
++      do {
++              val2 = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 
0x20) >> 5) & 0x01;
++              if (val == val2) {
++                      pass++;
++              } else {
++                      pass = 0;
++                      val = (ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 
0xb7, 0x20) >> 5) & 0x01;
++              }
++      } while ((pass < 5) && (count++ < 0x10000));
+ 
+-      val = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0x20) >> 5;
+       return val & 1 ? 1 : 0;
+ }
+ 
+@@ -979,7 +1003,7 @@ static void set_clock(void *i2c_priv, int clock)
+ 
+       for (i = 0; i < 0x10000; i++) {
+               ujcrb7 = ((clock & 0x01) ? 0 : 1);
+-              ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfe, 
ujcrb7);
++              ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf4, 
ujcrb7);
+               jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 
0x01);
+               if (ujcrb7 == jtemp)
+                       break;
+@@ -995,7 +1019,7 @@ static void set_data(void *i2c_priv, int data)
+ 
+       for (i = 0; i < 0x10000; i++) {
+               ujcrb7 = ((data & 0x01) ? 0 : 1) << 2;
+-              ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xfb, 
ujcrb7);
++              ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 0xf1, 
ujcrb7);
+               jtemp = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xb7, 
0x04);
+               if (ujcrb7 == jtemp)
+                       break;
+diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
+index 9ac6e1673375..1f291b344178 100644
+--- a/drivers/hwmon/ina2xx.c
++++ b/drivers/hwmon/ina2xx.c
+@@ -273,7 +273,7 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 
reg,
+               break;
+       case INA2XX_CURRENT:
+               /* signed register, result in mA */
+-              val = regval * data->current_lsb_uA;
++              val = (s16)regval * data->current_lsb_uA;
+               val = DIV_ROUND_CLOSEST(val, 1000);
+               break;
+       case INA2XX_CALIBRATION:
+diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
+index 49276bbdac3d..1bb80f992aa8 100644
+--- a/drivers/hwmon/w83795.c
++++ b/drivers/hwmon/w83795.c
+@@ -1691,7 +1691,7 @@ store_sf_setup(struct device *dev, struct 
device_attribute *attr,
+  * somewhere else in the code
+  */
+ #define SENSOR_ATTR_TEMP(index) {                                     \
+-      SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 4 ? S_IWUSR : 0), \
++      SENSOR_ATTR_2(temp##index##_type, S_IRUGO | (index < 5 ? S_IWUSR : 0), \
+               show_temp_mode, store_temp_mode, NOT_USED, index - 1),  \
+       SENSOR_ATTR_2(temp##index##_input, S_IRUGO, show_temp,          \
+               NULL, TEMP_READ, index - 1),                            \
+diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
+index f8f7a2191b98..f89489b28575 100644
+--- a/drivers/infiniband/hw/mlx5/qp.c
++++ b/drivers/infiniband/hw/mlx5/qp.c
+@@ -3888,17 +3888,18 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, struct 
ib_send_wr *wr,
+                       goto out;
+               }
+ 
+-              if (wr->opcode == IB_WR_LOCAL_INV ||
+-                  wr->opcode == IB_WR_REG_MR) {
++              if (wr->opcode == IB_WR_REG_MR) {
+                       fence = dev->umr_fence;
+                       next_fence = MLX5_FENCE_MODE_INITIATOR_SMALL;
+-              } else if (wr->send_flags & IB_SEND_FENCE) {
+-                      if (qp->next_fence)
+-                              fence = MLX5_FENCE_MODE_SMALL_AND_FENCE;
+-                      else
+-                              fence = MLX5_FENCE_MODE_FENCE;
+-              } else {
+-                      fence = qp->next_fence;
++              } else  {
++                      if (wr->send_flags & IB_SEND_FENCE) {
++                              if (qp->next_fence)
++                                      fence = MLX5_FENCE_MODE_SMALL_AND_FENCE;
++                              else
++                                      fence = MLX5_FENCE_MODE_FENCE;
++                      } else {
++                              fence = qp->next_fence;
++                      }
+               }
+ 
+               switch (ibqp->qp_type) {
+diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c 
b/drivers/net/ethernet/cavium/thunder/nic_main.c
+index 6677b96e1f3f..da142f6bd0c3 100644
+--- a/drivers/net/ethernet/cavium/thunder/nic_main.c
++++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
+@@ -1371,6 +1371,9 @@ static void nic_remove(struct pci_dev *pdev)
+ {
+       struct nicpf *nic = pci_get_drvdata(pdev);
+ 
++      if (!nic)
++              return;
++
+       if (nic->flags & NIC_SRIOV_ENABLED)
+               pci_disable_sriov(pdev);
+ 
+diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c 
b/drivers/net/ethernet/hisilicon/hip04_eth.c
+index 39778892b3b3..b5d18d95d7b9 100644
+--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
++++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
+@@ -922,10 +922,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
+       }
+ 
+       ret = register_netdev(ndev);
+-      if (ret) {
+-              free_netdev(ndev);
++      if (ret)
+               goto alloc_fail;
+-      }
+ 
+       return 0;
+ 
+diff --git a/drivers/net/ethernet/intel/igb/e1000_i210.c 
b/drivers/net/ethernet/intel/igb/e1000_i210.c
+index 07d48f2e3369..6766081f5ab9 100644
+--- a/drivers/net/ethernet/intel/igb/e1000_i210.c
++++ b/drivers/net/ethernet/intel/igb/e1000_i210.c
+@@ -862,6 +862,7 @@ s32 igb_pll_workaround_i210(struct e1000_hw *hw)
+               nvm_word = E1000_INVM_DEFAULT_AL;
+       tmp_nvm = nvm_word | E1000_INVM_PLL_WO_VAL;
+       igb_write_phy_reg_82580(hw, I347AT4_PAGE_SELECT, 
E1000_PHY_PLL_FREQ_PAGE);
++      phy_word = E1000_PHY_PLL_UNCONF;
+       for (i = 0; i < E1000_MAX_PLL_TRIES; i++) {
+               /* check current state directly from internal PHY */
+               igb_read_phy_reg_82580(hw, E1000_PHY_PLL_FREQ_REG, &phy_word);
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+index 77a60aa5dc7e..8466f3874a28 100644
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+@@ -1702,7 +1702,9 @@ static s32 ixgbe_get_link_capabilities_X550em(struct 
ixgbe_hw *hw,
+               *autoneg = false;
+ 
+               if (hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
+-                  hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) {
++                  hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1 ||
++                  hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core0 ||
++                  hw->phy.sfp_type == ixgbe_sfp_type_1g_lx_core1) {
+                       *speed = IXGBE_LINK_SPEED_1GB_FULL;
+                       return 0;
+               }
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c 
b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+index 9a4c4f8281bd..8a9a332d78b4 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+@@ -1027,8 +1027,8 @@ static int mlx4_en_set_pauseparam(struct net_device *dev,
+ 
+       tx_pause = !!(pause->tx_pause);
+       rx_pause = !!(pause->rx_pause);
+-      rx_ppp = priv->prof->rx_ppp && !(tx_pause || rx_pause);
+-      tx_ppp = priv->prof->tx_ppp && !(tx_pause || rx_pause);
++      rx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->rx_ppp;
++      tx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->tx_ppp;
+ 
+       err = mlx4_SET_PORT_general(mdev->dev, priv->port,
+                                   priv->rx_skb_size + ETH_FCS_LEN,
+diff --git a/drivers/net/ethernet/realtek/8139cp.c 
b/drivers/net/ethernet/realtek/8139cp.c
+index 5297bf77211c..d608c2a6c01f 100644
+--- a/drivers/net/ethernet/realtek/8139cp.c
++++ b/drivers/net/ethernet/realtek/8139cp.c
+@@ -578,6 +578,7 @@ static irqreturn_t cp_interrupt (int irq, void 
*dev_instance)
+       struct cp_private *cp;
+       int handled = 0;
+       u16 status;
++      u16 mask;
+ 
+       if (unlikely(dev == NULL))
+               return IRQ_NONE;
+@@ -585,6 +586,10 @@ static irqreturn_t cp_interrupt (int irq, void 
*dev_instance)
+ 
+       spin_lock(&cp->lock);
+ 
++      mask = cpr16(IntrMask);
++      if (!mask)
++              goto out_unlock;
++
+       status = cpr16(IntrStatus);
+       if (!status || (status == 0xFFFF))
+               goto out_unlock;
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
+index b131e555d3c2..f04be9e8980f 100644
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -1579,20 +1579,17 @@ static int gen10g_resume(struct phy_device *phydev)
+ 
+ static int __set_phy_supported(struct phy_device *phydev, u32 max_speed)
+ {
+-      phydev->supported &= ~(PHY_1000BT_FEATURES | PHY_100BT_FEATURES |
+-                             PHY_10BT_FEATURES);
+-
+       switch (max_speed) {
+-      default:
+-              return -ENOTSUPP;
+-      case SPEED_1000:
+-              phydev->supported |= PHY_1000BT_FEATURES;
++      case SPEED_10:
++              phydev->supported &= ~PHY_100BT_FEATURES;
+               /* fall through */
+       case SPEED_100:
+-              phydev->supported |= PHY_100BT_FEATURES;
+-              /* fall through */
+-      case SPEED_10:
+-              phydev->supported |= PHY_10BT_FEATURES;
++              phydev->supported &= ~PHY_1000BT_FEATURES;
++              break;
++      case SPEED_1000:
++              break;
++      default:
++              return -ENOTSUPP;
+       }
+ 
+       return 0;
+diff --git a/drivers/net/tun.c b/drivers/net/tun.c
+index 0260bc15bc0c..7a0d5e928bec 100644
+--- a/drivers/net/tun.c
++++ b/drivers/net/tun.c
+@@ -1570,9 +1570,9 @@ static void tun_setup(struct net_device *dev)
+  */
+ static int tun_validate(struct nlattr *tb[], struct nlattr *data[])
+ {
+-      if (!data)
+-              return 0;
+-      return -EINVAL;
++      /* NL_SET_ERR_MSG(extack,
++                     "tun/tap creation via rtnetlink is not supported."); */
++      return -EOPNOTSUPP;
+ }
+ 
+ static struct rtnl_link_ops tun_link_ops __read_mostly = {
+diff --git a/drivers/staging/speakup/kobjects.c 
b/drivers/staging/speakup/kobjects.c
+index dea018cba094..1253fe118044 100644
+--- a/drivers/staging/speakup/kobjects.c
++++ b/drivers/staging/speakup/kobjects.c
+@@ -387,7 +387,7 @@ static ssize_t synth_store(struct kobject *kobj, struct 
kobj_attribute *attr,
+       len = strlen(buf);
+       if (len < 2 || len > 9)
+               return -EINVAL;
+-      strncpy(new_synth_name, buf, len);
++      memcpy(new_synth_name, buf, len);
+       if (new_synth_name[len - 1] == '\n')
+               len--;
+       new_synth_name[len] = '\0';
+@@ -517,7 +517,7 @@ static ssize_t punc_store(struct kobject *kobj, struct 
kobj_attribute *attr,
+               return -EINVAL;
+       }
+ 
+-      strncpy(punc_buf, buf, x);
++      memcpy(punc_buf, buf, x);
+ 
+       while (x && punc_buf[x - 1] == '\n')
+               x--;
+diff --git a/drivers/usb/gadget/udc/omap_udc.c 
b/drivers/usb/gadget/udc/omap_udc.c
+index a8709f9e5648..9eed4947aad8 100644
+--- a/drivers/usb/gadget/udc/omap_udc.c
++++ b/drivers/usb/gadget/udc/omap_udc.c
+@@ -2037,6 +2037,7 @@ static inline int machine_without_vbus_sense(void)
+ {
+       return machine_is_omap_innovator()
+               || machine_is_omap_osk()
++              || machine_is_omap_palmte()
+               || machine_is_sx1()
+               /* No known omap7xx boards with vbus sense */
+               || cpu_is_omap7xx();
+@@ -2045,7 +2046,7 @@ static inline int machine_without_vbus_sense(void)
+ static int omap_udc_start(struct usb_gadget *g,
+               struct usb_gadget_driver *driver)
+ {
+-      int             status = -ENODEV;
++      int             status;
+       struct omap_ep  *ep;
+       unsigned long   flags;
+ 
+@@ -2083,6 +2084,7 @@ static int omap_udc_start(struct usb_gadget *g,
+                       goto done;
+               }
+       } else {
++              status = 0;
+               if (can_pullup(udc))
+                       pullup_enable(udc);
+               else
+@@ -2612,9 +2614,22 @@ omap_ep_setup(char *name, u8 addr, u8 type,
+ 
+ static void omap_udc_release(struct device *dev)
+ {
+-      complete(udc->done);
++      pullup_disable(udc);
++      if (!IS_ERR_OR_NULL(udc->transceiver)) {
++              usb_put_phy(udc->transceiver);
++              udc->transceiver = NULL;
++      }
++      omap_writew(0, UDC_SYSCON1);
++      remove_proc_file();
++      if (udc->dc_clk) {
++              if (udc->clk_requested)
++                      omap_udc_enable_clock(0);
++              clk_put(udc->hhc_clk);
++              clk_put(udc->dc_clk);
++      }
++      if (udc->done)
++              complete(udc->done);
+       kfree(udc);
+-      udc = NULL;
+ }
+ 
+ static int
+@@ -2886,8 +2901,8 @@ bad_on_1710:
+               udc->clr_halt = UDC_RESET_EP;
+ 
+       /* USB general purpose IRQ:  ep0, state changes, dma, etc */
+-      status = request_irq(pdev->resource[1].start, omap_udc_irq,
+-                      0, driver_name, udc);
++      status = devm_request_irq(&pdev->dev, pdev->resource[1].start,
++                                omap_udc_irq, 0, driver_name, udc);
+       if (status != 0) {
+               ERR("can't get irq %d, err %d\n",
+                       (int) pdev->resource[1].start, status);
+@@ -2895,20 +2910,20 @@ bad_on_1710:
+       }
+ 
+       /* USB "non-iso" IRQ (PIO for all but ep0) */
+-      status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
+-                      0, "omap_udc pio", udc);
++      status = devm_request_irq(&pdev->dev, pdev->resource[2].start,
++                                omap_udc_pio_irq, 0, "omap_udc pio", udc);
+       if (status != 0) {
+               ERR("can't get irq %d, err %d\n",
+                       (int) pdev->resource[2].start, status);
+-              goto cleanup2;
++              goto cleanup1;
+       }
+ #ifdef        USE_ISO
+-      status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
+-                      0, "omap_udc iso", udc);
++      status = devm_request_irq(&pdev->dev, pdev->resource[3].start,
++                                omap_udc_iso_irq, 0, "omap_udc iso", udc);
+       if (status != 0) {
+               ERR("can't get irq %d, err %d\n",
+                       (int) pdev->resource[3].start, status);
+-              goto cleanup3;
++              goto cleanup1;
+       }
+ #endif
+       if (cpu_is_omap16xx() || cpu_is_omap7xx()) {
+@@ -2919,23 +2934,8 @@ bad_on_1710:
+       }
+ 
+       create_proc_file();
+-      status = usb_add_gadget_udc_release(&pdev->dev, &udc->gadget,
+-                      omap_udc_release);
+-      if (status)
+-              goto cleanup4;
+-
+-      return 0;
+-
+-cleanup4:
+-      remove_proc_file();
+-
+-#ifdef        USE_ISO
+-cleanup3:
+-      free_irq(pdev->resource[2].start, udc);
+-#endif
+-
+-cleanup2:
+-      free_irq(pdev->resource[1].start, udc);
++      return usb_add_gadget_udc_release(&pdev->dev, &udc->gadget,
++                                        omap_udc_release);
+ 
+ cleanup1:
+       kfree(udc);
+@@ -2962,42 +2962,15 @@ static int omap_udc_remove(struct platform_device 
*pdev)
+ {
+       DECLARE_COMPLETION_ONSTACK(done);
+ 
+-      if (!udc)
+-              return -ENODEV;
+-
+-      usb_del_gadget_udc(&udc->gadget);
+-      if (udc->driver)
+-              return -EBUSY;
+-
+       udc->done = &done;
+ 
+-      pullup_disable(udc);
+-      if (!IS_ERR_OR_NULL(udc->transceiver)) {
+-              usb_put_phy(udc->transceiver);
+-              udc->transceiver = NULL;
+-      }
+-      omap_writew(0, UDC_SYSCON1);
+-
+-      remove_proc_file();
+-
+-#ifdef        USE_ISO
+-      free_irq(pdev->resource[3].start, udc);
+-#endif
+-      free_irq(pdev->resource[2].start, udc);
+-      free_irq(pdev->resource[1].start, udc);
++      usb_del_gadget_udc(&udc->gadget);
+ 
+-      if (udc->dc_clk) {
+-              if (udc->clk_requested)
+-                      omap_udc_enable_clock(0);
+-              clk_put(udc->hhc_clk);
+-              clk_put(udc->dc_clk);
+-      }
++      wait_for_completion(&done);
+ 
+       release_mem_region(pdev->resource[0].start,
+                       pdev->resource[0].end - pdev->resource[0].start + 1);
+ 
+-      wait_for_completion(&done);
+-
+       return 0;
+ }
+ 
+diff --git a/drivers/xen/xlate_mmu.c b/drivers/xen/xlate_mmu.c
+index 23f1387b3ef7..e7df65d32c91 100644
+--- a/drivers/xen/xlate_mmu.c
++++ b/drivers/xen/xlate_mmu.c
+@@ -36,6 +36,7 @@
+ #include <asm/xen/hypervisor.h>
+ 
+ #include <xen/xen.h>
++#include <xen/xen-ops.h>
+ #include <xen/page.h>
+ #include <xen/interface/xen.h>
+ #include <xen/interface/memory.h>
+diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
+index 79dc3ee1de58..a45f26ac5da7 100644
+--- a/fs/btrfs/send.c
++++ b/fs/btrfs/send.c
+@@ -3349,7 +3349,8 @@ static void free_pending_move(struct send_ctx *sctx, 
struct pending_dir_move *m)
+       kfree(m);
+ }
+ 
+-static void tail_append_pending_moves(struct pending_dir_move *moves,
++static void tail_append_pending_moves(struct send_ctx *sctx,
++                                    struct pending_dir_move *moves,
+                                     struct list_head *stack)
+ {
+       if (list_empty(&moves->list)) {
+@@ -3360,6 +3361,10 @@ static void tail_append_pending_moves(struct 
pending_dir_move *moves,
+               list_add_tail(&moves->list, stack);
+               list_splice_tail(&list, stack);
+       }
++      if (!RB_EMPTY_NODE(&moves->node)) {
++              rb_erase(&moves->node, &sctx->pending_dir_moves);
++              RB_CLEAR_NODE(&moves->node);
++      }
+ }
+ 
+ static int apply_children_dir_moves(struct send_ctx *sctx)
+@@ -3374,7 +3379,7 @@ static int apply_children_dir_moves(struct send_ctx 
*sctx)
+               return 0;
+ 
+       INIT_LIST_HEAD(&stack);
+-      tail_append_pending_moves(pm, &stack);
++      tail_append_pending_moves(sctx, pm, &stack);
+ 
+       while (!list_empty(&stack)) {
+               pm = list_first_entry(&stack, struct pending_dir_move, list);
+@@ -3385,7 +3390,7 @@ static int apply_children_dir_moves(struct send_ctx 
*sctx)
+                       goto out;
+               pm = get_pending_dir_moves(sctx, parent_ino);
+               if (pm)
+-                      tail_append_pending_moves(pm, &stack);
++                      tail_append_pending_moves(sctx, pm, &stack);
+       }
+       return 0;
+ 
+diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
+index 5e3bc9de7a16..799b59d96fe2 100644
+--- a/fs/cachefiles/rdwr.c
++++ b/fs/cachefiles/rdwr.c
+@@ -537,7 +537,10 @@ static int cachefiles_read_backing_file(struct 
cachefiles_object *object,
+                                           netpage->index, cachefiles_gfp);
+               if (ret < 0) {
+                       if (ret == -EEXIST) {
++                              put_page(backpage);
++                              backpage = NULL;
+                               put_page(netpage);
++                              netpage = NULL;
+                               fscache_retrieval_complete(op, 1);
+                               continue;
+                       }
+@@ -610,7 +613,10 @@ static int cachefiles_read_backing_file(struct 
cachefiles_object *object,
+                                           netpage->index, cachefiles_gfp);
+               if (ret < 0) {
+                       if (ret == -EEXIST) {
++                              put_page(backpage);
++                              backpage = NULL;
+                               put_page(netpage);
++                              netpage = NULL;
+                               fscache_retrieval_complete(op, 1);
+                               continue;
+                       }
+@@ -963,11 +969,8 @@ error:
+ void cachefiles_uncache_page(struct fscache_object *_object, struct page 
*page)
+ {
+       struct cachefiles_object *object;
+-      struct cachefiles_cache *cache;
+ 
+       object = container_of(_object, struct cachefiles_object, fscache);
+-      cache = container_of(object->fscache.cache,
+-                           struct cachefiles_cache, cache);
+ 
+       _enter("%p,{%lu}", object, page->index);
+ 
+diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
+index a4b531be9168..7a7bba7c2328 100644
+--- a/fs/exportfs/expfs.c
++++ b/fs/exportfs/expfs.c
+@@ -76,7 +76,7 @@ static bool dentry_connected(struct dentry *dentry)
+               struct dentry *parent = dget_parent(dentry);
+ 
+               dput(dentry);
+-              if (IS_ROOT(dentry)) {
++              if (dentry == parent) {
+                       dput(parent);
+                       return false;
+               }
+diff --git a/fs/fscache/object.c b/fs/fscache/object.c
+index 7a182c87f378..ab1d7f35f6c2 100644
+--- a/fs/fscache/object.c
++++ b/fs/fscache/object.c
+@@ -715,6 +715,9 @@ static const struct fscache_state 
*fscache_drop_object(struct fscache_object *ob
+ 
+       if (awaken)
+               wake_up_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING);
++      if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags))
++              wake_up_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP);
++
+ 
+       /* Prevent a race with our last child, which has to signal EV_CLEARED
+        * before dropping our spinlock.
+diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
+index 37cdd955eceb..320f4372f172 100644
+--- a/fs/hfs/btree.c
++++ b/fs/hfs/btree.c
+@@ -328,13 +328,14 @@ void hfs_bmap_free(struct hfs_bnode *node)
+ 
+               nidx -= len * 8;
+               i = node->next;
+-              hfs_bnode_put(node);
+               if (!i) {
+                       /* panic */;
+                       pr_crit("unable to free bnode %u. bmap not found!\n",
+                               node->this);
++                      hfs_bnode_put(node);
+                       return;
+               }
++              hfs_bnode_put(node);
+               node = hfs_bnode_find(tree, i);
+               if (IS_ERR(node))
+                       return;
+diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
+index d9d1a36ba826..8d2256454efe 100644
+--- a/fs/hfsplus/btree.c
++++ b/fs/hfsplus/btree.c
+@@ -453,14 +453,15 @@ void hfs_bmap_free(struct hfs_bnode *node)
+ 
+               nidx -= len * 8;
+               i = node->next;
+-              hfs_bnode_put(node);
+               if (!i) {
+                       /* panic */;
+                       pr_crit("unable to free bnode %u. "
+                                       "bmap not found!\n",
+                               node->this);
++                      hfs_bnode_put(node);
+                       return;
+               }
++              hfs_bnode_put(node);
+               node = hfs_bnode_find(tree, i);
+               if (IS_ERR(node))
+                       return;
+diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
+index 827fc9809bc2..3494e220b510 100644
+--- a/fs/ocfs2/export.c
++++ b/fs/ocfs2/export.c
+@@ -125,10 +125,10 @@ check_err:
+ 
+ check_gen:
+       if (handle->ih_generation != inode->i_generation) {
+-              iput(inode);
+               trace_ocfs2_get_dentry_generation((unsigned long long)blkno,
+                                                 handle->ih_generation,
+                                                 inode->i_generation);
++              iput(inode);
+               result = ERR_PTR(-ESTALE);
+               goto bail;
+       }
+diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
+index 4e8f32eb0bdb..c179afd0051a 100644
+--- a/fs/ocfs2/move_extents.c
++++ b/fs/ocfs2/move_extents.c
+@@ -156,18 +156,14 @@ out:
+ }
+ 
+ /*
+- * lock allocators, and reserving appropriate number of bits for
+- * meta blocks and data clusters.
+- *
+- * in some cases, we don't need to reserve clusters, just let data_ac
+- * be NULL.
++ * lock allocator, and reserve appropriate number of bits for
++ * meta blocks.
+  */
+-static int ocfs2_lock_allocators_move_extents(struct inode *inode,
++static int ocfs2_lock_meta_allocator_move_extents(struct inode *inode,
+                                       struct ocfs2_extent_tree *et,
+                                       u32 clusters_to_move,
+                                       u32 extents_to_split,
+                                       struct ocfs2_alloc_context **meta_ac,
+-                                      struct ocfs2_alloc_context **data_ac,
+                                       int extra_blocks,
+                                       int *credits)
+ {
+@@ -192,13 +188,6 @@ static int ocfs2_lock_allocators_move_extents(struct 
inode *inode,
+               goto out;
+       }
+ 
+-      if (data_ac) {
+-              ret = ocfs2_reserve_clusters(osb, clusters_to_move, data_ac);
+-              if (ret) {
+-                      mlog_errno(ret);
+-                      goto out;
+-              }
+-      }
+ 
+       *credits += ocfs2_calc_extend_credits(osb->sb, et->et_root_el);
+ 
+@@ -260,10 +249,10 @@ static int ocfs2_defrag_extent(struct 
ocfs2_move_extents_context *context,
+               }
+       }
+ 
+-      ret = ocfs2_lock_allocators_move_extents(inode, &context->et, *len, 1,
+-                                               &context->meta_ac,
+-                                               &context->data_ac,
+-                                               extra_blocks, &credits);
++      ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et,
++                                              *len, 1,
++                                              &context->meta_ac,
++                                              extra_blocks, &credits);
+       if (ret) {
+               mlog_errno(ret);
+               goto out;
+@@ -286,6 +275,21 @@ static int ocfs2_defrag_extent(struct 
ocfs2_move_extents_context *context,
+               }
+       }
+ 
++      /*
++       * Make sure ocfs2_reserve_cluster is called after
++       * __ocfs2_flush_truncate_log, otherwise, dead lock may happen.
++       *
++       * If ocfs2_reserve_cluster is called
++       * before __ocfs2_flush_truncate_log, dead lock on global bitmap
++       * may happen.
++       *
++       */
++      ret = ocfs2_reserve_clusters(osb, *len, &context->data_ac);
++      if (ret) {
++              mlog_errno(ret);
++              goto out_unlock_mutex;
++      }
++
+       handle = ocfs2_start_trans(osb, credits);
+       if (IS_ERR(handle)) {
+               ret = PTR_ERR(handle);
+@@ -606,9 +610,10 @@ static int ocfs2_move_extent(struct 
ocfs2_move_extents_context *context,
+               }
+       }
+ 
+-      ret = ocfs2_lock_allocators_move_extents(inode, &context->et, len, 1,
+-                                               &context->meta_ac,
+-                                               NULL, extra_blocks, &credits);
++      ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et,
++                                              len, 1,
++                                              &context->meta_ac,
++                                              extra_blocks, &credits);
+       if (ret) {
+               mlog_errno(ret);
+               goto out;
+diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
+index 43033a3d66d5..2434bffbc6dd 100644
+--- a/fs/pstore/platform.c
++++ b/fs/pstore/platform.c
+@@ -584,8 +584,8 @@ static void pstore_console_write(struct console *con, 
const char *s, unsigned c)
+               } else {
+                       spin_lock_irqsave(&psinfo->buf_lock, flags);
+               }
+-              memcpy(psinfo->buf, s, c);
+-              psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, 0, 0, c, psinfo);
++              psinfo->write_buf(PSTORE_TYPE_CONSOLE, 0, &id, 0,
++                                s, 0, c, psinfo);
+               spin_unlock_irqrestore(&psinfo->buf_lock, flags);
+               s += c;
+               c = e - s;
+diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
+index d62c423a5a2d..7b391b43bcf5 100644
+--- a/fs/sysv/inode.c
++++ b/fs/sysv/inode.c
+@@ -275,7 +275,7 @@ static int __sysv_write_inode(struct inode *inode, int 
wait)
+                 }
+         }
+       brelse(bh);
+-      return 0;
++      return err;
+ }
+ 
+ int sysv_write_inode(struct inode *inode, struct writeback_control *wbc)
+diff --git a/include/net/neighbour.h b/include/net/neighbour.h
+index 8b683841e574..f6017ddc4ded 100644
+--- a/include/net/neighbour.h
++++ b/include/net/neighbour.h
+@@ -448,6 +448,7 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, 
struct sk_buff *skb)
+ 
+ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff 
*skb)
+ {
++      unsigned int hh_alen = 0;
+       unsigned int seq;
+       int hh_len;
+ 
+@@ -455,16 +456,33 @@ static inline int neigh_hh_output(const struct hh_cache 
*hh, struct sk_buff *skb
+               seq = read_seqbegin(&hh->hh_lock);
+               hh_len = hh->hh_len;
+               if (likely(hh_len <= HH_DATA_MOD)) {
+-                      /* this is inlined by gcc */
+-                      memcpy(skb->data - HH_DATA_MOD, hh->hh_data, 
HH_DATA_MOD);
++                      hh_alen = HH_DATA_MOD;
++
++                      /* skb_push() would proceed silently if we have room for
++                       * the unaligned size but not for the aligned size:
++                       * check headroom explicitly.
++                       */
++                      if (likely(skb_headroom(skb) >= HH_DATA_MOD)) {
++                              /* this is inlined by gcc */
++                              memcpy(skb->data - HH_DATA_MOD, hh->hh_data,
++                                     HH_DATA_MOD);
++                      }
+               } else {
+-                      int hh_alen = HH_DATA_ALIGN(hh_len);
++                      hh_alen = HH_DATA_ALIGN(hh_len);
+ 
+-                      memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
++                      if (likely(skb_headroom(skb) >= hh_alen)) {
++                              memcpy(skb->data - hh_alen, hh->hh_data,
++                                     hh_alen);
++                      }
+               }
+       } while (read_seqretry(&hh->hh_lock, seq));
+ 
+-      skb_push(skb, hh_len);
++      if (WARN_ON_ONCE(skb_headroom(skb) < hh_alen)) {
++              kfree_skb(skb);
++              return NET_XMIT_DROP;
++      }
++
++      __skb_push(skb, hh_len);
+       return dev_queue_xmit(skb);
+ }
+ 
+diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
+index 41805fb3c661..7cc06f267be5 100644
+--- a/kernel/trace/bpf_trace.c
++++ b/kernel/trace/bpf_trace.c
+@@ -161,11 +161,13 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, 
u64, arg1,
+                       i++;
+               } else if (fmt[i] == 'p' || fmt[i] == 's') {
+                       mod[fmt_cnt]++;
+-                      i++;
+-                      if (!isspace(fmt[i]) && !ispunct(fmt[i]) && fmt[i] != 0)
++                      /* disallow any further format extensions */
++                      if (fmt[i + 1] != 0 &&
++                          !isspace(fmt[i + 1]) &&
++                          !ispunct(fmt[i + 1]))
+                               return -EINVAL;
+                       fmt_cnt++;
+-                      if (fmt[i - 1] == 's') {
++                      if (fmt[i] == 's') {
+                               if (str_seen)
+                                       /* allow only one '%s' per fmt string */
+                                       return -EINVAL;
+diff --git a/lib/debugobjects.c b/lib/debugobjects.c
+index 88580e8ee39e..1c43d4c5d2ab 100644
+--- a/lib/debugobjects.c
++++ b/lib/debugobjects.c
+@@ -1110,7 +1110,8 @@ void __init debug_objects_mem_init(void)
+ 
+       obj_cache = kmem_cache_create("debug_objects_cache",
+                                     sizeof (struct debug_obj), 0,
+-                                    SLAB_DEBUG_OBJECTS, NULL);
++                                    SLAB_DEBUG_OBJECTS | SLAB_NOLEAKTRACE,
++                                    NULL);
+ 
+       if (!obj_cache || debug_objects_replace_static_objects()) {
+               debug_objects_enabled = 0;
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
+index 928a0b84469d..ba724576764e 100644
+--- a/net/core/rtnetlink.c
++++ b/net/core/rtnetlink.c
+@@ -3186,6 +3186,9 @@ int ndo_dflt_fdb_dump(struct sk_buff *skb,
+ {
+       int err;
+ 
++      if (dev->type != ARPHRD_ETHER)
++              return -EINVAL;
++
+       netif_addr_lock_bh(dev);
+       err = nlmsg_populate_fdb(skb, cb, dev, idx, &dev->uc);
+       if (err)
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
+index bd68f073570b..6f35cdd5f2f0 100644
+--- a/net/ipv4/tcp_output.c
++++ b/net/ipv4/tcp_output.c
+@@ -2346,14 +2346,18 @@ void tcp_send_loss_probe(struct sock *sk)
+               skb = tcp_write_queue_tail(sk);
+       }
+ 
++      if (unlikely(!skb)) {
++              WARN_ONCE(tp->packets_out,
++                        "invalid inflight: %u state %u cwnd %u mss %d\n",
++                        tp->packets_out, sk->sk_state, tp->snd_cwnd, mss);
++              inet_csk(sk)->icsk_pending = 0;
++              return;
++      }
++
+       /* At most one outstanding TLP retransmission. */
+       if (tp->tlp_high_seq)
+               goto rearm_timer;
+ 
+-      /* Retransmit last segment. */
+-      if (WARN_ON(!skb))
+-              goto rearm_timer;
+-
+       if (skb_still_in_host_queue(sk, skb))
+               goto rearm_timer;
+ 
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
+index 8e77cecd2165..b723987761be 100644
+--- a/net/ipv6/ip6_output.c
++++ b/net/ipv6/ip6_output.c
+@@ -177,37 +177,37 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, 
struct flowi6 *fl6,
+       const struct ipv6_pinfo *np = inet6_sk(sk);
+       struct in6_addr *first_hop = &fl6->daddr;
+       struct dst_entry *dst = skb_dst(skb);
++      unsigned int head_room;
+       struct ipv6hdr *hdr;
+       u8  proto = fl6->flowi6_proto;
+       int seg_len = skb->len;
+       int hlimit = -1;
+       u32 mtu;
+ 
+-      if (opt) {
+-              unsigned int head_room;
++      head_room = sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);
++      if (opt)
++              head_room += opt->opt_nflen + opt->opt_flen;
+ 
+-              /* First: exthdrs may take lots of space (~8K for now)
+-                 MAX_HEADER is not enough.
+-               */
+-              head_room = opt->opt_nflen + opt->opt_flen;
+-              seg_len += head_room;
+-              head_room += sizeof(struct ipv6hdr) + 
LL_RESERVED_SPACE(dst->dev);
+-
+-              if (skb_headroom(skb) < head_room) {
+-                      struct sk_buff *skb2 = skb_realloc_headroom(skb, 
head_room);
+-                      if (!skb2) {
+-                              IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
+-                                            IPSTATS_MIB_OUTDISCARDS);
+-                              kfree_skb(skb);
+-                              return -ENOBUFS;
+-                      }
+-                      if (skb->sk)
+-                              skb_set_owner_w(skb2, skb->sk);
+-                      consume_skb(skb);
+-                      skb = skb2;
++      if (unlikely(skb_headroom(skb) < head_room)) {
++              struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
++              if (!skb2) {
++                      IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
++                                    IPSTATS_MIB_OUTDISCARDS);
++                      kfree_skb(skb);
++                      return -ENOBUFS;
+               }
++              if (skb->sk)
++                      skb_set_owner_w(skb2, skb->sk);
++              consume_skb(skb);
++              skb = skb2;
++      }
++
++      if (opt) {
++              seg_len += opt->opt_nflen + opt->opt_flen;
++
+               if (opt->opt_flen)
+                       ipv6_push_frag_opts(skb, opt, &proto);
++
+               if (opt->opt_nflen)
+                       ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop);
+       }
+diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
+index 079b3c426720..8382b7880b24 100644
+--- a/net/netfilter/ipvs/ip_vs_ctl.c
++++ b/net/netfilter/ipvs/ip_vs_ctl.c
+@@ -4013,6 +4013,9 @@ static void __net_exit 
ip_vs_control_net_cleanup_sysctl(struct netns_ipvs *ipvs)
+ 
+ static struct notifier_block ip_vs_dst_notifier = {
+       .notifier_call = ip_vs_dst_event,
++#ifdef CONFIG_IP_VS_IPV6
++      .priority = ADDRCONF_NOTIFY_PRIORITY + 5,
++#endif
+ };
+ 
+ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
+diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
+index 3f87ddb1777d..2e417c907a28 100644
+--- a/net/sched/sch_netem.c
++++ b/net/sched/sch_netem.c
+@@ -442,6 +442,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc 
*sch,
+       int count = 1;
+       int rc = NET_XMIT_SUCCESS;
+ 
++      /* Do not fool qdisc_drop_all() */
++      skb->prev = NULL;
++
+       /* Random duplication */
+       if (q->duplicate && q->duplicate >= get_crandom(&q->dup_cor))
+               ++count;
+diff --git a/sound/soc/omap/omap-abe-twl6040.c 
b/sound/soc/omap/omap-abe-twl6040.c
+index 89fe95e877db..07af30017b48 100644
+--- a/sound/soc/omap/omap-abe-twl6040.c
++++ b/sound/soc/omap/omap-abe-twl6040.c
+@@ -36,6 +36,8 @@
+ #include "../codecs/twl6040.h"
+ 
+ struct abe_twl6040 {
++      struct snd_soc_card card;
++      struct snd_soc_dai_link dai_links[2];
+       int     jack_detection; /* board can detect jack events */
+       int     mclk_freq;      /* MCLK frequency speed for twl6040 */
+ };
+@@ -208,40 +210,10 @@ static int omap_abe_dmic_init(struct snd_soc_pcm_runtime 
*rtd)
+                               ARRAY_SIZE(dmic_audio_map));
+ }
+ 
+-/* Digital audio interface glue - connects codec <--> CPU */
+-static struct snd_soc_dai_link abe_twl6040_dai_links[] = {
+-      {
+-              .name = "TWL6040",
+-              .stream_name = "TWL6040",
+-              .codec_dai_name = "twl6040-legacy",
+-              .codec_name = "twl6040-codec",
+-              .init = omap_abe_twl6040_init,
+-              .ops = &omap_abe_ops,
+-      },
+-      {
+-              .name = "DMIC",
+-              .stream_name = "DMIC Capture",
+-              .codec_dai_name = "dmic-hifi",
+-              .codec_name = "dmic-codec",
+-              .init = omap_abe_dmic_init,
+-              .ops = &omap_abe_dmic_ops,
+-      },
+-};
+-
+-/* Audio machine driver */
+-static struct snd_soc_card omap_abe_card = {
+-      .owner = THIS_MODULE,
+-
+-      .dapm_widgets = twl6040_dapm_widgets,
+-      .num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets),
+-      .dapm_routes = audio_map,
+-      .num_dapm_routes = ARRAY_SIZE(audio_map),
+-};
+-
+ static int omap_abe_probe(struct platform_device *pdev)
+ {
+       struct device_node *node = pdev->dev.of_node;
+-      struct snd_soc_card *card = &omap_abe_card;
++      struct snd_soc_card *card;
+       struct device_node *dai_node;
+       struct abe_twl6040 *priv;
+       int num_links = 0;
+@@ -252,12 +224,18 @@ static int omap_abe_probe(struct platform_device *pdev)
+               return -ENODEV;
+       }
+ 
+-      card->dev = &pdev->dev;
+-
+       priv = devm_kzalloc(&pdev->dev, sizeof(struct abe_twl6040), GFP_KERNEL);
+       if (priv == NULL)
+               return -ENOMEM;
+ 
++      card = &priv->card;
++      card->dev = &pdev->dev;
++      card->owner = THIS_MODULE;
++      card->dapm_widgets = twl6040_dapm_widgets;
++      card->num_dapm_widgets = ARRAY_SIZE(twl6040_dapm_widgets);
++      card->dapm_routes = audio_map;
++      card->num_dapm_routes = ARRAY_SIZE(audio_map);
++
+       if (snd_soc_of_parse_card_name(card, "ti,model")) {
+               dev_err(&pdev->dev, "Card name is not provided\n");
+               return -ENODEV;
+@@ -274,14 +252,27 @@ static int omap_abe_probe(struct platform_device *pdev)
+               dev_err(&pdev->dev, "McPDM node is not provided\n");
+               return -EINVAL;
+       }
+-      abe_twl6040_dai_links[0].cpu_of_node = dai_node;
+-      abe_twl6040_dai_links[0].platform_of_node = dai_node;
++
++      priv->dai_links[0].name = "DMIC";
++      priv->dai_links[0].stream_name = "TWL6040";
++      priv->dai_links[0].cpu_of_node = dai_node;
++      priv->dai_links[0].platform_of_node = dai_node;
++      priv->dai_links[0].codec_dai_name = "twl6040-legacy";
++      priv->dai_links[0].codec_name = "twl6040-codec";
++      priv->dai_links[0].init = omap_abe_twl6040_init;
++      priv->dai_links[0].ops = &omap_abe_ops;
+ 
+       dai_node = of_parse_phandle(node, "ti,dmic", 0);
+       if (dai_node) {
+               num_links = 2;
+-              abe_twl6040_dai_links[1].cpu_of_node = dai_node;
+-              abe_twl6040_dai_links[1].platform_of_node = dai_node;
++              priv->dai_links[1].name = "TWL6040";
++              priv->dai_links[1].stream_name = "DMIC Capture";
++              priv->dai_links[1].cpu_of_node = dai_node;
++              priv->dai_links[1].platform_of_node = dai_node;
++              priv->dai_links[1].codec_dai_name = "dmic-hifi";
++              priv->dai_links[1].codec_name = "dmic-codec";
++              priv->dai_links[1].init = omap_abe_dmic_init;
++              priv->dai_links[1].ops = &omap_abe_dmic_ops;
+       } else {
+               num_links = 1;
+       }
+@@ -300,7 +291,7 @@ static int omap_abe_probe(struct platform_device *pdev)
+               return -ENODEV;
+       }
+ 
+-      card->dai_link = abe_twl6040_dai_links;
++      card->dai_link = priv->dai_links;
+       card->num_links = num_links;
+ 
+       snd_soc_card_set_drvdata(card, priv);
+diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
+index 09db2aec12a3..776e809a8aab 100644
+--- a/sound/soc/omap/omap-dmic.c
++++ b/sound/soc/omap/omap-dmic.c
+@@ -48,6 +48,8 @@ struct omap_dmic {
+       struct device *dev;
+       void __iomem *io_base;
+       struct clk *fclk;
++      struct pm_qos_request pm_qos_req;
++      int latency;
+       int fclk_freq;
+       int out_freq;
+       int clk_div;
+@@ -124,6 +126,8 @@ static void omap_dmic_dai_shutdown(struct 
snd_pcm_substream *substream,
+ 
+       mutex_lock(&dmic->mutex);
+ 
++      pm_qos_remove_request(&dmic->pm_qos_req);
++
+       if (!dai->active)
+               dmic->active = 0;
+ 
+@@ -226,6 +230,8 @@ static int omap_dmic_dai_hw_params(struct 
snd_pcm_substream *substream,
+       /* packet size is threshold * channels */
+       dma_data = snd_soc_dai_get_dma_data(dai, substream);
+       dma_data->maxburst = dmic->threshold * channels;
++      dmic->latency = (OMAP_DMIC_THRES_MAX - dmic->threshold) * USEC_PER_SEC /
++                      params_rate(params);
+ 
+       return 0;
+ }
+@@ -236,6 +242,9 @@ static int omap_dmic_dai_prepare(struct snd_pcm_substream 
*substream,
+       struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
+       u32 ctrl;
+ 
++      if (pm_qos_request_active(&dmic->pm_qos_req))
++              pm_qos_update_request(&dmic->pm_qos_req, dmic->latency);
++
+       /* Configure uplink threshold */
+       omap_dmic_write(dmic, OMAP_DMIC_FIFO_CTRL_REG, dmic->threshold);
+ 
+diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
+index 64609c77a79d..44ffeb71cd1d 100644
+--- a/sound/soc/omap/omap-mcpdm.c
++++ b/sound/soc/omap/omap-mcpdm.c
+@@ -54,6 +54,8 @@ struct omap_mcpdm {
+       unsigned long phys_base;
+       void __iomem *io_base;
+       int irq;
++      struct pm_qos_request pm_qos_req;
++      int latency[2];
+ 
+       struct mutex mutex;
+ 
+@@ -277,6 +279,9 @@ static void omap_mcpdm_dai_shutdown(struct 
snd_pcm_substream *substream,
+                                 struct snd_soc_dai *dai)
+ {
+       struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
++      int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
++      int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
++      int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
+ 
+       mutex_lock(&mcpdm->mutex);
+ 
+@@ -289,6 +294,14 @@ static void omap_mcpdm_dai_shutdown(struct 
snd_pcm_substream *substream,
+               }
+       }
+ 
++      if (mcpdm->latency[stream2])
++              pm_qos_update_request(&mcpdm->pm_qos_req,
++                                    mcpdm->latency[stream2]);
++      else if (mcpdm->latency[stream1])
++              pm_qos_remove_request(&mcpdm->pm_qos_req);
++
++      mcpdm->latency[stream1] = 0;
++
+       mutex_unlock(&mcpdm->mutex);
+ }
+ 
+@@ -300,7 +313,7 @@ static int omap_mcpdm_dai_hw_params(struct 
snd_pcm_substream *substream,
+       int stream = substream->stream;
+       struct snd_dmaengine_dai_dma_data *dma_data;
+       u32 threshold;
+-      int channels;
++      int channels, latency;
+       int link_mask = 0;
+ 
+       channels = params_channels(params);
+@@ -340,14 +353,25 @@ static int omap_mcpdm_dai_hw_params(struct 
snd_pcm_substream *substream,
+ 
+               dma_data->maxburst =
+                               (MCPDM_DN_THRES_MAX - threshold) * channels;
++              latency = threshold;
+       } else {
+               /* If playback is not running assume a stereo stream to come */
+               if (!mcpdm->config[!stream].link_mask)
+                       mcpdm->config[!stream].link_mask = (0x3 << 3);
+ 
+               dma_data->maxburst = threshold * channels;
++              latency = (MCPDM_DN_THRES_MAX - threshold);
+       }
+ 
++      /*
++       * The DMA must act to a DMA request within latency time (usec) to avoid
++       * under/overflow
++       */
++      mcpdm->latency[stream] = latency * USEC_PER_SEC / params_rate(params);
++
++      if (!mcpdm->latency[stream])
++              mcpdm->latency[stream] = 10;
++
+       /* Check if we need to restart McPDM with this stream */
+       if (mcpdm->config[stream].link_mask &&
+           mcpdm->config[stream].link_mask != link_mask)
+@@ -362,6 +386,20 @@ static int omap_mcpdm_prepare(struct snd_pcm_substream 
*substream,
+                                 struct snd_soc_dai *dai)
+ {
+       struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
++      struct pm_qos_request *pm_qos_req = &mcpdm->pm_qos_req;
++      int tx = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
++      int stream1 = tx ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
++      int stream2 = tx ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
++      int latency = mcpdm->latency[stream2];
++
++      /* Prevent omap hardware from hitting off between FIFO fills */
++      if (!latency || mcpdm->latency[stream1] < latency)
++              latency = mcpdm->latency[stream1];
++
++      if (pm_qos_request_active(pm_qos_req))
++              pm_qos_update_request(pm_qos_req, latency);
++      else if (latency)
++              pm_qos_add_request(pm_qos_req, PM_QOS_CPU_DMA_LATENCY, latency);
+ 
+       if (!omap_mcpdm_active(mcpdm)) {
+               omap_mcpdm_start(mcpdm);
+@@ -423,6 +461,9 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai)
+       free_irq(mcpdm->irq, (void *)mcpdm);
+       pm_runtime_disable(mcpdm->dev);
+ 
++      if (pm_qos_request_active(&mcpdm->pm_qos_req))
++              pm_qos_remove_request(&mcpdm->pm_qos_req);
++
+       return 0;
+ }
+ 
+diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
+index 4e3de566809c..168559b5e9f3 100644
+--- a/sound/soc/soc-core.c
++++ b/sound/soc/soc-core.c
+@@ -2018,6 +2018,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card 
*card)
+       }
+ 
+       card->instantiated = 1;
++      dapm_mark_endpoints_dirty(card);
+       snd_soc_dapm_sync(&card->dapm);
+       mutex_unlock(&card->mutex);
+       mutex_unlock(&client_mutex);
+diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
+index 0d1acb704f64..dd4ed7c3c062 100644
+--- a/tools/objtool/elf.c
++++ b/tools/objtool/elf.c
+@@ -31,6 +31,8 @@
+ #include "elf.h"
+ #include "warn.h"
+ 
++#define MAX_NAME_LEN 128
++
+ struct section *find_section_by_name(struct elf *elf, const char *name)
+ {
+       struct section *sec;
+@@ -298,6 +300,8 @@ static int read_symbols(struct elf *elf)
+       /* Create parent/child links for any cold subfunctions */
+       list_for_each_entry(sec, &elf->sections, list) {
+               list_for_each_entry(sym, &sec->symbol_list, list) {
++                      char pname[MAX_NAME_LEN + 1];
++                      size_t pnamelen;
+                       if (sym->type != STT_FUNC)
+                               continue;
+                       sym->pfunc = sym->cfunc = sym;
+@@ -305,14 +309,21 @@ static int read_symbols(struct elf *elf)
+                       if (!coldstr)
+                               continue;
+ 
+-                      coldstr[0] = '\0';
+-                      pfunc = find_symbol_by_name(elf, sym->name);
+-                      coldstr[0] = '.';
++                      pnamelen = coldstr - sym->name;
++                      if (pnamelen > MAX_NAME_LEN) {
++                              WARN("%s(): parent function name exceeds 
maximum length of %d characters",
++                                   sym->name, MAX_NAME_LEN);
++                              return -1;
++                      }
++
++                      strncpy(pname, sym->name, pnamelen);
++                      pname[pnamelen] = '\0';
++                      pfunc = find_symbol_by_name(elf, pname);
+ 
+                       if (!pfunc) {
+                               WARN("%s(): can't find parent function",
+                                    sym->name);
+-                              goto err;
++                              return -1;
+                       }
+ 
+                       sym->pfunc = pfunc;
+diff --git a/tools/testing/selftests/Makefile 
b/tools/testing/selftests/Makefile
+index 76faf5bf0b32..d37dfc6608c6 100644
+--- a/tools/testing/selftests/Makefile
++++ b/tools/testing/selftests/Makefile
+@@ -15,6 +15,7 @@ TARGETS += memory-hotplug
+ TARGETS += mount
+ TARGETS += mqueue
+ TARGETS += net
++TARGETS += netfilter
+ TARGETS += nsfs
+ TARGETS += powerpc
+ TARGETS += pstore
+diff --git a/tools/testing/selftests/netfilter/Makefile 
b/tools/testing/selftests/netfilter/Makefile
+new file mode 100644
+index 000000000000..47ed6cef93fb
+--- /dev/null
++++ b/tools/testing/selftests/netfilter/Makefile
+@@ -0,0 +1,6 @@
++# SPDX-License-Identifier: GPL-2.0
++# Makefile for netfilter selftests
++
++TEST_PROGS := nft_trans_stress.sh
++
++include ../lib.mk
+diff --git a/tools/testing/selftests/netfilter/config 
b/tools/testing/selftests/netfilter/config
+new file mode 100644
+index 000000000000..1017313e41a8
+--- /dev/null
++++ b/tools/testing/selftests/netfilter/config
+@@ -0,0 +1,2 @@
++CONFIG_NET_NS=y
++NF_TABLES_INET=y
+diff --git a/tools/testing/selftests/netfilter/nft_trans_stress.sh 
b/tools/testing/selftests/netfilter/nft_trans_stress.sh
+new file mode 100755
+index 000000000000..f1affd12c4b1
+--- /dev/null
++++ b/tools/testing/selftests/netfilter/nft_trans_stress.sh
+@@ -0,0 +1,78 @@
++#!/bin/bash
++#
++# This test is for stress-testing the nf_tables config plane path vs.
++# packet path processing: Make sure we never release rules that are
++# still visible to other cpus.
++#
++# set -e
++
++# Kselftest framework requirement - SKIP code is 4.
++ksft_skip=4
++
++testns=testns1
++tables="foo bar baz quux"
++
++nft --version > /dev/null 2>&1
++if [ $? -ne 0 ];then
++      echo "SKIP: Could not run test without nft tool"
++      exit $ksft_skip
++fi
++
++ip -Version > /dev/null 2>&1
++if [ $? -ne 0 ];then
++      echo "SKIP: Could not run test without ip tool"
++      exit $ksft_skip
++fi
++
++tmp=$(mktemp)
++
++for table in $tables; do
++      echo add table inet "$table" >> "$tmp"
++      echo flush table inet "$table" >> "$tmp"
++
++      echo "add chain inet $table INPUT { type filter hook input priority 0; 
}" >> "$tmp"
++      echo "add chain inet $table OUTPUT { type filter hook output priority 
0; }" >> "$tmp"
++      for c in $(seq 1 400); do
++              chain=$(printf "chain%03u" "$c")
++              echo "add chain inet $table $chain" >> "$tmp"
++      done
++
++      for c in $(seq 1 400); do
++              chain=$(printf "chain%03u" "$c")
++              for BASE in INPUT OUTPUT; do
++                      echo "add rule inet $table $BASE counter jump $chain" 
>> "$tmp"
++              done
++              echo "add rule inet $table $chain counter return" >> "$tmp"
++      done
++done
++
++ip netns add "$testns"
++ip -netns "$testns" link set lo up
++
++lscpu | grep ^CPU\(s\): | ( read cpu cpunum ;
++cpunum=$((cpunum-1))
++for i in $(seq 0 $cpunum);do
++      mask=$(printf 0x%x $((1<<$i)))
++        ip netns exec "$testns" taskset $mask ping -4 127.0.0.1 -fq > 
/dev/null &
++        ip netns exec "$testns" taskset $mask ping -6 ::1 -fq > /dev/null &
++done)
++
++sleep 1
++
++for i in $(seq 1 10) ; do ip netns exec "$testns" nft -f "$tmp" & done
++
++for table in $tables;do
++      randsleep=$((RANDOM%10))
++      sleep $randsleep
++      ip netns exec "$testns" nft delete table inet $table 2>/dev/null
++done
++
++randsleep=$((RANDOM%10))
++sleep $randsleep
++
++pkill -9 ping
++
++wait
++
++rm -f "$tmp"
++ip netns del "$testns"

Reply via email to