From: Greg Kroah-Hartman Date: Mon, 10 Dec 2018 10:15:04 +0000 (+0100) Subject: 3.18-stable patches X-Git-Tag: v4.19.9~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b72794a6336064f50f0ce8d9433243a8dbfadd89;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: alsa-hda-add-support-for-amd-stoney-ridge.patch alsa-pcm-call-snd_pcm_unlink-conditionally-at-closing.patch alsa-pcm-fix-interval-evaluation-with-openmin-max.patch usb-appledisplay-add-27-apple-cinema-display.patch usb-check-usb_get_extra_descriptor-for-proper-size.patch usb-quirk-add-no-lpm-quirk-on-sandisk-ultra-flair-device.patch --- diff --git a/queue-3.18/alsa-hda-add-support-for-amd-stoney-ridge.patch b/queue-3.18/alsa-hda-add-support-for-amd-stoney-ridge.patch new file mode 100644 index 00000000000..e23122b178d --- /dev/null +++ b/queue-3.18/alsa-hda-add-support-for-amd-stoney-ridge.patch @@ -0,0 +1,34 @@ +From 3deef52ce10514ccdebba8e8ab85f9cebd0eb3f7 Mon Sep 17 00:00:00 2001 +From: Kai-Heng Feng +Date: Thu, 29 Nov 2018 08:57:37 +0000 +Subject: ALSA: hda: Add support for AMD Stoney Ridge + +From: Kai-Heng Feng + +commit 3deef52ce10514ccdebba8e8ab85f9cebd0eb3f7 upstream. + +It's similar to other AMD audio devices, it also supports D3, which can +save some power drain. + +Signed-off-by: Kai-Heng Feng +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_intel.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2092,6 +2092,10 @@ static const struct pci_device_id azx_id + /* AMD Hudson */ + { PCI_DEVICE(0x1022, 0x780d), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB }, ++ /* AMD Stoney */ ++ { PCI_DEVICE(0x1022, 0x157a), ++ .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | ++ AZX_DCAPS_PM_RUNTIME }, + /* AMD Raven */ + { PCI_DEVICE(0x1022, 0x15e3), + .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB | diff --git a/queue-3.18/alsa-pcm-call-snd_pcm_unlink-conditionally-at-closing.patch b/queue-3.18/alsa-pcm-call-snd_pcm_unlink-conditionally-at-closing.patch new file mode 100644 index 00000000000..880a5790f6d --- /dev/null +++ b/queue-3.18/alsa-pcm-call-snd_pcm_unlink-conditionally-at-closing.patch @@ -0,0 +1,43 @@ +From b51abed8355e5556886623b2772fa6b7598d2282 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 29 Nov 2018 08:02:49 +0100 +Subject: ALSA: pcm: Call snd_pcm_unlink() conditionally at closing + +From: Takashi Iwai + +commit b51abed8355e5556886623b2772fa6b7598d2282 upstream. + +Currently the PCM core calls snd_pcm_unlink() always unconditionally +at closing a stream. However, since snd_pcm_unlink() invokes the +global rwsem down, the lock can be easily contended. More badly, when +a thread runs in a high priority RT-FIFO, it may stall at spinning. + +Basically the call of snd_pcm_unlink() is required only for the linked +streams that are already rare occasion. For normal use cases, this +code path is fairly superfluous. + +As an optimization (and also as a workaround for the RT problem +above in normal situations without linked streams), this patch adds a +check before calling snd_pcm_unlink() and calls it only when needed. + +Reported-by: Chanho Min +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/core/pcm_native.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/sound/core/pcm_native.c ++++ b/sound/core/pcm_native.c +@@ -2193,7 +2193,8 @@ int snd_pcm_hw_constraints_complete(stru + + static void pcm_release_private(struct snd_pcm_substream *substream) + { +- snd_pcm_unlink(substream); ++ if (snd_pcm_stream_linked(substream)) ++ snd_pcm_unlink(substream); + } + + void snd_pcm_release_substream(struct snd_pcm_substream *substream) diff --git a/queue-3.18/alsa-pcm-fix-interval-evaluation-with-openmin-max.patch b/queue-3.18/alsa-pcm-fix-interval-evaluation-with-openmin-max.patch new file mode 100644 index 00000000000..09e05a7bc77 --- /dev/null +++ b/queue-3.18/alsa-pcm-fix-interval-evaluation-with-openmin-max.patch @@ -0,0 +1,40 @@ +From 5363857b916c1f48027e9b96ee8be8376bf20811 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Thu, 29 Nov 2018 12:05:19 +0100 +Subject: ALSA: pcm: Fix interval evaluation with openmin/max + +From: Takashi Iwai + +commit 5363857b916c1f48027e9b96ee8be8376bf20811 upstream. + +As addressed in alsa-lib (commit b420056604f0), we need to fix the +case where the evaluation of PCM interval "(x x+1]" leading to +-EINVAL. After applying rules, such an interval may be translated as +"(x x+1)". + +Fixes: ff2d6acdf6f1 ("ALSA: pcm: Fix snd_interval_refine first/last with open min/max") +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + include/sound/pcm_params.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/include/sound/pcm_params.h ++++ b/include/sound/pcm_params.h +@@ -272,11 +272,13 @@ static inline int snd_interval_empty(con + static inline int snd_interval_single(const struct snd_interval *i) + { + return (i->min == i->max || +- (i->min + 1 == i->max && i->openmax)); ++ (i->min + 1 == i->max && (i->openmin || i->openmax))); + } + + static inline int snd_interval_value(const struct snd_interval *i) + { ++ if (i->openmin && !i->openmax) ++ return i->max; + return i->min; + } + diff --git a/queue-3.18/series b/queue-3.18/series index b46ca2aa851..e262efcb41f 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -38,3 +38,9 @@ net-mlx4-fix-ubsan-warning-of-signed-integer-overflo.patch net-faraday-ftmac100-remove-netif_running-netdev-che.patch net-amd-add-missing-of_node_put.patch powerpc-vdso64-use-double-word-compare-on-pointers.patch +usb-quirk-add-no-lpm-quirk-on-sandisk-ultra-flair-device.patch +usb-appledisplay-add-27-apple-cinema-display.patch +usb-check-usb_get_extra_descriptor-for-proper-size.patch +alsa-hda-add-support-for-amd-stoney-ridge.patch +alsa-pcm-call-snd_pcm_unlink-conditionally-at-closing.patch +alsa-pcm-fix-interval-evaluation-with-openmin-max.patch diff --git a/queue-3.18/usb-appledisplay-add-27-apple-cinema-display.patch b/queue-3.18/usb-appledisplay-add-27-apple-cinema-display.patch new file mode 100644 index 00000000000..b1a87bfd524 --- /dev/null +++ b/queue-3.18/usb-appledisplay-add-27-apple-cinema-display.patch @@ -0,0 +1,29 @@ +From d7859905301880ad3e16272399d26900af3ac496 Mon Sep 17 00:00:00 2001 +From: Alexander Theissen +Date: Tue, 4 Dec 2018 23:43:35 +0100 +Subject: usb: appledisplay: Add 27" Apple Cinema Display + +From: Alexander Theissen + +commit d7859905301880ad3e16272399d26900af3ac496 upstream. + +Add another Apple Cinema Display to the list of supported displays. + +Signed-off-by: Alexander Theissen +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/misc/appledisplay.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/misc/appledisplay.c ++++ b/drivers/usb/misc/appledisplay.c +@@ -64,6 +64,7 @@ static const struct usb_device_id appled + { APPLEDISPLAY_DEVICE(0x921c) }, + { APPLEDISPLAY_DEVICE(0x921d) }, + { APPLEDISPLAY_DEVICE(0x9222) }, ++ { APPLEDISPLAY_DEVICE(0x9226) }, + { APPLEDISPLAY_DEVICE(0x9236) }, + + /* Terminating entry */ diff --git a/queue-3.18/usb-check-usb_get_extra_descriptor-for-proper-size.patch b/queue-3.18/usb-check-usb_get_extra_descriptor-for-proper-size.patch new file mode 100644 index 00000000000..2f3a57cbf06 --- /dev/null +++ b/queue-3.18/usb-check-usb_get_extra_descriptor-for-proper-size.patch @@ -0,0 +1,96 @@ +From 704620afc70cf47abb9d6a1a57f3825d2bca49cf Mon Sep 17 00:00:00 2001 +From: Mathias Payer +Date: Wed, 5 Dec 2018 21:19:59 +0100 +Subject: USB: check usb_get_extra_descriptor for proper size + +From: Mathias Payer + +commit 704620afc70cf47abb9d6a1a57f3825d2bca49cf upstream. + +When reading an extra descriptor, we need to properly check the minimum +and maximum size allowed, to prevent from invalid data being sent by a +device. + +Reported-by: Hui Peng +Reported-by: Mathias Payer +Co-developed-by: Linus Torvalds +Signed-off-by: Hui Peng +Signed-off-by: Mathias Payer +Signed-off-by: Linus Torvalds +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/hub.c | 3 ++- + drivers/usb/core/usb.c | 6 +++--- + drivers/usb/host/hwa-hc.c | 2 +- + include/linux/usb.h | 4 ++-- + 4 files changed, 8 insertions(+), 7 deletions(-) + +--- a/drivers/usb/core/hub.c ++++ b/drivers/usb/core/hub.c +@@ -2236,7 +2236,8 @@ static int usb_enumerate_device_otg(stru + /* descriptor may appear anywhere in config */ + if (__usb_get_extra_descriptor (udev->rawdescriptors[0], + le16_to_cpu(udev->config[0].desc.wTotalLength), +- USB_DT_OTG, (void **) &desc) == 0) { ++ USB_DT_OTG, (void **) &desc, ++ sizeof(*desc)) == 0) { + if (desc->bmAttributes & USB_OTG_HNP) { + unsigned port1 = udev->portnum; + +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -664,14 +664,14 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_ + */ + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr) ++ unsigned char type, void **ptr, size_t minsize) + { + struct usb_descriptor_header *header; + + while (size >= sizeof(struct usb_descriptor_header)) { + header = (struct usb_descriptor_header *)buffer; + +- if (header->bLength < 2) { ++ if (header->bLength < 2 || header->bLength > size) { + printk(KERN_ERR + "%s: bogus descriptor, type %d length %d\n", + usbcore_name, +@@ -680,7 +680,7 @@ int __usb_get_extra_descriptor(char *buf + return -1; + } + +- if (header->bDescriptorType == type) { ++ if (header->bDescriptorType == type && header->bLength >= minsize) { + *ptr = header; + return 0; + } +--- a/drivers/usb/host/hwa-hc.c ++++ b/drivers/usb/host/hwa-hc.c +@@ -654,7 +654,7 @@ static int hwahc_security_create(struct + top = itr + itr_size; + result = __usb_get_extra_descriptor(usb_dev->rawdescriptors[index], + le16_to_cpu(usb_dev->actconfig->desc.wTotalLength), +- USB_DT_SECURITY, (void **) &secd); ++ USB_DT_SECURITY, (void **) &secd, sizeof(*secd)); + if (result == -1) { + dev_warn(dev, "BUG? WUSB host has no security descriptors\n"); + return 0; +--- a/include/linux/usb.h ++++ b/include/linux/usb.h +@@ -329,11 +329,11 @@ struct usb_host_bos { + }; + + int __usb_get_extra_descriptor(char *buffer, unsigned size, +- unsigned char type, void **ptr); ++ unsigned char type, void **ptr, size_t min); + #define usb_get_extra_descriptor(ifpoint, type, ptr) \ + __usb_get_extra_descriptor((ifpoint)->extra, \ + (ifpoint)->extralen, \ +- type, (void **)ptr) ++ type, (void **)ptr, sizeof(**(ptr))) + + /* ----------------------------------------------------------------------- */ + diff --git a/queue-3.18/usb-quirk-add-no-lpm-quirk-on-sandisk-ultra-flair-device.patch b/queue-3.18/usb-quirk-add-no-lpm-quirk-on-sandisk-ultra-flair-device.patch new file mode 100644 index 00000000000..43652b7bf1b --- /dev/null +++ b/queue-3.18/usb-quirk-add-no-lpm-quirk-on-sandisk-ultra-flair-device.patch @@ -0,0 +1,66 @@ +From 2f2dde6ba89b1ef1fe23c1138131b315d9aa4019 Mon Sep 17 00:00:00 2001 +From: Harry Pan +Date: Thu, 29 Nov 2018 00:40:41 +0800 +Subject: usb: quirk: add no-LPM quirk on SanDisk Ultra Flair device + +From: Harry Pan + +commit 2f2dde6ba89b1ef1fe23c1138131b315d9aa4019 upstream. + +Some lower volume SanDisk Ultra Flair in 16GB, which the VID:PID is +in 0781:5591, will aggressively request LPM of U1/U2 during runtime, +when using this thumb drive as the OS installation key we found the +device will generate failure during U1 exit path making it dropped +from the USB bus, this causes a corrupted installation in system at +the end. + +i.e., +[ 166.918296] hub 2-0:1.0: state 7 ports 7 chg 0000 evt 0004 +[ 166.918327] usb usb2-port2: link state change +[ 166.918337] usb usb2-port2: do warm reset +[ 166.970039] usb usb2-port2: not warm reset yet, waiting 50ms +[ 167.022040] usb usb2-port2: not warm reset yet, waiting 200ms +[ 167.276043] usb usb2-port2: status 02c0, change 0041, 5.0 Gb/s +[ 167.276050] usb 2-2: USB disconnect, device number 2 +[ 167.276058] usb 2-2: unregistering device +[ 167.276060] usb 2-2: unregistering interface 2-2:1.0 +[ 167.276170] xhci_hcd 0000:00:15.0: shutdown urb ffffa3c7cc695cc0 ep1in-bulk +[ 167.284055] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK +[ 167.284064] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 33 04 90 00 01 00 00 +... + +Analyzed the USB trace in the link layer we realized it is because +of the 6-ms timer of tRecoveryConfigurationTimeout which documented +on the USB 3.2 Revision 1.0, the section 7.5.10.4.2 of "Exit from +Recovery.Configuration"; device initiates U1 exit -> Recovery.Active +-> Recovery.Configuration, then the host timer timeout makes the link +transits to eSS.Inactive -> Rx.Detect follows by a Warm Reset. + +Interestingly, the other higher volume of SanDisk Ultra Flair sharing +the same VID:PID, such as 64GB, would not request LPM during runtime, +it sticks at U0 always, thus disabling LPM does not affect those thumb +drives at all. + +The same odd occures in SanDisk Ultra Fit 16GB, VID:PID in 0781:5583. + +Signed-off-by: Harry Pan +Cc: stable +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/core/quirks.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -177,6 +177,10 @@ static const struct usb_device_id usb_qu + /* Midiman M-Audio Keystation 88es */ + { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME }, + ++ /* SanDisk Ultra Fit and Ultra Flair */ ++ { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, ++ { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, ++ + /* M-Systems Flash Disk Pioneers */ + { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, +