commit:     6803a1f4a0b85e26474b56a4aa58be6e35f47ef6
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 29 15:24:55 2022 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Jul 29 15:24:55 2022 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=6803a1f4

Linux patch 4.9.325

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

 0000_README              |    4 +
 1324_linux-4.9.325.patch | 1177 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1181 insertions(+)

diff --git a/0000_README b/0000_README
index 637684d9..d8d1692c 100644
--- a/0000_README
+++ b/0000_README
@@ -1339,6 +1339,10 @@ Patch:  1323_linux-4.9.324.patch
 From:   http://www.kernel.org
 Desc:   Linux 4.9.324
 
+Patch:  1324_linux-4.9.325.patch
+From:   http://www.kernel.org
+Desc:   Linux 4.9.325
+
 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/1324_linux-4.9.325.patch b/1324_linux-4.9.325.patch
new file mode 100644
index 00000000..2d5a1d69
--- /dev/null
+++ b/1324_linux-4.9.325.patch
@@ -0,0 +1,1177 @@
+diff --git a/Makefile b/Makefile
+index 3168f1c122213..6042ded263475 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 4
+ PATCHLEVEL = 9
+-SUBLEVEL = 324
++SUBLEVEL = 325
+ EXTRAVERSION =
+ NAME = Roaring Lionus
+ 
+diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c
+index 72b59511e59aa..bfeafff14c092 100644
+--- a/arch/alpha/kernel/srmcons.c
++++ b/arch/alpha/kernel/srmcons.c
+@@ -58,7 +58,7 @@ srmcons_do_receive_chars(struct tty_port *port)
+       } while((result.bits.status & 1) && (++loops < 10));
+ 
+       if (count)
+-              tty_schedule_flip(port);
++              tty_flip_buffer_push(port);
+ 
+       return count;
+ }
+diff --git a/drivers/char/random.c b/drivers/char/random.c
+index 38591c53ea571..1cbc33ee5a5f2 100644
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -184,8 +184,8 @@ static void __cold process_random_ready_list(void)
+ 
+ #define warn_unseeded_randomness() \
+       if (IS_ENABLED(CONFIG_WARN_ALL_UNSEEDED_RANDOM) && !crng_ready()) \
+-              pr_notice("%s called from %pS with crng_init=%d\n", \
+-                        __func__, (void *)_RET_IP_, crng_init)
++              printk_deferred(KERN_NOTICE "random: %s called from %pS with 
crng_init=%d\n", \
++                              __func__, (void *)_RET_IP_, crng_init)
+ 
+ 
+ /*********************************************************************
+diff --git a/drivers/i2c/busses/i2c-cadence.c 
b/drivers/i2c/busses/i2c-cadence.c
+index 9ab056bb834d9..fce1906e7df18 100644
+--- a/drivers/i2c/busses/i2c-cadence.c
++++ b/drivers/i2c/busses/i2c-cadence.c
+@@ -203,9 +203,9 @@ static inline bool cdns_is_holdquirk(struct cdns_i2c *id, 
bool hold_wrkaround)
+  */
+ static irqreturn_t cdns_i2c_isr(int irq, void *ptr)
+ {
+-      unsigned int isr_status, avail_bytes, updatetx;
++      unsigned int isr_status, avail_bytes;
+       unsigned int bytes_to_send;
+-      bool hold_quirk;
++      bool updatetx;
+       struct cdns_i2c *id = ptr;
+       /* Signal completion only after everything is updated */
+       int done_flag = 0;
+@@ -224,11 +224,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr)
+        * Check if transfer size register needs to be updated again for a
+        * large data receive operation.
+        */
+-      updatetx = 0;
+-      if (id->recv_count > id->curr_recv_count)
+-              updatetx = 1;
+-
+-      hold_quirk = (id->quirks & CDNS_I2C_BROKEN_HOLD_BIT) && updatetx;
++      updatetx = id->recv_count > id->curr_recv_count;
+ 
+       /* When receiving, handle data interrupt and completion interrupt */
+       if (id->p_recv_buf &&
+@@ -251,7 +247,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr)
+                       id->recv_count--;
+                       id->curr_recv_count--;
+ 
+-                      if (cdns_is_holdquirk(id, hold_quirk))
++                      if (cdns_is_holdquirk(id, updatetx))
+                               break;
+               }
+ 
+@@ -262,7 +258,7 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr)
+                * maintain transfer size non-zero while performing a large
+                * receive operation.
+                */
+-              if (cdns_is_holdquirk(id, hold_quirk)) {
++              if (cdns_is_holdquirk(id, updatetx)) {
+                       /* wait while fifo is full */
+                       while (cdns_i2c_readreg(CDNS_I2C_XFER_SIZE_OFFSET) !=
+                              (id->curr_recv_count - CDNS_I2C_FIFO_DEPTH))
+@@ -284,22 +280,6 @@ static irqreturn_t cdns_i2c_isr(int irq, void *ptr)
+                                                 CDNS_I2C_XFER_SIZE_OFFSET);
+                               id->curr_recv_count = id->recv_count;
+                       }
+-              } else if (id->recv_count && !hold_quirk &&
+-                                              !id->curr_recv_count) {
+-
+-                      /* Set the slave address in address register*/
+-                      cdns_i2c_writereg(id->p_msg->addr & CDNS_I2C_ADDR_MASK,
+-                                              CDNS_I2C_ADDR_OFFSET);
+-
+-                      if (id->recv_count > CDNS_I2C_TRANSFER_SIZE) {
+-                              cdns_i2c_writereg(CDNS_I2C_TRANSFER_SIZE,
+-                                              CDNS_I2C_XFER_SIZE_OFFSET);
+-                              id->curr_recv_count = CDNS_I2C_TRANSFER_SIZE;
+-                      } else {
+-                              cdns_i2c_writereg(id->recv_count,
+-                                              CDNS_I2C_XFER_SIZE_OFFSET);
+-                              id->curr_recv_count = id->recv_count;
+-                      }
+               }
+ 
+               /* Clear hold (if not repeated start) and signal completion */
+diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c
+index e94f855eac155..fd859a7872a6d 100644
+--- a/drivers/mfd/rtsx_usb.c
++++ b/drivers/mfd/rtsx_usb.c
+@@ -642,16 +642,20 @@ static int rtsx_usb_probe(struct usb_interface *intf,
+ 
+       ucr->pusb_dev = usb_dev;
+ 
+-      ucr->iobuf = usb_alloc_coherent(ucr->pusb_dev, IOBUF_SIZE,
+-                      GFP_KERNEL, &ucr->iobuf_dma);
+-      if (!ucr->iobuf)
++      ucr->cmd_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL);
++      if (!ucr->cmd_buf)
+               return -ENOMEM;
+ 
++      ucr->rsp_buf = kmalloc(IOBUF_SIZE, GFP_KERNEL);
++      if (!ucr->rsp_buf) {
++              ret = -ENOMEM;
++              goto out_free_cmd_buf;
++      }
++
+       usb_set_intfdata(intf, ucr);
+ 
+       ucr->vendor_id = id->idVendor;
+       ucr->product_id = id->idProduct;
+-      ucr->cmd_buf = ucr->rsp_buf = ucr->iobuf;
+ 
+       mutex_init(&ucr->dev_mutex);
+ 
+@@ -679,8 +683,11 @@ static int rtsx_usb_probe(struct usb_interface *intf,
+ 
+ out_init_fail:
+       usb_set_intfdata(ucr->pusb_intf, NULL);
+-      usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf,
+-                      ucr->iobuf_dma);
++      kfree(ucr->rsp_buf);
++      ucr->rsp_buf = NULL;
++out_free_cmd_buf:
++      kfree(ucr->cmd_buf);
++      ucr->cmd_buf = NULL;
+       return ret;
+ }
+ 
+@@ -693,8 +700,12 @@ static void rtsx_usb_disconnect(struct usb_interface 
*intf)
+       mfd_remove_devices(&intf->dev);
+ 
+       usb_set_intfdata(ucr->pusb_intf, NULL);
+-      usb_free_coherent(ucr->pusb_dev, IOBUF_SIZE, ucr->iobuf,
+-                      ucr->iobuf_dma);
++
++      kfree(ucr->cmd_buf);
++      ucr->cmd_buf = NULL;
++
++      kfree(ucr->rsp_buf);
++      ucr->rsp_buf = NULL;
+ }
+ 
+ #ifdef CONFIG_PM
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c 
b/drivers/net/ethernet/emulex/benet/be_cmds.c
+index 8887dd3abed71..619cc13ffb550 100644
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
+@@ -2291,7 +2291,7 @@ err:
+ 
+ /* Uses sync mcc */
+ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter,
+-                                    u8 page_num, u8 *data)
++                                    u8 page_num, u32 off, u32 len, u8 *data)
+ {
+       struct be_dma_mem cmd;
+       struct be_mcc_wrb *wrb;
+@@ -2325,10 +2325,10 @@ int be_cmd_read_port_transceiver_data(struct 
be_adapter *adapter,
+       req->port = cpu_to_le32(adapter->hba_port_num);
+       req->page_num = cpu_to_le32(page_num);
+       status = be_mcc_notify_wait(adapter);
+-      if (!status) {
++      if (!status && len > 0) {
+               struct be_cmd_resp_port_type *resp = cmd.va;
+ 
+-              memcpy(data, resp->page_data, PAGE_DATA_LEN);
++              memcpy(data, resp->page_data + off, len);
+       }
+ err:
+       mutex_unlock(&adapter->mcc_lock);
+@@ -2419,7 +2419,7 @@ int be_cmd_query_cable_type(struct be_adapter *adapter)
+       int status;
+ 
+       status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0,
+-                                                 page_data);
++                                                 0, PAGE_DATA_LEN, page_data);
+       if (!status) {
+               switch (adapter->phy.interface_type) {
+               case PHY_TYPE_QSFP:
+@@ -2444,7 +2444,7 @@ int be_cmd_query_sfp_info(struct be_adapter *adapter)
+       int status;
+ 
+       status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0,
+-                                                 page_data);
++                                                 0, PAGE_DATA_LEN, page_data);
+       if (!status) {
+               strlcpy(adapter->phy.vendor_name, page_data +
+                       SFP_VENDOR_NAME_OFFSET, SFP_VENDOR_NAME_LEN - 1);
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h 
b/drivers/net/ethernet/emulex/benet/be_cmds.h
+index 09da2d82c2f0d..8af11a5e49fe2 100644
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
+@@ -2431,7 +2431,7 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, 
u8 port_num, u8 beacon,
+ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num,
+                           u32 *state);
+ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter,
+-                                    u8 page_num, u8 *data);
++                                    u8 page_num, u32 off, u32 len, u8 *data);
+ int be_cmd_query_cable_type(struct be_adapter *adapter);
+ int be_cmd_query_sfp_info(struct be_adapter *adapter);
+ int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
+diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c 
b/drivers/net/ethernet/emulex/benet/be_ethtool.c
+index 56db37d929374..ca7750f483f98 100644
+--- a/drivers/net/ethernet/emulex/benet/be_ethtool.c
++++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c
+@@ -1345,7 +1345,7 @@ static int be_get_module_info(struct net_device *netdev,
+               return -EOPNOTSUPP;
+ 
+       status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0,
+-                                                 page_data);
++                                                 0, PAGE_DATA_LEN, page_data);
+       if (!status) {
+               if (!page_data[SFP_PLUS_SFF_8472_COMP]) {
+                       modinfo->type = ETH_MODULE_SFF_8079;
+@@ -1363,25 +1363,32 @@ static int be_get_module_eeprom(struct net_device 
*netdev,
+ {
+       struct be_adapter *adapter = netdev_priv(netdev);
+       int status;
++      u32 begin, end;
+ 
+       if (!check_privilege(adapter, MAX_PRIVILEGES))
+               return -EOPNOTSUPP;
+ 
+-      status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0,
+-                                                 data);
+-      if (status)
+-              goto err;
++      begin = eeprom->offset;
++      end = eeprom->offset + eeprom->len;
++
++      if (begin < PAGE_DATA_LEN) {
++              status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, 
begin,
++                                                         min_t(u32, end, 
PAGE_DATA_LEN) - begin,
++                                                         data);
++              if (status)
++                      goto err;
++
++              data += PAGE_DATA_LEN - begin;
++              begin = PAGE_DATA_LEN;
++      }
+ 
+-      if (eeprom->offset + eeprom->len > PAGE_DATA_LEN) {
+-              status = be_cmd_read_port_transceiver_data(adapter,
+-                                                         TR_PAGE_A2,
+-                                                         data +
+-                                                         PAGE_DATA_LEN);
++      if (end > PAGE_DATA_LEN) {
++              status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A2,
++                                                         begin - 
PAGE_DATA_LEN,
++                                                         end - begin, data);
+               if (status)
+                       goto err;
+       }
+-      if (eeprom->offset)
+-              memcpy(data, data + eeprom->offset, eeprom->len);
+ err:
+       return be_cmd_status(status);
+ }
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
+index 48938d00ff7e8..460a0294ea97e 100644
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -1703,7 +1703,7 @@ static const struct driver_info ax88179_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+@@ -1716,7 +1716,7 @@ static const struct driver_info ax88178a_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+@@ -1729,7 +1729,7 @@ static const struct driver_info cypress_GX3_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+@@ -1742,7 +1742,7 @@ static const struct driver_info dlink_dub1312_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+@@ -1755,7 +1755,7 @@ static const struct driver_info sitecom_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+@@ -1768,7 +1768,7 @@ static const struct driver_info samsung_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+@@ -1781,7 +1781,7 @@ static const struct driver_info lenovo_info = {
+       .link_reset = ax88179_link_reset,
+       .reset = ax88179_reset,
+       .stop = ax88179_stop,
+-      .flags = FLAG_ETHER | FLAG_FRAMING_AX,
++      .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP,
+       .rx_fixup = ax88179_rx_fixup,
+       .tx_fixup = ax88179_tx_fixup,
+ };
+diff --git a/drivers/power/reset/arm-versatile-reboot.c 
b/drivers/power/reset/arm-versatile-reboot.c
+index 06d34ab47df53..8022c782f6ff3 100644
+--- a/drivers/power/reset/arm-versatile-reboot.c
++++ b/drivers/power/reset/arm-versatile-reboot.c
+@@ -150,6 +150,7 @@ static int __init versatile_reboot_probe(void)
+       versatile_reboot_type = (enum versatile_reboot)reboot_id->data;
+ 
+       syscon_regmap = syscon_node_to_regmap(np);
++      of_node_put(np);
+       if (IS_ERR(syscon_regmap))
+               return PTR_ERR(syscon_regmap);
+ 
+diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h
+index a31f339211d58..b3172908f18c3 100644
+--- a/drivers/s390/char/keyboard.h
++++ b/drivers/s390/char/keyboard.h
+@@ -44,7 +44,7 @@ static inline void
+ kbd_put_queue(struct tty_port *port, int ch)
+ {
+       tty_insert_flip_char(port, ch, 0);
+-      tty_schedule_flip(port);
++      tty_flip_buffer_push(port);
+ }
+ 
+ static inline void
+@@ -52,5 +52,5 @@ kbd_puts_queue(struct tty_port *port, char *cp)
+ {
+       while (*cp)
+               tty_insert_flip_char(port, *cp++, 0);
+-      tty_schedule_flip(port);
++      tty_flip_buffer_push(port);
+ }
+diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
+index 5e4fa92068615..3e1d03a1b8e5a 100644
+--- a/drivers/tty/cyclades.c
++++ b/drivers/tty/cyclades.c
+@@ -556,7 +556,7 @@ static void cyy_chip_rx(struct cyclades_card *cinfo, int 
chip,
+               }
+               info->idle_stats.recv_idle = jiffies;
+       }
+-      tty_schedule_flip(port);
++      tty_flip_buffer_push(port);
+ 
+       /* end of service */
+       cyy_writeb(info, CyRIR, save_xir & 0x3f);
+@@ -998,7 +998,7 @@ static void cyz_handle_rx(struct cyclades_port *info)
+                               jiffies + 1);
+ #endif
+       info->idle_stats.recv_idle = jiffies;
+-      tty_schedule_flip(&info->port);
++      tty_flip_buffer_push(&info->port);
+ 
+       /* Update rx_get */
+       cy_writel(&buf_ctrl->rx_get, new_rx_get);
+@@ -1174,7 +1174,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
+               if (delta_count)
+                       wake_up_interruptible(&info->port.delta_msr_wait);
+               if (special_count)
+-                      tty_schedule_flip(&info->port);
++                      tty_flip_buffer_push(&info->port);
+       }
+ }
+ 
+diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
+index 996bd473dd03e..5c075c3808af1 100644
+--- a/drivers/tty/goldfish.c
++++ b/drivers/tty/goldfish.c
+@@ -85,7 +85,7 @@ static irqreturn_t goldfish_tty_interrupt(int irq, void 
*dev_id)
+       writel(count, base + GOLDFISH_TTY_DATA_LEN);
+       writel(GOLDFISH_TTY_CMD_READ_BUFFER, base + GOLDFISH_TTY_CMD);
+       spin_unlock_irqrestore(&qtty->lock, irq_flags);
+-      tty_schedule_flip(&qtty->port);
++      tty_flip_buffer_push(&qtty->port);
+       return IRQ_HANDLED;
+ }
+ 
+diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
+index 60d37b225589c..0a17abf484d47 100644
+--- a/drivers/tty/moxa.c
++++ b/drivers/tty/moxa.c
+@@ -1397,7 +1397,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned 
int handle,
+               if (inited && !tty_throttled(tty) &&
+                               MoxaPortRxQueue(p) > 0) { /* RX */
+                       MoxaPortReadData(p);
+-                      tty_schedule_flip(&p->port);
++                      tty_flip_buffer_push(&p->port);
+               }
+       } else {
+               clear_bit(EMPTYWAIT, &p->statusflags);
+@@ -1422,7 +1422,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned 
int handle,
+ 
+       if (tty && (intr & IntrBreak) && !I_IGNBRK(tty)) { /* BREAK */
+               tty_insert_flip_char(&p->port, 0, TTY_BREAK);
+-              tty_schedule_flip(&p->port);
++              tty_flip_buffer_push(&p->port);
+       }
+ 
+       if (intr & IntrLine)
+diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
+index 8a063a036bc08..f13f2535cc85b 100644
+--- a/drivers/tty/pty.c
++++ b/drivers/tty/pty.c
+@@ -106,21 +106,11 @@ static void pty_unthrottle(struct tty_struct *tty)
+ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
+ {
+       struct tty_struct *to = tty->link;
+-      unsigned long flags;
+ 
+-      if (tty->stopped)
++      if (tty->stopped || !c)
+               return 0;
+ 
+-      if (c > 0) {
+-              spin_lock_irqsave(&to->port->lock, flags);
+-              /* Stuff the data into the input queue of the other end */
+-              c = tty_insert_flip_string(to->port, buf, c);
+-              spin_unlock_irqrestore(&to->port->lock, flags);
+-              /* And shovel */
+-              if (c)
+-                      tty_flip_buffer_push(to->port);
+-      }
+-      return c;
++      return tty_insert_flip_string_and_push_buffer(to->port, buf, c);
+ }
+ 
+ /**
+diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
+index 7eb04ae71cc87..c74b30fa7bea0 100644
+--- a/drivers/tty/serial/lpc32xx_hs.c
++++ b/drivers/tty/serial/lpc32xx_hs.c
+@@ -350,7 +350,7 @@ static irqreturn_t serial_lpc32xx_interrupt(int irq, void 
*dev_id)
+                      LPC32XX_HSUART_IIR(port->membase));
+               port->icount.overrun++;
+               tty_insert_flip_char(tport, 0, TTY_OVERRUN);
+-              tty_schedule_flip(tport);
++              tty_flip_buffer_push(tport);
+       }
+ 
+       /* Data received? */
+diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
+index e65faa98146ef..17ccfc33dc3d6 100644
+--- a/drivers/tty/tty_buffer.c
++++ b/drivers/tty/tty_buffer.c
+@@ -388,27 +388,6 @@ int __tty_insert_flip_char(struct tty_port *port, 
unsigned char ch, char flag)
+ }
+ EXPORT_SYMBOL(__tty_insert_flip_char);
+ 
+-/**
+- *    tty_schedule_flip       -       push characters to ldisc
+- *    @port: tty port to push from
+- *
+- *    Takes any pending buffers and transfers their ownership to the
+- *    ldisc side of the queue. It then schedules those characters for
+- *    processing by the line discipline.
+- */
+-
+-void tty_schedule_flip(struct tty_port *port)
+-{
+-      struct tty_bufhead *buf = &port->buf;
+-
+-      /* paired w/ acquire in flush_to_ldisc(); ensures
+-       * flush_to_ldisc() sees buffer data.
+-       */
+-      smp_store_release(&buf->tail->commit, buf->tail->used);
+-      queue_work(system_unbound_wq, &buf->work);
+-}
+-EXPORT_SYMBOL(tty_schedule_flip);
+-
+ /**
+  *    tty_prepare_flip_string         -       make room for characters
+  *    @port: tty port
+@@ -547,6 +526,15 @@ static void flush_to_ldisc(struct work_struct *work)
+       tty_ldisc_deref(disc);
+ }
+ 
++static inline void tty_flip_buffer_commit(struct tty_buffer *tail)
++{
++      /*
++       * Paired w/ acquire in flush_to_ldisc(); ensures flush_to_ldisc() sees
++       * buffer data.
++       */
++      smp_store_release(&tail->commit, tail->used);
++}
++
+ /**
+  *    tty_flip_buffer_push    -       terminal
+  *    @port: tty port to push
+@@ -560,10 +548,44 @@ static void flush_to_ldisc(struct work_struct *work)
+ 
+ void tty_flip_buffer_push(struct tty_port *port)
+ {
+-      tty_schedule_flip(port);
++      struct tty_bufhead *buf = &port->buf;
++
++      tty_flip_buffer_commit(buf->tail);
++      queue_work(system_unbound_wq, &buf->work);
+ }
+ EXPORT_SYMBOL(tty_flip_buffer_push);
+ 
++/**
++ * tty_insert_flip_string_and_push_buffer - add characters to the tty buffer 
and
++ *    push
++ * @port: tty port
++ * @chars: characters
++ * @size: size
++ *
++ * The function combines tty_insert_flip_string() and tty_flip_buffer_push()
++ * with the exception of properly holding the @port->lock.
++ *
++ * To be used only internally (by pty currently).
++ *
++ * Returns: the number added.
++ */
++int tty_insert_flip_string_and_push_buffer(struct tty_port *port,
++              const unsigned char *chars, size_t size)
++{
++      struct tty_bufhead *buf = &port->buf;
++      unsigned long flags;
++
++      spin_lock_irqsave(&port->lock, flags);
++      size = tty_insert_flip_string(port, chars, size);
++      if (size)
++              tty_flip_buffer_commit(buf->tail);
++      spin_unlock_irqrestore(&port->lock, flags);
++
++      queue_work(system_unbound_wq, &buf->work);
++
++      return size;
++}
++
+ /**
+  *    tty_buffer_init         -       prepare a tty buffer structure
+  *    @tty: tty to initialise
+diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
+index 4bc6261ef3c1a..1d20abd7d3c6f 100644
+--- a/drivers/tty/vt/keyboard.c
++++ b/drivers/tty/vt/keyboard.c
+@@ -308,7 +308,7 @@ int kbd_rate(struct kbd_repeat *rpt)
+ static void put_queue(struct vc_data *vc, int ch)
+ {
+       tty_insert_flip_char(&vc->port, ch, 0);
+-      tty_schedule_flip(&vc->port);
++      tty_flip_buffer_push(&vc->port);
+ }
+ 
+ static void puts_queue(struct vc_data *vc, char *cp)
+@@ -317,7 +317,7 @@ static void puts_queue(struct vc_data *vc, char *cp)
+               tty_insert_flip_char(&vc->port, *cp, 0);
+               cp++;
+       }
+-      tty_schedule_flip(&vc->port);
++      tty_flip_buffer_push(&vc->port);
+ }
+ 
+ static void applkey(struct vc_data *vc, int key, char mode)
+@@ -562,7 +562,7 @@ static void fn_inc_console(struct vc_data *vc)
+ static void fn_send_intr(struct vc_data *vc)
+ {
+       tty_insert_flip_char(&vc->port, 0, TTY_BREAK);
+-      tty_schedule_flip(&vc->port);
++      tty_flip_buffer_push(&vc->port);
+ }
+ 
+ static void fn_scroll_forw(struct vc_data *vc)
+diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
+index f7a035fa9a97a..29037322d047c 100644
+--- a/drivers/tty/vt/vt.c
++++ b/drivers/tty/vt/vt.c
+@@ -1484,7 +1484,7 @@ static void respond_string(const char *p, struct 
tty_port *port)
+               tty_insert_flip_char(port, *p, 0);
+               p++;
+       }
+-      tty_schedule_flip(port);
++      tty_flip_buffer_push(port);
+ }
+ 
+ static void cursor_report(struct vc_data *vc, struct tty_struct *tty)
+diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
+index 2c3248e71e9c1..a6585854a85fc 100644
+--- a/drivers/xen/gntdev.c
++++ b/drivers/xen/gntdev.c
+@@ -390,7 +390,8 @@ static void __unmap_grant_pages_done(int result,
+       unsigned int offset = data->unmap_ops - map->unmap_ops;
+ 
+       for (i = 0; i < data->count; i++) {
+-              WARN_ON(map->unmap_ops[offset+i].status);
++              WARN_ON(map->unmap_ops[offset+i].status &&
++                      map->unmap_ops[offset+i].handle != -1);
+               pr_debug("unmap handle=%d st=%d\n",
+                       map->unmap_ops[offset+i].handle,
+                       map->unmap_ops[offset+i].status);
+diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
+index 53ac461f342bb..491385a8a69d9 100644
+--- a/include/linux/lsm_hooks.h
++++ b/include/linux/lsm_hooks.h
+@@ -666,11 +666,6 @@
+  *    @sig contains the signal value.
+  *    @secid contains the sid of the process where the signal originated
+  *    Return 0 if permission is granted.
+- * @task_wait:
+- *    Check permission before allowing a process to reap a child process @p
+- *    and collect its status information.
+- *    @p contains the task_struct for process.
+- *    Return 0 if permission is granted.
+  * @task_prctl:
+  *    Check permission before performing a process control operation on the
+  *    current process.
+@@ -1507,7 +1502,6 @@ union security_list_options {
+       int (*task_movememory)(struct task_struct *p);
+       int (*task_kill)(struct task_struct *p, struct siginfo *info,
+                               int sig, u32 secid);
+-      int (*task_wait)(struct task_struct *p);
+       int (*task_prctl)(int option, unsigned long arg2, unsigned long arg3,
+                               unsigned long arg4, unsigned long arg5);
+       void (*task_to_inode)(struct task_struct *p, struct inode *inode);
+@@ -1768,7 +1762,6 @@ struct security_hook_heads {
+       struct list_head task_getscheduler;
+       struct list_head task_movememory;
+       struct list_head task_kill;
+-      struct list_head task_wait;
+       struct list_head task_prctl;
+       struct list_head task_to_inode;
+       struct list_head ipc_permission;
+diff --git a/include/linux/mfd/rtsx_usb.h b/include/linux/mfd/rtsx_usb.h
+index c446e4fd6b5cc..09b08ff08830c 100644
+--- a/include/linux/mfd/rtsx_usb.h
++++ b/include/linux/mfd/rtsx_usb.h
+@@ -65,8 +65,6 @@ struct rtsx_ucr {
+       struct usb_device       *pusb_dev;
+       struct usb_interface    *pusb_intf;
+       struct usb_sg_request   current_sg;
+-      unsigned char           *iobuf;
+-      dma_addr_t              iobuf_dma;
+ 
+       struct timer_list       sg_timer;
+       struct mutex            dev_mutex;
+diff --git a/include/linux/security.h b/include/linux/security.h
+index 2f5d282bd3eca..472822a1e02bf 100644
+--- a/include/linux/security.h
++++ b/include/linux/security.h
+@@ -332,7 +332,6 @@ int security_task_getscheduler(struct task_struct *p);
+ int security_task_movememory(struct task_struct *p);
+ int security_task_kill(struct task_struct *p, struct siginfo *info,
+                       int sig, u32 secid);
+-int security_task_wait(struct task_struct *p);
+ int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
+                       unsigned long arg4, unsigned long arg5);
+ void security_task_to_inode(struct task_struct *p, struct inode *inode);
+@@ -980,11 +979,6 @@ static inline int security_task_kill(struct task_struct 
*p,
+       return 0;
+ }
+ 
+-static inline int security_task_wait(struct task_struct *p)
+-{
+-      return 0;
+-}
+-
+ static inline int security_task_prctl(int option, unsigned long arg2,
+                                     unsigned long arg3,
+                                     unsigned long arg4,
+diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
+index d43837f2ce3ae..67ccce8be5fba 100644
+--- a/include/linux/tty_flip.h
++++ b/include/linux/tty_flip.h
+@@ -11,7 +11,6 @@ extern int tty_insert_flip_string_fixed_flag(struct tty_port 
*port,
+ extern int tty_prepare_flip_string(struct tty_port *port,
+               unsigned char **chars, size_t size);
+ extern void tty_flip_buffer_push(struct tty_port *port);
+-void tty_schedule_flip(struct tty_port *port);
+ int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char 
flag);
+ 
+ static inline int tty_insert_flip_char(struct tty_port *port,
+@@ -39,4 +38,7 @@ static inline int tty_insert_flip_string(struct tty_port 
*port,
+ extern void tty_buffer_lock_exclusive(struct tty_port *port);
+ extern void tty_buffer_unlock_exclusive(struct tty_port *port);
+ 
++int tty_insert_flip_string_and_push_buffer(struct tty_port *port,
++              const unsigned char *chars, size_t cnt);
++
+ #endif /* _LINUX_TTY_FLIP_H */
+diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
+index 6213a90a8cecb..f5dbee53fb859 100644
+--- a/include/net/inet_sock.h
++++ b/include/net/inet_sock.h
+@@ -113,7 +113,8 @@ static inline struct inet_request_sock *inet_rsk(const 
struct request_sock *sk)
+ 
+ static inline u32 inet_request_mark(const struct sock *sk, struct sk_buff 
*skb)
+ {
+-      if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept)
++      if (!sk->sk_mark &&
++          READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept))
+               return skb->mark;
+ 
+       return sk->sk_mark;
+diff --git a/include/net/ip.h b/include/net/ip.h
+index c762fd047ef4c..f0e13a2565820 100644
+--- a/include/net/ip.h
++++ b/include/net/ip.h
+@@ -283,7 +283,7 @@ void ipfrag_init(void);
+ void ip_static_sysctl_init(void);
+ 
+ #define IP4_REPLY_MARK(net, mark) \
+-      ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0)
++      (READ_ONCE((net)->ipv4.sysctl_fwmark_reflect) ? (mark) : 0)
+ 
+ static inline bool ip_is_fragment(const struct iphdr *iph)
+ {
+diff --git a/include/net/tcp.h b/include/net/tcp.h
+index 97df2f6fcbd79..164dc4f04d0f1 100644
+--- a/include/net/tcp.h
++++ b/include/net/tcp.h
+@@ -1788,7 +1788,7 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 
saddr, __be32 daddr);
+ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
+ {
+       struct net *net = sock_net((struct sock *)tp);
+-      return tp->notsent_lowat ?: net->ipv4.sysctl_tcp_notsent_lowat;
++      return tp->notsent_lowat ?: 
READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);
+ }
+ 
+ static inline bool tcp_stream_memory_free(const struct sock *sk)
+diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
+index 3ce69c0276c09..9976703f2dbfa 100644
+--- a/kernel/bpf/core.c
++++ b/kernel/bpf/core.c
+@@ -60,11 +60,13 @@ void *bpf_internal_load_pointer_neg_helper(const struct 
sk_buff *skb, int k, uns
+ {
+       u8 *ptr = NULL;
+ 
+-      if (k >= SKF_NET_OFF)
++      if (k >= SKF_NET_OFF) {
+               ptr = skb_network_header(skb) + k - SKF_NET_OFF;
+-      else if (k >= SKF_LL_OFF)
++      } else if (k >= SKF_LL_OFF) {
++              if (unlikely(!skb_mac_header_was_set(skb)))
++                      return NULL;
+               ptr = skb_mac_header(skb) + k - SKF_LL_OFF;
+-
++      }
+       if (ptr >= skb->head && ptr + size <= skb_tail_pointer(skb))
+               return ptr;
+ 
+diff --git a/kernel/events/core.c b/kernel/events/core.c
+index 2466e2ae54dc1..58ef731d52c76 100644
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -5291,10 +5291,10 @@ again:
+ 
+               if (!atomic_inc_not_zero(&event->rb->mmap_count)) {
+                       /*
+-                       * Raced against perf_mmap_close() through
+-                       * perf_event_set_output(). Try again, hope for better
+-                       * luck.
++                       * Raced against perf_mmap_close(); remove the
++                       * event and try again.
+                        */
++                      ring_buffer_attach(event, NULL);
+                       mutex_unlock(&event->mmap_mutex);
+                       goto again;
+               }
+@@ -9542,14 +9542,25 @@ err_size:
+       goto out;
+ }
+ 
++static void mutex_lock_double(struct mutex *a, struct mutex *b)
++{
++      if (b < a)
++              swap(a, b);
++
++      mutex_lock(a);
++      mutex_lock_nested(b, SINGLE_DEPTH_NESTING);
++}
++
+ static int
+ perf_event_set_output(struct perf_event *event, struct perf_event 
*output_event)
+ {
+       struct ring_buffer *rb = NULL;
+       int ret = -EINVAL;
+ 
+-      if (!output_event)
++      if (!output_event) {
++              mutex_lock(&event->mmap_mutex);
+               goto set;
++      }
+ 
+       /* don't allow circular references */
+       if (event == output_event)
+@@ -9587,8 +9598,15 @@ perf_event_set_output(struct perf_event *event, struct 
perf_event *output_event)
+           event->pmu != output_event->pmu)
+               goto out;
+ 
++      /*
++       * Hold both mmap_mutex to serialize against perf_mmap_close().  Since
++       * output_event is already on rb->event_list, and the list iteration
++       * restarts after every removal, it is guaranteed this new event is
++       * observed *OR* if output_event is already removed, it's guaranteed we
++       * observe !rb->mmap_count.
++       */
++      mutex_lock_double(&event->mmap_mutex, &output_event->mmap_mutex);
+ set:
+-      mutex_lock(&event->mmap_mutex);
+       /* Can't redirect output if we've got an active mmap() */
+       if (atomic_read(&event->mmap_count))
+               goto unlock;
+@@ -9598,6 +9616,12 @@ set:
+               rb = ring_buffer_get(output_event);
+               if (!rb)
+                       goto unlock;
++
++              /* did we race against perf_mmap_close() */
++              if (!atomic_read(&rb->mmap_count)) {
++                      ring_buffer_put(rb);
++                      goto unlock;
++              }
+       }
+ 
+       ring_buffer_attach(event, rb);
+@@ -9605,20 +9629,13 @@ set:
+       ret = 0;
+ unlock:
+       mutex_unlock(&event->mmap_mutex);
++      if (output_event)
++              mutex_unlock(&output_event->mmap_mutex);
+ 
+ out:
+       return ret;
+ }
+ 
+-static void mutex_lock_double(struct mutex *a, struct mutex *b)
+-{
+-      if (b < a)
+-              swap(a, b);
+-
+-      mutex_lock(a);
+-      mutex_lock_nested(b, SINGLE_DEPTH_NESTING);
+-}
+-
+ static int perf_event_set_clock(struct perf_event *event, clockid_t clk_id)
+ {
+       bool nmi_safe = false;
+diff --git a/kernel/exit.c b/kernel/exit.c
+index 8716f0780fe3d..e0db254a405bb 100644
+--- a/kernel/exit.c
++++ b/kernel/exit.c
+@@ -14,7 +14,6 @@
+ #include <linux/tty.h>
+ #include <linux/iocontext.h>
+ #include <linux/key.h>
+-#include <linux/security.h>
+ #include <linux/cpu.h>
+ #include <linux/acct.h>
+ #include <linux/tsacct_kern.h>
+@@ -1342,7 +1341,7 @@ static int wait_task_continued(struct wait_opts *wo, 
struct task_struct *p)
+  * Returns nonzero for a final return, when we have unlocked tasklist_lock.
+  * Returns zero if the search for a child should continue;
+  * then ->notask_error is 0 if @p is an eligible child,
+- * or another error from security_task_wait(), or still -ECHILD.
++ * or still -ECHILD.
+  */
+ static int wait_consider_task(struct wait_opts *wo, int ptrace,
+                               struct task_struct *p)
+@@ -1362,20 +1361,6 @@ static int wait_consider_task(struct wait_opts *wo, int 
ptrace,
+       if (!ret)
+               return ret;
+ 
+-      ret = security_task_wait(p);
+-      if (unlikely(ret < 0)) {
+-              /*
+-               * If we have not yet seen any eligible child,
+-               * then let this error code replace -ECHILD.
+-               * A permission error will give the user a clue
+-               * to look for security policy problems, rather
+-               * than for mysterious wait bugs.
+-               */
+-              if (wo->notask_error)
+-                      wo->notask_error = ret;
+-              return 0;
+-      }
+-
+       if (unlikely(exit_state == EXIT_TRACE)) {
+               /*
+                * ptrace == 0 means we are the natural parent. In this case
+@@ -1468,7 +1453,7 @@ static int wait_consider_task(struct wait_opts *wo, int 
ptrace,
+  * Returns nonzero for a final return, when we have unlocked tasklist_lock.
+  * Returns zero if the search for a child should continue; then
+  * ->notask_error is 0 if there were any eligible children,
+- * or another error from security_task_wait(), or still -ECHILD.
++ * or still -ECHILD.
+  */
+ static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk)
+ {
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c
+index 6059f85546fe9..2990a05777bde 100644
+--- a/mm/mempolicy.c
++++ b/mm/mempolicy.c
+@@ -396,7 +396,7 @@ static void mpol_rebind_preferred(struct mempolicy *pol,
+ static void mpol_rebind_policy(struct mempolicy *pol, const nodemask_t 
*newmask,
+                               enum mpol_rebind_step step)
+ {
+-      if (!pol)
++      if (!pol || pol->mode == MPOL_LOCAL)
+               return;
+       if (!mpol_store_user_nodemask(pol) && step == MPOL_REBIND_ONCE &&
+           nodes_equal(pol->w.cpuset_mems_allowed, *newmask))
+diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
+index 75f961425639e..3c09bee931b7a 100644
+--- a/net/ipv4/igmp.c
++++ b/net/ipv4/igmp.c
+@@ -474,7 +474,8 @@ static struct sk_buff *add_grec(struct sk_buff *skb, 
struct ip_mc_list *pmc,
+ 
+       if (pmc->multiaddr == IGMP_ALL_HOSTS)
+               return skb;
+-      if (ipv4_is_local_multicast(pmc->multiaddr) && 
!net->ipv4.sysctl_igmp_llm_reports)
++      if (ipv4_is_local_multicast(pmc->multiaddr) &&
++          !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+               return skb;
+ 
+       mtu = READ_ONCE(dev->mtu);
+@@ -600,7 +601,7 @@ static int igmpv3_send_report(struct in_device *in_dev, 
struct ip_mc_list *pmc)
+                       if (pmc->multiaddr == IGMP_ALL_HOSTS)
+                               continue;
+                       if (ipv4_is_local_multicast(pmc->multiaddr) &&
+-                           !net->ipv4.sysctl_igmp_llm_reports)
++                          !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+                               continue;
+                       spin_lock_bh(&pmc->lock);
+                       if (pmc->sfcount[MCAST_EXCLUDE])
+@@ -743,7 +744,8 @@ static int igmp_send_report(struct in_device *in_dev, 
struct ip_mc_list *pmc,
+       if (type == IGMPV3_HOST_MEMBERSHIP_REPORT)
+               return igmpv3_send_report(in_dev, pmc);
+ 
+-      if (ipv4_is_local_multicast(group) && 
!net->ipv4.sysctl_igmp_llm_reports)
++      if (ipv4_is_local_multicast(group) &&
++          !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+               return 0;
+ 
+       if (type == IGMP_HOST_LEAVE_MESSAGE)
+@@ -921,7 +923,8 @@ static bool igmp_heard_report(struct in_device *in_dev, 
__be32 group)
+ 
+       if (group == IGMP_ALL_HOSTS)
+               return false;
+-      if (ipv4_is_local_multicast(group) && 
!net->ipv4.sysctl_igmp_llm_reports)
++      if (ipv4_is_local_multicast(group) &&
++          !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+               return false;
+ 
+       rcu_read_lock();
+@@ -1031,7 +1034,7 @@ static bool igmp_heard_query(struct in_device *in_dev, 
struct sk_buff *skb,
+               if (im->multiaddr == IGMP_ALL_HOSTS)
+                       continue;
+               if (ipv4_is_local_multicast(im->multiaddr) &&
+-                  !net->ipv4.sysctl_igmp_llm_reports)
++                  !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+                       continue;
+               spin_lock_bh(&im->lock);
+               if (im->tm_running)
+@@ -1272,7 +1275,8 @@ static void igmp_group_dropped(struct ip_mc_list *im)
+ #ifdef CONFIG_IP_MULTICAST
+       if (im->multiaddr == IGMP_ALL_HOSTS)
+               return;
+-      if (ipv4_is_local_multicast(im->multiaddr) && 
!net->ipv4.sysctl_igmp_llm_reports)
++      if (ipv4_is_local_multicast(im->multiaddr) &&
++          !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+               return;
+ 
+       reporter = im->reporter;
+@@ -1309,7 +1313,8 @@ static void igmp_group_added(struct ip_mc_list *im)
+ #ifdef CONFIG_IP_MULTICAST
+       if (im->multiaddr == IGMP_ALL_HOSTS)
+               return;
+-      if (ipv4_is_local_multicast(im->multiaddr) && 
!net->ipv4.sysctl_igmp_llm_reports)
++      if (ipv4_is_local_multicast(im->multiaddr) &&
++          !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+               return;
+ 
+       if (in_dev->dead)
+@@ -1621,7 +1626,7 @@ static void ip_mc_rejoin_groups(struct in_device *in_dev)
+               if (im->multiaddr == IGMP_ALL_HOSTS)
+                       continue;
+               if (ipv4_is_local_multicast(im->multiaddr) &&
+-                  !net->ipv4.sysctl_igmp_llm_reports)
++                  !READ_ONCE(net->ipv4.sysctl_igmp_llm_reports))
+                       continue;
+ 
+               /* a failover is happening and switches
+@@ -2166,7 +2171,7 @@ int ip_mc_join_group(struct sock *sk, struct ip_mreqn 
*imr)
+               count++;
+       }
+       err = -ENOBUFS;
+-      if (count >= net->ipv4.sysctl_igmp_max_memberships)
++      if (count >= READ_ONCE(net->ipv4.sysctl_igmp_max_memberships))
+               goto done;
+       iml = sock_kmalloc(sk, sizeof(*iml), GFP_KERNEL);
+       if (!iml)
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
+index e0009cd69da75..5b6d935a028c2 100644
+--- a/net/ipv4/tcp_output.c
++++ b/net/ipv4/tcp_output.c
+@@ -2005,7 +2005,7 @@ static int tcp_mtu_probe(struct sock *sk)
+        * probing process by not resetting search range to its orignal.
+        */
+       if (probe_size > tcp_mtu_to_mss(sk, icsk->icsk_mtup.search_high) ||
+-              interval < net->ipv4.sysctl_tcp_probe_threshold) {
++          interval < READ_ONCE(net->ipv4.sysctl_tcp_probe_threshold)) {
+               /* Check whether enough time has elaplased for
+                * another round of probing.
+                */
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
+index 9179b47e8b61f..0894108f561cb 100644
+--- a/net/xfrm/xfrm_policy.c
++++ b/net/xfrm/xfrm_policy.c
+@@ -1819,8 +1819,10 @@ static int xfrm_expand_policies(const struct flowi *fl, 
u16 family,
+               *num_xfrms = 0;
+               return 0;
+       }
+-      if (IS_ERR(pols[0]))
++      if (IS_ERR(pols[0])) {
++              *num_pols = 0;
+               return PTR_ERR(pols[0]);
++      }
+ 
+       *num_xfrms = pols[0]->xfrm_nr;
+ 
+@@ -1834,6 +1836,7 @@ static int xfrm_expand_policies(const struct flowi *fl, 
u16 family,
+               if (pols[1]) {
+                       if (IS_ERR(pols[1])) {
+                               xfrm_pols_put(pols, *num_pols);
++                              *num_pols = 0;
+                               return PTR_ERR(pols[1]);
+                       }
+                       (*num_pols)++;
+diff --git a/security/security.c b/security/security.c
+index 9a13d72a64465..5171c3cd1d304 100644
+--- a/security/security.c
++++ b/security/security.c
+@@ -1032,11 +1032,6 @@ int security_task_kill(struct task_struct *p, struct 
siginfo *info,
+       return call_int_hook(task_kill, 0, p, info, sig, secid);
+ }
+ 
+-int security_task_wait(struct task_struct *p)
+-{
+-      return call_int_hook(task_wait, 0, p);
+-}
+-
+ int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
+                        unsigned long arg4, unsigned long arg5)
+ {
+@@ -1776,7 +1771,6 @@ struct security_hook_heads security_hook_heads = {
+       .task_movememory =
+               LIST_HEAD_INIT(security_hook_heads.task_movememory),
+       .task_kill =    LIST_HEAD_INIT(security_hook_heads.task_kill),
+-      .task_wait =    LIST_HEAD_INIT(security_hook_heads.task_wait),
+       .task_prctl =   LIST_HEAD_INIT(security_hook_heads.task_prctl),
+       .task_to_inode =
+               LIST_HEAD_INIT(security_hook_heads.task_to_inode),
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
+index eb9e2b4e81d92..eb503eccbacc8 100644
+--- a/security/selinux/hooks.c
++++ b/security/selinux/hooks.c
+@@ -3951,11 +3951,6 @@ static int selinux_task_kill(struct task_struct *p, 
struct siginfo *info,
+       return rc;
+ }
+ 
+-static int selinux_task_wait(struct task_struct *p)
+-{
+-      return task_has_perm(p, current, PROCESS__SIGCHLD);
+-}
+-
+ static void selinux_task_to_inode(struct task_struct *p,
+                                 struct inode *inode)
+ {
+@@ -6220,7 +6215,6 @@ static struct security_hook_list selinux_hooks[] = {
+       LSM_HOOK_INIT(task_getscheduler, selinux_task_getscheduler),
+       LSM_HOOK_INIT(task_movememory, selinux_task_movememory),
+       LSM_HOOK_INIT(task_kill, selinux_task_kill),
+-      LSM_HOOK_INIT(task_wait, selinux_task_wait),
+       LSM_HOOK_INIT(task_to_inode, selinux_task_to_inode),
+ 
+       LSM_HOOK_INIT(ipc_permission, selinux_ipc_permission),
+diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
+index 84ed47195cdd2..f01b69ead47ec 100644
+--- a/security/smack/smack_lsm.c
++++ b/security/smack/smack_lsm.c
+@@ -2276,25 +2276,6 @@ static int smack_task_kill(struct task_struct *p, 
struct siginfo *info,
+       return rc;
+ }
+ 
+-/**
+- * smack_task_wait - Smack access check for waiting
+- * @p: task to wait for
+- *
+- * Returns 0
+- */
+-static int smack_task_wait(struct task_struct *p)
+-{
+-      /*
+-       * Allow the operation to succeed.
+-       * Zombies are bad.
+-       * In userless environments (e.g. phones) programs
+-       * get marked with SMACK64EXEC and even if the parent
+-       * and child shouldn't be talking the parent still
+-       * may expect to know when the child exits.
+-       */
+-      return 0;
+-}
+-
+ /**
+  * smack_task_to_inode - copy task smack into the inode blob
+  * @p: task to copy from
+@@ -4686,7 +4667,6 @@ static struct security_hook_list smack_hooks[] = {
+       LSM_HOOK_INIT(task_getscheduler, smack_task_getscheduler),
+       LSM_HOOK_INIT(task_movememory, smack_task_movememory),
+       LSM_HOOK_INIT(task_kill, smack_task_kill),
+-      LSM_HOOK_INIT(task_wait, smack_task_wait),
+       LSM_HOOK_INIT(task_to_inode, smack_task_to_inode),
+ 
+       LSM_HOOK_INIT(ipc_permission, smack_ipc_permission),
+diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
+index 78ffe445d7757..a67fbcabfa67d 100644
+--- a/sound/core/memalloc.c
++++ b/sound/core/memalloc.c
+@@ -177,6 +177,7 @@ int snd_dma_alloc_pages(int type, struct device *device, 
size_t size,
+       if (WARN_ON(!dmab))
+               return -ENXIO;
+ 
++      size = PAGE_ALIGN(size);
+       dmab->dev.type = type;
+       dmab->dev.dev = device;
+       dmab->bytes = 0;

Reply via email to