The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 3d92aa45fbfd7319e3a19f4ec59fd32b3862b723 Mon Sep 17 00:00:00 2001
From: Wenwen Wang <wenwen(a)cs.uga.edu>
Date: Wed, 7 Aug 2019 04:08:51 -0500
Subject: [PATCH] ALSA: hiface: fix multiple memory leak bugs
In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later
on, hiface_pcm_init_urb() is invoked to initialize 'rt->out_urbs[i]'. In
hiface_pcm_init_urb(), 'rt->out_urbs[i].buffer' is allocated through
kzalloc(). However, if hiface_pcm_init_urb() fails, both 'rt' and
'rt->out_urbs[i].buffer' are not deallocated, leading to memory leak bugs.
Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails.
To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'.
Fixes: a91c3fb2f842 ("Add M2Tech hiFace USB-SPDIF driver")
Signed-off-by: Wenwen Wang <wenwen(a)cs.uga.edu>
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai(a)suse.de>
diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
index 14fc1e1d5d13..c406497c5919 100644
--- a/sound/usb/hiface/pcm.c
+++ b/sound/usb/hiface/pcm.c
@@ -600,14 +600,13 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq)
ret = hiface_pcm_init_urb(&rt->out_urbs[i], chip, OUT_EP,
hiface_pcm_out_urb_handler);
if (ret < 0)
- return ret;
+ goto error;
}
ret = snd_pcm_new(chip->card, "USB-SPDIF Audio", 0, 1, 0, &pcm);
if (ret < 0) {
- kfree(rt);
dev_err(&chip->dev->dev, "Cannot create pcm instance\n");
- return ret;
+ goto error;
}
pcm->private_data = rt;
@@ -620,4 +619,10 @@ int hiface_pcm_init(struct hiface_chip *chip, u8 extra_freq)
chip->pcm = rt;
return 0;
+
+error:
+ for (i = 0; i < PCM_N_URBS; i++)
+ kfree(rt->out_urbs[i].buffer);
+ kfree(rt);
+ return ret;
}
Hello,
We ran automated tests on a patchset that was proposed for merging into this
kernel tree. The patches were applied to:
Kernel repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Commit: d36a8d2fb62c - Linux 5.2.8
The results of these automated tests are provided below.
Overall result: PASSED
Merge: OK
Compile: OK
Tests: OK
All kernel binaries, config files, and logs are available for download here:
https://artifacts.cki-project.org/pipelines/99643
We hope that these logs can help you find the problem quickly. For the full
detail on our testing procedures, please scroll to the bottom of this message.
Please reply to this email if you have any questions about the tests that we
ran or if you have any suggestions on how to make future tests more effective.
,-. ,-.
( C ) ( K ) Continuous
`-',-.`-' Kernel
( I ) Integration
`-'
______________________________________________________________________________
Merge testing
-------------
We cloned this repository and checked out the following commit:
Repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Commit: d36a8d2fb62c - Linux 5.2.8
We grabbed the e939b44eeef5 commit of the stable queue repository.
We then merged the patchset with `git am`:
revert-pci-add-missing-link-delays-required-by-the-pcie-spec.patch
iio-ingenic-jz47xx-set-clock-divider-on-probe.patch
iio-cros_ec_accel_legacy-fix-incorrect-channel-setting.patch
iio-imu-mpu6050-add-missing-available-scan-masks.patch
iio-adc-gyroadc-fix-uninitialized-return-code.patch
iio-adc-max9611-fix-misuse-of-genmask-macro.patch
staging-gasket-apex-fix-copy-paste-typo.patch
staging-wilc1000-flush-the-workqueue-before-deinit-the-host.patch
staging-android-ion-bail-out-upon-sigkill-when-allocating-memory.patch
staging-fbtft-fix-probing-of-gpio-descriptor.patch
staging-fbtft-fix-reset-assertion-when-using-gpio-descriptor.patch
crypto-ccp-fix-oops-by-properly-managing-allocated-structures.patch
crypto-ccp-add-support-for-valid-authsize-values-less-than-16.patch
crypto-ccp-ignore-tag-length-when-decrypting-gcm-ciphertext.patch
driver-core-platform-return-enxio-for-missing-gpioint.patch
usb-usbfs-fix-double-free-of-usb-memory-upon-submiturb-error.patch
revert-usb-rio500-simplify-locking.patch
usb-iowarrior-fix-deadlock-on-disconnect.patch
sound-fix-a-memory-leak-bug.patch
mmc-cavium-set-the-correct-dma-max-segment-size-for-mmc_host.patch
mmc-cavium-add-the-missing-dma-unmap-when-the-dma-has-finished.patch
loop-set-pf_memalloc_noio-for-the-worker-thread.patch
bdev-fixup-error-handling-in-blkdev_get.patch
input-usbtouchscreen-initialize-pm-mutex-before-using-it.patch
input-elantech-enable-smbus-on-new-2018-systems.patch
input-synaptics-enable-rmi-mode-for-hp-spectre-x360.patch
x86-mm-check-for-pfn-instead-of-page-in-vmalloc_sync_one.patch
x86-mm-sync-also-unmappings-in-vmalloc_sync_all.patch
mm-vmalloc-sync-unmappings-in-__purge_vmap_area_lazy.patch
coresight-fix-debug_locks_warn_on-for-uninitialized-attribute.patch
perf-annotate-fix-s390-gap-between-kernel-end-and-module-start.patch
perf-db-export-fix-thread__exec_comm.patch
perf-record-fix-module-size-on-s390.patch
x86-purgatory-do-not-use-__builtin_memcpy-and-__builtin_memset.patch
x86-purgatory-use-cflags_remove-rather-than-reset-kbuild_cflags.patch
genirq-affinity-create-affinity-mask-for-single-vector.patch
gfs2-gfs2_walk_metadata-fix.patch
usb-host-xhci-rcar-fix-timeout-in-xhci_suspend.patch
usb-yurex-fix-use-after-free-in-yurex_delete.patch
usb-typec-ucsi-ccg-fix-uninitilized-symbol-error.patch
usb-typec-tcpm-free-log-buf-memory-when-remove-debug-file.patch
usb-typec-tcpm-remove-tcpm-dir-if-no-children.patch
usb-typec-tcpm-add-null-check-before-dereferencing-config.patch
usb-typec-tcpm-ignore-unsupported-unknown-alternate-mode-requests.patch
can-rcar_canfd-fix-possible-irq-storm-on-high-load.patch
can-flexcan-fix-stop-mode-acknowledgment.patch
can-flexcan-fix-an-use-after-free-in-flexcan_setup_stop_mode.patch
can-peak_usb-fix-potential-double-kfree_skb.patch
powerpc-fix-off-by-one-in-max_zone_pfn-initializatio.patch
netfilter-nfnetlink-avoid-deadlock-due-to-synchronou.patch
vfio-ccw-set-pa_nr-to-0-if-memory-allocation-fails-f.patch
vfio-ccw-don-t-call-cp_free-if-we-are-processing-a-c.patch
netfilter-fix-rpfilter-dropping-vrf-packets-by-mista.patch
netfilter-nf_tables-fix-module-autoload-for-redir.patch
netfilter-conntrack-always-store-window-size-un-scal.patch
netfilter-nft_hash-fix-symhash-with-modulus-one.patch
scripts-sphinx-pre-install-fix-script-for-rhel-cento.patch
scripts-sphinx-pre-install-don-t-use-latex-with-cent.patch
scripts-sphinx-pre-install-fix-latexmk-dependencies.patch
rq-qos-don-t-reset-has_sleepers-on-spurious-wakeups.patch
rq-qos-set-ourself-task_uninterruptible-after-we-sch.patch
rq-qos-use-a-mb-for-got_token.patch
netfilter-nf_tables-support-auto-loading-for-inet-na.patch
drm-amd-display-no-audio-endpoint-for-dell-mst-displ.patch
drm-amd-display-clock-does-not-lower-in-updateplanes.patch
drm-amd-display-wait-for-backlight-programming-compl.patch
drm-amd-display-fix-dmcu-hang-when-going-into-modern.patch
drm-amd-display-use-encoder-s-engine-id-to-find-matc.patch
drm-amd-display-put-back-front-end-initialization-se.patch
drm-amd-display-allocate-4-ddc-engines-for-rv2.patch
drm-amd-display-fix-dc_create-failure-handling-and-6.patch
drm-amd-display-only-enable-audio-if-speaker-allocat.patch
drm-amd-display-increase-size-of-audios-array.patch
iscsi_ibft-make-iscsi_ibft-dependson-acpi-instead-of.patch
nl80211-fix-nl80211_he_max_capability_len.patch
mac80211-fix-possible-memory-leak-in-ieee80211_assig.patch
mac80211-don-t-warn-about-cw-params-when-not-using-t.patch
allocate_flower_entry-should-check-for-null-deref.patch
hwmon-occ-fix-division-by-zero-issue.patch
hwmon-nct6775-fix-register-address-and-added-missed-.patch
arm-dts-imx6ul-fix-clock-frequency-property-name-of-.patch
powerpc-papr_scm-force-a-scm-unbind-if-initial-scm-b.patch
arm64-force-ssbs-on-context-switch.patch
arm64-entry-sp-alignment-fault-doesn-t-write-to-far_.patch
iommu-vt-d-check-if-domain-pgd-was-allocated.patch
drm-msm-dpu-correct-dpu-encoder-spinlock-initializat.patch
drm-silence-variable-conn-set-but-not-used.patch
arm64-dts-imx8mm-correct-sai3-rxc-txfs-pin-s-mux-opt.patch
arm64-dts-imx8mq-fix-sai-compatible.patch
cpufreq-pasemi-fix-use-after-free-in-pas_cpufreq_cpu.patch
s390-qdio-add-sanity-checks-to-the-fast-requeue-path.patch
alsa-compress-fix-regression-on-compressed-capture-s.patch
alsa-compress-prevent-bypasses-of-set_params.patch
alsa-compress-don-t-allow-paritial-drain-operations-.patch
alsa-compress-be-more-restrictive-about-when-a-drain.patch
perf-script-fix-off-by-one-in-brstackinsn-ipc-comput.patch
perf-tools-fix-proper-buffer-size-for-feature-proces.patch
perf-stat-fix-segfault-for-event-group-in-repeat-mod.patch
perf-session-fix-loading-of-compressed-data-split-ac.patch
perf-probe-avoid-calling-freeing-routine-multiple-ti.patch
drbd-dynamically-allocate-shash-descriptor.patch
acpi-iort-fix-off-by-one-check-in-iort_dev_find_its_.patch
nvme-ignore-subnqn-for-adata-sx6000lnp.patch
nvme-fix-memory-leak-caused-by-incorrect-subsystem-f.patch
arm-davinci-fix-sleep.s-build-error-on-armv4.patch
arm-dts-bcm-bcm47094-add-missing-cells-for-mdio-bus-.patch
scsi-megaraid_sas-fix-panic-on-loading-firmware-cras.patch
scsi-ibmvfc-fix-warn_on-during-event-pool-release.patch
scsi-scsi_dh_alua-always-use-a-2-second-delay-before.patch
test_firmware-fix-a-memory-leak-bug.patch
tty-ldsem-locking-rwsem-add-missing-acquire-to-read_.patch
perf-x86-intel-fix-slots-pebs-event-constraint.patch
perf-x86-intel-fix-invalid-bit-13-for-icelake-msr_of.patch
perf-x86-apply-more-accurate-check-on-hypervisor-pla.patch
perf-core-fix-creating-kernel-counters-for-pmus-that.patch
s390-dma-provide-proper-arch_zone_dma_bits-value.patch
gen_compile_commands-lower-the-entry-count-threshold.patch
Compile testing
---------------
We compiled the kernel for 3 architectures:
aarch64:
make options: -j30 INSTALL_MOD_STRIP=1 targz-pkg
ppc64le:
make options: -j30 INSTALL_MOD_STRIP=1 targz-pkg
x86_64:
make options: -j30 INSTALL_MOD_STRIP=1 targz-pkg
Hardware testing
----------------
We booted each kernel and ran the following tests:
aarch64:
Host 1:
✅ Boot test [0]
✅ xfstests: xfs [1]
✅ selinux-policy: serge-testsuite [2]
✅ lvm thinp sanity [3]
✅ storage: software RAID testing [4]
🚧 ✅ Storage blktests [5]
Host 2:
✅ Boot test [0]
✅ Podman system integration test (as root) [6]
✅ Podman system integration test (as user) [6]
✅ LTP lite [7]
✅ Loopdev Sanity [8]
✅ jvm test suite [9]
✅ AMTU (Abstract Machine Test Utility) [10]
✅ LTP: openposix test suite [11]
✅ Ethernet drivers sanity [12]
✅ Networking socket: fuzz [13]
✅ audit: audit testsuite test [14]
✅ httpd: mod_ssl smoke sanity [15]
✅ iotop: sanity [16]
✅ tuned: tune-processes-through-perf [17]
✅ pciutils: update pci ids test [18]
✅ Usex - version 1.9-29 [19]
✅ storage: SCSI VPD [20]
ppc64le:
⚡ Internal infrastructure issues prevented one or more tests (marked
with ⚡⚡⚡) from running on this architecture.
This is not the fault of the kernel that was tested.
x86_64:
Host 1:
✅ Boot test [0]
✅ xfstests: xfs [1]
✅ selinux-policy: serge-testsuite [2]
✅ lvm thinp sanity [3]
✅ storage: software RAID testing [4]
🚧 ✅ Storage blktests [5]
Host 2:
✅ Boot test [0]
✅ Podman system integration test (as root) [6]
✅ Podman system integration test (as user) [6]
✅ LTP lite [7]
✅ Loopdev Sanity [8]
✅ jvm test suite [9]
✅ AMTU (Abstract Machine Test Utility) [10]
✅ LTP: openposix test suite [11]
✅ Ethernet drivers sanity [12]
✅ Networking socket: fuzz [13]
✅ audit: audit testsuite test [14]
✅ httpd: mod_ssl smoke sanity [15]
✅ iotop: sanity [16]
✅ tuned: tune-processes-through-perf [17]
✅ pciutils: sanity smoke test [22]
✅ pciutils: update pci ids test [18]
✅ Usex - version 1.9-29 [19]
✅ storage: SCSI VPD [20]
✅ stress: stress-ng [21]
Test source:
💚 Pull requests are welcome for new tests or improvements to existing tests!
[0]: https://github.com/CKI-project/tests-beaker/archive/master.zip#distribution…
[1]: https://github.com/CKI-project/tests-beaker/archive/master.zip#/filesystems…
[2]: https://github.com/CKI-project/tests-beaker/archive/master.zip#/packages/se…
[3]: https://github.com/CKI-project/tests-beaker/archive/master.zip#storage/lvm/…
[4]: https://github.com/CKI-project/tests-beaker/archive/master.zip#storage/swra…
[5]: https://github.com/CKI-project/tests-beaker/archive/master.zip#storage/blk
[6]: https://github.com/CKI-project/tests-beaker/archive/master.zip#/container/p…
[7]: https://github.com/CKI-project/tests-beaker/archive/master.zip#distribution…
[8]: https://github.com/CKI-project/tests-beaker/archive/master.zip#filesystems/…
[9]: https://github.com/CKI-project/tests-beaker/archive/master.zip#/jvm
[10]: https://github.com/CKI-project/tests-beaker/archive/master.zip#misc/amtu
[11]: https://github.com/CKI-project/tests-beaker/archive/master.zip#distribution…
[12]: https://github.com/CKI-project/tests-beaker/archive/master.zip#/networking/…
[13]: https://github.com/CKI-project/tests-beaker/archive/master.zip#/networking/…
[14]: https://github.com/CKI-project/tests-beaker/archive/master.zip#packages/aud…
[15]: https://github.com/CKI-project/tests-beaker/archive/master.zip#packages/htt…
[16]: https://github.com/CKI-project/tests-beaker/archive/master.zip#packages/iot…
[17]: https://github.com/CKI-project/tests-beaker/archive/master.zip#packages/tun…
[18]: https://github.com/CKI-project/tests-beaker/archive/master.zip#pciutils/upd…
[19]: https://github.com/CKI-project/tests-beaker/archive/master.zip#standards/us…
[20]: https://github.com/CKI-project/tests-beaker/archive/master.zip#storage/scsi…
[21]: https://github.com/CKI-project/tests-beaker/archive/master.zip#stress/stres…
[22]: https://github.com/CKI-project/tests-beaker/archive/master.zip#pciutils/san…
Waived tests (marked with 🚧)
-----------------------------
This test run included waived tests. Such tests are executed but their results
are not taken into account. Tests are waived when their results are not
reliable enough, e.g. when they're just introduced or are being fixed.
On Tue, Aug 13, 2019 at 05:55:26PM +0000, Sasha Levin wrote:
> Hi,
>
> [This is an automated email]
>
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
>
> The bot has tested the following trees: v5.2.8, v4.19.66, v4.14.138, v4.9.189, v4.4.189.
>
> v5.2.8: Build OK!
> v4.19.66: Failed to apply! Possible dependencies:
> 86c71d3deefa ("mt76: move eeprom utility routines in mt76x02_eeprom.h")
> d6500cf3700f ("mt76x0: add quirk to disable 2.4GHz band for Archer T1U")
> eef40d209ad0 ("mt76: move common eeprom definitions in mt76x02-lib module")
<snip>
> NOTE: The patch will not be queued to stable trees until it is upstream.
>
> How should we proceed with this patch?
mt76x0e support was added in 4.20 , so it's fine just to apply this
commit in 5.2 .
Stanislaw
Since the role_store() uses strncmp(), it's possible to refer
out-of-memory if the sysfs data size is smaller than strlen("host").
This patch fixes it by using sysfs_streq() instead of strncmp().
Reported-by: Pavel Machek <pavel(a)denx.de>
Fixes: 9bb86777fb71 ("phy: rcar-gen3-usb2: add sysfs for usb role swap")
Cc: <stable(a)vger.kernel.org> # v4.10+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh(a)renesas.com>
---
Just a record. The role_store() doesn't need to check the count because
the sysfs_streq() checks the first argument is NULL or not.
On "if (sysfs_streq(buf, "host"))"
Example 1: echo ho > role
--> In this case, the count is 3 and the buf has "ho" + NULL.
So, the third character differs between NULL and 's'.
Example 2: echo host-is-not-used > role
--> In this case, the count is 17 and the buf has "host-is-not-used" + NULL.
So, the fifth character differs between '-' and NULL.
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index 1322185..cc18970 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -20,6 +20,7 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
+#include <linux/string.h>
#include <linux/usb/of.h>
#include <linux/workqueue.h>
@@ -317,9 +318,9 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr,
if (!ch->is_otg_channel || !rcar_gen3_is_any_rphy_initialized(ch))
return -EIO;
- if (!strncmp(buf, "host", strlen("host")))
+ if (sysfs_streq(buf, "host"))
new_mode = PHY_MODE_USB_HOST;
- else if (!strncmp(buf, "peripheral", strlen("peripheral")))
+ else if (sysfs_streq(buf, "peripheral"))
new_mode = PHY_MODE_USB_DEVICE;
else
return -EINVAL;
--
2.7.4
From: Joerg Roedel <jroedel(a)suse.de>
Backport commits from upstream to fix a data corruption
issue that gets exposed when using PTI on x86-32.
Please consider them for inclusion into stable-5.2.
Joerg Roedel (3):
x86/mm: Check for pfn instead of page in vmalloc_sync_one()
x86/mm: Sync also unmappings in vmalloc_sync_all()
mm/vmalloc: Sync unmappings in __purge_vmap_area_lazy()
arch/x86/mm/fault.c | 15 ++++++---------
mm/vmalloc.c | 9 +++++++++
2 files changed, 15 insertions(+), 9 deletions(-)
--
2.16.4