commit:     187ad3ce7424083662d9a830ab9fbdd38ff0fc36
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 30 14:28:49 2021 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Wed Jun 30 14:28:49 2021 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=187ad3ce

Linux patch 4.4.274

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

 0000_README              |    4 +
 1273_linux-4.4.274.patch | 1405 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1409 insertions(+)

diff --git a/0000_README b/0000_README
index acc47c7..b63a9bc 100644
--- a/0000_README
+++ b/0000_README
@@ -1135,6 +1135,10 @@ Patch:  1272_linux-4.4.273.patch
 From:   http://www.kernel.org
 Desc:   Linux 4.4.273
 
+Patch:  1273_linux-4.4.274.patch
+From:   http://www.kernel.org
+Desc:   Linux 4.4.274
+
 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/1273_linux-4.4.274.patch b/1273_linux-4.4.274.patch
new file mode 100644
index 0000000..d14cd83
--- /dev/null
+++ b/1273_linux-4.4.274.patch
@@ -0,0 +1,1405 @@
+diff --git a/Makefile b/Makefile
+index 78a317e69e7fa..3d1fc6eb95eca 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 4
+ PATCHLEVEL = 4
+-SUBLEVEL = 273
++SUBLEVEL = 274
+ EXTRAVERSION =
+ NAME = Blurry Fish Butt
+ 
+@@ -716,12 +716,11 @@ KBUILD_CFLAGS += $(call cc-disable-warning, 
tautological-compare)
+ # See modpost pattern 2
+ KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
+ KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
+-else
++endif
+ 
+ # These warnings generated too much noise in a regular build.
+ # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
+ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
+-endif
+ 
+ KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
+ ifdef CONFIG_FRAME_POINTER
+diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
+index e9c3d38d995d2..ad72e83e11d16 100644
+--- a/arch/arm/kernel/setup.c
++++ b/arch/arm/kernel/setup.c
+@@ -479,9 +479,11 @@ void notrace cpu_init(void)
+        * In Thumb-2, msr with an immediate value is not allowed.
+        */
+ #ifdef CONFIG_THUMB2_KERNEL
+-#define PLC   "r"
++#define PLC_l "l"
++#define PLC_r "r"
+ #else
+-#define PLC   "I"
++#define PLC_l "I"
++#define PLC_r "I"
+ #endif
+ 
+       /*
+@@ -503,15 +505,15 @@ void notrace cpu_init(void)
+       "msr    cpsr_c, %9"
+           :
+           : "r" (stk),
+-            PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
++            PLC_r (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
+             "I" (offsetof(struct stack, irq[0])),
+-            PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
++            PLC_r (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
+             "I" (offsetof(struct stack, abt[0])),
+-            PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE),
++            PLC_r (PSR_F_BIT | PSR_I_BIT | UND_MODE),
+             "I" (offsetof(struct stack, und[0])),
+-            PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
++            PLC_r (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
+             "I" (offsetof(struct stack, fiq[0])),
+-            PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
++            PLC_l (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
+           : "r14");
+ #endif
+ }
+diff --git a/arch/arm/mach-omap2/board-n8x0.c 
b/arch/arm/mach-omap2/board-n8x0.c
+index b6443a4e0c780..68af9d9566cba 100644
+--- a/arch/arm/mach-omap2/board-n8x0.c
++++ b/arch/arm/mach-omap2/board-n8x0.c
+@@ -328,6 +328,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, 
int slot)
+ 
+ static void n8x0_mmc_callback(void *data, u8 card_mask)
+ {
++#ifdef CONFIG_MMC_OMAP
+       int bit, *openp, index;
+ 
+       if (board_is_n800()) {
+@@ -345,7 +346,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
+       else
+               *openp = 0;
+ 
+-#ifdef CONFIG_MMC_OMAP
+       omap_mmc_notify_cover_event(mmc_device, index, *openp);
+ #else
+       pr_warn("MMC: notify cover event not available\n");
+diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
+index 8fc842dae3b39..9a1489b927827 100644
+--- a/arch/x86/kernel/fpu/signal.c
++++ b/arch/x86/kernel/fpu/signal.c
+@@ -262,15 +262,23 @@ static int __fpu__restore_sig(void __user *buf, void 
__user *buf_fx, int size)
+               return 0;
+       }
+ 
+-      if (!access_ok(VERIFY_READ, buf, size))
++      if (!access_ok(VERIFY_READ, buf, size)) {
++              fpu__clear(fpu);
+               return -EACCES;
++      }
+ 
+       fpu__activate_curr(fpu);
+ 
+-      if (!static_cpu_has(X86_FEATURE_FPU))
+-              return fpregs_soft_set(current, NULL,
+-                                     0, sizeof(struct user_i387_ia32_struct),
+-                                     NULL, buf) != 0;
++      if (!static_cpu_has(X86_FEATURE_FPU)) {
++              int ret = fpregs_soft_set(current, NULL, 0,
++                                        sizeof(struct user_i387_ia32_struct),
++                                        NULL, buf);
++
++              if (ret)
++                      fpu__clear(fpu);
++
++              return ret != 0;
++      }
+ 
+       if (use_xsave()) {
+               struct _fpx_sw_bytes fx_sw_user;
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
+index 7f66ae1945b24..6ea993478ddd1 100644
+--- a/drivers/dma/pl330.c
++++ b/drivers/dma/pl330.c
+@@ -2531,13 +2531,15 @@ static struct dma_async_tx_descriptor 
*pl330_prep_dma_cyclic(
+       for (i = 0; i < len / period_len; i++) {
+               desc = pl330_get_desc(pch);
+               if (!desc) {
++                      unsigned long iflags;
++
+                       dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch 
desc\n",
+                               __func__, __LINE__);
+ 
+                       if (!first)
+                               return NULL;
+ 
+-                      spin_lock_irqsave(&pl330->pool_lock, flags);
++                      spin_lock_irqsave(&pl330->pool_lock, iflags);
+ 
+                       while (!list_empty(&first->node)) {
+                               desc = list_entry(first->node.next,
+@@ -2547,7 +2549,7 @@ static struct dma_async_tx_descriptor 
*pl330_prep_dma_cyclic(
+ 
+                       list_move_tail(&first->node, &pl330->desc_pool);
+ 
+-                      spin_unlock_irqrestore(&pl330->pool_lock, flags);
++                      spin_unlock_irqrestore(&pl330->pool_lock, iflags);
+ 
+                       return NULL;
+               }
+diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
+index 0fede051f4e1c..e6d3ed1de374a 100644
+--- a/drivers/dma/ste_dma40.c
++++ b/drivers/dma/ste_dma40.c
+@@ -3715,6 +3715,9 @@ failure:
+ 
+               kfree(base->lcla_pool.base_unaligned);
+ 
++              if (base->lcpa_base)
++                      iounmap(base->lcpa_base);
++
+               if (base->phy_lcpa)
+                       release_mem_region(base->phy_lcpa,
+                                          base->lcpa_size);
+diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c 
b/drivers/gpu/drm/radeon/radeon_uvd.c
+index b35ebabd6a9f8..eab985fdcfbd7 100644
+--- a/drivers/gpu/drm/radeon/radeon_uvd.c
++++ b/drivers/gpu/drm/radeon/radeon_uvd.c
+@@ -242,7 +242,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
+       if (rdev->uvd.vcpu_bo == NULL)
+               return -EINVAL;
+ 
+-      memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
++      memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, 
rdev->uvd_fw->size);
+ 
+       size = radeon_bo_size(rdev->uvd.vcpu_bo);
+       size -= rdev->uvd_fw->size;
+@@ -250,7 +250,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
+       ptr = rdev->uvd.cpu_addr;
+       ptr += rdev->uvd_fw->size;
+ 
+-      memset(ptr, 0, size);
++      memset_io((void __iomem *)ptr, 0, size);
+ 
+       return 0;
+ }
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
+index 25544a08fa838..1dd97f4b449af 100644
+--- a/drivers/hid/hid-core.c
++++ b/drivers/hid/hid-core.c
+@@ -1765,6 +1765,9 @@ int hid_connect(struct hid_device *hdev, unsigned int 
connect_mask)
+       case BUS_I2C:
+               bus = "I2C";
+               break;
++      case BUS_VIRTUAL:
++              bus = "VIRTUAL";
++              break;
+       default:
+               bus = "<UNKNOWN>";
+       }
+diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c
+index 0d6f135e266c2..2991957bbb7fc 100644
+--- a/drivers/hid/hid-gt683r.c
++++ b/drivers/hid/hid-gt683r.c
+@@ -64,6 +64,7 @@ static const struct hid_device_id gt683r_led_id[] = {
+       { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) 
},
+       { }
+ };
++MODULE_DEVICE_TABLE(hid, gt683r_led_id);
+ 
+ static void gt683r_brightness_set(struct led_classdev *led_cdev,
+                               enum led_brightness brightness)
+diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
+index 83e45d5801a98..ce4e9b34af980 100644
+--- a/drivers/hid/hid-sensor-hub.c
++++ b/drivers/hid/hid-sensor-hub.c
+@@ -222,16 +222,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device 
*hsdev, u32 report_id,
+       buffer_size = buffer_size / sizeof(__s32);
+       if (buffer_size) {
+               for (i = 0; i < buffer_size; ++i) {
+-                      hid_set_field(report->field[field_index], i,
+-                                    (__force __s32)cpu_to_le32(*buf32));
++                      ret = hid_set_field(report->field[field_index], i,
++                                          (__force __s32)cpu_to_le32(*buf32));
++                      if (ret)
++                              goto done_proc;
++
+                       ++buf32;
+               }
+       }
+       if (remaining_bytes) {
+               value = 0;
+               memcpy(&value, (u8 *)buf32, remaining_bytes);
+-              hid_set_field(report->field[field_index], i,
+-                            (__force __s32)cpu_to_le32(value));
++              ret = hid_set_field(report->field[field_index], i,
++                                  (__force __s32)cpu_to_le32(value));
++              if (ret)
++                      goto done_proc;
+       }
+       hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
+       hid_hw_wait(hsdev->hdev);
+diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
+index b0eeb5090c91e..d51fc2be0e10c 100644
+--- a/drivers/hid/usbhid/hid-core.c
++++ b/drivers/hid/usbhid/hid-core.c
+@@ -372,7 +372,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
+       raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report;
+       dir = usbhid->ctrl[usbhid->ctrltail].dir;
+ 
+-      len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
++      len = hid_report_len(report);
+       if (dir == USB_DIR_OUT) {
+               usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0);
+               usbhid->urbctrl->transfer_buffer_length = len;
+diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c 
b/drivers/i2c/busses/i2c-robotfuzz-osif.c
+index ced9c6a308d12..09f27060feca6 100644
+--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
++++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
+@@ -89,7 +89,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct 
i2c_msg *msgs,
+                       }
+               }
+ 
+-              ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
++              ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
+               if (ret) {
+                       dev_err(&adapter->dev, "failure sending STOP\n");
+                       return -EREMOTEIO;
+@@ -159,7 +159,7 @@ static int osif_probe(struct usb_interface *interface,
+        * Set bus frequency. The frequency is:
+        * 120,000,000 / ( 16 + 2 * div * 4^prescale).
+        * Using dev = 52, prescale = 0 give 100KHz */
+-      ret = osif_usb_read(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
++      ret = osif_usb_write(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
+                           NULL, 0);
+       if (ret) {
+               dev_err(&interface->dev, "failure sending bit rate");
+diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
+index 32834dad0b836..1243c2e5a86a2 100644
+--- a/drivers/net/caif/caif_serial.c
++++ b/drivers/net/caif/caif_serial.c
+@@ -362,6 +362,7 @@ static int ldisc_open(struct tty_struct *tty)
+       rtnl_lock();
+       result = register_netdevice(dev);
+       if (result) {
++              tty_kref_put(tty);
+               rtnl_unlock();
+               free_netdev(dev);
+               return -ENODEV;
+diff --git a/drivers/net/ethernet/ec_bhf.c b/drivers/net/ethernet/ec_bhf.c
+index f7b42483921c5..0ade0c6d81ee3 100644
+--- a/drivers/net/ethernet/ec_bhf.c
++++ b/drivers/net/ethernet/ec_bhf.c
+@@ -589,10 +589,12 @@ static void ec_bhf_remove(struct pci_dev *dev)
+       struct ec_bhf_priv *priv = netdev_priv(net_dev);
+ 
+       unregister_netdev(net_dev);
+-      free_netdev(net_dev);
+ 
+       pci_iounmap(dev, priv->dma_io);
+       pci_iounmap(dev, priv->io);
++
++      free_netdev(net_dev);
++
+       pci_release_regions(dev);
+       pci_clear_master(dev);
+       pci_disable_device(dev);
+diff --git a/drivers/net/ethernet/emulex/benet/be_main.c 
b/drivers/net/ethernet/emulex/benet/be_main.c
+index 7cd39324106dc..398b9bd09400b 100644
+--- a/drivers/net/ethernet/emulex/benet/be_main.c
++++ b/drivers/net/ethernet/emulex/benet/be_main.c
+@@ -5878,6 +5878,7 @@ drv_cleanup:
+ unmap_bars:
+       be_unmap_pci_bars(adapter);
+ free_netdev:
++      pci_disable_pcie_error_reporting(pdev);
+       free_netdev(netdev);
+ rel_reg:
+       pci_release_regions(pdev);
+diff --git a/drivers/net/ethernet/freescale/fec_ptp.c 
b/drivers/net/ethernet/freescale/fec_ptp.c
+index 1231816125955..031d4b3a544c0 100644
+--- a/drivers/net/ethernet/freescale/fec_ptp.c
++++ b/drivers/net/ethernet/freescale/fec_ptp.c
+@@ -586,6 +586,10 @@ void fec_ptp_init(struct platform_device *pdev)
+       fep->ptp_caps.enable = fec_ptp_enable;
+ 
+       fep->cycle_speed = clk_get_rate(fep->clk_ptp);
++      if (!fep->cycle_speed) {
++              fep->cycle_speed = NSEC_PER_SEC;
++              dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n");
++      }
+       fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
+ 
+       spin_lock_init(&fep->tmreg_lock);
+diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c 
b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+index 8ebf3611aba3c..9ecb99a1de35d 100644
+--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
++++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+@@ -4051,6 +4051,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
+               dev_err(&pdev->dev,
+                       "invalid sram_size %dB or board span %ldB\n",
+                       mgp->sram_size, mgp->board_span);
++              status = -EINVAL;
+               goto abort_with_ioremap;
+       }
+       memcpy_fromio(mgp->eeprom_strings,
+diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c 
b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+index f5fc0c416e510..f89441f9bd8d1 100644
+--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
++++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+@@ -1616,6 +1616,8 @@ err_out_free_netdev:
+       free_netdev(netdev);
+ 
+ err_out_free_res:
++      if (NX_IS_REVISION_P3(pdev->revision))
++              pci_disable_pcie_error_reporting(pdev);
+       pci_release_regions(pdev);
+ 
+ err_out_disable_pdev:
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c 
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+index a4b10776f8346..11274b7ea36c9 100644
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+@@ -2706,6 +2706,7 @@ err_out_free_hw_res:
+       kfree(ahw);
+ 
+ err_out_free_res:
++      pci_disable_pcie_error_reporting(pdev);
+       pci_release_regions(pdev);
+ 
+ err_out_disable_pdev:
+diff --git a/drivers/net/ethernet/realtek/r8169.c 
b/drivers/net/ethernet/realtek/r8169.c
+index f3a685d3f6497..55b0f11bf2a02 100644
+--- a/drivers/net/ethernet/realtek/r8169.c
++++ b/drivers/net/ethernet/realtek/r8169.c
+@@ -2314,7 +2314,7 @@ static void rtl8169_get_strings(struct net_device *dev, 
u32 stringset, u8 *data)
+ {
+       switch(stringset) {
+       case ETH_SS_STATS:
+-              memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings));
++              memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings));
+               break;
+       }
+ }
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c 
b/drivers/net/ethernet/renesas/sh_eth.c
+index 614b83c7ce817..1942264b621bc 100644
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -2210,7 +2210,7 @@ static void sh_eth_get_strings(struct net_device *ndev, 
u32 stringset, u8 *data)
+ {
+       switch (stringset) {
+       case ETH_SS_STATS:
+-              memcpy(data, *sh_eth_gstrings_stats,
++              memcpy(data, sh_eth_gstrings_stats,
+                      sizeof(sh_eth_gstrings_stats));
+               break;
+       }
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h 
b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+index b3fe0575ff6b7..db2a341ae4b31 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+@@ -83,10 +83,10 @@ enum power_event {
+ #define LPI_CTRL_STATUS_TLPIEN        0x00000001      /* Transmit LPI Entry */
+ 
+ /* GMAC HW ADDR regs */
+-#define GMAC_ADDR_HIGH(reg)   (((reg > 15) ? 0x00000800 : 0x00000040) + \
+-                              (reg * 8))
+-#define GMAC_ADDR_LOW(reg)    (((reg > 15) ? 0x00000804 : 0x00000044) + \
+-                              (reg * 8))
++#define GMAC_ADDR_HIGH(reg)   ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \
++                               0x00000040 + (reg * 8))
++#define GMAC_ADDR_LOW(reg)    ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \
++                               0x00000044 + (reg * 8))
+ #define GMAC_MAX_PERFECT_ADDRESSES    1
+ 
+ /* PCS registers (AN/TBI/SGMII/RGMII) offset */
+diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c 
b/drivers/net/ethernet/xilinx/ll_temac_main.c
+index ed6a88cf3281c..98a1c712b62a7 100644
+--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
+@@ -735,6 +735,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device 
*ndev)
+       /* Kick off the transfer */
+       lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
+ 
++      if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) {
++              netdev_info(ndev, "%s -> netif_stop_queue\n", __func__);
++              netif_stop_queue(ndev);
++      }
++
+       return NETDEV_TX_OK;
+ }
+ 
+diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
+index 470d416f2b86a..078eb110381c2 100644
+--- a/drivers/net/hamradio/mkiss.c
++++ b/drivers/net/hamradio/mkiss.c
+@@ -810,6 +810,7 @@ static void mkiss_close(struct tty_struct *tty)
+       ax->tty = NULL;
+ 
+       unregister_netdev(ax->dev);
++      free_netdev(ax->dev);
+ }
+ 
+ /* Perform I/O control on an active ax25 channel. */
+diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
+index f7180f8db39e1..9c15e1a1261be 100644
+--- a/drivers/net/usb/cdc_eem.c
++++ b/drivers/net/usb/cdc_eem.c
+@@ -138,10 +138,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, 
struct sk_buff *skb,
+       }
+ 
+       skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
++      dev_kfree_skb_any(skb);
+       if (!skb2)
+               return NULL;
+ 
+-      dev_kfree_skb_any(skb);
+       skb = skb2;
+ 
+ done:
+diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
+index 8de7797ea7e71..8bef8c3dd2a3e 100644
+--- a/drivers/net/usb/cdc_ncm.c
++++ b/drivers/net/usb/cdc_ncm.c
+@@ -1580,7 +1580,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct 
urb *urb)
+ static const struct driver_info cdc_ncm_info = {
+       .description = "CDC NCM",
+       .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
+-                      | FLAG_LINK_INTR,
++                      | FLAG_LINK_INTR | FLAG_ETHER,
+       .bind = cdc_ncm_bind,
+       .unbind = cdc_ncm_unbind,
+       .manage_power = usbnet_manage_power,
+diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
+index 27e9c089b2fc2..5baaa82916243 100644
+--- a/drivers/net/usb/r8152.c
++++ b/drivers/net/usb/r8152.c
+@@ -3820,7 +3820,7 @@ static void rtl8152_get_strings(struct net_device *dev, 
u32 stringset, u8 *data)
+ {
+       switch (stringset) {
+       case ETH_SS_STATS:
+-              memcpy(data, *rtl8152_gstrings, sizeof(rtl8152_gstrings));
++              memcpy(data, rtl8152_gstrings, sizeof(rtl8152_gstrings));
+               break;
+       }
+ }
+diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
+index 850bb147f4b08..9fe6a8d899b00 100644
+--- a/drivers/net/usb/smsc75xx.c
++++ b/drivers/net/usb/smsc75xx.c
+@@ -1485,7 +1485,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct 
usb_interface *intf)
+       ret = smsc75xx_wait_ready(dev, 0);
+       if (ret < 0) {
+               netdev_warn(dev->net, "device not ready in smsc75xx_bind\n");
+-              goto err;
++              goto free_pdata;
+       }
+ 
+       smsc75xx_init_mac_address(dev);
+@@ -1494,7 +1494,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct 
usb_interface *intf)
+       ret = smsc75xx_reset(dev);
+       if (ret < 0) {
+               netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret);
+-              goto err;
++              goto cancel_work;
+       }
+ 
+       dev->net->netdev_ops = &smsc75xx_netdev_ops;
+@@ -1504,8 +1504,11 @@ static int smsc75xx_bind(struct usbnet *dev, struct 
usb_interface *intf)
+       dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
+       return 0;
+ 
+-err:
++cancel_work:
++      cancel_work_sync(&pdata->set_multicast);
++free_pdata:
+       kfree(pdata);
++      dev->data[0] = 0;
+       return ret;
+ }
+ 
+@@ -1516,7 +1519,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct 
usb_interface *intf)
+               cancel_work_sync(&pdata->set_multicast);
+               netif_dbg(dev, ifdown, dev->net, "free pdata\n");
+               kfree(pdata);
+-              pdata = NULL;
+               dev->data[0] = 0;
+       }
+ }
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
+index 22e8172f373d3..b7f65fc54dc2c 100644
+--- a/drivers/pci/pci.c
++++ b/drivers/pci/pci.c
+@@ -1328,11 +1328,21 @@ static int pci_enable_device_flags(struct pci_dev 
*dev, unsigned long flags)
+       int err;
+       int i, bars = 0;
+ 
+-      if (atomic_inc_return(&dev->enable_cnt) > 1) {
+-              pci_update_current_state(dev, dev->current_state);
+-              return 0;               /* already enabled */
++      /*
++       * Power state could be unknown at this point, either due to a fresh
++       * boot or a device removal call.  So get the current power state
++       * so that things like MSI message writing will behave as expected
++       * (e.g. if the device really is in D0 at enable time).
++       */
++      if (dev->pm_cap) {
++              u16 pmcsr;
++              pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
++              dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
+       }
+ 
++      if (atomic_inc_return(&dev->enable_cnt) > 1)
++              return 0;               /* already enabled */
++
+       bridge = pci_upstream_bridge(dev);
+       if (bridge)
+               pci_enable_bridge(bridge);
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
+index bc0aa0849e72e..e65eec0644a76 100644
+--- a/drivers/pci/quirks.c
++++ b/drivers/pci/quirks.c
+@@ -3144,6 +3144,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev)
+       dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
+ }
+ 
++/*
++ * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be
++ * prevented for those affected devices.
++ */
++static void quirk_nvidia_no_bus_reset(struct pci_dev *dev)
++{
++      if ((dev->device & 0xffc0) == 0x2340)
++              quirk_no_bus_reset(dev);
++}
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
++                       quirk_nvidia_no_bus_reset);
++
+ /*
+  * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset.
+  * The device will throw a Link Down error on AER-capable systems and
+@@ -3157,6 +3169,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, 
quirk_no_bus_reset);
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset);
+ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset);
+ 
++/*
++ * Some TI KeyStone C667X devices do not support bus/hot reset.  The PCIESS
++ * automatically disables LTSSM when Secondary Bus Reset is received and
++ * the device stops working.  Prevent bus reset for these devices.  With
++ * this change, the device can be assigned to VMs with VFIO, but it will
++ * leak state between VMs.  Reference
++ * https://e2e.ti.com/support/processors/f/791/t/954382
++ */
++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0xb005, quirk_no_bus_reset);
++
+ static void quirk_no_pm_reset(struct pci_dev *dev)
+ {
+       /*
+diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
+index fb4b6034f6444..6365480300468 100644
+--- a/drivers/scsi/hosts.c
++++ b/drivers/scsi/hosts.c
+@@ -259,12 +259,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, 
struct device *dev,
+ 
+       device_enable_async_suspend(&shost->shost_dev);
+ 
++      get_device(&shost->shost_gendev);
+       error = device_add(&shost->shost_dev);
+       if (error)
+               goto out_del_gendev;
+ 
+-      get_device(&shost->shost_gendev);
+-
+       if (shost->transportt->host_size) {
+               shost->shost_data = kzalloc(shost->transportt->host_size,
+                                        GFP_KERNEL);
+@@ -300,6 +299,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, 
struct device *dev,
+  out_del_dev:
+       device_del(&shost->shost_dev);
+  out_del_gendev:
++      /*
++       * Host state is SHOST_RUNNING so we have to explicitly release
++       * ->shost_dev.
++       */
++      put_device(&shost->shost_dev);
+       device_del(&shost->shost_gendev);
+  out_destroy_freelist:
+       scsi_destroy_command_freelist(shost);
+diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
+index 96cf2448a1f4f..6c6aa23ced45f 100644
+--- a/drivers/target/target_core_transport.c
++++ b/drivers/target/target_core_transport.c
+@@ -2757,9 +2757,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool 
fabric_stop,
+       __releases(&cmd->t_state_lock)
+       __acquires(&cmd->t_state_lock)
+ {
+-
+-      assert_spin_locked(&cmd->t_state_lock);
+-      WARN_ON_ONCE(!irqs_disabled());
++      lockdep_assert_held(&cmd->t_state_lock);
+ 
+       if (fabric_stop)
+               cmd->transport_state |= CMD_T_FABRIC_STOP;
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
+index 8e8695eb652af..f115ce93dfb42 100644
+--- a/fs/gfs2/glock.c
++++ b/fs/gfs2/glock.c
+@@ -1342,6 +1342,7 @@ __acquires(&lru_lock)
+       while(!list_empty(list)) {
+               gl = list_entry(list->next, struct gfs2_glock, gl_lru);
+               list_del_init(&gl->gl_lru);
++              clear_bit(GLF_LRU, &gl->gl_flags);
+               if (!spin_trylock(&gl->gl_lockref.lock)) {
+ add_back_to_lru:
+                       list_add(&gl->gl_lru, &lru_list);
+@@ -1388,7 +1389,6 @@ static long gfs2_scan_glock_lru(int nr)
+               if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
+                       list_move(&gl->gl_lru, &dispose);
+                       atomic_dec(&lru_count);
+-                      clear_bit(GLF_LRU, &gl->gl_flags);
+                       freed++;
+                       continue;
+               }
+diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
+index bbb0dcc35905c..c3b629eec294a 100644
+--- a/fs/nilfs2/sysfs.c
++++ b/fs/nilfs2/sysfs.c
+@@ -1062,6 +1062,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs 
*nilfs)
+       nilfs_sysfs_delete_superblock_group(nilfs);
+       nilfs_sysfs_delete_segctor_group(nilfs);
+       kobject_del(&nilfs->ns_dev_kobj);
++      kobject_put(&nilfs->ns_dev_kobj);
+       kfree(nilfs->ns_dev_subgroups);
+ }
+ 
+diff --git a/include/linux/hid.h b/include/linux/hid.h
+index 19c53b64e07a1..6adea5a397245 100644
+--- a/include/linux/hid.h
++++ b/include/linux/hid.h
+@@ -1119,8 +1119,7 @@ static inline void hid_hw_wait(struct hid_device *hdev)
+  */
+ static inline u32 hid_report_len(struct hid_report *report)
+ {
+-      /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
+-      return ((report->size - 1) >> 3) + 1 + (report->id > 0);
++      return DIV_ROUND_UP(report->size, 8) + (report->id > 0);
+ }
+ 
+ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
+diff --git a/include/net/sock.h b/include/net/sock.h
+index 31198b32d9122..1b657a3a30b51 100644
+--- a/include/net/sock.h
++++ b/include/net/sock.h
+@@ -1728,7 +1728,8 @@ static inline u32 net_tx_rndhash(void)
+ 
+ static inline void sk_set_txhash(struct sock *sk)
+ {
+-      sk->sk_txhash = net_tx_rndhash();
++      /* This pairs with READ_ONCE() in skb_set_hash_from_sk() */
++      WRITE_ONCE(sk->sk_txhash, net_tx_rndhash());
+ }
+ 
+ static inline void sk_rethink_txhash(struct sock *sk)
+@@ -1980,9 +1981,12 @@ static inline void sock_poll_wait(struct file *filp,
+ 
+ static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
+ {
+-      if (sk->sk_txhash) {
++      /* This pairs with WRITE_ONCE() in sk_set_txhash() */
++      u32 txhash = READ_ONCE(sk->sk_txhash);
++
++      if (txhash) {
+               skb->l4_hash = 1;
+-              skb->hash = sk->sk_txhash;
++              skb->hash = txhash;
+       }
+ }
+ 
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
+index 9483bd5272475..bc8b1fdbf1bb7 100644
+--- a/kernel/trace/trace.c
++++ b/kernel/trace/trace.c
+@@ -1369,9 +1369,6 @@ struct saved_cmdlines_buffer {
+ };
+ static struct saved_cmdlines_buffer *savedcmd;
+ 
+-/* temporary disable recording */
+-static atomic_t trace_record_cmdline_disabled __read_mostly;
+-
+ static inline char *get_saved_cmdlines(int idx)
+ {
+       return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN];
+@@ -1635,9 +1632,6 @@ void trace_find_cmdline(int pid, char comm[])
+ 
+ void tracing_record_cmdline(struct task_struct *tsk)
+ {
+-      if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
+-              return;
+-
+       if (!__this_cpu_read(trace_cmdline_save))
+               return;
+ 
+@@ -2500,9 +2494,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)
+               return ERR_PTR(-EBUSY);
+ #endif
+ 
+-      if (!iter->snapshot)
+-              atomic_inc(&trace_record_cmdline_disabled);
+-
+       if (*pos != iter->pos) {
+               iter->ent = NULL;
+               iter->cpu = 0;
+@@ -2545,9 +2536,6 @@ static void s_stop(struct seq_file *m, void *p)
+               return;
+ #endif
+ 
+-      if (!iter->snapshot)
+-              atomic_dec(&trace_record_cmdline_disabled);
+-
+       trace_access_unlock(iter->cpu_file);
+       trace_event_read_unlock();
+ }
+diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
+index b67ea5eed2a89..b70233a9563f8 100644
+--- a/kernel/trace/trace_clock.c
++++ b/kernel/trace/trace_clock.c
+@@ -113,9 +113,9 @@ u64 notrace trace_clock_global(void)
+       prev_time = READ_ONCE(trace_clock_struct.prev_time);
+       now = sched_clock_cpu(this_cpu);
+ 
+-      /* Make sure that now is always greater than prev_time */
++      /* Make sure that now is always greater than or equal to prev_time */
+       if ((s64)(now - prev_time) < 0)
+-              now = prev_time + 1;
++              now = prev_time;
+ 
+       /*
+        * If in an NMI context then dont risk lockups and simply return
+@@ -129,7 +129,7 @@ u64 notrace trace_clock_global(void)
+               /* Reread prev_time in case it was already updated */
+               prev_time = READ_ONCE(trace_clock_struct.prev_time);
+               if ((s64)(now - prev_time) < 0)
+-                      now = prev_time + 1;
++                      now = prev_time;
+ 
+               trace_clock_struct.prev_time = now;
+ 
+diff --git a/net/can/bcm.c b/net/can/bcm.c
+index 1f15622d3c657..c6fee58baac4c 100644
+--- a/net/can/bcm.c
++++ b/net/can/bcm.c
+@@ -121,7 +121,7 @@ struct bcm_sock {
+       struct sock sk;
+       int bound;
+       int ifindex;
+-      struct notifier_block notifier;
++      struct list_head notifier;
+       struct list_head rx_ops;
+       struct list_head tx_ops;
+       unsigned long dropped_usr_msgs;
+@@ -129,6 +129,10 @@ struct bcm_sock {
+       char procname [32]; /* inode number in decimal with \0 */
+ };
+ 
++static LIST_HEAD(bcm_notifier_list);
++static DEFINE_SPINLOCK(bcm_notifier_lock);
++static struct bcm_sock *bcm_busy_notifier;
++
+ static inline struct bcm_sock *bcm_sk(const struct sock *sk)
+ {
+       return (struct bcm_sock *)sk;
+@@ -392,6 +396,7 @@ static void bcm_tx_timeout_tsklet(unsigned long data)
+               if (!op->count && (op->flags & TX_COUNTEVT)) {
+ 
+                       /* create notification to user */
++                      memset(&msg_head, 0, sizeof(msg_head));
+                       msg_head.opcode  = TX_EXPIRED;
+                       msg_head.flags   = op->flags;
+                       msg_head.count   = op->count;
+@@ -439,6 +444,7 @@ static void bcm_rx_changed(struct bcm_op *op, struct 
can_frame *data)
+       /* this element is not throttled anymore */
+       data->can_dlc &= (BCM_CAN_DLC_MASK|RX_RECV);
+ 
++      memset(&head, 0, sizeof(head));
+       head.opcode  = RX_CHANGED;
+       head.flags   = op->flags;
+       head.count   = op->count;
+@@ -550,6 +556,7 @@ static void bcm_rx_timeout_tsklet(unsigned long data)
+       struct bcm_msg_head msg_head;
+ 
+       /* create notification to user */
++      memset(&msg_head, 0, sizeof(msg_head));
+       msg_head.opcode  = RX_TIMEOUT;
+       msg_head.flags   = op->flags;
+       msg_head.count   = op->count;
+@@ -1385,20 +1392,15 @@ static int bcm_sendmsg(struct socket *sock, struct 
msghdr *msg, size_t size)
+ /*
+  * notification handler for netdevice status changes
+  */
+-static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
+-                      void *ptr)
++static void bcm_notify(struct bcm_sock *bo, unsigned long msg,
++                     struct net_device *dev)
+ {
+-      struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+-      struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier);
+       struct sock *sk = &bo->sk;
+       struct bcm_op *op;
+       int notify_enodev = 0;
+ 
+       if (!net_eq(dev_net(dev), &init_net))
+-              return NOTIFY_DONE;
+-
+-      if (dev->type != ARPHRD_CAN)
+-              return NOTIFY_DONE;
++              return;
+ 
+       switch (msg) {
+ 
+@@ -1433,7 +1435,28 @@ static int bcm_notifier(struct notifier_block *nb, 
unsigned long msg,
+                               sk->sk_error_report(sk);
+               }
+       }
++}
+ 
++static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
++                      void *ptr)
++{
++      struct net_device *dev = netdev_notifier_info_to_dev(ptr);
++
++      if (dev->type != ARPHRD_CAN)
++              return NOTIFY_DONE;
++      if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN)
++              return NOTIFY_DONE;
++      if (unlikely(bcm_busy_notifier)) /* Check for reentrant bug. */
++              return NOTIFY_DONE;
++
++      spin_lock(&bcm_notifier_lock);
++      list_for_each_entry(bcm_busy_notifier, &bcm_notifier_list, notifier) {
++              spin_unlock(&bcm_notifier_lock);
++              bcm_notify(bcm_busy_notifier, msg, dev);
++              spin_lock(&bcm_notifier_lock);
++      }
++      bcm_busy_notifier = NULL;
++      spin_unlock(&bcm_notifier_lock);
+       return NOTIFY_DONE;
+ }
+ 
+@@ -1453,9 +1476,9 @@ static int bcm_init(struct sock *sk)
+       INIT_LIST_HEAD(&bo->rx_ops);
+ 
+       /* set notifier */
+-      bo->notifier.notifier_call = bcm_notifier;
+-
+-      register_netdevice_notifier(&bo->notifier);
++      spin_lock(&bcm_notifier_lock);
++      list_add_tail(&bo->notifier, &bcm_notifier_list);
++      spin_unlock(&bcm_notifier_lock);
+ 
+       return 0;
+ }
+@@ -1476,7 +1499,14 @@ static int bcm_release(struct socket *sock)
+ 
+       /* remove bcm_ops, timer, rx_unregister(), etc. */
+ 
+-      unregister_netdevice_notifier(&bo->notifier);
++      spin_lock(&bcm_notifier_lock);
++      while (bcm_busy_notifier == bo) {
++              spin_unlock(&bcm_notifier_lock);
++              schedule_timeout_uninterruptible(1);
++              spin_lock(&bcm_notifier_lock);
++      }
++      list_del(&bo->notifier);
++      spin_unlock(&bcm_notifier_lock);
+ 
+       lock_sock(sk);
+ 
+@@ -1662,6 +1692,10 @@ static const struct can_proto bcm_can_proto = {
+       .prot       = &bcm_proto,
+ };
+ 
++static struct notifier_block canbcm_notifier = {
++      .notifier_call = bcm_notifier
++};
++
+ static int __init bcm_module_init(void)
+ {
+       int err;
+@@ -1676,6 +1710,8 @@ static int __init bcm_module_init(void)
+ 
+       /* create /proc/net/can-bcm directory */
+       proc_dir = proc_mkdir("can-bcm", init_net.proc_net);
++      register_netdevice_notifier(&canbcm_notifier);
++
+       return 0;
+ }
+ 
+@@ -1685,6 +1721,8 @@ static void __exit bcm_module_exit(void)
+ 
+       if (proc_dir)
+               remove_proc_entry("can-bcm", init_net.proc_net);
++
++      unregister_netdevice_notifier(&canbcm_notifier);
+ }
+ 
+ module_init(bcm_module_init);
+diff --git a/net/can/raw.c b/net/can/raw.c
+index e9403a26a1d54..2e1d850a7f2a0 100644
+--- a/net/can/raw.c
++++ b/net/can/raw.c
+@@ -84,7 +84,7 @@ struct raw_sock {
+       struct sock sk;
+       int bound;
+       int ifindex;
+-      struct notifier_block notifier;
++      struct list_head notifier;
+       int loopback;
+       int recv_own_msgs;
+       int fd_frames;
+@@ -96,6 +96,10 @@ struct raw_sock {
+       struct uniqframe __percpu *uniq;
+ };
+ 
++static LIST_HEAD(raw_notifier_list);
++static DEFINE_SPINLOCK(raw_notifier_lock);
++static struct raw_sock *raw_busy_notifier;
++
+ /*
+  * Return pointer to store the extra msg flags for raw_recvmsg().
+  * We use the space of one unsigned int beyond the 'struct sockaddr_can'
+@@ -260,21 +264,16 @@ static int raw_enable_allfilters(struct net_device *dev, 
struct sock *sk)
+       return err;
+ }
+ 
+-static int raw_notifier(struct notifier_block *nb,
+-                      unsigned long msg, void *ptr)
++static void raw_notify(struct raw_sock *ro, unsigned long msg,
++                     struct net_device *dev)
+ {
+-      struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+-      struct raw_sock *ro = container_of(nb, struct raw_sock, notifier);
+       struct sock *sk = &ro->sk;
+ 
+       if (!net_eq(dev_net(dev), &init_net))
+-              return NOTIFY_DONE;
+-
+-      if (dev->type != ARPHRD_CAN)
+-              return NOTIFY_DONE;
++              return;
+ 
+       if (ro->ifindex != dev->ifindex)
+-              return NOTIFY_DONE;
++              return;
+ 
+       switch (msg) {
+ 
+@@ -303,7 +302,28 @@ static int raw_notifier(struct notifier_block *nb,
+                       sk->sk_error_report(sk);
+               break;
+       }
++}
++
++static int raw_notifier(struct notifier_block *nb, unsigned long msg,
++                      void *ptr)
++{
++      struct net_device *dev = netdev_notifier_info_to_dev(ptr);
++
++      if (dev->type != ARPHRD_CAN)
++              return NOTIFY_DONE;
++      if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN)
++              return NOTIFY_DONE;
++      if (unlikely(raw_busy_notifier)) /* Check for reentrant bug. */
++              return NOTIFY_DONE;
+ 
++      spin_lock(&raw_notifier_lock);
++      list_for_each_entry(raw_busy_notifier, &raw_notifier_list, notifier) {
++              spin_unlock(&raw_notifier_lock);
++              raw_notify(raw_busy_notifier, msg, dev);
++              spin_lock(&raw_notifier_lock);
++      }
++      raw_busy_notifier = NULL;
++      spin_unlock(&raw_notifier_lock);
+       return NOTIFY_DONE;
+ }
+ 
+@@ -332,9 +352,9 @@ static int raw_init(struct sock *sk)
+               return -ENOMEM;
+ 
+       /* set notifier */
+-      ro->notifier.notifier_call = raw_notifier;
+-
+-      register_netdevice_notifier(&ro->notifier);
++      spin_lock(&raw_notifier_lock);
++      list_add_tail(&ro->notifier, &raw_notifier_list);
++      spin_unlock(&raw_notifier_lock);
+ 
+       return 0;
+ }
+@@ -349,7 +369,14 @@ static int raw_release(struct socket *sock)
+ 
+       ro = raw_sk(sk);
+ 
+-      unregister_netdevice_notifier(&ro->notifier);
++      spin_lock(&raw_notifier_lock);
++      while (raw_busy_notifier == ro) {
++              spin_unlock(&raw_notifier_lock);
++              schedule_timeout_uninterruptible(1);
++              spin_lock(&raw_notifier_lock);
++      }
++      list_del(&ro->notifier);
++      spin_unlock(&raw_notifier_lock);
+ 
+       lock_sock(sk);
+ 
+@@ -857,6 +884,10 @@ static const struct can_proto raw_can_proto = {
+       .prot       = &raw_proto,
+ };
+ 
++static struct notifier_block canraw_notifier = {
++      .notifier_call = raw_notifier
++};
++
+ static __init int raw_module_init(void)
+ {
+       int err;
+@@ -866,6 +897,8 @@ static __init int raw_module_init(void)
+       err = can_proto_register(&raw_can_proto);
+       if (err < 0)
+               printk(KERN_ERR "can: registration of raw protocol failed\n");
++      else
++              register_netdevice_notifier(&canraw_notifier);
+ 
+       return err;
+ }
+@@ -873,6 +906,7 @@ static __init int raw_module_init(void)
+ static __exit void raw_module_exit(void)
+ {
+       can_proto_unregister(&raw_can_proto);
++      unregister_netdevice_notifier(&canraw_notifier);
+ }
+ 
+ module_init(raw_module_init);
+diff --git a/net/compat.c b/net/compat.c
+index 20c5e5f215f23..14459a87fdbce 100644
+--- a/net/compat.c
++++ b/net/compat.c
+@@ -159,7 +159,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, 
struct sock *sk,
+       if (kcmlen > stackbuf_size)
+               kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
+       if (kcmsg == NULL)
+-              return -ENOBUFS;
++              return -ENOMEM;
+ 
+       /* Now copy them over neatly. */
+       memset(kcmsg, 0, kcmlen);
+diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
+index 2fd4aae8f2858..b9cbab73d0de5 100644
+--- a/net/core/fib_rules.c
++++ b/net/core/fib_rules.c
+@@ -695,7 +695,7 @@ static void notify_rule_change(int event, struct fib_rule 
*rule,
+ {
+       struct net *net;
+       struct sk_buff *skb;
+-      int err = -ENOBUFS;
++      int err = -ENOMEM;
+ 
+       net = ops->fro_net;
+       skb = nlmsg_new(fib_rule_nlmsg_size(ops, rule), GFP_KERNEL);
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
+index e2a0aed52983e..7d6fe9ba9a248 100644
+--- a/net/core/rtnetlink.c
++++ b/net/core/rtnetlink.c
+@@ -3240,6 +3240,10 @@ static int rtnl_bridge_notify(struct net_device *dev)
+       if (err < 0)
+               goto errout;
+ 
++      /* Notification info is only filled for bridge ports, not the bridge
++       * device itself. Therefore, a zero notification length is valid and
++       * should not result in an error.
++       */
+       if (!skb->len)
+               goto errout;
+ 
+diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
+index 0e83c5b08e0e3..e798e27b3c7d3 100644
+--- a/net/ipv4/cipso_ipv4.c
++++ b/net/ipv4/cipso_ipv4.c
+@@ -557,6 +557,7 @@ void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
+               kfree(doi_def->map.std->lvl.local);
+               kfree(doi_def->map.std->cat.cipso);
+               kfree(doi_def->map.std->cat.local);
++              kfree(doi_def->map.std);
+               break;
+       }
+       kfree(doi_def);
+diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
+index 60f564db25a3d..173777aa5add8 100644
+--- a/net/ipv4/ipconfig.c
++++ b/net/ipv4/ipconfig.c
+@@ -890,7 +890,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, 
unsigned long jiffies_d
+ 
+ 
+ /*
+- *  Copy BOOTP-supplied string if not already set.
++ *  Copy BOOTP-supplied string
+  */
+ static int __init ic_bootp_string(char *dest, char *src, int len, int max)
+ {
+@@ -941,12 +941,15 @@ static void __init ic_do_bootp_ext(u8 *ext)
+               }
+               break;
+       case 12:        /* Host name */
+-              ic_bootp_string(utsname()->nodename, ext+1, *ext,
+-                              __NEW_UTS_LEN);
+-              ic_host_name_set = 1;
++              if (!ic_host_name_set) {
++                      ic_bootp_string(utsname()->nodename, ext+1, *ext,
++                                      __NEW_UTS_LEN);
++                      ic_host_name_set = 1;
++              }
+               break;
+       case 15:        /* Domain name (DNS) */
+-              ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
++              if (!ic_domain[0])
++                      ic_bootp_string(ic_domain, ext+1, *ext, 
sizeof(ic_domain));
+               break;
+       case 17:        /* Root path */
+               if (!root_server_path[0])
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
+index a3abd136b8e71..56d89dfd8831b 100644
+--- a/net/ipv4/ping.c
++++ b/net/ipv4/ping.c
+@@ -978,6 +978,7 @@ bool ping_rcv(struct sk_buff *skb)
+       struct sock *sk;
+       struct net *net = dev_net(skb->dev);
+       struct icmphdr *icmph = icmp_hdr(skb);
++      bool rc = false;
+ 
+       /* We assume the packet has already been checked by icmp_rcv */
+ 
+@@ -992,14 +993,15 @@ bool ping_rcv(struct sk_buff *skb)
+               struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
+ 
+               pr_debug("rcv on socket %p\n", sk);
+-              if (skb2)
+-                      ping_queue_rcv_skb(sk, skb2);
++              if (skb2 && !ping_queue_rcv_skb(sk, skb2))
++                      rc = true;
+               sock_put(sk);
+-              return true;
+       }
+-      pr_debug("no socket, dropping\n");
+ 
+-      return false;
++      if (!rc)
++              pr_debug("no socket, dropping\n");
++
++      return rc;
+ }
+ EXPORT_SYMBOL_GPL(ping_rcv);
+ 
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c
+index ea1c319100a5d..2ab2289d97a09 100644
+--- a/net/ipv4/route.c
++++ b/net/ipv4/route.c
+@@ -70,6 +70,7 @@
+ #include <linux/types.h>
+ #include <linux/kernel.h>
+ #include <linux/mm.h>
++#include <linux/bootmem.h>
+ #include <linux/string.h>
+ #include <linux/socket.h>
+ #include <linux/sockios.h>
+@@ -463,8 +464,10 @@ static struct neighbour *ipv4_neigh_lookup(const struct 
dst_entry *dst,
+       return neigh_create(&arp_tbl, pkey, dev);
+ }
+ 
+-#define IP_IDENTS_SZ 2048u
+-
++/* Hash tables of size 2048..262144 depending on RAM size.
++ * Each bucket uses 8 bytes.
++ */
++static u32 ip_idents_mask __read_mostly;
+ static atomic_t *ip_idents __read_mostly;
+ static u32 *ip_tstamps __read_mostly;
+ 
+@@ -474,12 +477,16 @@ static u32 *ip_tstamps __read_mostly;
+  */
+ u32 ip_idents_reserve(u32 hash, int segs)
+ {
+-      u32 *p_tstamp = ip_tstamps + hash % IP_IDENTS_SZ;
+-      atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ;
+-      u32 old = ACCESS_ONCE(*p_tstamp);
+-      u32 now = (u32)jiffies;
++      u32 bucket, old, now = (u32)jiffies;
++      atomic_t *p_id;
++      u32 *p_tstamp;
+       u32 delta = 0;
+ 
++      bucket = hash & ip_idents_mask;
++      p_tstamp = ip_tstamps + bucket;
++      p_id = ip_idents + bucket;
++      old = ACCESS_ONCE(*p_tstamp);
++
+       if (old != now && cmpxchg(p_tstamp, old, now) == old)
+               delta = prandom_u32_max(now - old);
+ 
+@@ -2936,18 +2943,27 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
+ 
+ int __init ip_rt_init(void)
+ {
++      void *idents_hash;
+       int rc = 0;
+       int cpu;
+ 
+-      ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL);
+-      if (!ip_idents)
+-              panic("IP: failed to allocate ip_idents\n");
++      /* For modern hosts, this will use 2 MB of memory */
++      idents_hash = alloc_large_system_hash("IP idents",
++                                            sizeof(*ip_idents) + 
sizeof(*ip_tstamps),
++                                            0,
++                                            16, /* one bucket per 64 KB */
++                                            0,
++                                            NULL,
++                                            &ip_idents_mask,
++                                            2048,
++                                            256*1024);
++
++      ip_idents = idents_hash;
+ 
+-      prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents));
++      prandom_bytes(ip_idents, (ip_idents_mask + 1) * sizeof(*ip_idents));
+ 
+-      ip_tstamps = kcalloc(IP_IDENTS_SZ, sizeof(*ip_tstamps), GFP_KERNEL);
+-      if (!ip_tstamps)
+-              panic("IP: failed to allocate ip_tstamps\n");
++      ip_tstamps = idents_hash + (ip_idents_mask + 1) * sizeof(*ip_idents);
++      memset(ip_tstamps, 0, (ip_idents_mask + 1) * sizeof(*ip_tstamps));
+ 
+       for_each_possible_cpu(cpu) {
+               struct uncached_list *ul = &per_cpu(rt_uncached_list, cpu);
+diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
+index ae0fba044cd0a..bde924968cd23 100644
+--- a/net/mac80211/rx.c
++++ b/net/mac80211/rx.c
+@@ -1853,17 +1853,15 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
+       sc = le16_to_cpu(hdr->seq_ctrl);
+       frag = sc & IEEE80211_SCTL_FRAG;
+ 
+-      if (is_multicast_ether_addr(hdr->addr1)) {
+-              I802_DEBUG_INC(rx->local->dot11MulticastReceivedFrameCount);
+-              goto out_no_led;
+-      }
+-
+       if (rx->sta)
+               cache = &rx->sta->frags;
+ 
+       if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
+               goto out;
+ 
++      if (is_multicast_ether_addr(hdr->addr1))
++              return RX_DROP_MONITOR;
++
+       I802_DEBUG_INC(rx->local->rx_handlers_fragments);
+ 
+       if (skb_linearize(rx->skb))
+@@ -1992,7 +1990,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
+ 
+  out:
+       ieee80211_led_rx(rx->local);
+- out_no_led:
+       if (rx->sta)
+               rx->sta->rx_stats.packets++;
+       return RX_CONTINUE;
+diff --git a/net/netfilter/nf_synproxy_core.c 
b/net/netfilter/nf_synproxy_core.c
+index c8a4a48bced98..8be604eb69616 100644
+--- a/net/netfilter/nf_synproxy_core.c
++++ b/net/netfilter/nf_synproxy_core.c
+@@ -34,6 +34,9 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned 
int doff,
+       int length = (th->doff * 4) - sizeof(*th);
+       u8 buf[40], *ptr;
+ 
++      if (unlikely(length < 0))
++              return false;
++
+       ptr = skb_header_pointer(skb, doff + sizeof(*th), length, buf);
+       if (ptr == NULL)
+               return false;
+@@ -50,6 +53,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned 
int doff,
+                       length--;
+                       continue;
+               default:
++                      if (length < 2)
++                              return true;
+                       opsize = *ptr++;
+                       if (opsize < 2)
+                               return true;
+diff --git a/net/rds/recv.c b/net/rds/recv.c
+index 9bf812509e0e9..1ff4bc3237f01 100644
+--- a/net/rds/recv.c
++++ b/net/rds/recv.c
+@@ -482,7 +482,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, 
size_t size,
+ 
+               if (rds_cmsg_recv(inc, msg)) {
+                       ret = -EFAULT;
+-                      goto out;
++                      break;
+               }
+ 
+               rds_stats_inc(s_recv_delivered);
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
+index ac78c5ac82846..33948cc03ba63 100644
+--- a/net/unix/af_unix.c
++++ b/net/unix/af_unix.c
+@@ -534,12 +534,14 @@ static void unix_release_sock(struct sock *sk, int 
embrion)
+       u->path.mnt = NULL;
+       state = sk->sk_state;
+       sk->sk_state = TCP_CLOSE;
++
++      skpair = unix_peer(sk);
++      unix_peer(sk) = NULL;
++
+       unix_state_unlock(sk);
+ 
+       wake_up_interruptible_all(&u->peer_wait);
+ 
+-      skpair = unix_peer(sk);
+-
+       if (skpair != NULL) {
+               if (sk->sk_type == SOCK_STREAM || sk->sk_type == 
SOCK_SEQPACKET) {
+                       unix_state_lock(skpair);
+@@ -554,7 +556,6 @@ static void unix_release_sock(struct sock *sk, int embrion)
+ 
+               unix_dgram_peer_wake_disconnect(sk, skpair);
+               sock_put(skpair); /* It may now die */
+-              unix_peer(sk) = NULL;
+       }
+ 
+       /* Try to flush out this socket. Throw out buffers at least */
+diff --git a/net/wireless/util.c b/net/wireless/util.c
+index 915f1fa881e48..73c361fd4a16f 100644
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -978,6 +978,9 @@ int cfg80211_change_iface(struct 
cfg80211_registered_device *rdev,
+               case NL80211_IFTYPE_MESH_POINT:
+                       /* mesh should be handled? */
+                       break;
++              case NL80211_IFTYPE_OCB:
++                      cfg80211_leave_ocb(rdev, dev);
++                      break;
+               default:
+                       break;
+               }
+diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
+index a9fd95d10e84a..156639be7ed00 100644
+--- a/net/x25/af_x25.c
++++ b/net/x25/af_x25.c
+@@ -550,7 +550,7 @@ static int x25_create(struct net *net, struct socket 
*sock, int protocol,
+       if (protocol)
+               goto out;
+ 
+-      rc = -ENOBUFS;
++      rc = -ENOMEM;
+       if ((sk = x25_alloc_socket(net, kern)) == NULL)
+               goto out;
+ 

Reply via email to