From: Sasha Levin Date: Tue, 27 Dec 2022 02:31:10 +0000 (-0500) Subject: Fixes for 4.14 X-Git-Tag: v5.15.86~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5181570a628c158606194af87e06d7f1167945b7;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch b/queue-4.14/asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch new file mode 100644 index 00000000000..1fce7378638 --- /dev/null +++ b/queue-4.14/asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch @@ -0,0 +1,57 @@ +From 754ede9315c730867049f1db6340eeb7e7b5e101 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Dec 2022 18:04:24 +0800 +Subject: ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in + mt8173_rt5650_rt5514_dev_probe() + +From: Wang Yufen + +[ Upstream commit 3327d721114c109ba0575f86f8fda3b525404054 ] + +The node returned by of_parse_phandle() with refcount incremented, +of_node_put() needs be called when finish using it. So add it in the +error path in mt8173_rt5650_rt5514_dev_probe(). + +Fixes: 0d1d7a664288 ("ASoC: mediatek: Refine mt8173 driver and change config option") +Signed-off-by: Wang Yufen +Link: https://lore.kernel.org/r/1670234664-24246-1-git-send-email-wangyufen@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +index aa52e2f81760..c58aa649d676 100644 +--- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c ++++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c +@@ -209,14 +209,16 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) + if (!mt8173_rt5650_rt5514_codecs[0].of_node) { + dev_err(&pdev->dev, + "Property 'audio-codec' missing or invalid\n"); +- return -EINVAL; ++ ret = -EINVAL; ++ goto out; + } + mt8173_rt5650_rt5514_codecs[1].of_node = + of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1); + if (!mt8173_rt5650_rt5514_codecs[1].of_node) { + dev_err(&pdev->dev, + "Property 'audio-codec' missing or invalid\n"); +- return -EINVAL; ++ ret = -EINVAL; ++ goto out; + } + mt8173_rt5650_rt5514_codec_conf[0].of_node = + mt8173_rt5650_rt5514_codecs[1].of_node; +@@ -228,6 +230,7 @@ static int mt8173_rt5650_rt5514_dev_probe(struct platform_device *pdev) + dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", + __func__, ret); + ++out: + of_node_put(platform_node); + return ret; + } +-- +2.35.1 + diff --git a/queue-4.14/asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch b/queue-4.14/asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch new file mode 100644 index 00000000000..5982ab2d60a --- /dev/null +++ b/queue-4.14/asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch @@ -0,0 +1,37 @@ +From 10993d862fe5b15d9682a9521ec6b6b612794d8b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Dec 2022 11:28:02 +0800 +Subject: ASoC: rockchip: pdm: Add missing clk_disable_unprepare() in + rockchip_pdm_runtime_resume() + +From: Wang Jingjin + +[ Upstream commit ef0a098efb36660326c133af9b5a04a96a00e3ca ] + +The clk_disable_unprepare() should be called in the error handling of +rockchip_pdm_runtime_resume(). + +Fixes: fc05a5b22253 ("ASoC: rockchip: add support for pdm controller") +Signed-off-by: Wang Jingjin +Link: https://lore.kernel.org/r/20221205032802.2422983-1-wangjingjin1@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/rockchip/rockchip_pdm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c +index ad16c8310dd3..7dfd1e6b2c25 100644 +--- a/sound/soc/rockchip/rockchip_pdm.c ++++ b/sound/soc/rockchip/rockchip_pdm.c +@@ -303,6 +303,7 @@ static int rockchip_pdm_runtime_resume(struct device *dev) + + ret = clk_prepare_enable(pdm->hclk); + if (ret) { ++ clk_disable_unprepare(pdm->clk); + dev_err(pdm->dev, "hclock enable failed %d\n", ret); + return ret; + } +-- +2.35.1 + diff --git a/queue-4.14/asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch b/queue-4.14/asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch new file mode 100644 index 00000000000..9fa972e6676 --- /dev/null +++ b/queue-4.14/asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch @@ -0,0 +1,37 @@ +From 824c7c356fe1d0843a127078f99a24b1e4497f37 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Dec 2022 14:39:00 +0800 +Subject: ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in + rk_spdif_runtime_resume() + +From: Wang Jingjin + +[ Upstream commit 6d94d0090527b1763872275a7ccd44df7219b31e ] + +rk_spdif_runtime_resume() may have called clk_prepare_enable() before return +from failed branches, add missing clk_disable_unprepare() in this case. + +Fixes: f874b80e1571 ("ASoC: rockchip: Add rockchip SPDIF transceiver driver") +Signed-off-by: Wang Jingjin +Link: https://lore.kernel.org/r/20221208063900.4180790-1-wangjingjin1@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/rockchip/rockchip_spdif.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c +index a89fe9b6463b..5ac726da6015 100644 +--- a/sound/soc/rockchip/rockchip_spdif.c ++++ b/sound/soc/rockchip/rockchip_spdif.c +@@ -89,6 +89,7 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev) + + ret = clk_prepare_enable(spdif->hclk); + if (ret) { ++ clk_disable_unprepare(spdif->mclk); + dev_err(spdif->dev, "hclk clock enable failed %d\n", ret); + return ret; + } +-- +2.35.1 + diff --git a/queue-4.14/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch b/queue-4.14/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch new file mode 100644 index 00000000000..60e774e9ea6 --- /dev/null +++ b/queue-4.14/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch @@ -0,0 +1,42 @@ +From f120ca728ce9d6279fd60cf02c48772951bee72e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 13 Dec 2022 13:33:19 +0100 +Subject: ASoC: rt5670: Remove unbalanced pm_runtime_put() + +From: Hans de Goede + +[ Upstream commit 6c900dcc3f7331a67ed29739d74524e428d137fb ] + +For some reason rt5670_i2c_probe() does a pm_runtime_put() at the end +of a successful probe. But it has never done a pm_runtime_get() leading +to the following error being logged into dmesg: + + rt5670 i2c-10EC5640:00: Runtime PM usage count underflow! + +Fix this by removing the unnecessary pm_runtime_put(). + +Fixes: 64e89e5f5548 ("ASoC: rt5670: Add runtime PM support") +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20221213123319.11285-1-hdegoede@redhat.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/rt5670.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c +index 9545764ef3eb..08367a813f5b 100644 +--- a/sound/soc/codecs/rt5670.c ++++ b/sound/soc/codecs/rt5670.c +@@ -3071,8 +3071,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, + if (ret < 0) + goto err; + +- pm_runtime_put(&i2c->dev); +- + return 0; + err: + pm_runtime_disable(&i2c->dev); +-- +2.35.1 + diff --git a/queue-4.14/asoc-wm8994-fix-potential-deadlock.patch b/queue-4.14/asoc-wm8994-fix-potential-deadlock.patch new file mode 100644 index 00000000000..06793c2274a --- /dev/null +++ b/queue-4.14/asoc-wm8994-fix-potential-deadlock.patch @@ -0,0 +1,42 @@ +From 7f358007a104667127bdb84adfc23cd29a0af1d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Dec 2022 10:16:57 +0100 +Subject: ASoC: wm8994: Fix potential deadlock + +From: Marek Szyprowski + +[ Upstream commit 9529dc167ffcdfd201b9f0eda71015f174095f7e ] + +Fix this by dropping wm8994->accdet_lock while calling +cancel_delayed_work_sync(&wm8994->mic_work) in wm1811_jackdet_irq(). + +Fixes: c0cc3f166525 ("ASoC: wm8994: Allow a delay between jack insertion and microphone detect") +Signed-off-by: Marek Szyprowski +Acked-by: Charles Keepax +Link: https://lore.kernel.org/r/20221209091657.1183-1-m.szyprowski@samsung.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wm8994.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c +index f289762cd676..1feeeed4bfb2 100644 +--- a/sound/soc/codecs/wm8994.c ++++ b/sound/soc/codecs/wm8994.c +@@ -3704,7 +3704,12 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data) + } else { + dev_dbg(codec->dev, "Jack not detected\n"); + ++ /* Release wm8994->accdet_lock to avoid deadlock: ++ * cancel_delayed_work_sync() takes wm8994->mic_work internal ++ * lock and wm1811_mic_work takes wm8994->accdet_lock */ ++ mutex_unlock(&wm8994->accdet_lock); + cancel_delayed_work_sync(&wm8994->mic_work); ++ mutex_lock(&wm8994->accdet_lock); + + snd_soc_update_bits(codec, WM8958_MICBIAS2, + WM8958_MICB2_DISCH, WM8958_MICB2_DISCH); +-- +2.35.1 + diff --git a/queue-4.14/pstore-make-sure-config_pstore_pmsg-selects-config_r.patch b/queue-4.14/pstore-make-sure-config_pstore_pmsg-selects-config_r.patch new file mode 100644 index 00000000000..dff3580883c --- /dev/null +++ b/queue-4.14/pstore-make-sure-config_pstore_pmsg-selects-config_r.patch @@ -0,0 +1,53 @@ +From a3adca22a9bc437a8ca6fcffbe5d671dcafdb443 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Dec 2022 05:18:55 +0000 +Subject: pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES + +From: John Stultz + +[ Upstream commit 2f4fec5943407318b9523f01ce1f5d668c028332 ] + +In commit 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex +to avoid priority inversion") I changed a lock to an rt_mutex. + +However, its possible that CONFIG_RT_MUTEXES is not enabled, +which then results in a build failure, as the 0day bot detected: + https://lore.kernel.org/linux-mm/202212211244.TwzWZD3H-lkp@intel.com/ + +Thus this patch changes CONFIG_PSTORE_PMSG to select +CONFIG_RT_MUTEXES, which ensures the build will not fail. + +Cc: Wei Wang +Cc: Midas Chien +Cc: Connor O'Brien +Cc: Kees Cook +Cc: Anton Vorontsov +Cc: Colin Cross +Cc: Tony Luck +Cc: kernel test robot +Cc: kernel-team@android.com +Fixes: 76d62f24db07 ("pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion") +Reported-by: kernel test robot +Signed-off-by: John Stultz +Signed-off-by: Kees Cook +Link: https://lore.kernel.org/r/20221221051855.15761-1-jstultz@google.com +Signed-off-by: Sasha Levin +--- + fs/pstore/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig +index b42e5bd6d8ff..144e5027fe84 100644 +--- a/fs/pstore/Kconfig ++++ b/fs/pstore/Kconfig +@@ -51,6 +51,7 @@ config PSTORE_CONSOLE + config PSTORE_PMSG + bool "Log user space messages" + depends on PSTORE ++ select RT_MUTEXES + help + When the option is enabled, pstore will export a character + interface /dev/pmsg0 to log user space messages. On reboot +-- +2.35.1 + diff --git a/queue-4.14/pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch b/queue-4.14/pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch new file mode 100644 index 00000000000..00e461d706c --- /dev/null +++ b/queue-4.14/pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch @@ -0,0 +1,70 @@ +From 42200806393f1ef602df6225560b3f45614d55fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Dec 2022 23:18:34 +0000 +Subject: pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion + +From: John Stultz + +[ Upstream commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721 ] + +Wei Wang reported seeing priority inversion caused latencies +caused by contention on pmsg_lock, and suggested it be switched +to a rt_mutex. + +I was initially hesitant this would help, as the tasks in that +trace all seemed to be SCHED_NORMAL, so the benefit would be +limited to only nice boosting. + +However, another similar issue was raised where the priority +inversion was seen did involve a blocked RT task so it is clear +this would be helpful in that case. + +Cc: Wei Wang +Cc: Midas Chien +Cc: Connor O'Brien +Cc: Kees Cook +Cc: Anton Vorontsov +Cc: Colin Cross +Cc: Tony Luck +Cc: kernel-team@android.com +Fixes: 9d5438f462ab ("pstore: Add pmsg - user-space accessible pstore object") +Reported-by: Wei Wang +Signed-off-by: John Stultz +Signed-off-by: Kees Cook +Link: https://lore.kernel.org/r/20221214231834.3711880-1-jstultz@google.com +Signed-off-by: Sasha Levin +--- + fs/pstore/pmsg.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/fs/pstore/pmsg.c b/fs/pstore/pmsg.c +index 24db02de1787..ffc13ea196d2 100644 +--- a/fs/pstore/pmsg.c ++++ b/fs/pstore/pmsg.c +@@ -15,9 +15,10 @@ + #include + #include + #include ++#include + #include "internal.h" + +-static DEFINE_MUTEX(pmsg_lock); ++static DEFINE_RT_MUTEX(pmsg_lock); + + static ssize_t write_pmsg(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) +@@ -36,9 +37,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf, + if (!access_ok(VERIFY_READ, buf, count)) + return -EFAULT; + +- mutex_lock(&pmsg_lock); ++ rt_mutex_lock(&pmsg_lock); + ret = psinfo->write_user(&record, buf); +- mutex_unlock(&pmsg_lock); ++ rt_mutex_unlock(&pmsg_lock); + return ret ? ret : count; + } + +-- +2.35.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 041f1c15809..32c035f55d3 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -249,3 +249,10 @@ clk-st-fix-memory-leak-in-st_of_quadfs_setup.patch drm-fsl-dcu-fix-return-type-of-fsl_dcu_drm_connector.patch drm-sti-fix-return-type-of-sti_-dvo-hda-hdmi-_connec.patch orangefs-fix-kmemleak-in-orangefs_prepare_debugfs_he.patch +asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch +asoc-rockchip-pdm-add-missing-clk_disable_unprepare-.patch +asoc-wm8994-fix-potential-deadlock.patch +asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch +asoc-rt5670-remove-unbalanced-pm_runtime_put.patch +pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch +pstore-make-sure-config_pstore_pmsg-selects-config_r.patch