ASoC: amd: yc: Add DMI support for new acer/emdoor platforms
Subsystems (11)
Sasha Levin
maintainerPATCH 1/38 ASoC: amd: yc: Add DMI support for new acer/emdoor platforms
From: Syed Saba Kareem <[email protected]>
[ Upstream commit 7fd26a27680aa9032920f798a5a8b38a2c61075f ]
Adding DMI entries to support new acer/emdoor platforms.
--- sound/soc/amd/yc/acp6x-mach.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +14 -0
@@ -234,6 +234,20 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Blade 14 (2022) - RZ09-0427"), } }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "RB"), + DMI_MATCH(DMI_PRODUCT_NAME, "Swift SFA16-41"), + } + }, + { + .driver_data = &acp6x_card, + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "IRBIS"), + DMI_MATCH(DMI_PRODUCT_NAME, "15NBC1011"), + } + }, {} };
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 2/38 ASoC: SOF: sof-audio: start with the right widget type
From: Bard Liao <[email protected]>
[ Upstream commit fcc4348adafe53928fda46d104c1798e5a4de4ff ]
If there is a connection between a playback stream and a capture stream, all widgets that are connected to the playback stream and the capture stream will be in the list.
So, we have to start with the exactly right widget type. snd_soc_dapm_aif_out is for capture stream and a playback stream should start with a snd_soc_dapm_aif_in widget.
Contrarily, snd_soc_dapm_dai_in is for playback stream, and a capture stream should start with a snd_soc_dapm_dai_out widget.
--- sound/soc/sof/sof-audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/sof-audio.c +2 -2
@@ -429,11 +429,11 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget_lfor_each_dapm_widgets (list, i, widget) {/* starting widget for playback is AIF type */ -if (dir ==SNDRV_PCM_STREAM_PLAYBACK && !WIDGET_IS_AIF (widget->id)) +if (dir ==SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in)continue ;/* starting widget for capture is DAI type */ -if (dir ==SNDRV_PCM_STREAM_CAPTURE && !WIDGET_IS_DAI (widget->id)) +if (dir ==SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out)continue ;switch (op) {
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 3/38 ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit dfd5fe19db7dc7006642f8109ee8965e5d031897 ]
JBL Quantum610 Wireless (0ecb:205c) requires the same workaround that was used for JBL Quantum810 for limiting the sample rate.
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2152,6 +2152,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GENERIC_IMPLICIT_FB),DEVICE_FLG (0x0525 ,0xa4ad ,/* Hamedal C20 usb camero */ QUIRK_FLAG_IFACE_SKIP_CLOSE ), +DEVICE_FLG (0x0ecb ,0x205c ,/* JBL Quantum610 Wireless */ +QUIRK_FLAG_FIXED_RATE ),DEVICE_FLG (0x0ecb ,0x2069 ,/* JBL Quantum810 Wireless */ QUIRK_FLAG_FIXED_RATE),
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 4/38 ASoC: Intel: sof_rt5682: always set dpcm_capture for amplifiers
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 324f065cdbaba1b879a63bf07e61ca156b789537 ]
The amplifier may provide hardware support for I/V feedback, or alternatively the firmware may generate an echo reference attached to the SSP and dailink used for the amplifier.
To avoid any issues with invalid/NULL substreams in the latter case, always unconditionally set dpcm_capture.
--- sound/soc/intel/boards/sof_rt5682.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/intel/boards/sof_rt5682.c +3 -2
@@ -761,8 +761,6 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, links[id].num_codecs =ARRAY_SIZE (max_98373_components); links[id].init = max_98373_spk_codec_init; links[id].ops = &max_98373_ops; -/* feedback stream */ - links[id].dpcm_capture =1 ; }else if (sof_rt5682_quirk &SOF_MAX98360A_SPEAKER_AMP_PRESENT ) {max_98360a_dai_link (&links[id]);
@@ -789,6 +787,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, links[id].platforms = platform_component; links[id].num_platforms =ARRAY_SIZE (platform_component); links[id].dpcm_playback =1 ; +/* feedback stream or firmware-generated echo reference */ + links[id].dpcm_capture =1 ; + links[id].no_pcm =1 ; links[id].cpus = &cpus[id]; links[id].num_cpus =1 ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 5/38 ASoC: Intel: sof_cs42l42: always set dpcm_capture for amplifiers
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit e0a52220344ab7defe25b9cdd58fe1dc1122e67c ]
The amplifier may provide hardware support for I/V feedback, or alternatively the firmware may generate an echo reference attached to the SSP and dailink used for the amplifier.
To avoid any issues with invalid/NULL substreams in the latter case, always unconditionally set dpcm_capture.
--- sound/soc/intel/boards/sof_cs42l42.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/boards/sof_cs42l42.c +3 -0
@@ -336,6 +336,9 @@ static int create_spk_amp_dai_links(struct device *dev, links[*id].platforms = platform_component; links[*id].num_platforms =ARRAY_SIZE (platform_component); links[*id].dpcm_playback =1 ; +/* firmware-generated echo reference */ + links[*id].dpcm_capture =1 ; + links[*id].no_pcm =1 ; links[*id].cpus = &cpus[*id]; links[*id].num_cpus =1 ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 6/38 ASoC: Intel: sof_nau8825: always set dpcm_capture for amplifiers
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 36a71a0eb7cdb5ccf4b0214dbd41ab00dff18c7f ]
The amplifier may provide hardware support for I/V feedback, or alternatively the firmware may generate an echo reference attached to the SSP and dailink used for the amplifier.
To avoid any issues with invalid/NULL substreams in the latter case, always unconditionally set dpcm_capture.
--- sound/soc/intel/boards/sof_nau8825.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/intel/boards/sof_nau8825.c +3 -2
@@ -479,8 +479,6 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, links[id].num_codecs =ARRAY_SIZE (max_98373_components); links[id].init = max_98373_spk_codec_init; links[id].ops = &max_98373_ops; -/* feedback stream */ - links[id].dpcm_capture =1 ; }else if (sof_nau8825_quirk &SOF_MAX98360A_SPEAKER_AMP_PRESENT ) {max_98360a_dai_link (&links[id]);
@@ -493,6 +491,9 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, links[id].platforms = platform_component; links[id].num_platforms =ARRAY_SIZE (platform_component); links[id].dpcm_playback =1 ; +/* feedback stream or firmware-generated echo reference */ + links[id].dpcm_capture =1 ; + links[id].no_pcm =1 ; links[id].cpus = &cpus[id]; links[id].num_cpus =1 ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 7/38 ASoC: Intel: sof_ssp_amp: always set dpcm_capture for amplifiers
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit b3c00316a2f847791bae395ea6dd91aa7a221471 ]
The amplifier may provide hardware support for I/V feedback, or alternatively the firmware may generate an echo reference attached to the SSP and dailink used for the amplifier.
To avoid any issues with invalid/NULL substreams in the latter case, always unconditionally set dpcm_capture.
--- sound/soc/intel/boards/sof_ssp_amp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/soc/intel/boards/sof_ssp_amp.c +2 -3
@@ -258,13 +258,12 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,sof_rt1308_dai_link (&links[id]); }else if (sof_ssp_amp_quirk &SOF_CS35L41_SPEAKER_AMP_PRESENT ) {cs35l41_set_dai_link (&links[id]); - -/* feedback from amplifier */ - links[id].dpcm_capture =1 ; } links[id].platforms = platform_component; links[id].num_platforms =ARRAY_SIZE (platform_component); links[id].dpcm_playback =1 ; +/* feedback from amplifier or firmware-generated echo reference */ + links[id].dpcm_capture =1 ; links[id].no_pcm =1 ; links[id].cpus = &cpus[id]; links[id].num_cpus =1 ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 8/38 selftests/bpf: Verify copy_register_state() preserves parent/live fields
In reply to Sasha LevinFrom: Eduard Zingerman <[email protected]>
[ Upstream commit b9fa9bc839291020b362ab5392e5f18ba79657ac ]
A testcase to check that verifier.c:copy_register_state() preserves register parentage chain and livness information.
--- .../selftests/bpf/verifier/search_pruning.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)
tools/testing/selftests/bpf/verifier/search_pruning.c +36 -0
@@ -225,3 +225,39 @@ .result_unpriv = ACCEPT, .insn_processed = 15, }, +/* The test performs a conditional 64-bit write to a stack location +* fp[-8], this is followed by an unconditional 8-bit write to fp[-8], +* then data is read from fp[-8]. This sequence is unsafe. +* +* The test would be mistakenly marked as safe w/o dst register parent +* preservation in verifier.c:copy_register_state() function. +* +* Note the usage of BPF_F_TEST_STATE_FREQ to force creation of the +* checkpoint state after conditional 64-bit assignment. +*/ +{ + "write tracking and register parent chain bug", + .insns = { +/* r6 = ktime_get_ns() */ +BPF_EMIT_CALL (BPF_FUNC_ktime_get_ns), +BPF_MOV64_REG (BPF_REG_6 ,BPF_REG_0 ), +/* r0 = ktime_get_ns() */ +BPF_EMIT_CALL (BPF_FUNC_ktime_get_ns), +/* if r0 > r6 goto +1 */ +BPF_JMP_REG (BPF_JGT ,BPF_REG_0 ,BPF_REG_6 ,1 ), +/* *(u64 *)(r10 - 8) = 0xdeadbeef */ +BPF_ST_MEM (BPF_DW ,BPF_REG_FP ,-8 ,0xdeadbeef ), +/* r1 = 42 */ +BPF_MOV64_IMM (BPF_REG_1 ,42 ), +/* *(u8 *)(r10 - 8) = r1 */ +BPF_STX_MEM (BPF_B ,BPF_REG_FP ,BPF_REG_1 ,-8 ), +/* r2 = *(u64 *)(r10 - 8) */ +BPF_LDX_MEM (BPF_DW ,BPF_REG_2 ,BPF_REG_FP ,-8 ), +/* exit(0) */ +BPF_MOV64_IMM (BPF_REG_0 ,0 ), + BPF_EXIT_INSN(), + }, + .flags =BPF_F_TEST_STATE_FREQ , + .errstr = "invalid read from stack off -8+1 size 8", + .result = REJECT, +},
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 9/38 ALSA: hda: Do not unset preset when cleaning up codec
In reply to Sasha LevinFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 87978e6ad45a16835cc58234451111091be3c59a ]
Several functions that take part in codec's initialization and removal are re-used by ASoC codec drivers implementations. Drivers mimic the behavior of hda_codec_driver_probe/remove() found in sound/pci/hda/hda_bind.c with their component->probe/remove() instead.
One of the reasons for that is the expectation of snd_hda_codec_device_new() to receive a valid pointer to an instance of struct snd_card. This expectation can be met only once sound card components probing commences.
As ASoC sound card may be unbound without codec device being actually removed from the system, unsetting ->preset in snd_hda_codec_cleanup_for_unbind() interferes with module unload -> load scenario causing null-ptr-deref. Preset is assigned only once, during device/driver matching whereas ASoC codec driver's module reloading may occur several times throughout the lifetime of an audio stack.
--- sound/pci/hda/hda_bind.c | 2 ++ sound/pci/hda/hda_codec.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/hda_bind.c +2 -0
@@ -144,6 +144,7 @@ static int hda_codec_driver_probe(struct device *dev) error:snd_hda_codec_cleanup_for_unbind (codec); + codec->preset =NULL ;return err; }
@@ -166,6 +167,7 @@ static int hda_codec_driver_remove(struct device *dev)if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec); + codec->preset =NULL ;module_put (dev->driver->owner);return 0 ; }
sound/pci/hda/hda_codec.c +0 -1
@@ -795,7 +795,6 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec)snd_array_free (&codec->cvt_setups);snd_array_free (&codec->spdif_out);snd_array_free (&codec->verbs); - codec->preset =NULL ; codec->follower_dig_outs =NULL ; codec->spdif_status_reset =0 ;snd_array_free (&codec->mixers);
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 10/38 ASoC: amd: yc: Add Xiaomi Redmi Book Pro 15 2022 into DMI table
In reply to Sasha LevinFrom: fengwk <[email protected]>
[ Upstream commit dcff8b7ca92d724bdaf474a3fa37a7748377813a ]
This model requires an additional detection quirk to enable the internal microphone - BIOS doesn't seem to support AcpDmicConnected (nothing in acpidump output).
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -227,6 +227,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 14 2022"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"TIMI" ), + DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 15 2022"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 11/38 bpf, sockmap: Don't let sock_map_{close,destroy,unhash} call itself
In reply to Sasha LevinFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit 5b4a79ba65a1ab479903fff2e604865d229b70a9 ]
sock_map proto callbacks should never call themselves by design. Protect against bugs like [1] and break out of the recursive loop to avoid a stack overflow in favor of a resource leak.
[1] https://lore.kernel.org/all/[email protected]/
--- net/core/sock_map.c | 61 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-)
net/core/sock_map.c +34 -27
@@ -1569,15 +1569,16 @@ void sock_map_unhash(struct sock *sk) psock =sk_psock (sk);if (unlikely (!psock)) {rcu_read_unlock (); -if (sk->sk_prot->unhash) - sk->sk_prot->unhash (sk); -return ; + saved_unhash =READ_ONCE (sk->sk_prot)->unhash; + }else { + saved_unhash = psock->saved_unhash; +sock_map_remove_links (sk, psock); +rcu_read_unlock (); } - - saved_unhash = psock->saved_unhash; -sock_map_remove_links (sk, psock); -rcu_read_unlock (); -saved_unhash (sk); +if (WARN_ON_ONCE (saved_unhash == sock_map_unhash)) +return ; +if (saved_unhash) +saved_unhash (sk); }EXPORT_SYMBOL_GPL (sock_map_unhash);
@@ -1590,17 +1591,18 @@ void sock_map_destroy(struct sock *sk) psock =sk_psock_get (sk);if (unlikely (!psock)) {rcu_read_unlock (); -if (sk->sk_prot->destroy) - sk->sk_prot->destroy (sk); -return ; + saved_destroy =READ_ONCE (sk->sk_prot)->destroy; + }else { + saved_destroy = psock->saved_destroy; +sock_map_remove_links (sk, psock); +rcu_read_unlock (); +sk_psock_stop (psock); +sk_psock_put (sk, psock); } - - saved_destroy = psock->saved_destroy; -sock_map_remove_links (sk, psock); -rcu_read_unlock (); -sk_psock_stop (psock); -sk_psock_put (sk, psock); -saved_destroy (sk); +if (WARN_ON_ONCE (saved_destroy == sock_map_destroy)) +return ; +if (saved_destroy) +saved_destroy (sk); }EXPORT_SYMBOL_GPL (sock_map_destroy);
@@ -1615,16 +1617,21 @@ void sock_map_close(struct sock *sk, long timeout)if (unlikely (!psock)) {rcu_read_unlock ();release_sock (sk); -return sk->sk_prot->close (sk, timeout); + saved_close =READ_ONCE (sk->sk_prot)->close; + }else { + saved_close = psock->saved_close; +sock_map_remove_links (sk, psock); +rcu_read_unlock (); +sk_psock_stop (psock); +release_sock (sk); +cancel_work_sync (&psock->work); +sk_psock_put (sk, psock); } - - saved_close = psock->saved_close; -sock_map_remove_links (sk, psock); -rcu_read_unlock (); -sk_psock_stop (psock); -release_sock (sk); -cancel_work_sync (&psock->work); -sk_psock_put (sk, psock); +/* Make sure we do not recurse. This is a bug. +* Leak the socket instead of crashing on a stack overflow. +*/ +if (WARN_ON_ONCE (saved_close == sock_map_close)) +return ;saved_close (sk, timeout); }EXPORT_SYMBOL_GPL (sock_map_close);
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 12/38 ASoC: cs42l56: fix DT probe
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit e18c6da62edc780e4f4f3c9ce07bdacd69505182 ]
While looking through legacy platform data users, I noticed that the DT probing never uses data from the DT properties, as the platform_data structure gets overwritten directly after it is initialized.
There have never been any boards defining the platform_data in the mainline kernel either, so this driver so far only worked with patched kernels or with the default values.
For the benefit of possible downstream users, fix the DT probe by no longer overwriting the data.
--- sound/soc/codecs/cs42l56.c | 6 ------ 1 file changed, 6 deletions(-)
sound/soc/codecs/cs42l56.c +0 -6
@@ -1191,18 +1191,12 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client)if (pdata) { cs42l56->pdata = *pdata; }else { - pdata =devm_kzalloc (&i2c_client->dev,sizeof (*pdata), -GFP_KERNEL ); -if (!pdata) -return -ENOMEM ; -if (i2c_client->dev.of_node) { ret =cs42l56_handle_of_data (i2c_client, &cs42l56->pdata);if (ret !=0 )return ret; } - cs42l56->pdata = *pdata; }if (cs42l56->pdata.gpio_nreset) {
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 13/38 tools/virtio: fix the vringh test for virtio ring changes
In reply to Sasha LevinFrom: Shunsuke Mie <[email protected]>
[ Upstream commit 3f7b75abf41cc4143aa295f62acbb060a012868d ]
Fix the build caused by missing kmsan_handle_dma() and is_power_of_2() that are used in drivers/virtio/virtio_ring.c.
Message-Id: <[email protected]>
--- tools/virtio/linux/bug.h | 8 +++----- tools/virtio/linux/build_bug.h | 7 +++++++ tools/virtio/linux/cpumask.h | 7 +++++++ tools/virtio/linux/gfp.h | 7 +++++++ tools/virtio/linux/kernel.h | 1 + tools/virtio/linux/kmsan.h | 12 ++++++++++++ tools/virtio/linux/scatterlist.h | 1 + tools/virtio/linux/topology.h | 7 +++++++ 8 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 tools/virtio/linux/build_bug.h create mode 100644 tools/virtio/linux/cpumask.h create mode 100644 tools/virtio/linux/gfp.h create mode 100644 tools/virtio/linux/kmsan.h create mode 100644 tools/virtio/linux/topology.h
tools/virtio/linux/bug.h +3 -5
@@ -1,13 +1,11 @@/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef BUG_H -#define BUG_H +#ifndef _LINUX_BUG_H +#define _LINUX_BUG_H#include <asm/bug.h> #define BUG_ON (__BUG_ON_cond) assert(!(__BUG_ON_cond)) -#define BUILD_BUG_ON (x) -#define BUG () abort() -#endif /* BUG_H */ +#endif /* _LINUX_BUG_H */
tools/virtio/linux/build_bug.h new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_BUILD_BUG_H +#define _LINUX_BUILD_BUG_H + +#define BUILD_BUG_ON (x) + +#endif /* _LINUX_BUILD_BUG_H */
tools/virtio/linux/cpumask.h new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_CPUMASK_H +#define _LINUX_CPUMASK_H + +#include <linux/kernel.h> + +#endif /* _LINUX_CPUMASK_H */
tools/virtio/linux/gfp.h new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_GFP_H +#define __LINUX_GFP_H + +#include <linux/topology.h> + +#endif
tools/virtio/linux/kernel.h +1 -0
@@ -10,6 +10,7 @@#include <stdarg.h> #include <linux/compiler.h> +#include <linux/log2.h> #include <linux/types.h> #include <linux/overflow.h> #include <linux/list.h>
tools/virtio/linux/kmsan.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_KMSAN_H +#define _LINUX_KMSAN_H + +#include <linux/gfp.h> + +inline void kmsan_handle_dma (struct page *page,size_t offset,size_t size, +enum dma_data_direction dir) +{ +} + +#endif /* _LINUX_KMSAN_H */
tools/virtio/linux/scatterlist.h +1 -0
@@ -2,6 +2,7 @@ #ifndef SCATTERLIST_H #define SCATTERLIST_H #include <linux/kernel.h> +#include <linux/bug.h> struct scatterlist { unsigned long page_link;
tools/virtio/linux/topology.h new file +7 -0
@@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_TOPOLOGY_H +#define _LINUX_TOPOLOGY_H + +#include <linux/cpumask.h> + +#endif /* _LINUX_TOPOLOGY_H */
Signature · 6 lines
2.39.0 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 14/38 vdpa: ifcvf: Do proper cleanup if IFCVF init fails
In reply to Sasha LevinFrom: Tanmay Bhushan <[email protected]>
[ Upstream commit 6b04456e248761cf68f562f2fd7c04e591fcac94 ]
ifcvf_mgmt_dev leaks memory if it is not freed before returning. Call is made to correct return statement so memory does not leak. ifcvf_init_hw does not take care of this so it is needed to do it here.
Message-Id: <[email protected]>
--- drivers/vdpa/ifcvf/ifcvf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/ifcvf/ifcvf_main.c +1 -1
@@ -849,7 +849,7 @@ static int ifcvf_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret =ifcvf_init_hw (vf, pdev);if (ret) {IFCVF_ERR (pdev,"Failed to init IFCVF hw\n" ); -return ret; + goto err; }for (i =0 ; i < vf->nr_vring; i++)
Signature · 6 lines
2.39.0 _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Sasha Levin
maintainerPATCH 15/38 net/rose: Fix to not accept on connected socket
In reply to Sasha LevinFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit 14caefcf9837a2be765a566005ad82cd0d2a429f ]
If you call listen() and accept() on an already connect()ed rose socket, accept() can successfully connect. This is because when the peer socket sends data to sendmsg, the skb with its own sk stored in the connected socket's sk->sk_receive_queue is connected, and rose_accept() dequeues the skb waiting in the sk->sk_receive_queue.
This creates a child socket with the sk of the parent rose socket, which can cause confusion.
Fix rose_listen() to return -EINVAL if the socket has already been successfully connected, and add lock_sock to prevent this issue.
--- net/rose/af_rose.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/rose/af_rose.c +8 -0
@@ -488,6 +488,12 @@ static int rose_listen(struct socket *sock, int backlog) {struct sock *sk = sock->sk; +lock_sock (sk); +if (sock->state !=SS_UNCONNECTED ) { +release_sock (sk); +return -EINVAL ; + } +if (sk->sk_state !=TCP_LISTEN ) {struct rose_sock *rose =rose_sk (sk);
@@ -497,8 +503,10 @@ static int rose_listen(struct socket *sock, int backlog)memset (rose->dest_digis,0 ,AX25_ADDR_LEN *ROSE_MAX_DIGIS ); sk->sk_max_ack_backlog = backlog; sk->sk_state =TCP_LISTEN ; +release_sock (sk);return 0 ; } +release_sock (sk);return -EOPNOTSUPP ; }
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 16/38 selftest: net: Improve IPV6_TCLASS/IPV6_HOPLIMIT tests apparmor compatibility
In reply to Sasha LevinFrom: Andrei Gherzan <[email protected]>
[ Upstream commit a6efc42a86c0c87cfe2f1c3d1f09a4c9b13ba890 ]
"tcpdump" is used to capture traffic in these tests while using a random, temporary and not suffixed file for it. This can interfere with apparmor configuration where the tool is only allowed to read from files with 'known' extensions.
The MINE type application/vnd.tcpdump.pcap was registered with IANA for pcap files and .pcap is the extension that is both most common but also aligned with standard apparmor configurations. See TCPDUMP(8) for more details.
This improves compatibility with standard apparmor configurations by using ".pcap" as the file extension for the tests' temporary files.
--- tools/testing/selftests/net/cmsg_ipv6.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/cmsg_ipv6.sh +1 -1
@@ -6,7 +6,7 @@ ksft_skip=4 NS=ns IP6=2001:db8:1::1/64 TGT6=2001:db8:1::2 -TMPF=`mktemp` +TMPF=$(mktemp --suffix ".pcap") cleanup() {
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 17/38 powerpc/85xx: Fix unannotated intra-function call warning
In reply to Sasha LevinFrom: Sathvika Vasireddy <[email protected]>
[ Upstream commit 8afffce6aa3bddc940ac1909627ff1e772b6cbf1 ]
objtool throws the following warning:
arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c:
unannotated intra-function call
Fix the warning by annotating KernelSPE symbol with SYM_FUNC_START_LOCAL and SYM_FUNC_END macros.
--- arch/powerpc/kernel/head_85xx.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/head_85xx.S +2 -1
@@ -862,7 +862,7 @@ _GLOBAL(load_up_spe) * SPE unavailable trap from kernel - print a message, but let * the task use SPE in the kernel until it returns to user mode. */ -KernelSPE: +SYM_FUNC_START_LOCAL(KernelSPE) lwz r3,_MSR(r1) oris r3,r3,MSR_SPE@h stw r3,_MSR(r1) /* enable use of SPE after return */
@@ -879,6 +879,7 @@ KernelSPE: #endif .align 4,0 +SYM_FUNC_END(KernelSPE) #endif /* CONFIG_SPE */ /*
Signature · 1 line
2.39.0
Re: [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning
Hi Sasha,
Quoted 34 lines · Sasha Levin
From: Sathvika Vasireddy <[email protected]>
[ Upstream commit
8afffce6aa3bddc940ac1909627ff1e772b6cbf1]objtool throws the following warning:
arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c:
unannotated intra-function callFix the warning by annotating KernelSPE symbol with
SYM_FUNC_START_LOCALandSYM_FUNC_ENDmacros.Reported-by kernel test robot <[email protected]>Signed-off-by Sathvika Vasireddy <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/powerpc/kernel/head_85xx.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/powerpc/kernel/head_85xx.S +1
-1@@ -862,7 +862,7 @@ _GLOBAL(load_up_spe) * SPE unavailable trap from kernel - print a message, but let * the task use SPE in the kernel until it returns to user mode. */ -KernelSPE: +SYM_FUNC_START_LOCAL(KernelSPE) lwz r3,_MSR(r1) oris r3,r3,MSR_SPE@h stw r3,_MSR(r1) /* enable use of SPE after return */
arch/powerpc/kernel/head_85xx.S KernelSPE: · line 885
Quoted 7 lines
arch/powerpc/kernel/head_85xx.S +1
-0@@ -879,6 +879,7 @@ KernelSPE: #endif .align 4,0 +SYM_FUNC_END(KernelSPE) #endif /* CONFIG_SPE */ /*
Please drop this patch because objtool enablement patches for powerpc are not a part of kernel v6.1.
Thanks,
Sathvika
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.1 17/38] powerpc/85xx: Fix unannotated intra-function call warning
Quoted 36 lines · Sathvika Vasireddy
Hi Sasha,
Quoted 33 lines · Sasha Levin
From: Sathvika Vasireddy <[email protected]>
[ Upstream commit
8afffce6aa3bddc940ac1909627ff1e772b6cbf1]objtool throws the following warning:
arch/powerpc/kernel/head_85xx.o: warning: objtool: .head.text+0x1a6c:
unannotated intra-function callFix the warning by annotating KernelSPE symbol with
SYM_FUNC_START_LOCALandSYM_FUNC_ENDmacros.Reported-by kernel test robot <[email protected]>Signed-off-by Sathvika Vasireddy <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/powerpc/kernel/head_85xx.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/powerpc/kernel/head_85xx.S +1
-1@@ -862,7 +862,7 @@ _GLOBAL(load_up_spe) * SPE unavailable trap from kernel - print a message, but let * the task use SPE in the kernel until it returns to user mode. */ -KernelSPE: +SYM_FUNC_START_LOCAL(KernelSPE) lwz r3,_MSR(r1) oris r3,r3,MSR_SPE@h stw r3,_MSR(r1) /* enable use of SPE after return */
Quoted 8 lines
arch/powerpc/kernel/head_85xx.S KernelSPE: · line 883
Quoted 6 lines
arch/powerpc/kernel/head_85xx.S +1
-0@@ -879,6 +879,7 @@ KernelSPE: #endif .align 4,0 +SYM_FUNC_END(KernelSPE) #endif /* CONFIG_SPE */ /*Please drop this patch because objtool enablement patches for powerpc are not a part of kernel v6.1.
Ack, I'll drop this and the other one you've pointed out. Thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 18/38 powerpc/kvm: Fix unannotated intra-function call warning
In reply to Sasha LevinFrom: Sathvika Vasireddy <[email protected]>
[ Upstream commit fe6de81b610e5d0b9d2231acff2de74a35482e7d ]
objtool throws the following warning:
arch/powerpc/kvm/booke.o: warning: objtool: kvmppc_fill_pt_regs+0x30:
unannotated intra-function call
Fix the warning by setting the value of 'nip' using the _THIS_IP_ macro, without using an assembly bl/mflr sequence to save the instruction pointer.
--- arch/powerpc/kvm/booke.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/kvm/booke.c +2 -3
@@ -912,16 +912,15 @@ static int kvmppc_handle_debug(struct kvm_vcpu *vcpu)static void kvmppc_fill_pt_regs (struct pt_regs *regs) { -ulong r1, ip, msr, lr; +ulong r1, msr, lr; asm("mr %0, 1" :"=r" (r1)); asm("mflr %0" :"=r" (lr)); asm("mfmsr %0" :"=r" (msr)); - asm("bl 1f; 1: mflr %0" :"=r" (ip));memset (regs,0 ,sizeof (*regs)); regs->gpr[1 ] = r1; - regs->nip = ip; + regs->nip = _THIS_IP_; regs->msr = msr; regs->link = lr; }
Signature · 1 line
2.39.0
Re: [PATCH AUTOSEL 6.1 18/38] powerpc/kvm: Fix unannotated intra-function call warning
Hi Sasha,
Quoted 35 lines · Sasha Levin
From: Sathvika Vasireddy <[email protected]>
[ Upstream commit
fe6de81b610e5d0b9d2231acff2de74a35482e7d]objtool throws the following warning:
arch/powerpc/kvm/booke.o: warning: objtool:kvmppc_fill_pt_regs+0x30:
unannotated intra-function callFix the warning by setting the value of 'nip' using the _THIS_IP_ macro, without using an assembly bl/mflr sequence to save the instruction pointer.
Reported-by kernel test robot <[email protected]>Suggested-by Michael Ellerman <[email protected]>Signed-off-by Sathvika Vasireddy <[email protected]>Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/powerpc/kvm/booke.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)arch/powerpc/kvm/booke.c +1
-1@@ -912,16 +912,15 @@ static int kvmppc_handle_debug(struct kvm_vcpu *vcpu)static void kvmppc_fill_pt_regs (struct pt_regs *regs) { -ulong r1, ip, msr, lr; +ulong r1, msr, lr; asm("mr %0, 1" :"=r" (r1)); asm("mflr %0" :"=r" (lr));
arch/powerpc/kvm/booke.c static int kvmppc_handle_debug(struct kvm_vcpu *vcpu) · line 926
Quoted 10 lines
arch/powerpc/kvm/booke.c +1
-2asm("mfmsr %0" :"=r" (msr)); - asm("bl 1f; 1: mflr %0" :"=r" (ip));memset (regs,0 ,sizeof (*regs)); regs->gpr[1 ] = r1; - regs->nip = ip; + regs->nip = _THIS_IP_; regs->msr = msr; regs->link = lr; }
Please drop this patch because objtool enablement patches for powerpc are not a part of kernel v6.1
Thanks,
Sathvika
Sasha Levin
maintainerPATCH 19/38 net: stmmac: do not stop RX_CLK in Rx LPI state for qcs404 SoC
In reply to Sasha LevinFrom: Andrey Konovalov <[email protected]>
[ Upstream commit 54aa39a513dbf2164ca462a19f04519b2407a224 ]
Currently in phy_init_eee() the driver unconditionally configures the PHY to stop RX_CLK after entering Rx LPI state. This causes an LPI interrupt storm on my qcs404-base board.
Change the PHY initialization so that for "qcom,qcs404-ethqos" compatible device RX_CLK continues to run even in Rx LPI state.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- include/linux/stmmac.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +2 -0
@@ -560,6 +560,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->has_gmac4 =1 ; plat_dat->pmt =1 ; plat_dat->tso_en =of_property_read_bool (np,"snps,tso" ); +if (of_device_is_compatible (np,"qcom,qcs404-ethqos" )) + plat_dat->rx_clk_runs_in_lpi =1 ; ret =stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res);if (ret)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -1
@@ -1077,7 +1077,8 @@ static void stmmac_mac_link_up(struct phylink_config *config,stmmac_mac_set (priv, priv->ioaddr, true);if (phy && priv->dma_cap.eee) { - priv->eee_active =phy_init_eee (phy,1 ) >=0 ; + priv->eee_active = +phy_init_eee (phy, !priv->plat->rx_clk_runs_in_lpi) >=0 ; priv->eee_enabled =stmmac_eee_init (priv); priv->tx_lpi_enabled = priv->eee_enabled;stmmac_set_eee_pls (priv, priv->hw, true);
include/linux/stmmac.h +1 -0
@@ -252,6 +252,7 @@ struct plat_stmmacenet_data {int rss_en;int mac_port_sel_speed;bool en_tx_lpi_clockgating; +bool rx_clk_runs_in_lpi;int has_xgmac;bool vlan_fail_q_en;u8 vlan_fail_q;
Signature · 7 lines
2.39.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 20/38 powerpc/64: Fix perf profiling asynchronous interrupt handlers
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit c28548012ee2bac55772ef7685138bd1124b80c3 ]
Interrupt entry sets the soft mask to IRQS_ALL_DISABLED to match the hard irq disabled state. So when should_hard_irq_enable() returns true because we want PMI interrupts in irq handlers, MSR[EE] is enabled but PMIs just get soft-masked. Fix this by clearing IRQS_PMI_DISABLED before enabling MSR[EE].
This also tidies some of the warnings, no need to duplicate them in both should_hard_irq_enable() and do_hard_irq_enable().
--- arch/powerpc/include/asm/hw_irq.h | 41 ++++++++++++++++++++++--------- arch/powerpc/kernel/dbell.c | 2 +- arch/powerpc/kernel/irq.c | 2 +- arch/powerpc/kernel/time.c | 2 +- 4 files changed, 32 insertions(+), 15 deletions(-)
arch/powerpc/include/asm/hw_irq.h +29 -12
@@ -173,6 +173,15 @@ static inline notrace unsigned long irq_soft_mask_or_return(unsigned long mask)return flags; } +static inline notrace unsigned long irq_soft_mask_andc_return (unsigned long mask) +{ +unsigned long flags =irq_soft_mask_return (); + +irq_soft_mask_set (flags & ~mask); + +return flags; +} +static inline unsigned long arch_local_save_flags (void ) {return irq_soft_mask_return ();
@@ -331,10 +340,11 @@ bool power_pmu_wants_prompt_pmi(void);* is a different soft-masked interrupt pending that requires hard * masking. */ -static inline bool should_hard_irq_enable (void ) +static inline bool should_hard_irq_enable (struct pt_regs *regs) {if (IS_ENABLED (CONFIG_PPC_IRQ_SOFT_MASK_DEBUG )) { -WARN_ON (irq_soft_mask_return () ==IRQS_ENABLED ); +WARN_ON (irq_soft_mask_return () !=IRQS_ALL_DISABLED ); +WARN_ON (!(get_paca ()->irq_happened &PACA_IRQ_HARD_DIS ));WARN_ON (mfmsr () &MSR_EE ); }
@@ -347,8 +357,17 @@ static inline bool should_hard_irq_enable(void)* * TODO: Add test for 64e */ -if (IS_ENABLED (CONFIG_PPC_BOOK3S_64 ) && !power_pmu_wants_prompt_pmi ()) -return false; +if (IS_ENABLED (CONFIG_PPC_BOOK3S_64 )) { +if (!power_pmu_wants_prompt_pmi ()) +return false; +/* +* If PMIs are disabled then IRQs should be disabled as well, +* so we shouldn't see this condition, check for it just in +* case because we are about to enable PMIs. +*/ +if (WARN_ON_ONCE (regs->softe &IRQS_PMI_DISABLED )) +return false; + }if (get_paca ()->irq_happened &PACA_IRQ_MUST_HARD_MASK )return false;
@@ -358,18 +377,16 @@ static inline bool should_hard_irq_enable(void)/* * Do the hard enabling, only call this if should_hard_irq_enable is true. +* This allows PMI interrupts to profile irq handlers. */ static inline void do_hard_irq_enable (void ) { -if (IS_ENABLED (CONFIG_PPC_IRQ_SOFT_MASK_DEBUG )) { -WARN_ON (irq_soft_mask_return () ==IRQS_ENABLED ); -WARN_ON (get_paca ()->irq_happened &PACA_IRQ_MUST_HARD_MASK ); -WARN_ON (mfmsr () &MSR_EE ); - }/* -* This allows PMI interrupts (and watchdog soft-NMIs) through. -* There is no other reason to enable this way. +* Asynch interrupts come in with IRQS_ALL_DISABLED, +* PACA_IRQ_HARD_DIS, and MSR[EE]=0. */ +if (IS_ENABLED (CONFIG_PPC_BOOK3S_64 )) +irq_soft_mask_andc_return (IRQS_PMI_DISABLED );get_paca ()->irq_happened &= ~PACA_IRQ_HARD_DIS ;__hard_irq_enable (); }
@@ -452,7 +469,7 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs)return !(regs->msr &MSR_EE ); } -static __always_inline bool should_hard_irq_enable(void) +static __always_inline bool should_hard_irq_enable(struct pt_regs *regs) {return false; }
arch/powerpc/kernel/dbell.c +1 -1
@@ -27,7 +27,7 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(doorbell_exception)ppc_msgsync (); -if (should_hard_irq_enable ()) +if (should_hard_irq_enable (regs))do_hard_irq_enable ();kvmppc_clear_host_ipi (smp_processor_id ());
arch/powerpc/kernel/irq.c +1 -1
@@ -238,7 +238,7 @@ static void __do_irq(struct pt_regs *regs, unsigned long oldsp) irq =static_call (ppc_get_irq)();/* We can hard enable interrupts now to allow perf interrupts */ -if (should_hard_irq_enable ()) +if (should_hard_irq_enable (regs))do_hard_irq_enable ();/* And finally process it */
arch/powerpc/kernel/time.c +1 -1
@@ -533,7 +533,7 @@ DEFINE_INTERRUPT_HANDLER_ASYNC(timer_interrupt) }/* Conditionally hard-enable interrupts. */ -if (should_hard_irq_enable ()) { +if (should_hard_irq_enable (regs)) {/* * Ensure a positive value is written to the decrementer, or * else some CPUs will continue to take decrementer exceptions.
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 21/38 fscache: Use clear_and_wake_up_bit() in fscache_create_volume_work()
In reply to Sasha LevinFrom: Hou Tao <[email protected]>
[ Upstream commit 3288666c72568fe1cc7f5c5ae33dfd3ab18004c8 ]
fscache_create_volume_work() uses wake_up_bit() to wake up the processes which are waiting for the completion of volume creation. According to comments in wake_up_bit() and waitqueue_active(), an extra smp_mb() is needed to guarantee the memory order between FSCACHE_VOLUME_CREATING flag and waitqueue_active() before invoking wake_up_bit().
Fixing it by using clear_and_wake_up_bit() to add the missing memory barrier.
--- fs/fscache/volume.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/fscache/volume.c +1 -2
@@ -279,8 +279,7 @@ static void fscache_create_volume_work(struct work_struct *work)fscache_end_cache_access (volume->cache, fscache_access_acquire_volume_end); -clear_bit_unlock (FSCACHE_VOLUME_CREATING , &volume->flags); -wake_up_bit (&volume->flags,FSCACHE_VOLUME_CREATING ); +clear_and_wake_up_bit (FSCACHE_VOLUME_CREATING , &volume->flags);fscache_put_volume (volume, fscache_volume_put_create_work); }
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 22/38 drm/nouveau/devinit/tu102-: wait for GFW_BOOT_PROGRESS == COMPLETED
In reply to Sasha LevinFrom: Ben Skeggs <[email protected]>
[ Upstream commit d22915d22ded21fd5b24b60d174775789f173997 ]
Starting from Turing, the driver is no longer responsible for initiating DEVINIT when required as the GPU started loading a FW image from ROM and executing DEVINIT itself after power-on.
However - we apparently still need to wait for it to complete.
This should correct some issues with runpm on some systems, where we get control of the HW before it's been fully reinitialised after resume from suspend.
--- .../drm/nouveau/nvkm/subdev/devinit/tu102.c | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/tu102.c +23 -0
@@ -65,10 +65,33 @@ tu102_devinit_pll_set(struct nvkm_devinit *init, u32 type, u32 freq)return ret; } +static int +tu102_devinit_wait (struct nvkm_device *device) +{ +unsigned timeout =50 +2000 ; + +do { +if (nvkm_rd32 (device,0x118128 ) &0x00000001 ) { +if ((nvkm_rd32 (device,0x118234 ) &0x000000ff ) ==0xff ) +return 0 ; + } + +usleep_range (1000 ,2000 ); + }while (timeout--); + +return -ETIMEDOUT ; +} +int tu102_devinit_post (struct nvkm_devinit *base,bool post) {struct nv50_devinit *init =nv50_devinit (base); +int ret; + + ret =tu102_devinit_wait (init->base.subdev.device); +if (ret) +return ret; +gm200_devinit_preos (init, post);return 0 ; }
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 23/38 net: ethernet: mtk_eth_soc: Avoid truncating allocation
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit f3eceaed9edd7c0e0d9fb057613131f92973626f ]
There doesn't appear to be a reason to truncate the allocation used for flow_info, so do a full allocation and remove the unused empty struct. GCC does not like having a reference to an object that has been partially allocated, as bounds checking may become impossible when such an object is passed to other code. Seen with GCC 13:
../drivers/net/ethernet/mediatek/mtk_ppe.c: In function 'mtk_foe_entry_commit_subflow':../drivers/net/ethernet/mediatek/mtk_ppe.c:623:18: warning: array subscript 'struct mtk_flow_entry[0]' is partly outside array bounds of 'unsigned char[48]' [-Warray-bounds=]
623 | flow_info->l2_data.base_flow = entry;
| ^~
--- drivers/net/ethernet/mediatek/mtk_ppe.c | 3 +-- drivers/net/ethernet/mediatek/mtk_ppe.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/mediatek/mtk_ppe.c +1 -2
@@ -595,8 +595,7 @@ mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry,u32 ib1_mask =mtk_get_ib1_pkt_type_mask (ppe->eth) |MTK_FOE_IB1_UDP ;int type; - flow_info = kzalloc(offsetof(struct mtk_flow_entry, l2_data.end), -GFP_ATOMIC ); + flow_info =kzalloc (sizeof (*flow_info),GFP_ATOMIC );if (!flow_info)return ;
drivers/net/ethernet/mediatek/mtk_ppe.h +0 -1
@@ -277,7 +277,6 @@ struct mtk_flow_entry {struct {struct mtk_flow_entry *base_flow;struct hlist_node list; -struct {} end; } l2_data; };struct rhash_head node;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 24/38 net: sched: sch: Bounds check priority
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit de5ca4c3852f896cacac2bf259597aab5e17d9e3 ]
Nothing was explicitly bounds checking the priority index used to access clpriop[]. WARN and bail out early if it's pathological. Seen with GCC 13:
../net/sched/sch_htb.c: In function 'htb_activate_prios':../net/sched/sch_htb.c:437:44: warning: array subscript [0, 31] is outside array bounds of 'struct htb_prio[8]' [-Warray-bounds=]
437 | if (p->inner.clprio[prio].feed.rb_node)
| ~~~~~~~~~~~~~~~^~~~~~
../net/sched/sch_htb.c:131:41: note: while referencing 'clprio'
131 | struct htb_prio clprio[TC_HTB_NUMPRIO];
| ^~~~~~
--- net/sched/sch_htb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/sch_htb.c +4 -1
@@ -427,7 +427,10 @@ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)while (cl->cmode ==HTB_MAY_BORROW && p && mask) { m = mask;while (m) { -int prio =ffz (~m); +unsigned int prio =ffz (~m); + +if (WARN_ON_ONCE (prio >ARRAY_SIZE (p->inner.clprio))) +break ; m &= ~(1 << prio);if (p->inner.clprio[prio].feed.rb_node)
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 25/38 s390/decompressor: specify __decompress() buf len to avoid overflow
In reply to Sasha LevinFrom: Vasily Gorbik <[email protected]>
[ Upstream commit 7ab41c2c08a32132ba8c14624910e2fe8ce4ba4b ]
Historically calls to __decompress() didn't specify "out_len" parameter on many architectures including s390, expecting that no writes beyond uncompressed kernel image are performed. This has changed since commit 2aa14b1ab2c4 ("zstd: import usptream v1.5.2") which includes zstd library commit 6a7ede3dfccb ("Reduce size of dctx by reutilizing dst buffer (#2751)"). Now zstd decompression code might store literal buffer in the unwritten portion of the destination buffer. Since "out_len" is not set, it is considered to be unlimited and hence free to use for optimization needs. On s390 this might corrupt initrd or ipl report which are often placed right after the decompressor buffer. Luckily the size of uncompressed kernel image is already known to the decompressor, so to avoid the problem simply specify it in the "out_len" parameter.
--- arch/s390/boot/decompressor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/boot/decompressor.c +1 -1
@@ -80,6 +80,6 @@ void *decompress_kernel(void)void *output = (void *)decompress_offset;__decompress (_compressed_start, _compressed_end - _compressed_start, -NULL ,NULL , output,0 ,NULL , error); +NULL ,NULL , output, vmlinux.image_size,NULL , error);return output; }
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 26/38 nvme-fc: fix a missing queue put in nvmet_fc_ls_create_association
In reply to Sasha LevinFrom: Amit Engel <[email protected]>
[ Upstream commit 0cab4404874f2de52617de8400c844891c6ea1ce ]
As part of nvmet_fc_ls_create_association there is a case where nvmet_fc_alloc_target_queue fails right after a new association with an admin queue is created. In this case, no one releases the get taken in nvmet_fc_alloc_target_assoc. This fix is adding the missing put.
--- drivers/nvme/target/fc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/fc.c +3 -1
@@ -1685,8 +1685,10 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,else { queue =nvmet_fc_alloc_target_queue (iod->assoc,0 ,be16_to_cpu (rqst->assoc_cmd.sqsize)); -if (!queue) +if (!queue) { ret =VERR_QUEUE_ALLOC_FAIL ; +nvmet_fc_tgt_a_put (iod->assoc); + } } }
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 27/38 nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set
In reply to Sasha LevinFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit fd62678ab55cb01e11a404d302cdade222bf4022 ]
If nvme_alloc_admin_tag_set() fails, the admin_q and fabrics_q pointers are left with an invalid, non-NULL value. Other functions may then check the pointers and dereference them, e.g. in
nvme_probe() -> out_disable: -> nvme_dev_remove_admin().
Fix the bug by setting admin_q and fabrics_q to NULL in case of error.
Also use the set variable to free the tag_set as ctrl->admin_tagset isn't initialized yet.
--- drivers/nvme/host/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +3 -1
@@ -4881,7 +4881,9 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set, out_cleanup_admin_q:blk_mq_destroy_queue (ctrl->admin_q); out_free_tagset: -blk_mq_free_tag_set (ctrl->admin_tagset); +blk_mq_free_tag_set (set); + ctrl->admin_q =NULL ; + ctrl->fabrics_q =NULL ;return ret; }EXPORT_SYMBOL_GPL (nvme_alloc_admin_tag_set);
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 28/38 nvme: clear the request_queue pointers on failure in nvme_alloc_io_tag_set
In reply to Sasha LevinFrom: Maurizio Lombardi <[email protected]>
[ Upstream commit 6fbf13c0e24fd86ab2e4477cd8484a485b687421 ]
In nvme_alloc_io_tag_set(), the connect_q pointer should be set to NULL in case of error to avoid potential invalid pointer dereferences.
--- drivers/nvme/host/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
@@ -4933,6 +4933,7 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set, out_free_tag_set:blk_mq_free_tag_set (set); + ctrl->connect_q =NULL ;return ret; }EXPORT_SYMBOL_GPL (nvme_alloc_io_tag_set);
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 29/38 drm/amd/display: Add missing brackets in calculation
In reply to Sasha LevinFrom: Daniel Miess <[email protected]>
[ Upstream commit ea062fd28f922cb118bfb33229f405b81aff7781 ]
[Why]
Brackets missing in the calculation for MIN_DST_Y_NEXT_START
[How]
Add missing brackets for this calculation
--- .../gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c +1 -1
@@ -3184,7 +3184,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman }else { v->MIN_DST_Y_NEXT_START[k] = v->VTotal[k] - v->VFrontPorch[k] + v->VTotal[k] - v->VActive[k] - v->VStartup[k]; } - v->MIN_DST_Y_NEXT_START[k] +=dml_floor (4.0 * v->TSetup[k] / (double )v->HTotal[k] / v->PixelClock[k],1.0 ) /4.0 ; + v->MIN_DST_Y_NEXT_START[k] +=dml_floor (4.0 * v->TSetup[k] / ((double )v->HTotal[k] / v->PixelClock[k]),1.0 ) /4.0 ; if (((v->VUpdateOffsetPix[k] + v->VUpdateWidthPix[k] + v->VReadyOffsetPix[k]) / v->HTotal[k]) <= (isInterlaceTiming ? dml_floor((v->VTotal[k] - v->VActive[k] - v->VFrontPorch[k] - v->VStartup[k]) / 2.0, 1.0) :
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 30/38 drm/amd/display: Adjust downscaling limits for dcn314
In reply to Sasha LevinFrom: Daniel Miess <[email protected]>
[ Upstream commit dd2db2dc4bd298f33dea50c80c3c11bee4e3b0a4 ]
[Why]
Lower max_downscale_ratio and ARGB888 downscale factor to prevent cases where underflow may occur on dcn314
[How]
Set max_downscale_ratio to 400 and ARGB downscale factor to 250 for dcn314
--- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +3 -2
@@ -871,8 +871,9 @@ static const struct dc_plane_cap plane_cap = { }, // 6:1 downscaling ratio: 1000/6 = 166.666 + // 4:1 downscaling ratio for ARGB888 to prevent underflow during P010 playback: 1000/4 = 250 .max_downscale_factor = { - .argb8888 = 167, + .argb8888 = 250, .nv12 = 167, .fp16 =167 },
@@ -1755,7 +1756,7 @@ static bool dcn314_resource_construct( pool->base.underlay_pipe_index =NO_UNDERLAY_PIPE ; pool->base.pipe_count = pool->base.res_cap->num_timing_generator; pool->base.mpcc_count = pool->base.res_cap->num_timing_generator; - dc->caps.max_downscale_ratio =600 ; + dc->caps.max_downscale_ratio =400 ; dc->caps.i2c_speed_in_khz =100 ; dc->caps.i2c_speed_in_khz_hdcp =100 ; dc->caps.max_cursor_size =256 ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 31/38 drm/amd/display: Unassign does_plane_fit_in_mall function from dcn3.2
In reply to Sasha LevinFrom: George Shen <[email protected]>
[ Upstream commit 275d8a1db261a1272a818d40ebc61b3b865b60e5 ]
[Why]
The hwss function does_plane_fit_in_mall not applicable to dcn3.2 asics. Using it with dcn3.2 can result in undefined behaviour.
[How]
Assign the function pointer to NULL.
--- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_init.c +1 -1
@@ -94,7 +94,7 @@ static const struct hw_sequencer_funcs dcn32_funcs = { .get_vupdate_offset_from_vsync = dcn10_get_vupdate_offset_from_vsync, .calc_vupdate_position = dcn10_calc_vupdate_position, .apply_idle_power_optimizations = dcn32_apply_idle_power_optimizations, - .does_plane_fit_in_mall = dcn30_does_plane_fit_in_mall, + .does_plane_fit_in_mall = NULL, .set_backlight_level = dcn21_set_backlight_level, .set_abm_immediate_disable = dcn21_set_abm_immediate_disable, .hardware_release = dcn30_hardware_release,
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 32/38 drm/amd/display: Reset DMUB mailbox SW state after HW reset
In reply to Sasha LevinFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit 154711aa5759ef9b45903124fa813c4c29ee681c ]
[Why]
Otherwise we can be out of sync with what's in the hardware, leading to us rerunning every command that's presently in the ringbuffer.
[How]
Reset software state for the mailboxes in hw_reset callback. This is already done as part of the mailbox init in hw_init, but we do need to remember to reset the last cached wptr value as well here.
--- drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +12 -0
@@ -532,6 +532,9 @@ enum dmub_status dmub_srv_hw_init(struct dmub_srv *dmub,if (dmub->hw_funcs.reset) dmub->hw_funcs.reset (dmub); +/* reset the cache of the last wptr as well now that hw is reset */ + dmub->inbox1_last_wptr =0 ; + cw0.offset.quad_part = inst_fb->gpu_addr; cw0.region.base =DMUB_CW0_BASE ; cw0.region.top = cw0.region.base + inst_fb->size -1 ;
@@ -649,6 +652,15 @@ enum dmub_status dmub_srv_hw_reset(struct dmub_srv *dmub)if (dmub->hw_funcs.reset) dmub->hw_funcs.reset (dmub); +/* mailboxes have been reset in hw, so reset the sw state as well */ + dmub->inbox1_last_wptr =0 ; + dmub->inbox1_rb.wrpt =0 ; + dmub->inbox1_rb.rptr =0 ; + dmub->outbox0_rb.wrpt =0 ; + dmub->outbox0_rb.rptr =0 ; + dmub->outbox1_rb.wrpt =0 ; + dmub->outbox1_rb.rptr =0 ; + dmub->hw_init = false;return DMUB_STATUS_OK ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 33/38 drm/amdgpu: enable HDP SD for gfx 11.0.3
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit bb25849c0fa550b26cecc9c476c519a927c66898 ]
Enable HDP clock gating control for gfx 11.0.3.
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc21.c +2 -1
@@ -643,7 +643,8 @@ static int soc21_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_CGLS |AMD_CG_SUPPORT_REPEATER_FGCG | -AMD_CG_SUPPORT_GFX_MGCG ; +AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_HDP_SD ; adev->pg_flags =AMD_PG_SUPPORT_VCN |AMD_PG_SUPPORT_VCN_DPG |AMD_PG_SUPPORT_JPEG ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 34/38 drm/amdgpu: Enable vclk dclk node for gc11.0.3
In reply to Sasha LevinFrom: Yiqing Yao <[email protected]>
[ Upstream commit ac7170082c0e140663f0853d3de733a5341ce7b0 ]
These sysfs nodes are tested supported, so enable them.
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +4 -2
@@ -2007,14 +2007,16 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ gc_ver ==IP_VERSION (10 ,3 ,0 ) || gc_ver ==IP_VERSION (10 ,1 ,2 ) || gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver == IP_VERSION(11, 0, 2))) + gc_ver ==IP_VERSION (11 ,0 ,2 ) || + gc_ver == IP_VERSION(11, 0, 3))) *states =ATTR_STATE_UNSUPPORTED ; }else if (DEVICE_ATTR_IS (pp_dpm_dclk)) {if (!(gc_ver ==IP_VERSION (10 ,3 ,1 ) || gc_ver ==IP_VERSION (10 ,3 ,0 ) || gc_ver ==IP_VERSION (10 ,1 ,2 ) || gc_ver ==IP_VERSION (11 ,0 ,0 ) || - gc_ver ==IP_VERSION (11 ,0 ,2 ))) + gc_ver ==IP_VERSION (11 ,0 ,2 ) || + gc_ver ==IP_VERSION (11 ,0 ,3 ))) *states =ATTR_STATE_UNSUPPORTED ; }else if (DEVICE_ATTR_IS (pp_power_profile_mode)) {if (amdgpu_dpm_get_power_profile_mode (adev,NULL ) == -EOPNOTSUPP )
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 35/38 drm/amd/display: Properly handle additional cases where DCN is not supported
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 6fc547a5a2ef5ce05b16924106663ab92f8f87a7 ]
There could be boards with DCN listed in IP discovery, but no display hardware actually wired up. In this case the vbios display table will not be populated. Detect this case and skip loading DM when we detect it.
v2: Mark DCN as harvested as well so other display checks elsewhere in the driver are handled properly.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -0
@@ -4512,6 +4512,17 @@ DEVICE_ATTR_WO(s3_debug);static int dm_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +struct amdgpu_mode_info *mode_info = &adev->mode_info; +struct atom_context *ctx = mode_info->atom_context; +int index =GetIndexIntoMasterTable (DATA , Object_Header); +u16 data_offset; + +/* if there is no object header, skip DM */ +if (!amdgpu_atom_parse_data_header (ctx, index,NULL ,NULL ,NULL , &data_offset)) { + adev->harvest_ip_mask |=AMD_HARVEST_IP_DMU_MASK ; +dev_info (adev->dev,"No object header, skipping DM\n" ); +return -ENOENT ; + }switch (adev->asic_type) {#if defined(CONFIG_DRM_AMD_DC_SI )
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 36/38 platform/x86: touchscreen_dmi: Add Chuwi Vi8 (CWI501) DMI match
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit eecf2acd4a580e9364e5087daf0effca60a240b7 ]
Add a DMI match for the CWI501 version of the Chuwi Vi8 tablet, pointing to the same chuwi_vi8_data as the existing CWI506 version DMI match.
--- drivers/platform/x86/touchscreen_dmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/touchscreen_dmi.c +9 -0
@@ -1097,6 +1097,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { DMI_MATCH(DMI_BIOS_DATE, "05/07/2016"), }, }, + { +/* Chuwi Vi8 (CWI501) */ + .driver_data = (void *)&chuwi_vi8_data, + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Insyde" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"i86" ), + DMI_MATCH(DMI_BIOS_VERSION, "CHUWI.W86JLBNR01"), + }, + }, {/* Chuwi Vi8 (CWI506) */ .driver_data = (void *)&chuwi_vi8_data,
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 37/38 ceph: move mount state enum to super.h
In reply to Sasha LevinFrom: Xiubo Li <[email protected]>
[ Upstream commit b38b17b6a01ca4e738af097a1529910646ef4270 ]
These flags are only used in ceph filesystem in fs/ceph, so just move it to the place it should be.
--- fs/ceph/super.h | 10 ++++++++++ include/linux/ceph/libceph.h | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-)
fs/ceph/super.h +10 -0
@@ -100,6 +100,16 @@ struct ceph_mount_options {char *mon_addr; }; +/* mount state */ +enum { +CEPH_MOUNT_MOUNTING , +CEPH_MOUNT_MOUNTED , +CEPH_MOUNT_UNMOUNTING , +CEPH_MOUNT_UNMOUNTED , +CEPH_MOUNT_SHUTDOWN , +CEPH_MOUNT_RECOVER , +}; +#define CEPH_ASYNC_CREATE_CONFLICT_BITS 8struct ceph_fs_client {
include/linux/ceph/libceph.h +0 -10
@@ -99,16 +99,6 @@ struct ceph_options {#define CEPH_AUTH_NAME_DEFAULT "guest" -/* mount state */ -enum { -CEPH_MOUNT_MOUNTING , -CEPH_MOUNT_MOUNTED , -CEPH_MOUNT_UNMOUNTING , -CEPH_MOUNT_UNMOUNTED , -CEPH_MOUNT_SHUTDOWN , -CEPH_MOUNT_RECOVER , -}; -static inline unsigned long ceph_timeout_jiffies (unsigned long timeout) {return timeout ?:MAX_SCHEDULE_TIMEOUT ;
Signature · 1 line
2.39.0
Sasha Levin
maintainerPATCH 38/38 ceph: blocklist the kclient when receiving corrupted snap trace
In reply to Sasha LevinFrom: Xiubo Li <[email protected]>
[ Upstream commit a68e564adcaa69b0930809fb64d9d5f7d9c32ba9 ]
When received corrupted snap trace we don't know what exactly has happened in MDS side. And we shouldn't continue IOs and metadatas access to MDS, which may corrupt or get incorrect contents.
This patch will just block all the further IO/MDS requests immediately and then evict the kclient itself.
The reason why we still need to evict the kclient just after blocking all the further IOs is that the MDS could revoke the caps faster.
--- fs/ceph/addr.c | 17 +++++++++++++++-- fs/ceph/caps.c | 16 +++++++++++++--- fs/ceph/file.c | 3 +++ fs/ceph/mds_client.c | 30 +++++++++++++++++++++++++++--- fs/ceph/snap.c | 36 ++++++++++++++++++++++++++++++++++-- fs/ceph/super.h | 1 + 6 files changed, 93 insertions(+), 10 deletions(-)
fs/ceph/addr.c +15 -2
@@ -305,7 +305,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)struct inode *inode = rreq->inode;struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_fs_client *fsc =ceph_inode_to_client (inode); -struct ceph_osd_request *req; +struct ceph_osd_request *req =NULL ;struct ceph_vino vino =ceph_vino (inode);struct iov_iter iter;struct page **pages;
@@ -313,6 +313,11 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)int err =0 ;u64 len = subreq->len; +if (ceph_inode_is_shutdown (inode)) { + err = -EIO ; + goto out; + } +if (ceph_has_inline_data (ci) &&ceph_netfs_issue_op_inline (subreq))return ;
@@ -563,6 +568,9 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)dout ("writepage %p idx %lu\n" , page, page->index); +if (ceph_inode_is_shutdown (inode)) +return -EIO ; +/* verify this is a writeable snap context */ snapc =page_snap_context (page);if (!snapc) {
@@ -1643,7 +1651,7 @@ int ceph_uninline_data(struct file *file)struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_fs_client *fsc =ceph_inode_to_client (inode);struct ceph_osd_request *req =NULL ; -struct ceph_cap_flush *prealloc_cf; +struct ceph_cap_flush *prealloc_cf =NULL ;struct folio *folio =NULL ;u64 inline_version =CEPH_INLINE_NONE ;struct page *pages[1 ];
@@ -1657,6 +1665,11 @@ int ceph_uninline_data(struct file *file)dout ("uninline_data %p %llx.%llx inline_version %llu\n" , inode,ceph_vinop (inode), inline_version); +if (ceph_inode_is_shutdown (inode)) { + err = -EIO ; + goto out; + } +if (inline_version ==CEPH_INLINE_NONE )return 0 ;
fs/ceph/caps.c +13 -3
@@ -4081,6 +4081,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,void *p, *end;struct cap_extra_info extra_info = {};bool queue_trunc; +bool close_sessions = false;dout ("handle_caps from mds%d\n" , session->s_mds);
@@ -4218,9 +4219,13 @@ void ceph_handle_caps(struct ceph_mds_session *session, realm =NULL ;if (snaptrace_len) {down_write (&mdsc->snap_rwsem); -ceph_update_snap_trace (mdsc, snaptrace, - snaptrace + snaptrace_len, - false, &realm); +if (ceph_update_snap_trace (mdsc, snaptrace, + snaptrace + snaptrace_len, + false, &realm)) { +up_write (&mdsc->snap_rwsem); + close_sessions = true; + goto done; + }downgrade_write (&mdsc->snap_rwsem); }else {down_read (&mdsc->snap_rwsem);
@@ -4280,6 +4285,11 @@ void ceph_handle_caps(struct ceph_mds_session *session,iput (inode); out:ceph_put_string (extra_info.pool_ns); + +/* Defer closing the sessions after s_mutex lock being released */ +if (close_sessions) +ceph_mdsc_close_sessions (mdsc); +return ; flush_cap_releases:
fs/ceph/file.c +3 -0
@@ -2004,6 +2004,9 @@ static int ceph_zero_partial_object(struct inode *inode,loff_t zero =0 ;int op; +if (ceph_inode_is_shutdown (inode)) +return -EIO ; +if (!length) { op = offset ?CEPH_OSD_OP_DELETE :CEPH_OSD_OP_TRUNCATE ; length = &zero;
fs/ceph/mds_client.c +27 -3
@@ -806,6 +806,9 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, {struct ceph_mds_session *s; +if (READ_ONCE (mdsc->fsc->mount_state) ==CEPH_MOUNT_FENCE_IO ) +return ERR_PTR (-EIO ); +if (mds >= mdsc->mdsmap->possible_max_rank)return ERR_PTR (-EINVAL );
@@ -1478,6 +1481,9 @@ static int __open_session(struct ceph_mds_client *mdsc,int mstate;int mds = session->s_mds; +if (READ_ONCE (mdsc->fsc->mount_state) ==CEPH_MOUNT_FENCE_IO ) +return -EIO ; +/* wait for mds to go active? */ mstate =ceph_mdsmap_get_state (mdsc->mdsmap, mds); dout("open_session to mds%d (%s)\n", mds,
@@ -2860,6 +2866,11 @@ static void __do_request(struct ceph_mds_client *mdsc,return ; } +if (READ_ONCE (mdsc->fsc->mount_state) ==CEPH_MOUNT_FENCE_IO ) { +dout ("do_request metadata corrupted\n" ); + err = -EIO ; + goto finish; + }if (req->r_timeout &&time_after_eq (jiffies, req->r_started + req->r_timeout)) {dout ("do_request timed out\n" );
@@ -3245,6 +3256,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)u64 tid;int err, result;int mds = session->s_mds; +bool close_sessions = false;if (msg->front.iov_len <sizeof (*head)) {pr_err ("mdsc_handle_reply got corrupt (short) reply\n" );
@@ -3351,10 +3363,17 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) realm =NULL ;if (rinfo->snapblob_len) {down_write (&mdsc->snap_rwsem); -ceph_update_snap_trace (mdsc, rinfo->snapblob, + err =ceph_update_snap_trace (mdsc, rinfo->snapblob, rinfo->snapblob + rinfo->snapblob_len,le32_to_cpu (head->op) ==CEPH_MDS_OP_RMSNAP , &realm); +if (err) { +up_write (&mdsc->snap_rwsem); + close_sessions = true; +if (err == -EIO ) +ceph_msg_dump (msg); + goto out_err; + }downgrade_write (&mdsc->snap_rwsem); }else {down_read (&mdsc->snap_rwsem);
@@ -3412,6 +3431,10 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) req->r_end_latency, err); out:ceph_mdsc_put_request (req); + +/* Defer closing the sessions after s_mutex lock being released */ +if (close_sessions) +ceph_mdsc_close_sessions (mdsc);return ; }
@@ -5011,7 +5034,7 @@ static bool done_closing_sessions(struct ceph_mds_client *mdsc, int skipped) }/* -* called after sb is ro. +* called after sb is ro or when metadata corrupted. */ void ceph_mdsc_close_sessions (struct ceph_mds_client *mdsc) {
@@ -5301,7 +5324,8 @@ static void mds_peer_reset(struct ceph_connection *con)struct ceph_mds_client *mdsc = s->s_mdsc;pr_warn ("mds%d closed our session\n" , s->s_mds); -send_mds_reconnect (mdsc, s); +if (READ_ONCE (mdsc->fsc->mount_state) !=CEPH_MOUNT_FENCE_IO ) +send_mds_reconnect (mdsc, s); }static void mds_dispatch (struct ceph_connection *con,struct ceph_msg *msg)
fs/ceph/snap.c +34 -2
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/ceph/ceph_debug.h> +#include <linux/fs.h> #include <linux/sort.h> #include <linux/slab.h> #include <linux/iversion.h>
@@ -766,8 +767,10 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,struct ceph_snap_realm *realm;struct ceph_snap_realm *first_realm =NULL ;struct ceph_snap_realm *realm_to_rebuild =NULL ; +struct ceph_client *client = mdsc->fsc->client;int rebuild_snapcs;int err = -ENOMEM ; +int ret;LIST_HEAD (dirty_realms);lockdep_assert_held_write (&mdsc->snap_rwsem);
@@ -884,6 +887,27 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc,if (first_realm)ceph_put_snap_realm (mdsc, first_realm);pr_err ("%s error %d\n" , __func__, err); + +/* +* When receiving a corrupted snap trace we don't know what +* exactly has happened in MDS side. And we shouldn't continue +* writing to OSD, which may corrupt the snapshot contents. +* +* Just try to blocklist this kclient and then this kclient +* must be remounted to continue after the corrupted metadata +* fixed in the MDS side. +*/ +WRITE_ONCE (mdsc->fsc->mount_state,CEPH_MOUNT_FENCE_IO ); + ret =ceph_monc_blocklist_add (&client->monc, &client->msgr.inst.addr); +if (ret) +pr_err ("%s failed to blocklist %s: %d\n" , __func__, +ceph_pr_addr (&client->msgr.inst.addr), ret); + +WARN (1 ,"%s: %s%sdo remount to continue%s" , + __func__, ret ?"" :ceph_pr_addr (&client->msgr.inst.addr), + ret ?"" :" was blocklisted, " , + err == -EIO ?" after corrupted snaptrace is fixed" :"" ); +return err; }
@@ -984,6 +1008,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,__le64 *split_inos =NULL , *split_realms =NULL ;int i;int locked_rwsem =0 ; +bool close_sessions = false;/* decode */ if (msg->front.iov_len <sizeof (*h))
@@ -1092,8 +1117,12 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,* update using the provided snap trace. if we are deleting a * snap, we can avoid queueing cap_snaps. */ -ceph_update_snap_trace (mdsc, p, e, - op ==CEPH_SNAP_OP_DESTROY ,NULL ); +if (ceph_update_snap_trace (mdsc, p, e, + op ==CEPH_SNAP_OP_DESTROY , +NULL )) { + close_sessions = true; + goto bad; + }if (op ==CEPH_SNAP_OP_SPLIT )/* we took a reference when we created the realm, above */
@@ -1112,6 +1141,9 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, out:if (locked_rwsem)up_write (&mdsc->snap_rwsem); + +if (close_sessions) +ceph_mdsc_close_sessions (mdsc);return ; }
fs/ceph/super.h +1 -0
@@ -108,6 +108,7 @@ enum {CEPH_MOUNT_UNMOUNTED ,CEPH_MOUNT_SHUTDOWN ,CEPH_MOUNT_RECOVER , + CEPH_MOUNT_FENCE_IO, };#define CEPH_ASYNC_CREATE_CONFLICT_BITS 8
Signature · 1 line
2.39.0