From: Sasha Levin Date: Mon, 18 Jul 2022 01:29:46 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v4.9.324~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=17872a8beec7d14380eb57e9109867c0af2f7425;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch b/queue-5.4/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch new file mode 100644 index 00000000000..48724ca9a01 --- /dev/null +++ b/queue-5.4/arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch @@ -0,0 +1,34 @@ +From 5e0996d52a41cb7308e78a5418272f9505f9d97e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Jun 2022 11:27:13 +0200 +Subject: ARM: dts: stm32: use the correct clock source for CEC on stm32mp151 + +From: Gabriel Fernandez + +[ Upstream commit 78ece8cce1ba0c3f3e5a7c6c1b914b3794f04c44 ] + +The peripheral clock of CEC is not LSE but CEC. + +Signed-off-by: Gabriel Fernandez +Signed-off-by: Alexandre Torgue +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/stm32mp157c.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi +index a687c024daa9..0e9e930c60f0 100644 +--- a/arch/arm/boot/dts/stm32mp157c.dtsi ++++ b/arch/arm/boot/dts/stm32mp157c.dtsi +@@ -515,7 +515,7 @@ + compatible = "st,stm32-cec"; + reg = <0x40016000 0x400>; + interrupts = ; +- clocks = <&rcc CEC_K>, <&clk_lse>; ++ clocks = <&rcc CEC_K>, <&rcc CEC>; + clock-names = "cec", "hdmi-cec"; + status = "disabled"; + }; +-- +2.35.1 + diff --git a/queue-5.4/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch b/queue-5.4/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch new file mode 100644 index 00000000000..709a35a064f --- /dev/null +++ b/queue-5.4/asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch @@ -0,0 +1,48 @@ +From abc8794921b08f4737240246988d610496cb12f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:17 +0100 +Subject: ASoC: cs47l15: Fix event generation for low power mux control + +From: Charles Keepax + +[ Upstream commit 7f103af4a10f375b9b346b4d0b730f6a66b8c451 ] + +cs47l15_in1_adc_put always returns zero regardless of if the control +value was updated. This results in missing notifications to user-space +of the control change. Update the handling to return 1 when the value is +changed. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-3-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/cs47l15.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/cs47l15.c b/sound/soc/codecs/cs47l15.c +index ece1276f38eb..1f7148794a5a 100644 +--- a/sound/soc/codecs/cs47l15.c ++++ b/sound/soc/codecs/cs47l15.c +@@ -122,6 +122,9 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol, + snd_soc_kcontrol_component(kcontrol); + struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); + ++ if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode) ++ return 0; ++ + switch (ucontrol->value.integer.value[0]) { + case 0: + /* Set IN1 to normal mode */ +@@ -150,7 +153,7 @@ static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol, + break; + } + +- return 0; ++ return 1; + } + + static const struct snd_kcontrol_new cs47l15_snd_controls[] = { +-- +2.35.1 + diff --git a/queue-5.4/asoc-madera-fix-event-generation-for-out1-demux.patch b/queue-5.4/asoc-madera-fix-event-generation-for-out1-demux.patch new file mode 100644 index 00000000000..5b3880f0010 --- /dev/null +++ b/queue-5.4/asoc-madera-fix-event-generation-for-out1-demux.patch @@ -0,0 +1,46 @@ +From 0a5ecbe78e5c617b2b069fc50d356bdbe4aaa55d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:18 +0100 +Subject: ASoC: madera: Fix event generation for OUT1 demux + +From: Charles Keepax + +[ Upstream commit e3cabbef3db8269207a6b8808f510137669f8deb ] + +madera_out1_demux_put returns the value of +snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for +the kcontrol. This is obviously different to the expected return a 1 if +the control was updated value. This results in spurious notifications to +user-space. Update the handling to only return a 1 when the value is +changed. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-4-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/madera.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c +index 52639811cc52..e375dca9ba8d 100644 +--- a/sound/soc/codecs/madera.c ++++ b/sound/soc/codecs/madera.c +@@ -568,7 +568,13 @@ int madera_out1_demux_put(struct snd_kcontrol *kcontrol, + end: + snd_soc_dapm_mutex_unlock(dapm); + +- return snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ ret = snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); ++ if (ret < 0) { ++ dev_err(madera->dev, "Failed to update demux power state: %d\n", ret); ++ return ret; ++ } ++ ++ return change; + } + EXPORT_SYMBOL_GPL(madera_out1_demux_put); + +-- +2.35.1 + diff --git a/queue-5.4/asoc-madera-fix-event-generation-for-rate-controls.patch b/queue-5.4/asoc-madera-fix-event-generation-for-rate-controls.patch new file mode 100644 index 00000000000..ef85b99b86e --- /dev/null +++ b/queue-5.4/asoc-madera-fix-event-generation-for-rate-controls.patch @@ -0,0 +1,51 @@ +From 8affd5be8740ac5f562e47c5c1a11feda57274ea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 11:51:19 +0100 +Subject: ASoC: madera: Fix event generation for rate controls + +From: Charles Keepax + +[ Upstream commit 980555e95f7cabdc9c80a07107622b097ba23703 ] + +madera_adsp_rate_put always returns zero regardless of if the control +value was updated. This results in missing notifications to user-space +of the control change. Update the handling to return 1 when the +value is changed. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220623105120.1981154-5-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/madera.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c +index e375dca9ba8d..4a56082a4c43 100644 +--- a/sound/soc/codecs/madera.c ++++ b/sound/soc/codecs/madera.c +@@ -853,7 +853,7 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol, + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; + const int adsp_num = e->shift_l; + const unsigned int item = ucontrol->value.enumerated.item[0]; +- int ret; ++ int ret = 0; + + if (item >= e->items) + return -EINVAL; +@@ -870,10 +870,10 @@ static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol, + "Cannot change '%s' while in use by active audio paths\n", + kcontrol->id.name); + ret = -EBUSY; +- } else { ++ } else if (priv->adsp_rate_cache[adsp_num] != e->values[item]) { + /* Volatile register so defer until the codec is powered up */ + priv->adsp_rate_cache[adsp_num] = e->values[item]; +- ret = 0; ++ ret = 1; + } + + mutex_unlock(&priv->rate_lock); +-- +2.35.1 + diff --git a/queue-5.4/asoc-ops-fix-off-by-one-in-range-control-validation.patch b/queue-5.4/asoc-ops-fix-off-by-one-in-range-control-validation.patch new file mode 100644 index 00000000000..fb88c02d8c4 --- /dev/null +++ b/queue-5.4/asoc-ops-fix-off-by-one-in-range-control-validation.patch @@ -0,0 +1,45 @@ +From 5848743147b559fe8f52615f585860f494e845d8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Jun 2022 11:52:46 +0100 +Subject: ASoC: ops: Fix off by one in range control validation + +From: Mark Brown + +[ Upstream commit 5871321fb4558c55bf9567052b618ff0be6b975e ] + +We currently report that range controls accept a range of 0..(max-min) but +accept writes in the range 0..(max-min+1). Remove that extra +1. + +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20220604105246.4055214-1-broonie@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/soc-ops.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c +index 7a37312c8e0c..453b61b42dd9 100644 +--- a/sound/soc/soc-ops.c ++++ b/sound/soc/soc-ops.c +@@ -530,7 +530,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, + return -EINVAL; + if (mc->platform_max && tmp > mc->platform_max) + return -EINVAL; +- if (tmp > mc->max - mc->min + 1) ++ if (tmp > mc->max - mc->min) + return -EINVAL; + + if (invert) +@@ -551,7 +551,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, + return -EINVAL; + if (mc->platform_max && tmp > mc->platform_max) + return -EINVAL; +- if (tmp > mc->max - mc->min + 1) ++ if (tmp > mc->max - mc->min) + return -EINVAL; + + if (invert) +-- +2.35.1 + diff --git a/queue-5.4/asoc-wm5110-fix-dre-control.patch b/queue-5.4/asoc-wm5110-fix-dre-control.patch new file mode 100644 index 00000000000..9abe78cba97 --- /dev/null +++ b/queue-5.4/asoc-wm5110-fix-dre-control.patch @@ -0,0 +1,56 @@ +From 65bae50eda3d6dd21073e1cf7cdde7e8fb46f8cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 11:20:39 +0100 +Subject: ASoC: wm5110: Fix DRE control + +From: Charles Keepax + +[ Upstream commit 0bc0ae9a5938d512fd5d44f11c9c04892dcf4961 ] + +The DRE controls on wm5110 should return a value of 1 if the DRE state +is actually changed, update to fix this. + +Signed-off-by: Charles Keepax +Link: https://lore.kernel.org/r/20220621102041.1713504-2-ckeepax@opensource.cirrus.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/wm5110.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c +index 9dc215b5c504..06ec3f48c808 100644 +--- a/sound/soc/codecs/wm5110.c ++++ b/sound/soc/codecs/wm5110.c +@@ -413,6 +413,7 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, + unsigned int rnew = (!!ucontrol->value.integer.value[1]) << mc->rshift; + unsigned int lold, rold; + unsigned int lena, rena; ++ bool change = false; + int ret; + + snd_soc_dapm_mutex_lock(dapm); +@@ -440,8 +441,8 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, + goto err; + } + +- ret = regmap_update_bits(arizona->regmap, ARIZONA_DRE_ENABLE, +- mask, lnew | rnew); ++ ret = regmap_update_bits_check(arizona->regmap, ARIZONA_DRE_ENABLE, ++ mask, lnew | rnew, &change); + if (ret) { + dev_err(arizona->dev, "Failed to set DRE: %d\n", ret); + goto err; +@@ -454,6 +455,9 @@ static int wm5110_put_dre(struct snd_kcontrol *kcontrol, + if (!rnew && rold) + wm5110_clear_pga_volume(arizona, mc->rshift); + ++ if (change) ++ ret = 1; ++ + err: + snd_soc_dapm_mutex_unlock(dapm); + +-- +2.35.1 + diff --git a/queue-5.4/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch b/queue-5.4/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch new file mode 100644 index 00000000000..60c8f4b4f3e --- /dev/null +++ b/queue-5.4/cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch @@ -0,0 +1,38 @@ +From ff24585d127d9a5c6f2c04dfd93e0c5295fc43ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 Jun 2022 10:25:45 +0800 +Subject: cpufreq: pmac32-cpufreq: Fix refcount leak bug + +From: Liang He + +[ Upstream commit ccd7567d4b6cf187fdfa55f003a9e461ee629e36 ] + +In pmac_cpufreq_init_MacRISC3(), we need to add corresponding +of_node_put() for the three node pointers whose refcount have +been incremented by of_find_node_by_name(). + +Signed-off-by: Liang He +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/pmac32-cpufreq.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c +index 73621bc11976..3704476bb83a 100644 +--- a/drivers/cpufreq/pmac32-cpufreq.c ++++ b/drivers/cpufreq/pmac32-cpufreq.c +@@ -471,6 +471,10 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) + if (slew_done_gpio_np) + slew_done_gpio = read_gpio(slew_done_gpio_np); + ++ of_node_put(volt_gpio_np); ++ of_node_put(freq_gpio_np); ++ of_node_put(slew_done_gpio_np); ++ + /* If we use the frequency GPIOs, calculate the min/max speeds based + * on the bus frequencies + */ +-- +2.35.1 + diff --git a/queue-5.4/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch b/queue-5.4/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch new file mode 100644 index 00000000000..8800c01e9bb --- /dev/null +++ b/queue-5.4/irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch @@ -0,0 +1,41 @@ +From a8f2b0d7dd498317874b6d0d2104cf56bb77252c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jun 2022 08:54:26 +0900 +Subject: irqchip: or1k-pic: Undefine mask_ack for level triggered hardware + +From: Stafford Horne + +[ Upstream commit 8520501346ed8d1c4a6dfa751cb57328a9c843f1 ] + +The mask_ack operation clears the interrupt by writing to the PICSR +register. This we don't want for level triggered interrupt because +it does not actually clear the interrupt on the source hardware. + +This was causing issues in qemu with multi core setups where +interrupts would continue to fire even though they had been cleared in +PICSR. + +Just remove the mask_ack operation. + +Acked-by: Marc Zyngier +Signed-off-by: Stafford Horne +Signed-off-by: Sasha Levin +--- + drivers/irqchip/irq-or1k-pic.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/irqchip/irq-or1k-pic.c b/drivers/irqchip/irq-or1k-pic.c +index 03d2366118dd..d5f1fabc45d7 100644 +--- a/drivers/irqchip/irq-or1k-pic.c ++++ b/drivers/irqchip/irq-or1k-pic.c +@@ -66,7 +66,6 @@ static struct or1k_pic_dev or1k_pic_level = { + .name = "or1k-PIC-level", + .irq_unmask = or1k_pic_unmask, + .irq_mask = or1k_pic_mask, +- .irq_mask_ack = or1k_pic_mask_ack, + }, + .handle = handle_level_irq, + .flags = IRQ_LEVEL | IRQ_NOPROBE, +-- +2.35.1 + diff --git a/queue-5.4/net-sfp-fix-memory-leak-in-sfp_probe.patch b/queue-5.4/net-sfp-fix-memory-leak-in-sfp_probe.patch new file mode 100644 index 00000000000..03e6f825941 --- /dev/null +++ b/queue-5.4/net-sfp-fix-memory-leak-in-sfp_probe.patch @@ -0,0 +1,39 @@ +From cd0147a3dcc3ab5194680a57ab7ccc1c7788567f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jun 2022 15:55:50 +0800 +Subject: net: sfp: fix memory leak in sfp_probe() + +From: Jianglei Nie + +[ Upstream commit 0a18d802d65cf662644fd1d369c86d84a5630652 ] + +sfp_probe() allocates a memory chunk from sfp with sfp_alloc(). When +devm_add_action() fails, sfp is not freed, which leads to a memory leak. + +We should use devm_add_action_or_reset() instead of devm_add_action(). + +Signed-off-by: Jianglei Nie +Reviewed-by: Russell King (Oracle) +Link: https://lore.kernel.org/r/20220629075550.2152003-1-niejianglei2021@163.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/phy/sfp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c +index 5657c604602e..beaa00342a13 100644 +--- a/drivers/net/phy/sfp.c ++++ b/drivers/net/phy/sfp.c +@@ -1878,7 +1878,7 @@ static int sfp_probe(struct platform_device *pdev) + + platform_set_drvdata(pdev, sfp); + +- err = devm_add_action(sfp->dev, sfp_cleanup, sfp); ++ err = devm_add_action_or_reset(sfp->dev, sfp_cleanup, sfp); + if (err < 0) + return err; + +-- +2.35.1 + diff --git a/queue-5.4/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch b/queue-5.4/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch new file mode 100644 index 00000000000..b6a2090210a --- /dev/null +++ b/queue-5.4/net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch @@ -0,0 +1,34 @@ +From 86885c8841479e19c332d727e28fa41c37d5e658 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jun 2022 14:34:18 +0800 +Subject: net: tipc: fix possible refcount leak in tipc_sk_create() + +From: Hangyu Hua + +[ Upstream commit 00aff3590fc0a73bddd3b743863c14e76fd35c0c ] + +Free sk in case tipc_sk_insert() fails. + +Signed-off-by: Hangyu Hua +Reviewed-by: Tung Nguyen +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/tipc/socket.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/tipc/socket.c b/net/tipc/socket.c +index d543c4556df2..58c4d61d603f 100644 +--- a/net/tipc/socket.c ++++ b/net/tipc/socket.c +@@ -455,6 +455,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, + sock_init_data(sock, sk); + tipc_set_sk_state(sk, TIPC_OPEN); + if (tipc_sk_insert(tsk)) { ++ sk_free(sk); + pr_warn("Socket create failed; port number exhausted\n"); + return -EINVAL; + } +-- +2.35.1 + diff --git a/queue-5.4/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch b/queue-5.4/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch new file mode 100644 index 00000000000..7296282b01d --- /dev/null +++ b/queue-5.4/netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch @@ -0,0 +1,104 @@ +From 0bb1900a3b70e204f818fadd1fca8d2fdd842114 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 18:26:03 +0200 +Subject: netfilter: br_netfilter: do not skip all hooks with 0 priority + +From: Florian Westphal + +[ Upstream commit c2577862eeb0be94f151f2f1fff662b028061b00 ] + +When br_netfilter module is loaded, skbs may be diverted to the +ipv4/ipv6 hooks, just like as if we were routing. + +Unfortunately, bridge filter hooks with priority 0 may be skipped +in this case. + +Example: +1. an nftables bridge ruleset is loaded, with a prerouting + hook that has priority 0. +2. interface is added to the bridge. +3. no tcp packet is ever seen by the bridge prerouting hook. +4. flush the ruleset +5. load the bridge ruleset again. +6. tcp packets are processed as expected. + +After 1) the only registered hook is the bridge prerouting hook, but its +not called yet because the bridge hasn't been brought up yet. + +After 2), hook order is: + 0 br_nf_pre_routing // br_netfilter internal hook + 0 chain bridge f prerouting // nftables bridge ruleset + +The packet is diverted to br_nf_pre_routing. +If call-iptables is off, the nftables bridge ruleset is called as expected. + +But if its enabled, br_nf_hook_thresh() will skip it because it assumes +that all 0-priority hooks had been called previously in bridge context. + +To avoid this, check for the br_nf_pre_routing hook itself, we need to +resume directly after it, even if this hook has a priority of 0. + +Unfortunately, this still results in different packet flow. +With this fix, the eval order after in 3) is: +1. br_nf_pre_routing +2. ip(6)tables (if enabled) +3. nftables bridge + +but after 5 its the much saner: +1. nftables bridge +2. br_nf_pre_routing +3. ip(6)tables (if enabled) + +Unfortunately I don't see a solution here: +It would be possible to move br_nf_pre_routing to a higher priority +so that it will be called later in the pipeline, but this also impacts +ebtables evaluation order, and would still result in this very ordering +problem for all nftables-bridge hooks with the same priority as the +br_nf_pre_routing one. + +Searching back through the git history I don't think this has +ever behaved in any other way, hence, no fixes-tag. + +Reported-by: Radim Hrazdil +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/bridge/br_netfilter_hooks.c | 21 ++++++++++++++++++--- + 1 file changed, 18 insertions(+), 3 deletions(-) + +diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c +index 480e4111b24c..19726d81025d 100644 +--- a/net/bridge/br_netfilter_hooks.c ++++ b/net/bridge/br_netfilter_hooks.c +@@ -1012,9 +1012,24 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net, + return okfn(net, sk, skb); + + ops = nf_hook_entries_get_hook_ops(e); +- for (i = 0; i < e->num_hook_entries && +- ops[i]->priority <= NF_BR_PRI_BRNF; i++) +- ; ++ for (i = 0; i < e->num_hook_entries; i++) { ++ /* These hooks have already been called */ ++ if (ops[i]->priority < NF_BR_PRI_BRNF) ++ continue; ++ ++ /* These hooks have not been called yet, run them. */ ++ if (ops[i]->priority > NF_BR_PRI_BRNF) ++ break; ++ ++ /* take a closer look at NF_BR_PRI_BRNF. */ ++ if (ops[i]->hook == br_nf_pre_routing) { ++ /* This hook diverted the skb to this function, ++ * hooks after this have not been run yet. ++ */ ++ i++; ++ break; ++ } ++ } + + nf_hook_state_init(&state, hook, NFPROTO_BRIDGE, indev, outdev, + sk, net, okfn); +-- +2.35.1 + diff --git a/queue-5.4/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch b/queue-5.4/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch new file mode 100644 index 00000000000..cd7290b4bc0 --- /dev/null +++ b/queue-5.4/nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch @@ -0,0 +1,50 @@ +From 7df3e8059de98538cb4c09af4dfaf236248c32c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 19:06:43 +0200 +Subject: NFC: nxp-nci: don't print header length mismatch on i2c error + +From: Michael Walle + +[ Upstream commit 9577fc5fdc8b07b891709af6453545db405e24ad ] + +Don't print a misleading header length mismatch error if the i2c call +returns an error. Instead just return the error code without any error +message. + +Signed-off-by: Michael Walle +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/nfc/nxp-nci/i2c.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c +index 3943a30053b3..f426dcdfcdd6 100644 +--- a/drivers/nfc/nxp-nci/i2c.c ++++ b/drivers/nfc/nxp-nci/i2c.c +@@ -122,7 +122,9 @@ static int nxp_nci_i2c_fw_read(struct nxp_nci_i2c_phy *phy, + skb_put_data(*skb, &header, NXP_NCI_FW_HDR_LEN); + + r = i2c_master_recv(client, skb_put(*skb, frame_len), frame_len); +- if (r != frame_len) { ++ if (r < 0) { ++ goto fw_read_exit_free_skb; ++ } else if (r != frame_len) { + nfc_err(&client->dev, + "Invalid frame length: %u (expected %zu)\n", + r, frame_len); +@@ -166,7 +168,9 @@ static int nxp_nci_i2c_nci_read(struct nxp_nci_i2c_phy *phy, + return 0; + + r = i2c_master_recv(client, skb_put(*skb, header.plen), header.plen); +- if (r != header.plen) { ++ if (r < 0) { ++ goto nci_read_exit_free_skb; ++ } else if (r != header.plen) { + nfc_err(&client->dev, + "Invalid frame payload length: %u (expected %u)\n", + r, header.plen); +-- +2.35.1 + diff --git a/queue-5.4/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch b/queue-5.4/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch new file mode 100644 index 00000000000..e1e18543aaf --- /dev/null +++ b/queue-5.4/nvme-fix-regression-when-disconnect-a-recovering-ctr.patch @@ -0,0 +1,143 @@ +From 9300f108304daf6d643b197a7dcbf48555e24f6a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 14:45:39 +0800 +Subject: nvme: fix regression when disconnect a recovering ctrl + +From: Ruozhu Li + +[ Upstream commit f7f70f4aa09dc43d7455c060143e86a017c30548 ] + +We encountered a problem that the disconnect command hangs. +After analyzing the log and stack, we found that the triggering +process is as follows: +CPU0 CPU1 + nvme_rdma_error_recovery_work + nvme_rdma_teardown_io_queues +nvme_do_delete_ctrl nvme_stop_queues + nvme_remove_namespaces + --clear ctrl->namespaces + nvme_start_queues + --no ns in ctrl->namespaces + nvme_ns_remove return(because ctrl is deleting) + blk_freeze_queue + blk_mq_freeze_queue_wait + --wait for ns to unquiesce to clean infligt IO, hang forever + +This problem was not found in older kernels because we will flush +err work in nvme_stop_ctrl before nvme_remove_namespaces.It does not +seem to be modified for functional reasons, the patch can be revert +to solve the problem. + +Revert commit 794a4cb3d2f7 ("nvme: remove the .stop_ctrl callout") + +Signed-off-by: Ruozhu Li +Reviewed-by: Sagi Grimberg +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 2 ++ + drivers/nvme/host/nvme.h | 1 + + drivers/nvme/host/rdma.c | 12 +++++++++--- + drivers/nvme/host/tcp.c | 10 +++++++--- + 4 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 79e22618817d..d2ea6ca37c41 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -4034,6 +4034,8 @@ void nvme_stop_ctrl(struct nvme_ctrl *ctrl) + nvme_stop_keep_alive(ctrl); + flush_work(&ctrl->async_event_work); + cancel_work_sync(&ctrl->fw_act_work); ++ if (ctrl->ops->stop_ctrl) ++ ctrl->ops->stop_ctrl(ctrl); + } + EXPORT_SYMBOL_GPL(nvme_stop_ctrl); + +diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h +index 1d1431dd4f9e..81a5b968253f 100644 +--- a/drivers/nvme/host/nvme.h ++++ b/drivers/nvme/host/nvme.h +@@ -402,6 +402,7 @@ struct nvme_ctrl_ops { + void (*free_ctrl)(struct nvme_ctrl *ctrl); + void (*submit_async_event)(struct nvme_ctrl *ctrl); + void (*delete_ctrl)(struct nvme_ctrl *ctrl); ++ void (*stop_ctrl)(struct nvme_ctrl *ctrl); + int (*get_address)(struct nvme_ctrl *ctrl, char *buf, int size); + }; + +diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c +index 4213c71b02a4..d5d7b2f98edc 100644 +--- a/drivers/nvme/host/rdma.c ++++ b/drivers/nvme/host/rdma.c +@@ -973,6 +973,14 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, + } + } + ++static void nvme_rdma_stop_ctrl(struct nvme_ctrl *nctrl) ++{ ++ struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); ++ ++ cancel_work_sync(&ctrl->err_work); ++ cancel_delayed_work_sync(&ctrl->reconnect_work); ++} ++ + static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) + { + struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); +@@ -1947,9 +1955,6 @@ static const struct blk_mq_ops nvme_rdma_admin_mq_ops = { + + static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown) + { +- cancel_work_sync(&ctrl->err_work); +- cancel_delayed_work_sync(&ctrl->reconnect_work); +- + nvme_rdma_teardown_io_queues(ctrl, shutdown); + blk_mq_quiesce_queue(ctrl->ctrl.admin_q); + if (shutdown) +@@ -1999,6 +2004,7 @@ static const struct nvme_ctrl_ops nvme_rdma_ctrl_ops = { + .submit_async_event = nvme_rdma_submit_async_event, + .delete_ctrl = nvme_rdma_delete_ctrl, + .get_address = nvmf_get_address, ++ .stop_ctrl = nvme_rdma_stop_ctrl, + }; + + /* +diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c +index 4378344f0e7a..2a27ac9aedba 100644 +--- a/drivers/nvme/host/tcp.c ++++ b/drivers/nvme/host/tcp.c +@@ -1973,9 +1973,6 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work) + + static void nvme_tcp_teardown_ctrl(struct nvme_ctrl *ctrl, bool shutdown) + { +- cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); +- cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); +- + nvme_tcp_teardown_io_queues(ctrl, shutdown); + blk_mq_quiesce_queue(ctrl->admin_q); + if (shutdown) +@@ -2014,6 +2011,12 @@ static void nvme_reset_ctrl_work(struct work_struct *work) + nvme_tcp_reconnect_or_remove(ctrl); + } + ++static void nvme_tcp_stop_ctrl(struct nvme_ctrl *ctrl) ++{ ++ cancel_work_sync(&to_tcp_ctrl(ctrl)->err_work); ++ cancel_delayed_work_sync(&to_tcp_ctrl(ctrl)->connect_work); ++} ++ + static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl) + { + struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl); +@@ -2322,6 +2325,7 @@ static const struct nvme_ctrl_ops nvme_tcp_ctrl_ops = { + .submit_async_event = nvme_tcp_submit_async_event, + .delete_ctrl = nvme_tcp_delete_ctrl, + .get_address = nvmf_get_address, ++ .stop_ctrl = nvme_tcp_stop_ctrl, + }; + + static bool +-- +2.35.1 + diff --git a/queue-5.4/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch b/queue-5.4/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch new file mode 100644 index 00000000000..1092a881f37 --- /dev/null +++ b/queue-5.4/platform-x86-hp-wmi-ignore-sanitization-mode-event.patch @@ -0,0 +1,49 @@ +From 4244d4e452def32a97d43cee6872b13162a17267 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jun 2022 20:37:26 +0800 +Subject: platform/x86: hp-wmi: Ignore Sanitization Mode event + +From: Kai-Heng Feng + +[ Upstream commit 9ab762a84b8094540c18a170e5ddd6488632c456 ] + +After system resume the hp-wmi driver may complain: +[ 702.620180] hp_wmi: Unknown event_id - 23 - 0x0 + +According to HP it means 'Sanitization Mode' and it's harmless to just +ignore the event. + +Cc: Jorge Lopez +Signed-off-by: Kai-Heng Feng +Link: https://lore.kernel.org/r/20220628123726.250062-1-kai.heng.feng@canonical.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/hp-wmi.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c +index 63a530a3d9fe..c3fdb0ecad96 100644 +--- a/drivers/platform/x86/hp-wmi.c ++++ b/drivers/platform/x86/hp-wmi.c +@@ -62,6 +62,7 @@ enum hp_wmi_event_ids { + HPWMI_BACKLIT_KB_BRIGHTNESS = 0x0D, + HPWMI_PEAKSHIFT_PERIOD = 0x0F, + HPWMI_BATTERY_CHARGE_PERIOD = 0x10, ++ HPWMI_SANITIZATION_MODE = 0x17, + }; + + struct bios_args { +@@ -629,6 +630,8 @@ static void hp_wmi_notify(u32 value, void *context) + break; + case HPWMI_BATTERY_CHARGE_PERIOD: + break; ++ case HPWMI_SANITIZATION_MODE: ++ break; + default: + pr_info("Unknown event_id - %d - 0x%x\n", event_id, event_data); + break; +-- +2.35.1 + diff --git a/queue-5.4/series b/queue-5.4/series index 8ce8eff53cb..3d1505ac115 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -42,3 +42,22 @@ seg6-fix-skb-checksum-in-srv6-end.b6-and-end.b6.enca.patch seg6-bpf-fix-skb-checksum-in-bpf_push_seg6_encap.patch sfc-fix-kernel-panic-when-creating-vf.patch mm-sysctl-fix-missing-numa_stat-when-config_hugetlb_.patch +virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch +virtio_mmio-restore-guest-page-size-on-resume.patch +netfilter-br_netfilter-do-not-skip-all-hooks-with-0-.patch +cpufreq-pmac32-cpufreq-fix-refcount-leak-bug.patch +platform-x86-hp-wmi-ignore-sanitization-mode-event.patch +net-tipc-fix-possible-refcount-leak-in-tipc_sk_creat.patch +nfc-nxp-nci-don-t-print-header-length-mismatch-on-i2.patch +nvme-fix-regression-when-disconnect-a-recovering-ctr.patch +net-sfp-fix-memory-leak-in-sfp_probe.patch +asoc-ops-fix-off-by-one-in-range-control-validation.patch +asoc-wm5110-fix-dre-control.patch +asoc-cs47l15-fix-event-generation-for-low-power-mux-.patch +asoc-madera-fix-event-generation-for-out1-demux.patch +asoc-madera-fix-event-generation-for-rate-controls.patch +irqchip-or1k-pic-undefine-mask_ack-for-level-trigger.patch +x86-clear-.brk-area-at-early-boot.patch +soc-ixp4xx-npe-fix-unused-match-warning.patch +arm-dts-stm32-use-the-correct-clock-source-for-cec-o.patch +signal-handling-don-t-use-bug_on-for-debugging.patch diff --git a/queue-5.4/signal-handling-don-t-use-bug_on-for-debugging.patch b/queue-5.4/signal-handling-don-t-use-bug_on-for-debugging.patch new file mode 100644 index 00000000000..64f530e47d6 --- /dev/null +++ b/queue-5.4/signal-handling-don-t-use-bug_on-for-debugging.patch @@ -0,0 +1,54 @@ +From 16ac49af818e918ce271a208daecb4b4b0def045 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Jul 2022 12:20:59 -0700 +Subject: signal handling: don't use BUG_ON() for debugging + +From: Linus Torvalds + +[ Upstream commit a382f8fee42ca10c9bfce0d2352d4153f931f5dc ] + +These are indeed "should not happen" situations, but it turns out recent +changes made the 'task_is_stopped_or_trace()' case trigger (fix for that +exists, is pending more testing), and the BUG_ON() makes it +unnecessarily hard to actually debug for no good reason. + +It's been that way for a long time, but let's make it clear: BUG_ON() is +not good for debugging, and should never be used in situations where you +could just say "this shouldn't happen, but we can continue". + +Use WARN_ON_ONCE() instead to make sure it gets logged, and then just +continue running. Instead of making the system basically unusuable +because you crashed the machine while potentially holding some very core +locks (eg this function is commonly called while holding 'tasklist_lock' +for writing). + +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/signal.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/kernel/signal.c b/kernel/signal.c +index 3f61367fd168..1f4293a107b4 100644 +--- a/kernel/signal.c ++++ b/kernel/signal.c +@@ -1916,12 +1916,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig) + bool autoreap = false; + u64 utime, stime; + +- BUG_ON(sig == -1); ++ WARN_ON_ONCE(sig == -1); + +- /* do_notify_parent_cldstop should have been called instead. */ +- BUG_ON(task_is_stopped_or_traced(tsk)); ++ /* do_notify_parent_cldstop should have been called instead. */ ++ WARN_ON_ONCE(task_is_stopped_or_traced(tsk)); + +- BUG_ON(!tsk->ptrace && ++ WARN_ON_ONCE(!tsk->ptrace && + (tsk->group_leader != tsk || !thread_group_empty(tsk))); + + /* Wake up all pidfd waiters */ +-- +2.35.1 + diff --git a/queue-5.4/soc-ixp4xx-npe-fix-unused-match-warning.patch b/queue-5.4/soc-ixp4xx-npe-fix-unused-match-warning.patch new file mode 100644 index 00000000000..abdda21a53e --- /dev/null +++ b/queue-5.4/soc-ixp4xx-npe-fix-unused-match-warning.patch @@ -0,0 +1,45 @@ +From 9b259f983749420245b4981322d6feca8a2dce95 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Jun 2022 09:43:15 +0200 +Subject: soc: ixp4xx/npe: Fix unused match warning + +From: Linus Walleij + +[ Upstream commit 620f83b8326ce9706b1118334f0257ae028ce045 ] + +The kernel test robot found this inconsistency: + + drivers/soc/ixp4xx/ixp4xx-npe.c:737:34: warning: + 'ixp4xx_npe_of_match' defined but not used [-Wunused-const-variable=] + 737 | static const struct of_device_id ixp4xx_npe_of_match[] = { + +This is because the match is enclosed in the of_match_ptr() +which compiles into NULL when OF is disabled and this +is unnecessary. + +Fix it by dropping of_match_ptr() around the match. + +Signed-off-by: Linus Walleij +Link: https://lore.kernel.org/r/20220626074315.61209-1-linus.walleij@linaro.org' +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + drivers/soc/ixp4xx/ixp4xx-npe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c +index 6065aaab6740..8482a4892b83 100644 +--- a/drivers/soc/ixp4xx/ixp4xx-npe.c ++++ b/drivers/soc/ixp4xx/ixp4xx-npe.c +@@ -735,7 +735,7 @@ static const struct of_device_id ixp4xx_npe_of_match[] = { + static struct platform_driver ixp4xx_npe_driver = { + .driver = { + .name = "ixp4xx-npe", +- .of_match_table = of_match_ptr(ixp4xx_npe_of_match), ++ .of_match_table = ixp4xx_npe_of_match, + }, + .probe = ixp4xx_npe_probe, + .remove = ixp4xx_npe_remove, +-- +2.35.1 + diff --git a/queue-5.4/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch b/queue-5.4/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch new file mode 100644 index 00000000000..8cc03a5a9eb --- /dev/null +++ b/queue-5.4/virtio_mmio-add-missing-pm-calls-to-freeze-restore.patch @@ -0,0 +1,81 @@ +From ecc6ab6934004521aeb420e227b0c2198cf0a28f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 13:06:20 +0200 +Subject: virtio_mmio: Add missing PM calls to freeze/restore + +From: Stephan Gerhold + +[ Upstream commit ed7ac37fde33ccd84e4bd2b9363c191f925364c7 ] + +Most virtio drivers provide freeze/restore callbacks to finish up +device usage before suspend and to reinitialize the virtio device after +resume. However, these callbacks are currently only called when using +virtio_pci. virtio_mmio does not have any PM ops defined. + +This causes problems for example after suspend to disk (hibernation), +since the virtio devices might lose their state after the VMM is +restarted. Calling virtio_device_freeze()/restore() ensures that +the virtio devices are re-initialized correctly. + +Fix this by implementing the dev_pm_ops for virtio_mmio, +similar to virtio_pci_common. + +Signed-off-by: Stephan Gerhold +Message-Id: <20220621110621.3638025-2-stephan.gerhold@kernkonzept.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/virtio/virtio_mmio.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c +index 74547323aa83..2a2d817caeff 100644 +--- a/drivers/virtio/virtio_mmio.c ++++ b/drivers/virtio/virtio_mmio.c +@@ -62,6 +62,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -514,6 +515,25 @@ static const struct virtio_config_ops virtio_mmio_config_ops = { + .bus_name = vm_bus_name, + }; + ++#ifdef CONFIG_PM_SLEEP ++static int virtio_mmio_freeze(struct device *dev) ++{ ++ struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); ++ ++ return virtio_device_freeze(&vm_dev->vdev); ++} ++ ++static int virtio_mmio_restore(struct device *dev) ++{ ++ struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); ++ ++ return virtio_device_restore(&vm_dev->vdev); ++} ++ ++static const struct dev_pm_ops virtio_mmio_pm_ops = { ++ SET_SYSTEM_SLEEP_PM_OPS(virtio_mmio_freeze, virtio_mmio_restore) ++}; ++#endif + + static void virtio_mmio_release_dev(struct device *_d) + { +@@ -767,6 +787,9 @@ static struct platform_driver virtio_mmio_driver = { + .name = "virtio-mmio", + .of_match_table = virtio_mmio_match, + .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match), ++#ifdef CONFIG_PM_SLEEP ++ .pm = &virtio_mmio_pm_ops, ++#endif + }, + }; + +-- +2.35.1 + diff --git a/queue-5.4/virtio_mmio-restore-guest-page-size-on-resume.patch b/queue-5.4/virtio_mmio-restore-guest-page-size-on-resume.patch new file mode 100644 index 00000000000..882118f4e59 --- /dev/null +++ b/queue-5.4/virtio_mmio-restore-guest-page-size-on-resume.patch @@ -0,0 +1,44 @@ +From 7bed057da068f6be52505b9479069976f386ef94 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jun 2022 13:06:21 +0200 +Subject: virtio_mmio: Restore guest page size on resume + +From: Stephan Gerhold + +[ Upstream commit e0c2ce8217955537dd5434baeba061f209797119 ] + +Virtio devices might lose their state when the VMM is restarted +after a suspend to disk (hibernation) cycle. This means that the +guest page size register must be restored for the virtio_mmio legacy +interface, since otherwise the virtio queues are not functional. + +This is particularly problematic for QEMU that currently still defaults +to using the legacy interface for virtio_mmio. Write the guest page +size register again in virtio_mmio_restore() to make legacy virtio_mmio +devices work correctly after hibernation. + +Signed-off-by: Stephan Gerhold +Message-Id: <20220621110621.3638025-3-stephan.gerhold@kernkonzept.com> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + drivers/virtio/virtio_mmio.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c +index 2a2d817caeff..e781e5e9215f 100644 +--- a/drivers/virtio/virtio_mmio.c ++++ b/drivers/virtio/virtio_mmio.c +@@ -527,6 +527,9 @@ static int virtio_mmio_restore(struct device *dev) + { + struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev); + ++ if (vm_dev->version == 1) ++ writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); ++ + return virtio_device_restore(&vm_dev->vdev); + } + +-- +2.35.1 + diff --git a/queue-5.4/x86-clear-.brk-area-at-early-boot.patch b/queue-5.4/x86-clear-.brk-area-at-early-boot.patch new file mode 100644 index 00000000000..7b7eab521b3 --- /dev/null +++ b/queue-5.4/x86-clear-.brk-area-at-early-boot.patch @@ -0,0 +1,43 @@ +From fd64814ae6c58d96212fe19cf718f69636a42562 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Jun 2022 09:14:40 +0200 +Subject: x86: Clear .brk area at early boot + +From: Juergen Gross + +[ Upstream commit 38fa5479b41376dc9d7f57e71c83514285a25ca0 ] + +The .brk section has the same properties as .bss: it is an alloc-only +section and should be cleared before being used. + +Not doing so is especially a problem for Xen PV guests, as the +hypervisor will validate page tables (check for writable page tables +and hypervisor private bits) before accepting them to be used. + +Make sure .brk is initially zero by letting clear_bss() clear the brk +area, too. + +Signed-off-by: Juergen Gross +Signed-off-by: Borislav Petkov +Link: https://lore.kernel.org/r/20220630071441.28576-3-jgross@suse.com +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/head64.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c +index 206a4b6144c2..950286016f63 100644 +--- a/arch/x86/kernel/head64.c ++++ b/arch/x86/kernel/head64.c +@@ -383,6 +383,8 @@ static void __init clear_bss(void) + { + memset(__bss_start, 0, + (unsigned long) __bss_stop - (unsigned long) __bss_start); ++ memset(__brk_base, 0, ++ (unsigned long) __brk_limit - (unsigned long) __brk_base); + } + + static unsigned long get_cmd_line_ptr(void) +-- +2.35.1 +