commit:     7b32dce1b780090fed085118f338b12b31e4ea8f
Author:     Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  8 12:37:04 2021 +0000
Commit:     Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
CommitDate: Wed Sep  8 12:39:36 2021 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7b32dce1

Linux patch 5.14.2

Signed-off-by: Alice Ferrazzi <alicef <AT> gentoo.org>

 0000_README             |   4 +
 1001_linux-5.14.2.patch | 336 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 340 insertions(+)

diff --git a/0000_README b/0000_README
index dc9ab2d..d1db2c0 100644
--- a/0000_README
+++ b/0000_README
@@ -47,6 +47,10 @@ Patch:  1000_linux-5.14.1.patch
 From:   http://www.kernel.org
 Desc:   Linux 5.14.1
 
+Patch:  1001_linux-5.14.2.patch
+From:   http://www.kernel.org
+Desc:   Linux 5.14.2
+
 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/1001_linux-5.14.2.patch b/1001_linux-5.14.2.patch
new file mode 100644
index 0000000..be5d674
--- /dev/null
+++ b/1001_linux-5.14.2.patch
@@ -0,0 +1,336 @@
+diff --git a/Makefile b/Makefile
+index 83d1f7c1fd304..9a2b00ecc6af4 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0
+ VERSION = 5
+ PATCHLEVEL = 14
+-SUBLEVEL = 1
++SUBLEVEL = 2
+ EXTRAVERSION =
+ NAME = Opossums on Parade
+ 
+diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
+index 3878880469d10..b843902ad9fd7 100644
+--- a/arch/xtensa/Kconfig
++++ b/arch/xtensa/Kconfig
+@@ -30,7 +30,7 @@ config XTENSA
+       select HAVE_DMA_CONTIGUOUS
+       select HAVE_EXIT_THREAD
+       select HAVE_FUNCTION_TRACER
+-      select HAVE_FUTEX_CMPXCHG if !MMU
++      select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX
+       select HAVE_HW_BREAKPOINT if PERF_EVENTS
+       select HAVE_IRQ_TIME_ACCOUNTING
+       select HAVE_PCI
+diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
+index 06130dc431a04..b234958f883a4 100644
+--- a/drivers/hid/usbhid/hid-core.c
++++ b/drivers/hid/usbhid/hid-core.c
+@@ -377,27 +377,27 @@ static int hid_submit_ctrl(struct hid_device *hid)
+       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;
+               if (raw_report) {
+                       memcpy(usbhid->ctrlbuf, raw_report, len);
+                       kfree(raw_report);
+                       usbhid->ctrl[usbhid->ctrltail].raw_report = NULL;
+               }
+       } else {
+-              int maxpacket, padlen;
++              int maxpacket;
+ 
+               usbhid->urbctrl->pipe = usb_rcvctrlpipe(hid_to_usb_dev(hid), 0);
+               maxpacket = usb_maxpacket(hid_to_usb_dev(hid),
+                                         usbhid->urbctrl->pipe, 0);
+               if (maxpacket > 0) {
+-                      padlen = DIV_ROUND_UP(len, maxpacket);
+-                      padlen *= maxpacket;
+-                      if (padlen > usbhid->bufsize)
+-                              padlen = usbhid->bufsize;
++                      len += (len == 0);    /* Don't allow 0-length reports */
++                      len = DIV_ROUND_UP(len, maxpacket);
++                      len *= maxpacket;
++                      if (len > usbhid->bufsize)
++                              len = usbhid->bufsize;
+               } else
+-                      padlen = 0;
+-              usbhid->urbctrl->transfer_buffer_length = padlen;
++                      len = 0;
+       }
++      usbhid->urbctrl->transfer_buffer_length = len;
+       usbhid->urbctrl->dev = hid_to_usb_dev(hid);
+ 
+       usbhid->cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE | dir;
+diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c 
b/drivers/media/usb/stkwebcam/stk-webcam.c
+index a45d464427c4c..0e231e576dc3d 100644
+--- a/drivers/media/usb/stkwebcam/stk-webcam.c
++++ b/drivers/media/usb/stkwebcam/stk-webcam.c
+@@ -1346,7 +1346,7 @@ static int stk_camera_probe(struct usb_interface 
*interface,
+       if (!dev->isoc_ep) {
+               pr_err("Could not find isoc-in endpoint\n");
+               err = -ENODEV;
+-              goto error;
++              goto error_put;
+       }
+       dev->vsettings.palette = V4L2_PIX_FMT_RGB565;
+       dev->vsettings.mode = MODE_VGA;
+@@ -1359,10 +1359,12 @@ static int stk_camera_probe(struct usb_interface 
*interface,
+ 
+       err = stk_register_video_device(dev);
+       if (err)
+-              goto error;
++              goto error_put;
+ 
+       return 0;
+ 
++error_put:
++      usb_put_intf(interface);
+ error:
+       v4l2_ctrl_handler_free(hdl);
+       v4l2_device_unregister(&dev->v4l2_dev);
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
+index 3c80bfbf3bec9..d48bed5782a5c 100644
+--- a/drivers/usb/serial/cp210x.c
++++ b/drivers/usb/serial/cp210x.c
+@@ -1164,10 +1164,8 @@ static int cp210x_set_chars(struct usb_serial_port 
*port,
+ 
+       kfree(dmabuf);
+ 
+-      if (result < 0) {
+-              dev_err(&port->dev, "failed to set special chars: %d\n", 
result);
++      if (result < 0)
+               return result;
+-      }
+ 
+       return 0;
+ }
+@@ -1192,6 +1190,7 @@ static void cp210x_set_flow_control(struct tty_struct 
*tty,
+       struct cp210x_flow_ctl flow_ctl;
+       u32 flow_repl;
+       u32 ctl_hs;
++      bool crtscts;
+       int ret;
+ 
+       /*
+@@ -1219,8 +1218,10 @@ static void cp210x_set_flow_control(struct tty_struct 
*tty,
+               chars.bXoffChar = STOP_CHAR(tty);
+ 
+               ret = cp210x_set_chars(port, &chars);
+-              if (ret)
+-                      return;
++              if (ret) {
++                      dev_err(&port->dev, "failed to set special chars: %d\n",
++                                      ret);
++              }
+       }
+ 
+       mutex_lock(&port_priv->mutex);
+@@ -1249,14 +1250,14 @@ static void cp210x_set_flow_control(struct tty_struct 
*tty,
+                       flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL;
+               else
+                       flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
+-              port_priv->crtscts = true;
++              crtscts = true;
+       } else {
+               ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE;
+               if (port_priv->rts)
+                       flow_repl |= CP210X_SERIAL_RTS_ACTIVE;
+               else
+                       flow_repl |= CP210X_SERIAL_RTS_INACTIVE;
+-              port_priv->crtscts = false;
++              crtscts = false;
+       }
+ 
+       if (I_IXOFF(tty)) {
+@@ -1279,8 +1280,12 @@ static void cp210x_set_flow_control(struct tty_struct 
*tty,
+       flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs);
+       flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl);
+ 
+-      cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
++      ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl,
+                       sizeof(flow_ctl));
++      if (ret)
++              goto out_unlock;
++
++      port_priv->crtscts = crtscts;
+ out_unlock:
+       mutex_unlock(&port_priv->mutex);
+ }
+diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
+index 930b3d50a3308..f45ca7ddf78ea 100644
+--- a/drivers/usb/serial/pl2303.c
++++ b/drivers/usb/serial/pl2303.c
+@@ -433,6 +433,7 @@ static int pl2303_detect_type(struct usb_serial *serial)
+               switch (bcdDevice) {
+               case 0x100:
+               case 0x305:
++              case 0x405:
+                       /*
+                        * Assume it's an HXN-type if the device doesn't
+                        * support the old read request value.
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
+index 70cb64db33f73..24e994e75f5ca 100644
+--- a/fs/ext4/inline.c
++++ b/fs/ext4/inline.c
+@@ -750,6 +750,12 @@ int ext4_write_inline_data_end(struct inode *inode, 
loff_t pos, unsigned len,
+       ext4_write_lock_xattr(inode, &no_expand);
+       BUG_ON(!ext4_has_inline_data(inode));
+ 
++      /*
++       * ei->i_inline_off may have changed since ext4_write_begin()
++       * called ext4_try_to_write_inline_data()
++       */
++      (void) ext4_find_inline_data_nolock(inode);
++
+       kaddr = kmap_atomic(page);
+       ext4_write_inline_data(inode, &iloc, kaddr, pos, len);
+       kunmap_atomic(kaddr);
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c
+index dfa09a277b56f..970013c93d3ea 100644
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -5032,6 +5032,14 @@ no_journal:
+               err = percpu_counter_init(&sbi->s_freeinodes_counter, freei,
+                                         GFP_KERNEL);
+       }
++      /*
++       * Update the checksum after updating free space/inode
++       * counters.  Otherwise the superblock can have an incorrect
++       * checksum in the buffer cache until it is written out and
++       * e2fsprogs programs trying to open a file system immediately
++       * after it is mounted can fail.
++       */
++      ext4_superblock_csum_set(sb);
+       if (!err)
+               err = percpu_counter_init(&sbi->s_dirs_counter,
+                                         ext4_count_dirs(sb), GFP_KERNEL);
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
+index 7d5883432085a..a144a3f68e9eb 100644
+--- a/sound/core/pcm_lib.c
++++ b/sound/core/pcm_lib.c
+@@ -1746,7 +1746,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct 
snd_pcm_substream *substream,
+               channels = params_channels(params);
+               frame_size = snd_pcm_format_size(format, channels);
+               if (frame_size > 0)
+-                      params->fifo_size /= (unsigned)frame_size;
++                      params->fifo_size /= frame_size;
+       }
+       return 0;
+ }
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 7ad689f991e7e..70516527ebce3 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -8438,6 +8438,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", 
ALC236_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
++      SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", 
ALC245_FIXUP_HP_X360_AMP),
+       SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", 
ALC245_FIXUP_HP_X360_AMP),
+       SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", 
ALC236_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", 
ALC285_FIXUP_HP_GPIO_LED),
+@@ -9521,6 +9522,16 @@ static int patch_alc269(struct hda_codec *codec)
+ 
+       snd_hda_pick_fixup(codec, alc269_fixup_models,
+                      alc269_fixup_tbl, alc269_fixups);
++      /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
++       * the quirk breaks the latter (bko#214101).
++       * Clear the wrong entry.
++       */
++      if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
++          codec->core.vendor_id == 0x10ec0294) {
++              codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
++              codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
++      }
++
+       snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, 
true);
+       snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, 
alc269_fixups, false);
+       snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
+diff --git a/sound/usb/card.h b/sound/usb/card.h
+index 6c0a052a28f99..5b19901f305a3 100644
+--- a/sound/usb/card.h
++++ b/sound/usb/card.h
+@@ -94,6 +94,7 @@ struct snd_usb_endpoint {
+       struct list_head ready_playback_urbs; /* playback URB FIFO for implicit 
fb */
+ 
+       unsigned int nurbs;             /* # urbs */
++      unsigned int nominal_queue_size; /* total buffer sizes in URBs */
+       unsigned long active_mask;      /* bitmask of active urbs */
+       unsigned long unlink_mask;      /* bitmask of unlinked urbs */
+       char *syncbuf;                  /* sync buffer for all sync URBs */
+@@ -187,6 +188,7 @@ struct snd_usb_substream {
+       } dsd_dop;
+ 
+       bool trigger_tstamp_pending_update; /* trigger timestamp being updated 
from initial estimate */
++      bool early_playback_start;      /* early start needed for playback? */
+       struct media_ctl *media_ctl;
+ };
+ 
+diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
+index 4f856771216b4..bf26c04cf4716 100644
+--- a/sound/usb/endpoint.c
++++ b/sound/usb/endpoint.c
+@@ -1126,6 +1126,10 @@ static int data_ep_set_params(struct snd_usb_endpoint 
*ep)
+               INIT_LIST_HEAD(&u->ready_list);
+       }
+ 
++      /* total buffer bytes of all URBs plus the next queue;
++       * referred in pcm.c
++       */
++      ep->nominal_queue_size = maxsize * urb_packs * (ep->nurbs + 1);
+       return 0;
+ 
+ out_of_memory:
+@@ -1287,6 +1291,11 @@ int snd_usb_endpoint_configure(struct snd_usb_audio 
*chip,
+        * to be set up before parameter setups
+        */
+       iface_first = ep->cur_audiofmt->protocol == UAC_VERSION_1;
++      /* Workaround for Sony WALKMAN NW-A45 DAC;
++       * it requires the interface setup at first like UAC1
++       */
++      if (chip->usb_id == USB_ID(0x054c, 0x0b8c))
++              iface_first = true;
+       if (iface_first) {
+               err = endpoint_set_interface(chip, ep, true);
+               if (err < 0)
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
+index 4e5031a680647..f5cbf61ac366e 100644
+--- a/sound/usb/pcm.c
++++ b/sound/usb/pcm.c
+@@ -614,6 +614,14 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream 
*substream)
+       subs->period_elapsed_pending = 0;
+       runtime->delay = 0;
+ 
++      /* check whether early start is needed for playback stream */
++      subs->early_playback_start =
++              subs->direction == SNDRV_PCM_STREAM_PLAYBACK &&
++              subs->data_endpoint->nominal_queue_size >= subs->buffer_bytes;
++
++      if (subs->early_playback_start)
++              ret = start_endpoints(subs);
++
+  unlock:
+       snd_usb_unlock_shutdown(chip);
+       return ret;
+@@ -1394,7 +1402,7 @@ static void prepare_playback_urb(struct 
snd_usb_substream *subs,
+               subs->trigger_tstamp_pending_update = false;
+       }
+ 
+-      if (period_elapsed && !subs->running) {
++      if (period_elapsed && !subs->running && !subs->early_playback_start) {
+               subs->period_elapsed_pending = 1;
+               period_elapsed = 0;
+       }
+@@ -1448,7 +1456,8 @@ static int snd_usb_substream_playback_trigger(struct 
snd_pcm_substream *substrea
+                                             prepare_playback_urb,
+                                             retire_playback_urb,
+                                             subs);
+-              if (cmd == SNDRV_PCM_TRIGGER_START) {
++              if (!subs->early_playback_start &&
++                  cmd == SNDRV_PCM_TRIGGER_START) {
+                       err = start_endpoints(subs);
+                       if (err < 0) {
+                               
snd_usb_endpoint_set_callback(subs->data_endpoint,

Reply via email to