--- /dev/null
+From 58fb380fddc4d31c896665cf98829e07e9a9c104 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 19 Apr 2020 09:19:26 +0200
+Subject: ALSA: hda: Remove ASUS ROG Zenith from the blacklist
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit a8cf44f085ac12c0b5b8750ebb3b436c7f455419 ]
+
+The commit 3c6fd1f07ed0 ("ALSA: hda: Add driver blacklist") added a
+new blacklist for the devices that are known to have empty codecs, and
+one of the entries was ASUS ROG Zenith II (PCI SSID 1043:874f).
+However, it turned out that the very same PCI SSID is used for the
+previous model that does have the valid HD-audio codecs and the change
+broke the sound on it.
+
+This patch reverts the corresponding entry as a temporary solution.
+Although Zenith II and co will see get the empty HD-audio bus again,
+it'd be merely resource wastes and won't affect the functionality,
+so it's no end of the world. We'll need to address this later,
+e.g. by either switching to DMI string matching or using PCI ID &
+SSID pairs.
+
+Fixes: 3c6fd1f07ed0 ("ALSA: hda: Add driver blacklist")
+Reported-by: Johnathan Smithinovic <johnathan.smithinovic@gmx.at>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20200419071926.22683-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_intel.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index 72bbfeddea24a..dd77b9ffe5fd9 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -2024,7 +2024,6 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
+ * should be ignored from the beginning.
+ */
+ static const struct snd_pci_quirk driver_blacklist[] = {
+- SND_PCI_QUIRK(0x1043, 0x874f, "ASUS ROG Zenith II / Strix", 0),
+ SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0),
+ SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0),
+ {}
+--
+2.20.1
+
--- /dev/null
+From 6c63a8ff5d8304dddc028a969adcc61c3d99eb90 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 Apr 2020 13:33:20 +0200
+Subject: ALSA: usb-audio: Add connector notifier delegation
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit fef66ae73a611e84c8b4b74ff6f805ec5f113477 ]
+
+It turned out that ALC1220-VB USB-audio device gives the interrupt
+event to some PCM terminals while those don't allow the connector
+state request but only the actual I/O terminals return the request.
+The recent commit 7dc3c5a0172e ("ALSA: usb-audio: Don't create jack
+controls for PCM terminals") excluded those phantom terminals, so
+those events are ignored, too.
+
+My first thought was that this could be easily deduced from the
+associated terminals, but some of them have even no associate terminal
+ID, hence it's not too trivial to figure out.
+
+Since the number of such terminals are small and limited, this patch
+implements another quirk table for the simple mapping of the
+connectors. It's not really scalable, but let's hope that there will
+be not many such funky devices in future.
+
+Fixes: 7dc3c5a0172e ("ALSA: usb-audio: Don't create jack controls for PCM terminals")
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206873
+Link: https://lore.kernel.org/r/20200422113320.26664-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/usb/mixer.c | 25 +++++++++++++++++++++++++
+ sound/usb/mixer.h | 10 ++++++++++
+ sound/usb/mixer_maps.c | 13 +++++++++++++
+ 3 files changed, 48 insertions(+)
+
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
+index f9586a6ea05b6..583edacc9fe8e 100644
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -3096,6 +3096,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
+ if (map->id == state.chip->usb_id) {
+ state.map = map->map;
+ state.selector_map = map->selector_map;
++ mixer->connector_map = map->connector_map;
+ mixer->ignore_ctl_error |= map->ignore_ctl_error;
+ break;
+ }
+@@ -3177,10 +3178,32 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
+ return 0;
+ }
+
++static int delegate_notify(struct usb_mixer_interface *mixer, int unitid,
++ u8 *control, u8 *channel)
++{
++ const struct usbmix_connector_map *map = mixer->connector_map;
++
++ if (!map)
++ return unitid;
++
++ for (; map->id; map++) {
++ if (map->id == unitid) {
++ if (control && map->control)
++ *control = map->control;
++ if (channel && map->channel)
++ *channel = map->channel;
++ return map->delegated_id;
++ }
++ }
++ return unitid;
++}
++
+ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
+ {
+ struct usb_mixer_elem_list *list;
+
++ unitid = delegate_notify(mixer, unitid, NULL, NULL);
++
+ for_each_mixer_elem(list, mixer, unitid) {
+ struct usb_mixer_elem_info *info =
+ mixer_elem_list_to_info(list);
+@@ -3250,6 +3273,8 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
+ return;
+ }
+
++ unitid = delegate_notify(mixer, unitid, &control, &channel);
++
+ for_each_mixer_elem(list, mixer, unitid)
+ count++;
+
+diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
+index 37e1b234c802f..8e0fb7fdf1a00 100644
+--- a/sound/usb/mixer.h
++++ b/sound/usb/mixer.h
+@@ -6,6 +6,13 @@
+
+ struct media_mixer_ctl;
+
++struct usbmix_connector_map {
++ u8 id;
++ u8 delegated_id;
++ u8 control;
++ u8 channel;
++};
++
+ struct usb_mixer_interface {
+ struct snd_usb_audio *chip;
+ struct usb_host_interface *hostif;
+@@ -18,6 +25,9 @@ struct usb_mixer_interface {
+ /* the usb audio specification version this interface complies to */
+ int protocol;
+
++ /* optional connector delegation map */
++ const struct usbmix_connector_map *connector_map;
++
+ /* Sound Blaster remote control stuff */
+ const struct rc_config *rc_cfg;
+ u32 rc_code;
+diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
+index 28eec0e0aa5e4..39d6c6fa5e337 100644
+--- a/sound/usb/mixer_maps.c
++++ b/sound/usb/mixer_maps.c
+@@ -27,6 +27,7 @@ struct usbmix_ctl_map {
+ u32 id;
+ const struct usbmix_name_map *map;
+ const struct usbmix_selector_map *selector_map;
++ const struct usbmix_connector_map *connector_map;
+ int ignore_ctl_error;
+ };
+
+@@ -377,6 +378,15 @@ static const struct usbmix_name_map trx40_mobo_map[] = {
+ {}
+ };
+
++static const struct usbmix_connector_map trx40_mobo_connector_map[] = {
++ { 10, 16 }, /* (Back) Speaker */
++ { 11, 17 }, /* Front Headphone */
++ { 13, 7 }, /* Line */
++ { 14, 8 }, /* Mic */
++ { 15, 9 }, /* Front Mic */
++ {}
++};
++
+ /*
+ * Control map entries
+ */
+@@ -499,6 +509,7 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
+ { /* Gigabyte TRX40 Aorus Pro WiFi */
+ .id = USB_ID(0x0414, 0xa002),
+ .map = trx40_mobo_map,
++ .connector_map = trx40_mobo_connector_map,
+ },
+ { /* ASUS ROG Zenith II */
+ .id = USB_ID(0x0b05, 0x1916),
+@@ -511,10 +522,12 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
+ { /* MSI TRX40 Creator */
+ .id = USB_ID(0x0db0, 0x0d64),
+ .map = trx40_mobo_map,
++ .connector_map = trx40_mobo_connector_map,
+ },
+ { /* MSI TRX40 */
+ .id = USB_ID(0x0db0, 0x543d),
+ .map = trx40_mobo_map,
++ .connector_map = trx40_mobo_connector_map,
+ },
+ { 0 } /* terminator */
+ };
+--
+2.20.1
+
--- /dev/null
+From be5e0f0c41679212f0c6ee5fde1b3a66390308e3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 Apr 2020 08:20:36 +0200
+Subject: ALSA: usb-audio: Add static mapping table for ALC1220-VB-based mobos
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit a43c1c41bc5145971d06edc42a6b1e8faa0e2bc3 ]
+
+TRX40 mobos from MSI and others with ALC1220-VB USB-audio device need
+yet more quirks for the proper control names.
+
+This patch provides the mapping table for those boards, correcting the
+FU names for volume and mute controls as well as the terminal names
+for jack controls. It also improves build_connector_control() not to
+add the directional suffix blindly if the string is given from the
+mapping table.
+
+With this patch applied, the new UCM profiles will be effective.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206873
+Link: https://lore.kernel.org/r/20200420062036.28567-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/usb/mixer.c | 12 +++++++++---
+ sound/usb/mixer_maps.c | 24 +++++++++++++++++++++---
+ sound/usb/quirks-table.h | 14 ++++++++++++++
+ 3 files changed, 44 insertions(+), 6 deletions(-)
+
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
+index 5661994e13e7d..f9586a6ea05b6 100644
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -1755,8 +1755,10 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
+ {
+ struct snd_kcontrol *kctl;
+ struct usb_mixer_elem_info *cval;
++ const struct usbmix_name_map *map;
+
+- if (check_ignored_ctl(find_map(imap, term->id, 0)))
++ map = find_map(imap, term->id, 0);
++ if (check_ignored_ctl(map))
+ return;
+
+ cval = kzalloc(sizeof(*cval), GFP_KERNEL);
+@@ -1788,8 +1790,12 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
+ usb_mixer_elem_info_free(cval);
+ return;
+ }
+- get_connector_control_name(mixer, term, is_input, kctl->id.name,
+- sizeof(kctl->id.name));
++
++ if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)))
++ strlcat(kctl->id.name, " Jack", sizeof(kctl->id.name));
++ else
++ get_connector_control_name(mixer, term, is_input, kctl->id.name,
++ sizeof(kctl->id.name));
+ kctl->private_free = snd_usb_mixer_elem_free;
+ snd_usb_mixer_add_control(&cval->head, kctl);
+ }
+diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
+index 3a54ca04ec4c0..28eec0e0aa5e4 100644
+--- a/sound/usb/mixer_maps.c
++++ b/sound/usb/mixer_maps.c
+@@ -359,6 +359,24 @@ static const struct usbmix_name_map asus_rog_map[] = {
+ {}
+ };
+
++/* TRX40 mobos with Realtek ALC1220-VB */
++static const struct usbmix_name_map trx40_mobo_map[] = {
++ { 18, NULL }, /* OT, IEC958 - broken response, disabled */
++ { 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */
++ { 16, "Speaker" }, /* OT */
++ { 22, "Speaker Playback" }, /* FU */
++ { 7, "Line" }, /* IT */
++ { 19, "Line Capture" }, /* FU */
++ { 17, "Front Headphone" }, /* OT */
++ { 23, "Front Headphone Playback" }, /* FU */
++ { 8, "Mic" }, /* IT */
++ { 20, "Mic Capture" }, /* FU */
++ { 9, "Front Mic" }, /* IT */
++ { 21, "Front Mic Capture" }, /* FU */
++ { 24, "IEC958 Playback" }, /* FU */
++ {}
++};
++
+ /*
+ * Control map entries
+ */
+@@ -480,7 +498,7 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
+ },
+ { /* Gigabyte TRX40 Aorus Pro WiFi */
+ .id = USB_ID(0x0414, 0xa002),
+- .map = asus_rog_map,
++ .map = trx40_mobo_map,
+ },
+ { /* ASUS ROG Zenith II */
+ .id = USB_ID(0x0b05, 0x1916),
+@@ -492,11 +510,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
+ },
+ { /* MSI TRX40 Creator */
+ .id = USB_ID(0x0db0, 0x0d64),
+- .map = asus_rog_map,
++ .map = trx40_mobo_map,
+ },
+ { /* MSI TRX40 */
+ .id = USB_ID(0x0db0, 0x543d),
+- .map = asus_rog_map,
++ .map = trx40_mobo_map,
+ },
+ { 0 } /* terminator */
+ };
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
+index dcaf9eed9a415..8c2f5c23e1b43 100644
+--- a/sound/usb/quirks-table.h
++++ b/sound/usb/quirks-table.h
+@@ -3635,4 +3635,18 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
+ }
+ },
+
++#define ALC1220_VB_DESKTOP(vend, prod) { \
++ USB_DEVICE(vend, prod), \
++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \
++ .vendor_name = "Realtek", \
++ .product_name = "ALC1220-VB-DT", \
++ .profile_name = "Realtek-ALC1220-VB-Desktop", \
++ .ifnum = QUIRK_NO_INTERFACE \
++ } \
++}
++ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */
++ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */
++ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
++#undef ALC1220_VB_DESKTOP
++
+ #undef USB_DEVICE_VENDOR_SPEC
+--
+2.20.1
+
--- /dev/null
+From 659c38a10e99d5e7b4a24adb48d042c5b3a5136c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 21 Mar 2020 21:11:25 -0400
+Subject: KEYS: Avoid false positive ENOMEM error on key read
+
+From: Waiman Long <longman@redhat.com>
+
+[ Upstream commit 4f0882491a148059a52480e753b7f07fc550e188 ]
+
+By allocating a kernel buffer with a user-supplied buffer length, it
+is possible that a false positive ENOMEM error may be returned because
+the user-supplied length is just too large even if the system do have
+enough memory to hold the actual key data.
+
+Moreover, if the buffer length is larger than the maximum amount of
+memory that can be returned by kmalloc() (2^(MAX_ORDER-1) number of
+pages), a warning message will also be printed.
+
+To reduce this possibility, we set a threshold (PAGE_SIZE) over which we
+do check the actual key length first before allocating a buffer of the
+right size to hold it. The threshold is arbitrary, it is just used to
+trigger a buffer length check. It does not limit the actual key length
+as long as there is enough memory to satisfy the memory request.
+
+To further avoid large buffer allocation failure due to page
+fragmentation, kvmalloc() is used to allocate the buffer so that vmapped
+pages can be used when there is not a large enough contiguous set of
+pages available for allocation.
+
+In the extremely unlikely scenario that the key keeps on being changed
+and made longer (still <= buflen) in between 2 __keyctl_read_key()
+calls, the __keyctl_read_key() calling loop in keyctl_read_key() may
+have to be iterated a large number of times, but definitely not infinite.
+
+Signed-off-by: Waiman Long <longman@redhat.com>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ security/keys/internal.h | 12 +++++++++
+ security/keys/keyctl.c | 58 +++++++++++++++++++++++++++++-----------
+ 2 files changed, 55 insertions(+), 15 deletions(-)
+
+diff --git a/security/keys/internal.h b/security/keys/internal.h
+index c039373488bd9..7e99149436167 100644
+--- a/security/keys/internal.h
++++ b/security/keys/internal.h
+@@ -16,6 +16,8 @@
+ #include <linux/keyctl.h>
+ #include <linux/refcount.h>
+ #include <linux/compat.h>
++#include <linux/mm.h>
++#include <linux/vmalloc.h>
+
+ struct iovec;
+
+@@ -349,4 +351,14 @@ static inline void key_check(const struct key *key)
+
+ #endif
+
++/*
++ * Helper function to clear and free a kvmalloc'ed memory object.
++ */
++static inline void __kvzfree(const void *addr, size_t len)
++{
++ if (addr) {
++ memset((void *)addr, 0, len);
++ kvfree(addr);
++ }
++}
+ #endif /* _INTERNAL_H */
+diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
+index 106e16f9006b4..5e01192e222a0 100644
+--- a/security/keys/keyctl.c
++++ b/security/keys/keyctl.c
+@@ -339,7 +339,7 @@ long keyctl_update_key(key_serial_t id,
+ payload = NULL;
+ if (plen) {
+ ret = -ENOMEM;
+- payload = kmalloc(plen, GFP_KERNEL);
++ payload = kvmalloc(plen, GFP_KERNEL);
+ if (!payload)
+ goto error;
+
+@@ -360,7 +360,7 @@ long keyctl_update_key(key_serial_t id,
+
+ key_ref_put(key_ref);
+ error2:
+- kzfree(payload);
++ __kvzfree(payload, plen);
+ error:
+ return ret;
+ }
+@@ -827,7 +827,8 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
+ struct key *key;
+ key_ref_t key_ref;
+ long ret;
+- char *key_data;
++ char *key_data = NULL;
++ size_t key_data_len;
+
+ /* find the key first */
+ key_ref = lookup_user_key(keyid, 0, 0);
+@@ -878,24 +879,51 @@ can_read_key:
+ * Allocating a temporary buffer to hold the keys before
+ * transferring them to user buffer to avoid potential
+ * deadlock involving page fault and mmap_sem.
++ *
++ * key_data_len = (buflen <= PAGE_SIZE)
++ * ? buflen : actual length of key data
++ *
++ * This prevents allocating arbitrary large buffer which can
++ * be much larger than the actual key length. In the latter case,
++ * at least 2 passes of this loop is required.
+ */
+- key_data = kmalloc(buflen, GFP_KERNEL);
++ key_data_len = (buflen <= PAGE_SIZE) ? buflen : 0;
++ for (;;) {
++ if (key_data_len) {
++ key_data = kvmalloc(key_data_len, GFP_KERNEL);
++ if (!key_data) {
++ ret = -ENOMEM;
++ goto key_put_out;
++ }
++ }
+
+- if (!key_data) {
+- ret = -ENOMEM;
+- goto key_put_out;
+- }
+- ret = __keyctl_read_key(key, key_data, buflen);
++ ret = __keyctl_read_key(key, key_data, key_data_len);
++
++ /*
++ * Read methods will just return the required length without
++ * any copying if the provided length isn't large enough.
++ */
++ if (ret <= 0 || ret > buflen)
++ break;
++
++ /*
++ * The key may change (unlikely) in between 2 consecutive
++ * __keyctl_read_key() calls. In this case, we reallocate
++ * a larger buffer and redo the key read when
++ * key_data_len < ret <= buflen.
++ */
++ if (ret > key_data_len) {
++ if (unlikely(key_data))
++ __kvzfree(key_data, key_data_len);
++ key_data_len = ret;
++ continue; /* Allocate buffer */
++ }
+
+- /*
+- * Read methods will just return the required length without
+- * any copying if the provided length isn't large enough.
+- */
+- if (ret > 0 && ret <= buflen) {
+ if (copy_to_user(buffer, key_data, ret))
+ ret = -EFAULT;
++ break;
+ }
+- kzfree(key_data);
++ __kvzfree(key_data, key_data_len);
+
+ key_put_out:
+ key_put(key);
+--
+2.20.1
+
geneve-use-the-correct-nlattr-array-in-nl_set_err_msg_attr.patch
xfrm-always-set-xfrm_transformed-in-xfrm-4-6-_output_finish.patch
vrf-check-skb-for-xfrm_transformed-flag.patch
+keys-avoid-false-positive-enomem-error-on-key-read.patch
+alsa-hda-remove-asus-rog-zenith-from-the-blacklist.patch
+alsa-usb-audio-add-static-mapping-table-for-alc1220-.patch
+alsa-usb-audio-add-connector-notifier-delegation.patch