From 5f0a792eed218838618045f098b97c43bd47b58f Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sat, 29 Jun 2024 07:49:59 -0400 Subject: [PATCH] Fixes for 6.6 Signed-off-by: Sasha Levin --- ...sing-channel-at-encoding-rpn-nrpn-mi.patch | 64 +++ ...-missing-msb-in-midi2-spp-conversion.patch | 37 ++ ...-a-null-check-for-chip_pdev-structur.patch | 46 ++ ...ove-i2s-configuration-check-in-acp_i.patch | 53 +++ ...-classd-re-add-dai_link-platform-to-.patch | 79 ++++ ...oc-atmel-convert-not-to-use-asoc_xxx.patch | 243 ++++++++++ ...c-card-set-priv-pdev-before-using-it.patch | 54 +++ ...8183-da7219-max98357-fix-kcontrol-na.patch | 77 ++++ ...ss-dai-close-graph-on-prepare-errors.patch | 109 +++++ ...s-tdm-fix-trcm-mode-by-setting-clock.patch | 56 +++ ...ar_off-setting-in-coerce_subreg_to_s.patch | 55 +++ ...ar_off-setting-in-set_sext32_default.patch | 67 +++ ...-overrunning-reservations-in-ringbuf.patch | 152 +++++++ ...ontext-when-getting-inodes-during-lo.patch | 418 ++++++++++++++++++ ...for-duplicate-reqsk-on-identical-syn.patch | 195 ++++++++ ...-outstanding-tx-skbs-during-scrq-res.patch | 60 +++ ...-queues-on-vsi-queue-reconfiguration.patch | 57 +++ ...uffers-fix-memory-corruptions-on-spe.patch | 161 +++++++ ...ochip-fix-initial-port-flush-problem.patch | 49 ++ ...p-fix-wrong-register-write-when-mask.patch | 53 +++ ...p-use-collision-based-back-pressure-.patch | 55 +++ ...sible-double-free-in-error-handling-.patch | 39 ++ ...dd-microchip-ksz-9477-to-the-device-.patch | 36 ++ ...defined-reference-to-netfilter_lwtun.patch | 47 ++ ...les-fully-validate-nft_data_value-on.patch | 92 ++++ ...related-ct-labels-from-its-master-if.patch | 59 +++ ...orrect-compat-recv-recvfrom-syscalls.patch | 48 ++ ...pc-restore-some-missing-spu-syscalls.patch | 54 +++ ...ssing-virt_to_phys-for-directed-dibv.patch | 39 ++ queue-6.6/series | 35 ++ ...rc-fix-compat-recv-recvfrom-syscalls.patch | 279 ++++++++++++ .../sparc-fix-old-compat_sys_select.patch | 39 ++ ...fastopen_synack-to-enter-tcp_ca_loss.patch | 168 +++++++ ...d-null-pointer-dereference-in-perf_t.patch | 306 +++++++++++++ ...-increase-worker-desc-s-length-to-32.patch | 40 ++ ...remove-warn-from-__xdp_reg_mem_model.patch | 76 ++++ 36 files changed, 3497 insertions(+) create mode 100644 queue-6.6/alsa-seq-fix-missing-channel-at-encoding-rpn-nrpn-mi.patch create mode 100644 queue-6.6/alsa-seq-fix-missing-msb-in-midi2-spp-conversion.patch create mode 100644 queue-6.6/asoc-amd-acp-add-a-null-check-for-chip_pdev-structur.patch create mode 100644 queue-6.6/asoc-amd-acp-remove-i2s-configuration-check-in-acp_i.patch create mode 100644 queue-6.6/asoc-atmel-atmel-classd-re-add-dai_link-platform-to-.patch create mode 100644 queue-6.6/asoc-atmel-convert-not-to-use-asoc_xxx.patch create mode 100644 queue-6.6/asoc-fsl-asoc-card-set-priv-pdev-before-using-it.patch create mode 100644 queue-6.6/asoc-mediatek-mt8183-da7219-max98357-fix-kcontrol-na.patch create mode 100644 queue-6.6/asoc-q6apm-lpass-dai-close-graph-on-prepare-errors.patch create mode 100644 queue-6.6/asoc-rockchip-i2s-tdm-fix-trcm-mode-by-setting-clock.patch create mode 100644 queue-6.6/bpf-add-missed-var_off-setting-in-coerce_subreg_to_s.patch create mode 100644 queue-6.6/bpf-add-missed-var_off-setting-in-set_sext32_default.patch create mode 100644 queue-6.6/bpf-fix-overrunning-reservations-in-ringbuf.patch create mode 100644 queue-6.6/btrfs-use-nofs-context-when-getting-inodes-during-lo.patch create mode 100644 queue-6.6/fix-race-for-duplicate-reqsk-on-identical-syn.patch create mode 100644 queue-6.6/ibmvnic-free-any-outstanding-tx-skbs-during-scrq-res.patch create mode 100644 queue-6.6/ice-rebuild-tc-queues-on-vsi-queue-reconfiguration.patch create mode 100644 queue-6.6/mlxsw-spectrum_buffers-fix-memory-corruptions-on-spe.patch create mode 100644 queue-6.6/net-dsa-microchip-fix-initial-port-flush-problem.patch create mode 100644 queue-6.6/net-dsa-microchip-fix-wrong-register-write-when-mask.patch create mode 100644 queue-6.6/net-dsa-microchip-use-collision-based-back-pressure-.patch create mode 100644 queue-6.6/net-mana-fix-possible-double-free-in-error-handling-.patch create mode 100644 queue-6.6/net-phy-micrel-add-microchip-ksz-9477-to-the-device-.patch create mode 100644 queue-6.6/netfilter-fix-undefined-reference-to-netfilter_lwtun.patch create mode 100644 queue-6.6/netfilter-nf_tables-fully-validate-nft_data_value-on.patch create mode 100644 queue-6.6/openvswitch-get-related-ct-labels-from-its-master-if.patch create mode 100644 queue-6.6/parisc-use-correct-compat-recv-recvfrom-syscalls.patch create mode 100644 queue-6.6/powerpc-restore-some-missing-spu-syscalls.patch create mode 100644 queue-6.6/s390-pci-add-missing-virt_to_phys-for-directed-dibv.patch create mode 100644 queue-6.6/sparc-fix-compat-recv-recvfrom-syscalls.patch create mode 100644 queue-6.6/sparc-fix-old-compat_sys_select.patch create mode 100644 queue-6.6/tcp-fix-tcp_rcv_fastopen_synack-to-enter-tcp_ca_loss.patch create mode 100644 queue-6.6/tracing-net_sched-null-pointer-dereference-in-perf_t.patch create mode 100644 queue-6.6/workqueue-increase-worker-desc-s-length-to-32.patch create mode 100644 queue-6.6/xdp-remove-warn-from-__xdp_reg_mem_model.patch diff --git a/queue-6.6/alsa-seq-fix-missing-channel-at-encoding-rpn-nrpn-mi.patch b/queue-6.6/alsa-seq-fix-missing-channel-at-encoding-rpn-nrpn-mi.patch new file mode 100644 index 00000000000..43cd2db775b --- /dev/null +++ b/queue-6.6/alsa-seq-fix-missing-channel-at-encoding-rpn-nrpn-mi.patch @@ -0,0 +1,64 @@ +From bb1e49530aebe7cc485f1e378626a0ec9b92ed07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jun 2024 11:51:58 +0200 +Subject: ALSA: seq: Fix missing channel at encoding RPN/NRPN MIDI2 messages + +From: Takashi Iwai + +[ Upstream commit c5ab94ea280a9b4108723eecf0a636e22a5bb137 ] + +The conversion from the legacy event to MIDI2 UMP for RPN and NRPN +missed the setup of the channel number, resulting in always the +channel 0. Fix it. + +Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") +Link: https://patch.msgid.link/20240625095200.25745-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/seq/seq_ump_convert.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c +index d81f776a4c3dd..6687efdceea13 100644 +--- a/sound/core/seq/seq_ump_convert.c ++++ b/sound/core/seq/seq_ump_convert.c +@@ -791,7 +791,8 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event, + + /* set up the MIDI2 RPN/NRPN packet data from the parsed info */ + static void fill_rpn(struct snd_seq_ump_midi2_bank *cc, +- union snd_ump_midi2_msg *data) ++ union snd_ump_midi2_msg *data, ++ unsigned char channel) + { + if (cc->rpn_set) { + data->rpn.status = UMP_MSG_STATUS_RPN; +@@ -808,6 +809,7 @@ static void fill_rpn(struct snd_seq_ump_midi2_bank *cc, + } + data->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) | + cc->cc_data_lsb); ++ data->rpn.channel = channel; + cc->cc_data_msb = cc->cc_data_lsb = 0; + } + +@@ -855,7 +857,7 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event, + cc->cc_data_lsb = val; + if (!(cc->rpn_set || cc->nrpn_set)) + return 0; // skip +- fill_rpn(cc, data); ++ fill_rpn(cc, data, channel); + return 1; + } + +@@ -957,7 +959,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event, + cc->cc_data_lsb = lsb; + if (!(cc->rpn_set || cc->nrpn_set)) + return 0; // skip +- fill_rpn(cc, data); ++ fill_rpn(cc, data, channel); + return 1; + } + +-- +2.43.0 + diff --git a/queue-6.6/alsa-seq-fix-missing-msb-in-midi2-spp-conversion.patch b/queue-6.6/alsa-seq-fix-missing-msb-in-midi2-spp-conversion.patch new file mode 100644 index 00000000000..5a044944c23 --- /dev/null +++ b/queue-6.6/alsa-seq-fix-missing-msb-in-midi2-spp-conversion.patch @@ -0,0 +1,37 @@ +From c95323c1b81ba6e770ff8fa3e4291208c2d327e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jun 2024 16:51:13 +0200 +Subject: ALSA: seq: Fix missing MSB in MIDI2 SPP conversion + +From: Takashi Iwai + +[ Upstream commit 9d65ab6050d25f17c13f4195aa8e160c6ac638f6 ] + +The conversion of SPP to MIDI2 UMP called a wrong function, and the +secondary argument wasn't taken. As a result, MSB of SPP was always +zero. Fix to call the right function. + +Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events") +Link: https://patch.msgid.link/20240626145141.16648-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/seq/seq_ump_convert.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c +index 6687efdceea13..e90b27a135e6f 100644 +--- a/sound/core/seq/seq_ump_convert.c ++++ b/sound/core/seq/seq_ump_convert.c +@@ -1020,7 +1020,7 @@ static int system_2p_ev_to_ump_midi2(const struct snd_seq_event *event, + union snd_ump_midi2_msg *data, + unsigned char status) + { +- return system_1p_ev_to_ump_midi1(event, dest_port, ++ return system_2p_ev_to_ump_midi1(event, dest_port, + (union snd_ump_midi1_msg *)data, + status); + } +-- +2.43.0 + diff --git a/queue-6.6/asoc-amd-acp-add-a-null-check-for-chip_pdev-structur.patch b/queue-6.6/asoc-amd-acp-add-a-null-check-for-chip_pdev-structur.patch new file mode 100644 index 00000000000..10b524d85a5 --- /dev/null +++ b/queue-6.6/asoc-amd-acp-add-a-null-check-for-chip_pdev-structur.patch @@ -0,0 +1,46 @@ +From 83fb4d99610bcef4c804ea8793d54a05bde47285 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jun 2024 12:58:34 +0530 +Subject: ASoC: amd: acp: add a null check for chip_pdev structure + +From: Vijendar Mukunda + +[ Upstream commit 98d919dfee1cc402ca29d45da642852d7c9a2301 ] + +When acp platform device creation is skipped, chip->chip_pdev value will +remain NULL. Add NULL check for chip->chip_pdev structure in +snd_acp_resume() function to avoid null pointer dereference. + +Fixes: 088a40980efb ("ASoC: amd: acp: add pm ops support for acp pci driver") +Signed-off-by: Vijendar Mukunda +Link: https://msgid.link/r/20240617072844.871468-1-Vijendar.Mukunda@amd.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/amd/acp/acp-pci.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c +index 223238f662f83..7de6446e6f7c1 100644 +--- a/sound/soc/amd/acp/acp-pci.c ++++ b/sound/soc/amd/acp/acp-pci.c +@@ -185,10 +185,12 @@ static int __maybe_unused snd_acp_resume(struct device *dev) + ret = acp_init(chip); + if (ret) + dev_err(dev, "ACP init failed\n"); +- child = chip->chip_pdev->dev; +- adata = dev_get_drvdata(&child); +- if (adata) +- acp_enable_interrupts(adata); ++ if (chip->chip_pdev) { ++ child = chip->chip_pdev->dev; ++ adata = dev_get_drvdata(&child); ++ if (adata) ++ acp_enable_interrupts(adata); ++ } + return ret; + } + +-- +2.43.0 + diff --git a/queue-6.6/asoc-amd-acp-remove-i2s-configuration-check-in-acp_i.patch b/queue-6.6/asoc-amd-acp-remove-i2s-configuration-check-in-acp_i.patch new file mode 100644 index 00000000000..e5dd5097438 --- /dev/null +++ b/queue-6.6/asoc-amd-acp-remove-i2s-configuration-check-in-acp_i.patch @@ -0,0 +1,53 @@ +From 7550a5c1d8be3995ebd28637157414ebd75f5180 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jun 2024 12:58:35 +0530 +Subject: ASoC: amd: acp: remove i2s configuration check in acp_i2s_probe() + +From: Vijendar Mukunda + +[ Upstream commit 70fa3900c3ed92158628710e81d274e5cb52f92b ] + +ACP supports different pin configurations for I2S IO. Checking ACP pin +configuration value against specific value breaks the functionality for +other I2S pin configurations. This check is no longer required in i2s dai +driver probe call as i2s configuration check will be verified during acp +platform device creation sequence. +Remove i2s_mode check in acp_i2s_probe() function. + +Fixes: b24484c18b10 ("ASoC: amd: acp: ACP code generic to support newer platforms") +Signed-off-by: Vijendar Mukunda +Link: https://msgid.link/r/20240617072844.871468-2-Vijendar.Mukunda@amd.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/amd/acp/acp-i2s.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c +index df350014966a0..cf2fdde5aaa18 100644 +--- a/sound/soc/amd/acp/acp-i2s.c ++++ b/sound/soc/amd/acp/acp-i2s.c +@@ -543,20 +543,12 @@ static int acp_i2s_probe(struct snd_soc_dai *dai) + { + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); +- struct acp_resource *rsrc = adata->rsrc; +- unsigned int val; + + if (!adata->acp_base) { + dev_err(dev, "I2S base is NULL\n"); + return -EINVAL; + } + +- val = readl(adata->acp_base + rsrc->i2s_pin_cfg_offset); +- if (val != rsrc->i2s_mode) { +- dev_err(dev, "I2S Mode not supported val %x\n", val); +- return -EINVAL; +- } +- + return 0; + } + +-- +2.43.0 + diff --git a/queue-6.6/asoc-atmel-atmel-classd-re-add-dai_link-platform-to-.patch b/queue-6.6/asoc-atmel-atmel-classd-re-add-dai_link-platform-to-.patch new file mode 100644 index 00000000000..7db9a0bfb69 --- /dev/null +++ b/queue-6.6/asoc-atmel-atmel-classd-re-add-dai_link-platform-to-.patch @@ -0,0 +1,79 @@ +From ceca2eadd54ce46ecdfacb881ab74cb97490d7e9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Jun 2024 13:10:30 +0300 +Subject: ASoC: atmel: atmel-classd: Re-add dai_link->platform to fix card init + +From: Andrei Simion + +[ Upstream commit 2ed22161b19b11239aa742804549f63edd7c91e3 ] + +The removed dai_link->platform component cause a fail which +is exposed at runtime. (ex: when a sound tool is used) +This patch re-adds the dai_link->platform component to have +a full card registered. + +Before this patch: +:~$ aplay -l +**** List of PLAYBACK Hardware Devices **** +card 0: CLASSD [CLASSD], device 0: CLASSD PCM snd-soc-dummy-dai-0 [] + Subdevices: 1/1 + Subdevice #0: subdevice #0 + +:~$ speaker-test -t sine +speaker-test 1.2.6 +Playback device is default +Stream parameters are 48000Hz, S16_LE, 1 channels +Sine wave rate is 440.0000Hz +Playback open error: -22,Invalid argument + +After this patch which restores the platform component: +:~$ aplay -l +**** List of PLAYBACK Hardware Devices **** +card 0: CLASSD [CLASSD], device 0: CLASSD PCM snd-soc-dummy-dai-0 + [CLASSD PCM snd-soc-dummy-dai-0] + Subdevices: 1/1 + Subdevice #0: subdevice #0 +-> Resolve the playback error. + +Fixes: 2f650f87c03c ("ASoC: atmel: remove unnecessary dai_link->platform") +Signed-off-by: Andrei Simion +Acked-by: Kuninori Morimoto +Link: https://msgid.link/r/20240604101030.237792-1-andrei.simion@microchip.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/atmel/atmel-classd.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c +index 6aed1ee443b44..ba314b2799190 100644 +--- a/sound/soc/atmel/atmel-classd.c ++++ b/sound/soc/atmel/atmel-classd.c +@@ -473,19 +473,22 @@ static int atmel_classd_asoc_card_init(struct device *dev, + if (!dai_link) + return -ENOMEM; + +- comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); ++ comp = devm_kzalloc(dev, 2 * sizeof(*comp), GFP_KERNEL); + if (!comp) + return -ENOMEM; + +- dai_link->cpus = comp; ++ dai_link->cpus = &comp[0]; + dai_link->codecs = &snd_soc_dummy_dlc; ++ dai_link->platforms = &comp[1]; + + dai_link->num_cpus = 1; + dai_link->num_codecs = 1; ++ dai_link->num_platforms = 1; + + dai_link->name = "CLASSD"; + dai_link->stream_name = "CLASSD PCM"; + dai_link->cpus->dai_name = dev_name(dev); ++ dai_link->platforms->name = dev_name(dev); + + card->dai_link = dai_link; + card->num_links = 1; +-- +2.43.0 + diff --git a/queue-6.6/asoc-atmel-convert-not-to-use-asoc_xxx.patch b/queue-6.6/asoc-atmel-convert-not-to-use-asoc_xxx.patch new file mode 100644 index 00000000000..718e86a7188 --- /dev/null +++ b/queue-6.6/asoc-atmel-convert-not-to-use-asoc_xxx.patch @@ -0,0 +1,243 @@ +From f65f5ed199b05b5fb82e9ce13bb62b814e3cbc70 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Sep 2023 23:49:01 +0000 +Subject: ASoC: atmel: convert not to use asoc_xxx() + +From: Kuninori Morimoto + +[ Upstream commit 6547effc3aea50cc3c60874f9a65a19f4919ef9d ] + +ASoC is now unified asoc_xxx() into snd_soc_xxx(). +This patch convert asoc_xxx() to snd_soc_xxx(). + +Signed-off-by: Kuninori Morimoto +Link: https://lore.kernel.org/r/87r0n4qniq.wl-kuninori.morimoto.gx@renesas.com +Signed-off-by: Mark Brown +Stable-dep-of: 2ed22161b19b ("ASoC: atmel: atmel-classd: Re-add dai_link->platform to fix card init") +Signed-off-by: Sasha Levin +--- + sound/soc/atmel/atmel-classd.c | 10 +++++----- + sound/soc/atmel/atmel-pcm-dma.c | 8 ++++---- + sound/soc/atmel/atmel-pcm-pdc.c | 4 ++-- + sound/soc/atmel/atmel-pdmic.c | 12 ++++++------ + sound/soc/atmel/atmel_wm8904.c | 4 ++-- + sound/soc/atmel/mikroe-proto.c | 2 +- + sound/soc/atmel/sam9g20_wm8731.c | 2 +- + sound/soc/atmel/sam9x5_wm8731.c | 2 +- + 8 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c +index 4c1985711218d..6aed1ee443b44 100644 +--- a/sound/soc/atmel/atmel-classd.c ++++ b/sound/soc/atmel/atmel-classd.c +@@ -118,7 +118,7 @@ static const struct snd_pcm_hardware atmel_classd_hw = { + static int atmel_classd_cpu_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); + int err; + +@@ -141,7 +141,7 @@ atmel_classd_platform_configure_dma(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct dma_slave_config *slave_config) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); + + if (params_physical_width(params) != 16) { +@@ -338,7 +338,7 @@ atmel_classd_cpu_dai_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_component *component = cpu_dai->component; + int fs; +@@ -381,7 +381,7 @@ static void + atmel_classd_cpu_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); + + clk_disable_unprepare(dd->gclk); +@@ -478,7 +478,7 @@ static int atmel_classd_asoc_card_init(struct device *dev, + return -ENOMEM; + + dai_link->cpus = comp; +- dai_link->codecs = &asoc_dummy_dlc; ++ dai_link->codecs = &snd_soc_dummy_dlc; + + dai_link->num_cpus = 1; + dai_link->num_codecs = 1; +diff --git a/sound/soc/atmel/atmel-pcm-dma.c b/sound/soc/atmel/atmel-pcm-dma.c +index 96a8c7dba98ff..7306e04da513b 100644 +--- a/sound/soc/atmel/atmel-pcm-dma.c ++++ b/sound/soc/atmel/atmel-pcm-dma.c +@@ -52,10 +52,10 @@ static const struct snd_pcm_hardware atmel_pcm_dma_hardware = { + static void atmel_pcm_dma_irq(u32 ssc_sr, + struct snd_pcm_substream *substream) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pcm_dma_params *prtd; + +- prtd = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); ++ prtd = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream); + + if (ssc_sr & prtd->mask->ssc_error) { + if (snd_pcm_running(substream)) +@@ -77,12 +77,12 @@ static void atmel_pcm_dma_irq(u32 ssc_sr, + static int atmel_pcm_configure_dma(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pcm_dma_params *prtd; + struct ssc_device *ssc; + int ret; + +- prtd = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); ++ prtd = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream); + ssc = prtd->ssc; + + ret = snd_hwparams_to_dma_slave_config(substream, params, slave_config); +diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c +index 3e7ea2021b46b..7db8df85c54f3 100644 +--- a/sound/soc/atmel/atmel-pcm-pdc.c ++++ b/sound/soc/atmel/atmel-pcm-pdc.c +@@ -140,12 +140,12 @@ static int atmel_pcm_hw_params(struct snd_soc_component *component, + { + struct snd_pcm_runtime *runtime = substream->runtime; + struct atmel_runtime_data *prtd = runtime->private_data; +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + + /* this may get called several times by oss emulation + * with different params */ + +- prtd->params = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream); ++ prtd->params = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream); + prtd->params->dma_intr_handler = atmel_pcm_dma_irq; + + prtd->dma_buffer = runtime->dma_addr; +diff --git a/sound/soc/atmel/atmel-pdmic.c b/sound/soc/atmel/atmel-pdmic.c +index 0db7815d230c3..fa29dd8ef2089 100644 +--- a/sound/soc/atmel/atmel-pdmic.c ++++ b/sound/soc/atmel/atmel-pdmic.c +@@ -104,7 +104,7 @@ static struct atmel_pdmic_pdata *atmel_pdmic_dt_init(struct device *dev) + static int atmel_pdmic_cpu_dai_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card); + int ret; + +@@ -132,7 +132,7 @@ static int atmel_pdmic_cpu_dai_startup(struct snd_pcm_substream *substream, + static void atmel_pdmic_cpu_dai_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card); + + /* Disable the overrun error interrupt */ +@@ -145,7 +145,7 @@ static void atmel_pdmic_cpu_dai_shutdown(struct snd_pcm_substream *substream, + static int atmel_pdmic_cpu_dai_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_component *component = cpu_dai->component; + u32 val; +@@ -191,7 +191,7 @@ atmel_pdmic_platform_configure_dma(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct dma_slave_config *slave_config) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card); + int ret; + +@@ -356,7 +356,7 @@ atmel_pdmic_cpu_dai_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *cpu_dai) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_component *component = cpu_dai->component; + unsigned int rate_min = substream->runtime->hw.rate_min; +@@ -501,7 +501,7 @@ static int atmel_pdmic_asoc_card_init(struct device *dev, + return -ENOMEM; + + dai_link->cpus = comp; +- dai_link->codecs = &asoc_dummy_dlc; ++ dai_link->codecs = &snd_soc_dummy_dlc; + + dai_link->num_cpus = 1; + dai_link->num_codecs = 1; +diff --git a/sound/soc/atmel/atmel_wm8904.c b/sound/soc/atmel/atmel_wm8904.c +index 00e98136bec25..01e944fa11483 100644 +--- a/sound/soc/atmel/atmel_wm8904.c ++++ b/sound/soc/atmel/atmel_wm8904.c +@@ -26,8 +26,8 @@ static const struct snd_soc_dapm_widget atmel_asoc_wm8904_dapm_widgets[] = { + static int atmel_asoc_wm8904_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) + { +- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); +- struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); ++ struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); ++ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + int ret; + + ret = snd_soc_dai_set_pll(codec_dai, WM8904_FLL_MCLK, WM8904_FLL_MCLK, +diff --git a/sound/soc/atmel/mikroe-proto.c b/sound/soc/atmel/mikroe-proto.c +index 30c87c2c1b0bd..18a8760443ae6 100644 +--- a/sound/soc/atmel/mikroe-proto.c ++++ b/sound/soc/atmel/mikroe-proto.c +@@ -21,7 +21,7 @@ + static int snd_proto_init(struct snd_soc_pcm_runtime *rtd) + { + struct snd_soc_card *card = rtd->card; +- struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); ++ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + + /* Set proto sysclk */ + int ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, +diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c +index 0405e9e49140e..d3ec9826d505f 100644 +--- a/sound/soc/atmel/sam9g20_wm8731.c ++++ b/sound/soc/atmel/sam9g20_wm8731.c +@@ -66,7 +66,7 @@ static const struct snd_soc_dapm_route intercon[] = { + */ + static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) + { +- struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); ++ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + struct device *dev = rtd->dev; + int ret; + +diff --git a/sound/soc/atmel/sam9x5_wm8731.c b/sound/soc/atmel/sam9x5_wm8731.c +index cd1d59a90e021..d1c1f370a9cd5 100644 +--- a/sound/soc/atmel/sam9x5_wm8731.c ++++ b/sound/soc/atmel/sam9x5_wm8731.c +@@ -40,7 +40,7 @@ struct sam9x5_drvdata { + */ + static int sam9x5_wm8731_init(struct snd_soc_pcm_runtime *rtd) + { +- struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); ++ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + struct device *dev = rtd->dev; + int ret; + +-- +2.43.0 + diff --git a/queue-6.6/asoc-fsl-asoc-card-set-priv-pdev-before-using-it.patch b/queue-6.6/asoc-fsl-asoc-card-set-priv-pdev-before-using-it.patch new file mode 100644 index 00000000000..4cf809f0fa2 --- /dev/null +++ b/queue-6.6/asoc-fsl-asoc-card-set-priv-pdev-before-using-it.patch @@ -0,0 +1,54 @@ +From 2fa9e564ecf332f9fea546b53dc69b10e084f67b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jun 2024 15:25:03 +0200 +Subject: ASoC: fsl-asoc-card: set priv->pdev before using it + +From: Elinor Montmasson + +[ Upstream commit 90f3feb24172185f1832636264943e8b5e289245 ] + +priv->pdev pointer was set after being used in +fsl_asoc_card_audmux_init(). +Move this assignment at the start of the probe function, so +sub-functions can correctly use pdev through priv. + +fsl_asoc_card_audmux_init() dereferences priv->pdev to get access to the +dev struct, used with dev_err macros. +As priv is zero-initialised, there would be a NULL pointer dereference. +Note that if priv->dev is dereferenced before assignment but never used, +for example if there is no error to be printed, the driver won't crash +probably due to compiler optimisations. + +Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support") +Signed-off-by: Elinor Montmasson +Link: https://patch.msgid.link/20240620132511.4291-2-elinor.montmasson@savoirfairelinux.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/fsl/fsl-asoc-card.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c +index 5f181b89838ac..f76252b3f5913 100644 +--- a/sound/soc/fsl/fsl-asoc-card.c ++++ b/sound/soc/fsl/fsl-asoc-card.c +@@ -559,6 +559,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) + if (!priv) + return -ENOMEM; + ++ priv->pdev = pdev; ++ + cpu_np = of_parse_phandle(np, "audio-cpu", 0); + /* Give a chance to old DT binding */ + if (!cpu_np) +@@ -781,7 +783,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) + } + + /* Initialize sound card */ +- priv->pdev = pdev; + priv->card.dev = &pdev->dev; + priv->card.owner = THIS_MODULE; + ret = snd_soc_of_parse_card_name(&priv->card, "model"); +-- +2.43.0 + diff --git a/queue-6.6/asoc-mediatek-mt8183-da7219-max98357-fix-kcontrol-na.patch b/queue-6.6/asoc-mediatek-mt8183-da7219-max98357-fix-kcontrol-na.patch new file mode 100644 index 00000000000..bd8fbd5f8ec --- /dev/null +++ b/queue-6.6/asoc-mediatek-mt8183-da7219-max98357-fix-kcontrol-na.patch @@ -0,0 +1,77 @@ +From d2fb13bb8c74961c2388628924e0b3c08b05ddc7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 May 2024 08:37:54 +0000 +Subject: ASoC: mediatek: mt8183-da7219-max98357: Fix kcontrol name collision + +From: Hsin-Te Yuan + +[ Upstream commit 97d8613679eb53bd0c07d0fbd3d8471e46ba46c1 ] + +Since "Headphone Switch" kcontrol name has already been used by da7219, +rename the control name from "Headphone" to "Headphones" to prevent the +colision. Also, this change makes kcontrol name align with the one in +mt8186-mt6366-da7219-max98357.c. + +Fixes: 9c7388baa2053 ("ASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols") +Change-Id: I9ae69a4673cd04786b247cc514fdd20f878ef009 +Signed-off-by: Hsin-Te Yuan +Reviewed-by: Chen-Yu Tsai +Link: https://msgid.link/r/20240531-da7219-v1-1-ac3343f3ae6a@chromium.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +index 701fbcc0f2c9c..b48375aa30271 100644 +--- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c ++++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +@@ -31,7 +31,7 @@ struct mt8183_da7219_max98357_priv { + + static struct snd_soc_jack_pin mt8183_da7219_max98357_jack_pins[] = { + { +- .pin = "Headphone", ++ .pin = "Headphones", + .mask = SND_JACK_HEADPHONE, + }, + { +@@ -626,7 +626,7 @@ static struct snd_soc_codec_conf mt6358_codec_conf[] = { + }; + + static const struct snd_kcontrol_new mt8183_da7219_max98357_snd_controls[] = { +- SOC_DAPM_PIN_SWITCH("Headphone"), ++ SOC_DAPM_PIN_SWITCH("Headphones"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Speakers"), + SOC_DAPM_PIN_SWITCH("Line Out"), +@@ -634,7 +634,7 @@ static const struct snd_kcontrol_new mt8183_da7219_max98357_snd_controls[] = { + + static const + struct snd_soc_dapm_widget mt8183_da7219_max98357_dapm_widgets[] = { +- SND_SOC_DAPM_HP("Headphone", NULL), ++ SND_SOC_DAPM_HP("Headphones", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_SPK("Speakers", NULL), + SND_SOC_DAPM_SPK("Line Out", NULL), +@@ -680,7 +680,7 @@ static struct snd_soc_codec_conf mt8183_da7219_rt1015_codec_conf[] = { + }; + + static const struct snd_kcontrol_new mt8183_da7219_rt1015_snd_controls[] = { +- SOC_DAPM_PIN_SWITCH("Headphone"), ++ SOC_DAPM_PIN_SWITCH("Headphones"), + SOC_DAPM_PIN_SWITCH("Headset Mic"), + SOC_DAPM_PIN_SWITCH("Left Spk"), + SOC_DAPM_PIN_SWITCH("Right Spk"), +@@ -689,7 +689,7 @@ static const struct snd_kcontrol_new mt8183_da7219_rt1015_snd_controls[] = { + + static const + struct snd_soc_dapm_widget mt8183_da7219_rt1015_dapm_widgets[] = { +- SND_SOC_DAPM_HP("Headphone", NULL), ++ SND_SOC_DAPM_HP("Headphones", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), + SND_SOC_DAPM_SPK("Left Spk", NULL), + SND_SOC_DAPM_SPK("Right Spk", NULL), +-- +2.43.0 + diff --git a/queue-6.6/asoc-q6apm-lpass-dai-close-graph-on-prepare-errors.patch b/queue-6.6/asoc-q6apm-lpass-dai-close-graph-on-prepare-errors.patch new file mode 100644 index 00000000000..d494abc0963 --- /dev/null +++ b/queue-6.6/asoc-q6apm-lpass-dai-close-graph-on-prepare-errors.patch @@ -0,0 +1,109 @@ +From 1eaf182126e404b8c7b748cb4d5d248f93f9ae70 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Jun 2024 13:13:05 +0100 +Subject: ASoC: q6apm-lpass-dai: close graph on prepare errors + +From: Srinivas Kandagatla + +[ Upstream commit be1fae62cf253a5b67526cee9fbc07689b97c125 ] + +There is an issue around with error handling and graph management with +the exising code, none of the error paths close the graph, which result in +leaving the loaded graph in dsp, however the driver thinks otherwise. + +This can have a nasty side effect specially when we try to load the same +graph to dsp, dsp returns error which leaves the board with no sound and +requires restart. + +Fix this by properly closing the graph when we hit errors between +open and close. + +Fixes: 30ad723b93ad ("ASoC: qdsp6: audioreach: add q6apm lpass dai support") +Signed-off-by: Srinivas Kandagatla +Reviewed-by: Dmitry Baryshkov +Tested-by: Dmitry Baryshkov # X13s +Link: https://lore.kernel.org/r/20240613-q6apm-fixes-v1-1-d88953675ab3@linaro.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 32 +++++++++++++++---------- + 1 file changed, 20 insertions(+), 12 deletions(-) + +diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +index 7ad604b80e25e..6511f0a08de16 100644 +--- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c ++++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +@@ -140,14 +140,17 @@ static void q6apm_lpass_dai_shutdown(struct snd_pcm_substream *substream, struct + struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); + int rc; + +- if (!dai_data->is_port_started[dai->id]) +- return; +- rc = q6apm_graph_stop(dai_data->graph[dai->id]); +- if (rc < 0) +- dev_err(dai->dev, "fail to close APM port (%d)\n", rc); ++ if (dai_data->is_port_started[dai->id]) { ++ rc = q6apm_graph_stop(dai_data->graph[dai->id]); ++ dai_data->is_port_started[dai->id] = false; ++ if (rc < 0) ++ dev_err(dai->dev, "fail to close APM port (%d)\n", rc); ++ } + +- q6apm_graph_close(dai_data->graph[dai->id]); +- dai_data->is_port_started[dai->id] = false; ++ if (dai_data->graph[dai->id]) { ++ q6apm_graph_close(dai_data->graph[dai->id]); ++ dai_data->graph[dai->id] = NULL; ++ } + } + + static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) +@@ -162,8 +165,10 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s + q6apm_graph_stop(dai_data->graph[dai->id]); + dai_data->is_port_started[dai->id] = false; + +- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + q6apm_graph_close(dai_data->graph[dai->id]); ++ dai_data->graph[dai->id] = NULL; ++ } + } + + /** +@@ -182,26 +187,29 @@ static int q6apm_lpass_dai_prepare(struct snd_pcm_substream *substream, struct s + + cfg->direction = substream->stream; + rc = q6apm_graph_media_format_pcm(dai_data->graph[dai->id], cfg); +- + if (rc) { + dev_err(dai->dev, "Failed to set media format %d\n", rc); +- return rc; ++ goto err; + } + + rc = q6apm_graph_prepare(dai_data->graph[dai->id]); + if (rc) { + dev_err(dai->dev, "Failed to prepare Graph %d\n", rc); +- return rc; ++ goto err; + } + + rc = q6apm_graph_start(dai_data->graph[dai->id]); + if (rc < 0) { + dev_err(dai->dev, "fail to start APM port %x\n", dai->id); +- return rc; ++ goto err; + } + dai_data->is_port_started[dai->id] = true; + + return 0; ++err: ++ q6apm_graph_close(dai_data->graph[dai->id]); ++ dai_data->graph[dai->id] = NULL; ++ return rc; + } + + static int q6apm_lpass_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) +-- +2.43.0 + diff --git a/queue-6.6/asoc-rockchip-i2s-tdm-fix-trcm-mode-by-setting-clock.patch b/queue-6.6/asoc-rockchip-i2s-tdm-fix-trcm-mode-by-setting-clock.patch new file mode 100644 index 00000000000..10b90c49cea --- /dev/null +++ b/queue-6.6/asoc-rockchip-i2s-tdm-fix-trcm-mode-by-setting-clock.patch @@ -0,0 +1,56 @@ +From 5042d18253cbc813b39b0ca1aae6179119f5f19d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Jun 2024 21:47:52 +0300 +Subject: ASoC: rockchip: i2s-tdm: Fix trcm mode by setting clock on right mclk + +From: Alibek Omarov + +[ Upstream commit ccd8d753f0fe8f16745fa2b6be5946349731d901 ] + +When TRCM mode is enabled, I2S RX and TX clocks are synchronized through +selected clock source. Without this fix BCLK and LRCK might get parented +to an uninitialized MCLK and the DAI will receive data at wrong pace. + +However, unlike in original i2s-tdm driver, there is no need to manually +synchronize mclk_rx and mclk_tx, as only one gets used anyway. + +Tested on a board with RK3568 SoC and Silergy SY24145S codec with enabled and +disabled TRCM mode. + +Fixes: 9e2ab4b18ebd ("ASoC: rockchip: i2s-tdm: Fix inaccurate sampling rates") +Signed-off-by: Alibek Omarov +Reviewed-by: Luca Ceresoli +Link: https://msgid.link/r/20240604184752.697313-1-a1ba.omarov@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/rockchip/rockchip_i2s_tdm.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c +index 15f8919fd224a..e6a6eabc47e5b 100644 +--- a/sound/soc/rockchip/rockchip_i2s_tdm.c ++++ b/sound/soc/rockchip/rockchip_i2s_tdm.c +@@ -657,8 +657,17 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream, + int err; + + if (i2s_tdm->is_master_mode) { +- struct clk *mclk = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? +- i2s_tdm->mclk_tx : i2s_tdm->mclk_rx; ++ struct clk *mclk; ++ ++ if (i2s_tdm->clk_trcm == TRCM_TX) { ++ mclk = i2s_tdm->mclk_tx; ++ } else if (i2s_tdm->clk_trcm == TRCM_RX) { ++ mclk = i2s_tdm->mclk_rx; ++ } else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ mclk = i2s_tdm->mclk_tx; ++ } else { ++ mclk = i2s_tdm->mclk_rx; ++ } + + err = clk_set_rate(mclk, DEFAULT_MCLK_FS * params_rate(params)); + if (err) +-- +2.43.0 + diff --git a/queue-6.6/bpf-add-missed-var_off-setting-in-coerce_subreg_to_s.patch b/queue-6.6/bpf-add-missed-var_off-setting-in-coerce_subreg_to_s.patch new file mode 100644 index 00000000000..32de62ce82f --- /dev/null +++ b/queue-6.6/bpf-add-missed-var_off-setting-in-coerce_subreg_to_s.patch @@ -0,0 +1,55 @@ +From 29dcaefc8a69dbdd287ef57beb9da66d067f157a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 Jun 2024 10:46:32 -0700 +Subject: bpf: Add missed var_off setting in coerce_subreg_to_size_sx() + +From: Yonghong Song + +[ Upstream commit 44b7f7151dfc2e0947f39ed4b9bc4b0c2ccd46fc ] + +In coerce_subreg_to_size_sx(), for the case where upper +sign extension bits are the same for smax32 and smin32 +values, we missed to setup properly. This is especially +problematic if both smax32 and smin32's sign extension +bits are 1. + +The following is a simple example illustrating the inconsistent +verifier states due to missed var_off: + + 0: (85) call bpf_get_prandom_u32#7 ; R0_w=scalar() + 1: (bf) r3 = r0 ; R0_w=scalar(id=1) R3_w=scalar(id=1) + 2: (57) r3 &= 15 ; R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=15,var_off=(0x0; 0xf)) + 3: (47) r3 |= 128 ; R3_w=scalar(smin=umin=smin32=umin32=128,smax=umax=smax32=umax32=143,var_off=(0x80; 0xf)) + 4: (bc) w7 = (s8)w3 + REG INVARIANTS VIOLATION (alu): range bounds violation u64=[0xffffff80, 0x8f] s64=[0xffffff80, 0x8f] + u32=[0xffffff80, 0x8f] s32=[0x80, 0xffffff8f] var_off=(0x80, 0xf) + +The var_off=(0x80, 0xf) is not correct, and the correct one should +be var_off=(0xffffff80; 0xf) since from insn 3, we know that at +insn 4, the sign extension bits will be 1. This patch fixed this +issue by setting var_off properly. + +Fixes: 8100928c8814 ("bpf: Support new sign-extension mov insns") +Signed-off-by: Yonghong Song +Link: https://lore.kernel.org/r/20240615174632.3995278-1-yonghong.song@linux.dev +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/bpf/verifier.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index 291bda5ef5526..171045b6956d9 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -6204,6 +6204,7 @@ static void coerce_subreg_to_size_sx(struct bpf_reg_state *reg, int size) + reg->s32_max_value = s32_max; + reg->u32_min_value = (u32)s32_min; + reg->u32_max_value = (u32)s32_max; ++ reg->var_off = tnum_subreg(tnum_range(s32_min, s32_max)); + return; + } + +-- +2.43.0 + diff --git a/queue-6.6/bpf-add-missed-var_off-setting-in-set_sext32_default.patch b/queue-6.6/bpf-add-missed-var_off-setting-in-set_sext32_default.patch new file mode 100644 index 00000000000..a50297c08fa --- /dev/null +++ b/queue-6.6/bpf-add-missed-var_off-setting-in-set_sext32_default.patch @@ -0,0 +1,67 @@ +From d9c63b7b8c8d238d926ebd3cae858445c12a4aaf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 Jun 2024 10:46:26 -0700 +Subject: bpf: Add missed var_off setting in set_sext32_default_val() + +From: Yonghong Song + +[ Upstream commit 380d5f89a4815ff88461a45de2fb6f28533df708 ] + +Zac reported a verification failure and Alexei reproduced the issue +with a simple reproducer ([1]). The verification failure is due to missed +setting for var_off. + +The following is the reproducer in [1]: + 0: R1=ctx() R10=fp0 + 0: (71) r3 = *(u8 *)(r10 -387) ; + R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff)) R10=fp0 + 1: (bc) w7 = (s8)w3 ; + R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff)) + R7_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=127,var_off=(0x0; 0x7f)) + 2: (36) if w7 >= 0x2533823b goto pc-3 + mark_precise: frame0: last_idx 2 first_idx 0 subseq_idx -1 + mark_precise: frame0: regs=r7 stack= before 1: (bc) w7 = (s8)w3 + mark_precise: frame0: regs=r3 stack= before 0: (71) r3 = *(u8 *)(r10 -387) + 2: R7_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=127,var_off=(0x0; 0x7f)) + 3: (b4) w0 = 0 ; R0_w=0 + 4: (95) exit + +Note that after insn 1, the var_off for R7 is (0x0; 0x7f). This is not correct +since upper 24 bits of w7 could be 0 or 1. So correct var_off should be +(0x0; 0xffffffff). Missing var_off setting in set_sext32_default_val() caused later +incorrect analysis in zext_32_to_64(dst_reg) and reg_bounds_sync(dst_reg). + +To fix the issue, set var_off correctly in set_sext32_default_val(). The correct +reg state after insn 1 becomes: + 1: (bc) w7 = (s8)w3 ; + R3_w=scalar(smin=smin32=0,smax=umax=smax32=umax32=255,var_off=(0x0; 0xff)) + R7_w=scalar(smin=0,smax=umax=0xffffffff,smin32=-128,smax32=127,var_off=(0x0; 0xffffffff)) +and at insn 2, the verifier correctly determines either branch is possible. + + [1] https://lore.kernel.org/bpf/CAADnVQLPU0Shz7dWV4bn2BgtGdxN3uFHPeobGBA72tpg5Xoykw@mail.gmail.com/ + +Fixes: 8100928c8814 ("bpf: Support new sign-extension mov insns") +Reported-by: Zac Ecob +Signed-off-by: Yonghong Song +Link: https://lore.kernel.org/r/20240615174626.3994813-1-yonghong.song@linux.dev +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/bpf/verifier.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c +index ec0464c075bb4..291bda5ef5526 100644 +--- a/kernel/bpf/verifier.c ++++ b/kernel/bpf/verifier.c +@@ -6159,6 +6159,7 @@ static void set_sext32_default_val(struct bpf_reg_state *reg, int size) + } + reg->u32_min_value = 0; + reg->u32_max_value = U32_MAX; ++ reg->var_off = tnum_subreg(tnum_unknown); + } + + static void coerce_subreg_to_size_sx(struct bpf_reg_state *reg, int size) +-- +2.43.0 + diff --git a/queue-6.6/bpf-fix-overrunning-reservations-in-ringbuf.patch b/queue-6.6/bpf-fix-overrunning-reservations-in-ringbuf.patch new file mode 100644 index 00000000000..bc5508f9faf --- /dev/null +++ b/queue-6.6/bpf-fix-overrunning-reservations-in-ringbuf.patch @@ -0,0 +1,152 @@ +From 1c3feb62f809fae4f8b1d44456fbf0a09da9dbba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 16:08:27 +0200 +Subject: bpf: Fix overrunning reservations in ringbuf + +From: Daniel Borkmann + +[ Upstream commit cfa1a2329a691ffd991fcf7248a57d752e712881 ] + +The BPF ring buffer internally is implemented as a power-of-2 sized circular +buffer, with two logical and ever-increasing counters: consumer_pos is the +consumer counter to show which logical position the consumer consumed the +data, and producer_pos which is the producer counter denoting the amount of +data reserved by all producers. + +Each time a record is reserved, the producer that "owns" the record will +successfully advance producer counter. In user space each time a record is +read, the consumer of the data advanced the consumer counter once it finished +processing. Both counters are stored in separate pages so that from user +space, the producer counter is read-only and the consumer counter is read-write. + +One aspect that simplifies and thus speeds up the implementation of both +producers and consumers is how the data area is mapped twice contiguously +back-to-back in the virtual memory, allowing to not take any special measures +for samples that have to wrap around at the end of the circular buffer data +area, because the next page after the last data page would be first data page +again, and thus the sample will still appear completely contiguous in virtual +memory. + +Each record has a struct bpf_ringbuf_hdr { u32 len; u32 pg_off; } header for +book-keeping the length and offset, and is inaccessible to the BPF program. +Helpers like bpf_ringbuf_reserve() return `(void *)hdr + BPF_RINGBUF_HDR_SZ` +for the BPF program to use. Bing-Jhong and Muhammad reported that it is however +possible to make a second allocated memory chunk overlapping with the first +chunk and as a result, the BPF program is now able to edit first chunk's +header. + +For example, consider the creation of a BPF_MAP_TYPE_RINGBUF map with size +of 0x4000. Next, the consumer_pos is modified to 0x3000 /before/ a call to +bpf_ringbuf_reserve() is made. This will allocate a chunk A, which is in +[0x0,0x3008], and the BPF program is able to edit [0x8,0x3008]. Now, lets +allocate a chunk B with size 0x3000. This will succeed because consumer_pos +was edited ahead of time to pass the `new_prod_pos - cons_pos > rb->mask` +check. Chunk B will be in range [0x3008,0x6010], and the BPF program is able +to edit [0x3010,0x6010]. Due to the ring buffer memory layout mentioned +earlier, the ranges [0x0,0x4000] and [0x4000,0x8000] point to the same data +pages. This means that chunk B at [0x4000,0x4008] is chunk A's header. +bpf_ringbuf_submit() / bpf_ringbuf_discard() use the header's pg_off to then +locate the bpf_ringbuf itself via bpf_ringbuf_restore_from_rec(). Once chunk +B modified chunk A's header, then bpf_ringbuf_commit() refers to the wrong +page and could cause a crash. + +Fix it by calculating the oldest pending_pos and check whether the range +from the oldest outstanding record to the newest would span beyond the ring +buffer size. If that is the case, then reject the request. We've tested with +the ring buffer benchmark in BPF selftests (./benchs/run_bench_ringbufs.sh) +before/after the fix and while it seems a bit slower on some benchmarks, it +is still not significantly enough to matter. + +Fixes: 457f44363a88 ("bpf: Implement BPF ring buffer and verifier support for it") +Reported-by: Bing-Jhong Billy Jheng +Reported-by: Muhammad Ramdhan +Co-developed-by: Bing-Jhong Billy Jheng +Co-developed-by: Andrii Nakryiko +Signed-off-by: Bing-Jhong Billy Jheng +Signed-off-by: Andrii Nakryiko +Signed-off-by: Daniel Borkmann +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20240621140828.18238-1-daniel@iogearbox.net +Signed-off-by: Sasha Levin +--- + kernel/bpf/ringbuf.c | 31 +++++++++++++++++++++++++------ + 1 file changed, 25 insertions(+), 6 deletions(-) + +diff --git a/kernel/bpf/ringbuf.c b/kernel/bpf/ringbuf.c +index f045fde632e5f..238d9b206bbde 100644 +--- a/kernel/bpf/ringbuf.c ++++ b/kernel/bpf/ringbuf.c +@@ -51,7 +51,8 @@ struct bpf_ringbuf { + * This prevents a user-space application from modifying the + * position and ruining in-kernel tracking. The permissions of the + * pages depend on who is producing samples: user-space or the +- * kernel. ++ * kernel. Note that the pending counter is placed in the same ++ * page as the producer, so that it shares the same cache line. + * + * Kernel-producer + * --------------- +@@ -70,6 +71,7 @@ struct bpf_ringbuf { + */ + unsigned long consumer_pos __aligned(PAGE_SIZE); + unsigned long producer_pos __aligned(PAGE_SIZE); ++ unsigned long pending_pos; + char data[] __aligned(PAGE_SIZE); + }; + +@@ -179,6 +181,7 @@ static struct bpf_ringbuf *bpf_ringbuf_alloc(size_t data_sz, int numa_node) + rb->mask = data_sz - 1; + rb->consumer_pos = 0; + rb->producer_pos = 0; ++ rb->pending_pos = 0; + + return rb; + } +@@ -404,9 +407,9 @@ bpf_ringbuf_restore_from_rec(struct bpf_ringbuf_hdr *hdr) + + static void *__bpf_ringbuf_reserve(struct bpf_ringbuf *rb, u64 size) + { +- unsigned long cons_pos, prod_pos, new_prod_pos, flags; +- u32 len, pg_off; ++ unsigned long cons_pos, prod_pos, new_prod_pos, pend_pos, flags; + struct bpf_ringbuf_hdr *hdr; ++ u32 len, pg_off, tmp_size, hdr_len; + + if (unlikely(size > RINGBUF_MAX_RECORD_SZ)) + return NULL; +@@ -424,13 +427,29 @@ static void *__bpf_ringbuf_reserve(struct bpf_ringbuf *rb, u64 size) + spin_lock_irqsave(&rb->spinlock, flags); + } + ++ pend_pos = rb->pending_pos; + prod_pos = rb->producer_pos; + new_prod_pos = prod_pos + len; + +- /* check for out of ringbuf space by ensuring producer position +- * doesn't advance more than (ringbuf_size - 1) ahead ++ while (pend_pos < prod_pos) { ++ hdr = (void *)rb->data + (pend_pos & rb->mask); ++ hdr_len = READ_ONCE(hdr->len); ++ if (hdr_len & BPF_RINGBUF_BUSY_BIT) ++ break; ++ tmp_size = hdr_len & ~BPF_RINGBUF_DISCARD_BIT; ++ tmp_size = round_up(tmp_size + BPF_RINGBUF_HDR_SZ, 8); ++ pend_pos += tmp_size; ++ } ++ rb->pending_pos = pend_pos; ++ ++ /* check for out of ringbuf space: ++ * - by ensuring producer position doesn't advance more than ++ * (ringbuf_size - 1) ahead ++ * - by ensuring oldest not yet committed record until newest ++ * record does not span more than (ringbuf_size - 1) + */ +- if (new_prod_pos - cons_pos > rb->mask) { ++ if (new_prod_pos - cons_pos > rb->mask || ++ new_prod_pos - pend_pos > rb->mask) { + spin_unlock_irqrestore(&rb->spinlock, flags); + return NULL; + } +-- +2.43.0 + diff --git a/queue-6.6/btrfs-use-nofs-context-when-getting-inodes-during-lo.patch b/queue-6.6/btrfs-use-nofs-context-when-getting-inodes-during-lo.patch new file mode 100644 index 00000000000..4c4fbc3069b --- /dev/null +++ b/queue-6.6/btrfs-use-nofs-context-when-getting-inodes-during-lo.patch @@ -0,0 +1,418 @@ +From 8dc79126723d42038300908ba0af51d831e91a52 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Jun 2024 11:16:19 +0100 +Subject: btrfs: use NOFS context when getting inodes during logging and log + replay + +From: Filipe Manana + +[ Upstream commit d1825752e3074b5ff8d7f6016160e2b7c5c367ca ] + +During inode logging (and log replay too), we are holding a transaction +handle and we often need to call btrfs_iget(), which will read an inode +from its subvolume btree if it's not loaded in memory and that results in +allocating an inode with GFP_KERNEL semantics at the btrfs_alloc_inode() +callback - and this may recurse into the filesystem in case we are under +memory pressure and attempt to commit the current transaction, resulting +in a deadlock since the logging (or log replay) task is holding a +transaction handle open. + +Syzbot reported this with the following stack traces: + + WARNING: possible circular locking dependency detected + 6.10.0-rc2-syzkaller-00361-g061d1af7b030 #0 Not tainted + ------------------------------------------------------ + syz-executor.1/9919 is trying to acquire lock: + ffffffff8dd3aac0 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:334 [inline] + ffffffff8dd3aac0 (fs_reclaim){+.+.}-{0:0}, at: slab_pre_alloc_hook mm/slub.c:3891 [inline] + ffffffff8dd3aac0 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc_node mm/slub.c:3981 [inline] + ffffffff8dd3aac0 (fs_reclaim){+.+.}-{0:0}, at: kmem_cache_alloc_lru_noprof+0x58/0x2f0 mm/slub.c:4020 + + but task is already holding lock: + ffff88804b569358 (&ei->log_mutex){+.+.}-{3:3}, at: btrfs_log_inode+0x39c/0x4660 fs/btrfs/tree-log.c:6481 + + which lock already depends on the new lock. + + the existing dependency chain (in reverse order) is: + + -> #3 (&ei->log_mutex){+.+.}-{3:3}: + __mutex_lock_common kernel/locking/mutex.c:608 [inline] + __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 + btrfs_log_inode+0x39c/0x4660 fs/btrfs/tree-log.c:6481 + btrfs_log_inode_parent+0x8cb/0x2a90 fs/btrfs/tree-log.c:7079 + btrfs_log_dentry_safe+0x59/0x80 fs/btrfs/tree-log.c:7180 + btrfs_sync_file+0x9c1/0xe10 fs/btrfs/file.c:1959 + vfs_fsync_range+0x141/0x230 fs/sync.c:188 + generic_write_sync include/linux/fs.h:2794 [inline] + btrfs_do_write_iter+0x584/0x10c0 fs/btrfs/file.c:1705 + new_sync_write fs/read_write.c:497 [inline] + vfs_write+0x6b6/0x1140 fs/read_write.c:590 + ksys_write+0x12f/0x260 fs/read_write.c:643 + do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] + __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 + do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 + entry_SYSENTER_compat_after_hwframe+0x84/0x8e + + -> #2 (btrfs_trans_num_extwriters){++++}-{0:0}: + join_transaction+0x164/0xf40 fs/btrfs/transaction.c:315 + start_transaction+0x427/0x1a70 fs/btrfs/transaction.c:700 + btrfs_commit_super+0xa1/0x110 fs/btrfs/disk-io.c:4170 + close_ctree+0xcb0/0xf90 fs/btrfs/disk-io.c:4324 + generic_shutdown_super+0x159/0x3d0 fs/super.c:642 + kill_anon_super+0x3a/0x60 fs/super.c:1226 + btrfs_kill_super+0x3b/0x50 fs/btrfs/super.c:2096 + deactivate_locked_super+0xbe/0x1a0 fs/super.c:473 + deactivate_super+0xde/0x100 fs/super.c:506 + cleanup_mnt+0x222/0x450 fs/namespace.c:1267 + task_work_run+0x14e/0x250 kernel/task_work.c:180 + resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] + exit_to_user_mode_loop kernel/entry/common.c:114 [inline] + exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] + __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] + syscall_exit_to_user_mode+0x278/0x2a0 kernel/entry/common.c:218 + __do_fast_syscall_32+0x80/0x120 arch/x86/entry/common.c:389 + do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 + entry_SYSENTER_compat_after_hwframe+0x84/0x8e + + -> #1 (btrfs_trans_num_writers){++++}-{0:0}: + __lock_release kernel/locking/lockdep.c:5468 [inline] + lock_release+0x33e/0x6c0 kernel/locking/lockdep.c:5774 + percpu_up_read include/linux/percpu-rwsem.h:99 [inline] + __sb_end_write include/linux/fs.h:1650 [inline] + sb_end_intwrite include/linux/fs.h:1767 [inline] + __btrfs_end_transaction+0x5ca/0x920 fs/btrfs/transaction.c:1071 + btrfs_commit_inode_delayed_inode+0x228/0x330 fs/btrfs/delayed-inode.c:1301 + btrfs_evict_inode+0x960/0xe80 fs/btrfs/inode.c:5291 + evict+0x2ed/0x6c0 fs/inode.c:667 + iput_final fs/inode.c:1741 [inline] + iput.part.0+0x5a8/0x7f0 fs/inode.c:1767 + iput+0x5c/0x80 fs/inode.c:1757 + dentry_unlink_inode+0x295/0x480 fs/dcache.c:400 + __dentry_kill+0x1d0/0x600 fs/dcache.c:603 + dput.part.0+0x4b1/0x9b0 fs/dcache.c:845 + dput+0x1f/0x30 fs/dcache.c:835 + ovl_stack_put+0x60/0x90 fs/overlayfs/util.c:132 + ovl_destroy_inode+0xc6/0x190 fs/overlayfs/super.c:182 + destroy_inode+0xc4/0x1b0 fs/inode.c:311 + iput_final fs/inode.c:1741 [inline] + iput.part.0+0x5a8/0x7f0 fs/inode.c:1767 + iput+0x5c/0x80 fs/inode.c:1757 + dentry_unlink_inode+0x295/0x480 fs/dcache.c:400 + __dentry_kill+0x1d0/0x600 fs/dcache.c:603 + shrink_kill fs/dcache.c:1048 [inline] + shrink_dentry_list+0x140/0x5d0 fs/dcache.c:1075 + prune_dcache_sb+0xeb/0x150 fs/dcache.c:1156 + super_cache_scan+0x32a/0x550 fs/super.c:221 + do_shrink_slab+0x44f/0x11c0 mm/shrinker.c:435 + shrink_slab_memcg mm/shrinker.c:548 [inline] + shrink_slab+0xa87/0x1310 mm/shrinker.c:626 + shrink_one+0x493/0x7c0 mm/vmscan.c:4790 + shrink_many mm/vmscan.c:4851 [inline] + lru_gen_shrink_node+0x89f/0x1750 mm/vmscan.c:4951 + shrink_node mm/vmscan.c:5910 [inline] + kswapd_shrink_node mm/vmscan.c:6720 [inline] + balance_pgdat+0x1105/0x1970 mm/vmscan.c:6911 + kswapd+0x5ea/0xbf0 mm/vmscan.c:7180 + kthread+0x2c1/0x3a0 kernel/kthread.c:389 + ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 + ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 + + -> #0 (fs_reclaim){+.+.}-{0:0}: + check_prev_add kernel/locking/lockdep.c:3134 [inline] + check_prevs_add kernel/locking/lockdep.c:3253 [inline] + validate_chain kernel/locking/lockdep.c:3869 [inline] + __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 + lock_acquire kernel/locking/lockdep.c:5754 [inline] + lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 + __fs_reclaim_acquire mm/page_alloc.c:3801 [inline] + fs_reclaim_acquire+0x102/0x160 mm/page_alloc.c:3815 + might_alloc include/linux/sched/mm.h:334 [inline] + slab_pre_alloc_hook mm/slub.c:3891 [inline] + slab_alloc_node mm/slub.c:3981 [inline] + kmem_cache_alloc_lru_noprof+0x58/0x2f0 mm/slub.c:4020 + btrfs_alloc_inode+0x118/0xb20 fs/btrfs/inode.c:8411 + alloc_inode+0x5d/0x230 fs/inode.c:261 + iget5_locked fs/inode.c:1235 [inline] + iget5_locked+0x1c9/0x2c0 fs/inode.c:1228 + btrfs_iget_locked fs/btrfs/inode.c:5590 [inline] + btrfs_iget_path fs/btrfs/inode.c:5607 [inline] + btrfs_iget+0xfb/0x230 fs/btrfs/inode.c:5636 + add_conflicting_inode fs/btrfs/tree-log.c:5657 [inline] + copy_inode_items_to_log+0x1039/0x1e30 fs/btrfs/tree-log.c:5928 + btrfs_log_inode+0xa48/0x4660 fs/btrfs/tree-log.c:6592 + log_new_delayed_dentries fs/btrfs/tree-log.c:6363 [inline] + btrfs_log_inode+0x27dd/0x4660 fs/btrfs/tree-log.c:6718 + btrfs_log_all_parents fs/btrfs/tree-log.c:6833 [inline] + btrfs_log_inode_parent+0x22ba/0x2a90 fs/btrfs/tree-log.c:7141 + btrfs_log_dentry_safe+0x59/0x80 fs/btrfs/tree-log.c:7180 + btrfs_sync_file+0x9c1/0xe10 fs/btrfs/file.c:1959 + vfs_fsync_range+0x141/0x230 fs/sync.c:188 + generic_write_sync include/linux/fs.h:2794 [inline] + btrfs_do_write_iter+0x584/0x10c0 fs/btrfs/file.c:1705 + do_iter_readv_writev+0x504/0x780 fs/read_write.c:741 + vfs_writev+0x36f/0xde0 fs/read_write.c:971 + do_pwritev+0x1b2/0x260 fs/read_write.c:1072 + __do_compat_sys_pwritev2 fs/read_write.c:1218 [inline] + __se_compat_sys_pwritev2 fs/read_write.c:1210 [inline] + __ia32_compat_sys_pwritev2+0x121/0x1b0 fs/read_write.c:1210 + do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] + __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 + do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 + entry_SYSENTER_compat_after_hwframe+0x84/0x8e + + other info that might help us debug this: + + Chain exists of: + fs_reclaim --> btrfs_trans_num_extwriters --> &ei->log_mutex + + Possible unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock(&ei->log_mutex); + lock(btrfs_trans_num_extwriters); + lock(&ei->log_mutex); + lock(fs_reclaim); + + *** DEADLOCK *** + + 7 locks held by syz-executor.1/9919: + #0: ffff88802be20420 (sb_writers#23){.+.+}-{0:0}, at: do_pwritev+0x1b2/0x260 fs/read_write.c:1072 + #1: ffff888065c0f8f0 (&sb->s_type->i_mutex_key#33){++++}-{3:3}, at: inode_lock include/linux/fs.h:791 [inline] + #1: ffff888065c0f8f0 (&sb->s_type->i_mutex_key#33){++++}-{3:3}, at: btrfs_inode_lock+0xc8/0x110 fs/btrfs/inode.c:385 + #2: ffff888065c0f778 (&ei->i_mmap_lock){++++}-{3:3}, at: btrfs_inode_lock+0xee/0x110 fs/btrfs/inode.c:388 + #3: ffff88802be20610 (sb_internal#4){.+.+}-{0:0}, at: btrfs_sync_file+0x95b/0xe10 fs/btrfs/file.c:1952 + #4: ffff8880546323f0 (btrfs_trans_num_writers){++++}-{0:0}, at: join_transaction+0x430/0xf40 fs/btrfs/transaction.c:290 + #5: ffff888054632418 (btrfs_trans_num_extwriters){++++}-{0:0}, at: join_transaction+0x430/0xf40 fs/btrfs/transaction.c:290 + #6: ffff88804b569358 (&ei->log_mutex){+.+.}-{3:3}, at: btrfs_log_inode+0x39c/0x4660 fs/btrfs/tree-log.c:6481 + + stack backtrace: + CPU: 2 PID: 9919 Comm: syz-executor.1 Not tainted 6.10.0-rc2-syzkaller-00361-g061d1af7b030 #0 + Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 + Call Trace: + + __dump_stack lib/dump_stack.c:88 [inline] + dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 + check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187 + check_prev_add kernel/locking/lockdep.c:3134 [inline] + check_prevs_add kernel/locking/lockdep.c:3253 [inline] + validate_chain kernel/locking/lockdep.c:3869 [inline] + __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 + lock_acquire kernel/locking/lockdep.c:5754 [inline] + lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719 + __fs_reclaim_acquire mm/page_alloc.c:3801 [inline] + fs_reclaim_acquire+0x102/0x160 mm/page_alloc.c:3815 + might_alloc include/linux/sched/mm.h:334 [inline] + slab_pre_alloc_hook mm/slub.c:3891 [inline] + slab_alloc_node mm/slub.c:3981 [inline] + kmem_cache_alloc_lru_noprof+0x58/0x2f0 mm/slub.c:4020 + btrfs_alloc_inode+0x118/0xb20 fs/btrfs/inode.c:8411 + alloc_inode+0x5d/0x230 fs/inode.c:261 + iget5_locked fs/inode.c:1235 [inline] + iget5_locked+0x1c9/0x2c0 fs/inode.c:1228 + btrfs_iget_locked fs/btrfs/inode.c:5590 [inline] + btrfs_iget_path fs/btrfs/inode.c:5607 [inline] + btrfs_iget+0xfb/0x230 fs/btrfs/inode.c:5636 + add_conflicting_inode fs/btrfs/tree-log.c:5657 [inline] + copy_inode_items_to_log+0x1039/0x1e30 fs/btrfs/tree-log.c:5928 + btrfs_log_inode+0xa48/0x4660 fs/btrfs/tree-log.c:6592 + log_new_delayed_dentries fs/btrfs/tree-log.c:6363 [inline] + btrfs_log_inode+0x27dd/0x4660 fs/btrfs/tree-log.c:6718 + btrfs_log_all_parents fs/btrfs/tree-log.c:6833 [inline] + btrfs_log_inode_parent+0x22ba/0x2a90 fs/btrfs/tree-log.c:7141 + btrfs_log_dentry_safe+0x59/0x80 fs/btrfs/tree-log.c:7180 + btrfs_sync_file+0x9c1/0xe10 fs/btrfs/file.c:1959 + vfs_fsync_range+0x141/0x230 fs/sync.c:188 + generic_write_sync include/linux/fs.h:2794 [inline] + btrfs_do_write_iter+0x584/0x10c0 fs/btrfs/file.c:1705 + do_iter_readv_writev+0x504/0x780 fs/read_write.c:741 + vfs_writev+0x36f/0xde0 fs/read_write.c:971 + do_pwritev+0x1b2/0x260 fs/read_write.c:1072 + __do_compat_sys_pwritev2 fs/read_write.c:1218 [inline] + __se_compat_sys_pwritev2 fs/read_write.c:1210 [inline] + __ia32_compat_sys_pwritev2+0x121/0x1b0 fs/read_write.c:1210 + do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] + __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 + do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 + entry_SYSENTER_compat_after_hwframe+0x84/0x8e + RIP: 0023:0xf7334579 + Code: b8 01 10 06 03 (...) + RSP: 002b:00000000f5f265ac EFLAGS: 00000292 ORIG_RAX: 000000000000017b + RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00000000200002c0 + RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000000 + RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 + R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 + R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 + +Fix this by ensuring we are under a NOFS scope whenever we call +btrfs_iget() during inode logging and log replay. + +Reported-by: syzbot+8576cfa84070dce4d59b@syzkaller.appspotmail.com +Link: https://lore.kernel.org/linux-btrfs/000000000000274a3a061abbd928@google.com/ +Fixes: 712e36c5f2a7 ("btrfs: use GFP_KERNEL in btrfs_alloc_inode") +Reviewed-by: Johannes Thumshirn +Reviewed-by: Josef Bacik +Reviewed-by: Qu Wenruo +Signed-off-by: Filipe Manana +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Sasha Levin +--- + fs/btrfs/tree-log.c | 43 ++++++++++++++++++++++++++++--------------- + 1 file changed, 28 insertions(+), 15 deletions(-) + +diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c +index 833391ae0bac2..e0037665aa927 100644 +--- a/fs/btrfs/tree-log.c ++++ b/fs/btrfs/tree-log.c +@@ -140,6 +140,25 @@ static void wait_log_commit(struct btrfs_root *root, int transid); + * and once to do all the other items. + */ + ++static struct inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root) ++{ ++ unsigned int nofs_flag; ++ struct inode *inode; ++ ++ /* ++ * We're holding a transaction handle whether we are logging or ++ * replaying a log tree, so we must make sure NOFS semantics apply ++ * because btrfs_alloc_inode() may be triggered and it uses GFP_KERNEL ++ * to allocate an inode, which can recurse back into the filesystem and ++ * attempt a transaction commit, resulting in a deadlock. ++ */ ++ nofs_flag = memalloc_nofs_save(); ++ inode = btrfs_iget(root->fs_info->sb, objectid, root); ++ memalloc_nofs_restore(nofs_flag); ++ ++ return inode; ++} ++ + /* + * start a sub transaction and setup the log tree + * this increments the log tree writer count to make the people +@@ -603,7 +622,7 @@ static noinline struct inode *read_one_inode(struct btrfs_root *root, + { + struct inode *inode; + +- inode = btrfs_iget(root->fs_info->sb, objectid, root); ++ inode = btrfs_iget_logging(objectid, root); + if (IS_ERR(inode)) + inode = NULL; + return inode; +@@ -5377,7 +5396,6 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, + struct btrfs_log_ctx *ctx) + { + struct btrfs_root *root = start_inode->root; +- struct btrfs_fs_info *fs_info = root->fs_info; + struct btrfs_path *path; + LIST_HEAD(dir_list); + struct btrfs_dir_list *dir_elem; +@@ -5438,7 +5456,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, + continue; + + btrfs_release_path(path); +- di_inode = btrfs_iget(fs_info->sb, di_key.objectid, root); ++ di_inode = btrfs_iget_logging(di_key.objectid, root); + if (IS_ERR(di_inode)) { + ret = PTR_ERR(di_inode); + goto out; +@@ -5498,7 +5516,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, + btrfs_add_delayed_iput(curr_inode); + curr_inode = NULL; + +- vfs_inode = btrfs_iget(fs_info->sb, ino, root); ++ vfs_inode = btrfs_iget_logging(ino, root); + if (IS_ERR(vfs_inode)) { + ret = PTR_ERR(vfs_inode); + break; +@@ -5593,7 +5611,7 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans, + if (ctx->num_conflict_inodes >= MAX_CONFLICT_INODES) + return BTRFS_LOG_FORCE_COMMIT; + +- inode = btrfs_iget(root->fs_info->sb, ino, root); ++ inode = btrfs_iget_logging(ino, root); + /* + * If the other inode that had a conflicting dir entry was deleted in + * the current transaction then we either: +@@ -5694,7 +5712,6 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, + struct btrfs_root *root, + struct btrfs_log_ctx *ctx) + { +- struct btrfs_fs_info *fs_info = root->fs_info; + int ret = 0; + + /* +@@ -5725,7 +5742,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, + list_del(&curr->list); + kfree(curr); + +- inode = btrfs_iget(fs_info->sb, ino, root); ++ inode = btrfs_iget_logging(ino, root); + /* + * If the other inode that had a conflicting dir entry was + * deleted in the current transaction, we need to log its parent +@@ -5736,7 +5753,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans, + if (ret != -ENOENT) + break; + +- inode = btrfs_iget(fs_info->sb, parent, root); ++ inode = btrfs_iget_logging(parent, root); + if (IS_ERR(inode)) { + ret = PTR_ERR(inode); + break; +@@ -6258,7 +6275,6 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans, + struct btrfs_log_ctx *ctx) + { + const bool orig_log_new_dentries = ctx->log_new_dentries; +- struct btrfs_fs_info *fs_info = trans->fs_info; + struct btrfs_delayed_item *item; + int ret = 0; + +@@ -6284,7 +6300,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans, + if (key.type == BTRFS_ROOT_ITEM_KEY) + continue; + +- di_inode = btrfs_iget(fs_info->sb, key.objectid, inode->root); ++ di_inode = btrfs_iget_logging(key.objectid, inode->root); + if (IS_ERR(di_inode)) { + ret = PTR_ERR(di_inode); + break; +@@ -6668,7 +6684,6 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, + struct btrfs_inode *inode, + struct btrfs_log_ctx *ctx) + { +- struct btrfs_fs_info *fs_info = trans->fs_info; + int ret; + struct btrfs_path *path; + struct btrfs_key key; +@@ -6733,8 +6748,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, + cur_offset = item_size; + } + +- dir_inode = btrfs_iget(fs_info->sb, inode_key.objectid, +- root); ++ dir_inode = btrfs_iget_logging(inode_key.objectid, root); + /* + * If the parent inode was deleted, return an error to + * fallback to a transaction commit. This is to prevent +@@ -6796,7 +6810,6 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans, + btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); + + while (true) { +- struct btrfs_fs_info *fs_info = root->fs_info; + struct extent_buffer *leaf; + int slot; + struct btrfs_key search_key; +@@ -6811,7 +6824,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans, + search_key.objectid = found_key.offset; + search_key.type = BTRFS_INODE_ITEM_KEY; + search_key.offset = 0; +- inode = btrfs_iget(fs_info->sb, ino, root); ++ inode = btrfs_iget_logging(ino, root); + if (IS_ERR(inode)) + return PTR_ERR(inode); + +-- +2.43.0 + diff --git a/queue-6.6/fix-race-for-duplicate-reqsk-on-identical-syn.patch b/queue-6.6/fix-race-for-duplicate-reqsk-on-identical-syn.patch new file mode 100644 index 00000000000..56d909c08e9 --- /dev/null +++ b/queue-6.6/fix-race-for-duplicate-reqsk-on-identical-syn.patch @@ -0,0 +1,195 @@ +From 2ede714a65b75a6162a5c0692612a33436ea30f6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 09:39:29 +0800 +Subject: Fix race for duplicate reqsk on identical SYN + +From: luoxuanqiang + +[ Upstream commit ff46e3b4421923937b7f6e44ffcd3549a074f321 ] + +When bonding is configured in BOND_MODE_BROADCAST mode, if two identical +SYN packets are received at the same time and processed on different CPUs, +it can potentially create the same sk (sock) but two different reqsk +(request_sock) in tcp_conn_request(). + +These two different reqsk will respond with two SYNACK packets, and since +the generation of the seq (ISN) incorporates a timestamp, the final two +SYNACK packets will have different seq values. + +The consequence is that when the Client receives and replies with an ACK +to the earlier SYNACK packet, we will reset(RST) it. + +======================================================================== + +This behavior is consistently reproducible in my local setup, +which comprises: + + | NETA1 ------ NETB1 | +PC_A --- bond --- | | --- bond --- PC_B + | NETA2 ------ NETB2 | + +- PC_A is the Server and has two network cards, NETA1 and NETA2. I have + bonded these two cards using BOND_MODE_BROADCAST mode and configured + them to be handled by different CPU. + +- PC_B is the Client, also equipped with two network cards, NETB1 and + NETB2, which are also bonded and configured in BOND_MODE_BROADCAST mode. + +If the client attempts a TCP connection to the server, it might encounter +a failure. Capturing packets from the server side reveals: + +10.10.10.10.45182 > localhost: Flags [S], seq 320236027, +10.10.10.10.45182 > localhost: Flags [S], seq 320236027, +localhost > 10.10.10.10.45182: Flags [S.], seq 2967855116, +localhost > 10.10.10.10.45182: Flags [S.], seq 2967855123, <== +10.10.10.10.45182 > localhost: Flags [.], ack 4294967290, +10.10.10.10.45182 > localhost: Flags [.], ack 4294967290, +localhost > 10.10.10.10.45182: Flags [R], seq 2967855117, <== +localhost > 10.10.10.10.45182: Flags [R], seq 2967855117, + +Two SYNACKs with different seq numbers are sent by localhost, +resulting in an anomaly. + +======================================================================== + +The attempted solution is as follows: +Add a return value to inet_csk_reqsk_queue_hash_add() to confirm if the +ehash insertion is successful (Up to now, the reason for unsuccessful +insertion is that a reqsk for the same connection has already been +inserted). If the insertion fails, release the reqsk. + +Due to the refcnt, Kuniyuki suggests also adding a return value check +for the DCCP module; if ehash insertion fails, indicating a successful +insertion of the same connection, simply release the reqsk as well. + +Simultaneously, In the reqsk_queue_hash_req(), the start of the +req->rsk_timer is adjusted to be after successful insertion. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: luoxuanqiang +Reviewed-by: Kuniyuki Iwashima +Reviewed-by: Eric Dumazet +Link: https://lore.kernel.org/r/20240621013929.1386815-1-luoxuanqiang@kylinos.cn +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + include/net/inet_connection_sock.h | 2 +- + net/dccp/ipv4.c | 7 +++++-- + net/dccp/ipv6.c | 7 +++++-- + net/ipv4/inet_connection_sock.c | 17 +++++++++++++---- + net/ipv4/tcp_input.c | 7 ++++++- + 5 files changed, 30 insertions(+), 10 deletions(-) + +diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h +index 6ecac01115d9c..fee1e56505510 100644 +--- a/include/net/inet_connection_sock.h ++++ b/include/net/inet_connection_sock.h +@@ -264,7 +264,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, + struct sock *inet_csk_reqsk_queue_add(struct sock *sk, + struct request_sock *req, + struct sock *child); +-void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, ++bool inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, + unsigned long timeout); + struct sock *inet_csk_complete_hashdance(struct sock *sk, struct sock *child, + struct request_sock *req, +diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c +index 524b7e581a036..65a6733fc897f 100644 +--- a/net/dccp/ipv4.c ++++ b/net/dccp/ipv4.c +@@ -655,8 +655,11 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) + if (dccp_v4_send_response(sk, req)) + goto drop_and_free; + +- inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); +- reqsk_put(req); ++ if (unlikely(!inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT))) ++ reqsk_free(req); ++ else ++ reqsk_put(req); ++ + return 0; + + drop_and_free: +diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c +index 6f5a556f4f6d7..683e4291b348a 100644 +--- a/net/dccp/ipv6.c ++++ b/net/dccp/ipv6.c +@@ -398,8 +398,11 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) + if (dccp_v6_send_response(sk, req)) + goto drop_and_free; + +- inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); +- reqsk_put(req); ++ if (unlikely(!inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT))) ++ reqsk_free(req); ++ else ++ reqsk_put(req); ++ + return 0; + + drop_and_free: +diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c +index a018981b45142..8720f3840b698 100644 +--- a/net/ipv4/inet_connection_sock.c ++++ b/net/ipv4/inet_connection_sock.c +@@ -1116,25 +1116,34 @@ static void reqsk_timer_handler(struct timer_list *t) + inet_csk_reqsk_queue_drop_and_put(oreq->rsk_listener, oreq); + } + +-static void reqsk_queue_hash_req(struct request_sock *req, ++static bool reqsk_queue_hash_req(struct request_sock *req, + unsigned long timeout) + { ++ bool found_dup_sk = false; ++ ++ if (!inet_ehash_insert(req_to_sk(req), NULL, &found_dup_sk)) ++ return false; ++ ++ /* The timer needs to be setup after a successful insertion. */ + timer_setup(&req->rsk_timer, reqsk_timer_handler, TIMER_PINNED); + mod_timer(&req->rsk_timer, jiffies + timeout); + +- inet_ehash_insert(req_to_sk(req), NULL, NULL); + /* before letting lookups find us, make sure all req fields + * are committed to memory and refcnt initialized. + */ + smp_wmb(); + refcount_set(&req->rsk_refcnt, 2 + 1); ++ return true; + } + +-void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, ++bool inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req, + unsigned long timeout) + { +- reqsk_queue_hash_req(req, timeout); ++ if (!reqsk_queue_hash_req(req, timeout)) ++ return false; ++ + inet_csk_reqsk_queue_added(sk); ++ return true; + } + EXPORT_SYMBOL_GPL(inet_csk_reqsk_queue_hash_add); + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index abd6e95d2dca8..64707a5227f5a 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -7091,7 +7091,12 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, + tcp_rsk(req)->tfo_listener = false; + if (!want_cookie) { + req->timeout = tcp_timeout_init((struct sock *)req); +- inet_csk_reqsk_queue_hash_add(sk, req, req->timeout); ++ if (unlikely(!inet_csk_reqsk_queue_hash_add(sk, req, ++ req->timeout))) { ++ reqsk_free(req); ++ return 0; ++ } ++ + } + af_ops->send_synack(sk, dst, &fl, req, &foc, + !want_cookie ? TCP_SYNACK_NORMAL : +-- +2.43.0 + diff --git a/queue-6.6/ibmvnic-free-any-outstanding-tx-skbs-during-scrq-res.patch b/queue-6.6/ibmvnic-free-any-outstanding-tx-skbs-during-scrq-res.patch new file mode 100644 index 00000000000..0d7c9bea384 --- /dev/null +++ b/queue-6.6/ibmvnic-free-any-outstanding-tx-skbs-during-scrq-res.patch @@ -0,0 +1,60 @@ +From 4fd37063548fb9cdf66d202d9c52ecc47f2b7343 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jun 2024 10:23:12 -0500 +Subject: ibmvnic: Free any outstanding tx skbs during scrq reset + +From: Nick Child + +[ Upstream commit 49bbeb5719c2f56907d3a9623b47c6c15c2c431d ] + +There are 2 types of outstanding tx skb's: +Type 1: Packets that are sitting in the drivers ind_buff that are +waiting to be batch sent to the NIC. During a device reset, these are +freed with a call to ibmvnic_tx_scrq_clean_buffer() +Type 2: Packets that have been sent to the NIC and are awaiting a TX +completion IRQ. These are free'd during a reset with a call to +clean_tx_pools() + +During any reset which requires us to free the tx irq, ensure that the +Type 2 skb references are freed. Since the irq is released, it is +impossible for the NIC to inform of any completions. + +Furthermore, later in the reset process is a call to init_tx_pools() +which marks every entry in the tx pool as free (ie not outstanding). +So if the driver is to make a call to init_tx_pools(), it must first +be sure that the tx pool is empty of skb references. + +This issue was discovered by observing the following in the logs during +EEH testing: + TX free map points to untracked skb (tso_pool 0 idx=4) + TX free map points to untracked skb (tso_pool 0 idx=5) + TX free map points to untracked skb (tso_pool 1 idx=36) + +Fixes: 65d6470d139a ("ibmvnic: clean pending indirect buffs during reset") +Signed-off-by: Nick Child +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/ibm/ibmvnic.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c +index cdf5251e56795..ca21e55335b23 100644 +--- a/drivers/net/ethernet/ibm/ibmvnic.c ++++ b/drivers/net/ethernet/ibm/ibmvnic.c +@@ -4057,6 +4057,12 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter, bool do_h_free) + adapter->num_active_tx_scrqs = 0; + } + ++ /* Clean any remaining outstanding SKBs ++ * we freed the irq so we won't be hearing ++ * from them ++ */ ++ clean_tx_pools(adapter); ++ + if (adapter->rx_scrq) { + for (i = 0; i < adapter->num_active_rx_scrqs; i++) { + if (!adapter->rx_scrq[i]) +-- +2.43.0 + diff --git a/queue-6.6/ice-rebuild-tc-queues-on-vsi-queue-reconfiguration.patch b/queue-6.6/ice-rebuild-tc-queues-on-vsi-queue-reconfiguration.patch new file mode 100644 index 00000000000..b185657c10f --- /dev/null +++ b/queue-6.6/ice-rebuild-tc-queues-on-vsi-queue-reconfiguration.patch @@ -0,0 +1,57 @@ +From 4dd9beef7b48561369770b9cadcd73e35290ef07 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 10:54:19 -0700 +Subject: ice: Rebuild TC queues on VSI queue reconfiguration + +From: Jan Sokolowski + +[ Upstream commit f4b91c1d17c676b8ad4c6bd674da874f3f7d5701 ] + +TC queues needs to be correctly updated when the number of queues on +a VSI is reconfigured, so netdev's queue and TC settings will be +dynamically adjusted and could accurately represent the underlying +hardware state after changes to the VSI queue counts. + +Fixes: 0754d65bd4be ("ice: Add infrastructure for mqprio support via ndo_setup_tc") +Reviewed-by: Wojciech Drewek +Signed-off-by: Jan Sokolowski +Signed-off-by: Karen Ostrowska +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_main.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c +index 26ef8aec4cfdf..600a2f5370875 100644 +--- a/drivers/net/ethernet/intel/ice/ice_main.c ++++ b/drivers/net/ethernet/intel/ice/ice_main.c +@@ -3958,7 +3958,7 @@ bool ice_is_wol_supported(struct ice_hw *hw) + int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked) + { + struct ice_pf *pf = vsi->back; +- int err = 0, timeout = 50; ++ int i, err = 0, timeout = 50; + + if (!new_rx && !new_tx) + return -EINVAL; +@@ -3984,6 +3984,14 @@ int ice_vsi_recfg_qs(struct ice_vsi *vsi, int new_rx, int new_tx, bool locked) + + ice_vsi_close(vsi); + ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); ++ ++ ice_for_each_traffic_class(i) { ++ if (vsi->tc_cfg.ena_tc & BIT(i)) ++ netdev_set_tc_queue(vsi->netdev, ++ vsi->tc_cfg.tc_info[i].netdev_tc, ++ vsi->tc_cfg.tc_info[i].qcount_tx, ++ vsi->tc_cfg.tc_info[i].qoffset); ++ } + ice_pf_dcb_recfg(pf, locked); + ice_vsi_open(vsi); + done: +-- +2.43.0 + diff --git a/queue-6.6/mlxsw-spectrum_buffers-fix-memory-corruptions-on-spe.patch b/queue-6.6/mlxsw-spectrum_buffers-fix-memory-corruptions-on-spe.patch new file mode 100644 index 00000000000..f0456b57932 --- /dev/null +++ b/queue-6.6/mlxsw-spectrum_buffers-fix-memory-corruptions-on-spe.patch @@ -0,0 +1,161 @@ +From 617726d0ecf6186ac6cd4daf46e41b9a87ccc787 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 09:19:14 +0200 +Subject: mlxsw: spectrum_buffers: Fix memory corruptions on Spectrum-4 systems + +From: Ido Schimmel + +[ Upstream commit c28947de2bed40217cf256c5d0d16880054fcf13 ] + +The following two shared buffer operations make use of the Shared Buffer +Status Register (SBSR): + + # devlink sb occupancy snapshot pci/0000:01:00.0 + # devlink sb occupancy clearmax pci/0000:01:00.0 + +The register has two masks of 256 bits to denote on which ingress / +egress ports the register should operate on. Spectrum-4 has more than +256 ports, so the register was extended by cited commit with a new +'port_page' field. + +However, when filling the register's payload, the driver specifies the +ports as absolute numbers and not relative to the first port of the port +page, resulting in memory corruptions [1]. + +Fix by specifying the ports relative to the first port of the port page. + +[1] +BUG: KASAN: slab-use-after-free in mlxsw_sp_sb_occ_snapshot+0xb6d/0xbc0 +Read of size 1 at addr ffff8881068cb00f by task devlink/1566 +[...] +Call Trace: + + dump_stack_lvl+0xc6/0x120 + print_report+0xce/0x670 + kasan_report+0xd7/0x110 + mlxsw_sp_sb_occ_snapshot+0xb6d/0xbc0 + mlxsw_devlink_sb_occ_snapshot+0x75/0xb0 + devlink_nl_sb_occ_snapshot_doit+0x1f9/0x2a0 + genl_family_rcv_msg_doit+0x20c/0x300 + genl_rcv_msg+0x567/0x800 + netlink_rcv_skb+0x170/0x450 + genl_rcv+0x2d/0x40 + netlink_unicast+0x547/0x830 + netlink_sendmsg+0x8d4/0xdb0 + __sys_sendto+0x49b/0x510 + __x64_sys_sendto+0xe5/0x1c0 + do_syscall_64+0xc1/0x1d0 + entry_SYSCALL_64_after_hwframe+0x77/0x7f +[...] +Allocated by task 1: + kasan_save_stack+0x33/0x60 + kasan_save_track+0x14/0x30 + __kasan_kmalloc+0x8f/0xa0 + copy_verifier_state+0xbc2/0xfb0 + do_check_common+0x2c51/0xc7e0 + bpf_check+0x5107/0x9960 + bpf_prog_load+0xf0e/0x2690 + __sys_bpf+0x1a61/0x49d0 + __x64_sys_bpf+0x7d/0xc0 + do_syscall_64+0xc1/0x1d0 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Freed by task 1: + kasan_save_stack+0x33/0x60 + kasan_save_track+0x14/0x30 + kasan_save_free_info+0x3b/0x60 + poison_slab_object+0x109/0x170 + __kasan_slab_free+0x14/0x30 + kfree+0xca/0x2b0 + free_verifier_state+0xce/0x270 + do_check_common+0x4828/0xc7e0 + bpf_check+0x5107/0x9960 + bpf_prog_load+0xf0e/0x2690 + __sys_bpf+0x1a61/0x49d0 + __x64_sys_bpf+0x7d/0xc0 + do_syscall_64+0xc1/0x1d0 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Fixes: f8538aec88b4 ("mlxsw: Add support for more than 256 ports in SBSR register") +Signed-off-by: Ido Schimmel +Reviewed-by: Petr Machata +Reviewed-by: Simon Horman +Signed-off-by: Petr Machata +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../mellanox/mlxsw/spectrum_buffers.c | 20 +++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +index c9f1c79f3f9d0..ba090262e27ef 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +@@ -1607,8 +1607,8 @@ static void mlxsw_sp_sb_sr_occ_query_cb(struct mlxsw_core *mlxsw_core, + int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core, + unsigned int sb_index) + { ++ u16 local_port, local_port_1, first_local_port, last_local_port; + struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); +- u16 local_port, local_port_1, last_local_port; + struct mlxsw_sp_sb_sr_occ_query_cb_ctx cb_ctx; + u8 masked_count, current_page = 0; + unsigned long cb_priv = 0; +@@ -1628,6 +1628,7 @@ int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core, + masked_count = 0; + mlxsw_reg_sbsr_pack(sbsr_pl, false); + mlxsw_reg_sbsr_port_page_set(sbsr_pl, current_page); ++ first_local_port = current_page * MLXSW_REG_SBSR_NUM_PORTS_IN_PAGE; + last_local_port = current_page * MLXSW_REG_SBSR_NUM_PORTS_IN_PAGE + + MLXSW_REG_SBSR_NUM_PORTS_IN_PAGE - 1; + +@@ -1645,9 +1646,12 @@ int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core, + if (local_port != MLXSW_PORT_CPU_PORT) { + /* Ingress quotas are not supported for the CPU port */ + mlxsw_reg_sbsr_ingress_port_mask_set(sbsr_pl, +- local_port, 1); ++ local_port - first_local_port, ++ 1); + } +- mlxsw_reg_sbsr_egress_port_mask_set(sbsr_pl, local_port, 1); ++ mlxsw_reg_sbsr_egress_port_mask_set(sbsr_pl, ++ local_port - first_local_port, ++ 1); + for (i = 0; i < mlxsw_sp->sb_vals->pool_count; i++) { + err = mlxsw_sp_sb_pm_occ_query(mlxsw_sp, local_port, i, + &bulk_list); +@@ -1684,7 +1688,7 @@ int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core, + unsigned int sb_index) + { + struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core); +- u16 local_port, last_local_port; ++ u16 local_port, first_local_port, last_local_port; + LIST_HEAD(bulk_list); + unsigned int masked_count; + u8 current_page = 0; +@@ -1702,6 +1706,7 @@ int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core, + masked_count = 0; + mlxsw_reg_sbsr_pack(sbsr_pl, true); + mlxsw_reg_sbsr_port_page_set(sbsr_pl, current_page); ++ first_local_port = current_page * MLXSW_REG_SBSR_NUM_PORTS_IN_PAGE; + last_local_port = current_page * MLXSW_REG_SBSR_NUM_PORTS_IN_PAGE + + MLXSW_REG_SBSR_NUM_PORTS_IN_PAGE - 1; + +@@ -1719,9 +1724,12 @@ int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core, + if (local_port != MLXSW_PORT_CPU_PORT) { + /* Ingress quotas are not supported for the CPU port */ + mlxsw_reg_sbsr_ingress_port_mask_set(sbsr_pl, +- local_port, 1); ++ local_port - first_local_port, ++ 1); + } +- mlxsw_reg_sbsr_egress_port_mask_set(sbsr_pl, local_port, 1); ++ mlxsw_reg_sbsr_egress_port_mask_set(sbsr_pl, ++ local_port - first_local_port, ++ 1); + for (i = 0; i < mlxsw_sp->sb_vals->pool_count; i++) { + err = mlxsw_sp_sb_pm_occ_clear(mlxsw_sp, local_port, i, + &bulk_list); +-- +2.43.0 + diff --git a/queue-6.6/net-dsa-microchip-fix-initial-port-flush-problem.patch b/queue-6.6/net-dsa-microchip-fix-initial-port-flush-problem.patch new file mode 100644 index 00000000000..7729b464889 --- /dev/null +++ b/queue-6.6/net-dsa-microchip-fix-initial-port-flush-problem.patch @@ -0,0 +1,49 @@ +From 5350ad937dcf35845b93dbdec84bb843d0f96f81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 18 Jun 2024 17:16:42 -0700 +Subject: net: dsa: microchip: fix initial port flush problem + +From: Tristram Ha + +[ Upstream commit ad53f5f54f351e967128edbc431f0f26427172cf ] + +The very first flush in any port will flush all learned addresses in all +ports. This can be observed by unplugging the cable from one port while +additional ports are connected and dumping the fdb entries. + +This problem is caused by the initially wrong value programmed to the +REG_SW_LUE_CTRL_1 register. Setting SW_FLUSH_STP_TABLE and +SW_FLUSH_MSTP_TABLE bits does not have an immediate effect. It is when +ksz9477_flush_dyn_mac_table() is called then the SW_FLUSH_STP_TABLE bit +takes effect and flushes all learned entries. After that call both bits +are reset and so the next port flush will not cause such problem again. + +Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477") +Signed-off-by: Tristram Ha +Link: https://patch.msgid.link/1718756202-2731-1-git-send-email-Tristram.Ha@microchip.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/microchip/ksz9477.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c +index 83b7f2d5c1ea6..353c41e031f1a 100644 +--- a/drivers/net/dsa/microchip/ksz9477.c ++++ b/drivers/net/dsa/microchip/ksz9477.c +@@ -174,10 +174,8 @@ int ksz9477_reset_switch(struct ksz_device *dev) + SPI_AUTO_EDGE_DETECTION, 0); + + /* default configuration */ +- ksz_read8(dev, REG_SW_LUE_CTRL_1, &data8); +- data8 = SW_AGING_ENABLE | SW_LINK_AUTO_AGING | +- SW_SRC_ADDR_FILTER | SW_FLUSH_STP_TABLE | SW_FLUSH_MSTP_TABLE; +- ksz_write8(dev, REG_SW_LUE_CTRL_1, data8); ++ ksz_write8(dev, REG_SW_LUE_CTRL_1, ++ SW_AGING_ENABLE | SW_LINK_AUTO_AGING | SW_SRC_ADDR_FILTER); + + /* disable interrupts */ + ksz_write32(dev, REG_SW_INT_MASK__4, SWITCH_INT_MASK); +-- +2.43.0 + diff --git a/queue-6.6/net-dsa-microchip-fix-wrong-register-write-when-mask.patch b/queue-6.6/net-dsa-microchip-fix-wrong-register-write-when-mask.patch new file mode 100644 index 00000000000..4c82dd80bdb --- /dev/null +++ b/queue-6.6/net-dsa-microchip-fix-wrong-register-write-when-mask.patch @@ -0,0 +1,53 @@ +From aea1b788c06ccdb8870c37692c5c22357cab31ee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 15:34:22 -0700 +Subject: net: dsa: microchip: fix wrong register write when masking interrupt + +From: Tristram Ha + +[ Upstream commit b1c4b4d45263241ec6c2405a8df8265d4b58e707 ] + +The switch global port interrupt mask, REG_SW_PORT_INT_MASK__4, is +defined as 0x001C in ksz9477_reg.h. The designers used 32-bit value in +anticipation for increase of port count in future product but currently +the maximum port count is 7 and the effective value is 0x7F in register +0x001F. Each port has its own interrupt mask and is defined as 0x#01F. +It uses only 4 bits for different interrupts. + +The developer who implemented the current interrupt mechanism in the +switch driver noticed there are similarities between the mechanism to +mask port interrupts in global interrupt and individual interrupts in +each port and so used the same code to handle these interrupts. He +updated the code to use the new macro REG_SW_PORT_INT_MASK__1 which is +defined as 0x1F in ksz_common.h but he forgot to update the 32-bit write +to 8-bit as now the mask registers are 0x1F and 0x#01F. + +In addition all KSZ switches other than the KSZ9897/KSZ9893 and LAN937X +families use only 8-bit access and so this common code will eventually +be changed to accommodate them. + +Fixes: e1add7dd6183 ("net: dsa: microchip: use common irq routines for girq and pirq") +Signed-off-by: Tristram Ha +Link: https://lore.kernel.org/r/1719009262-2948-1-git-send-email-Tristram.Ha@microchip.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/microchip/ksz_common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c +index 3c2a2b5290e5b..1c3f186499989 100644 +--- a/drivers/net/dsa/microchip/ksz_common.c ++++ b/drivers/net/dsa/microchip/ksz_common.c +@@ -1973,7 +1973,7 @@ static void ksz_irq_bus_sync_unlock(struct irq_data *d) + struct ksz_device *dev = kirq->dev; + int ret; + +- ret = ksz_write32(dev, kirq->reg_mask, kirq->masked); ++ ret = ksz_write8(dev, kirq->reg_mask, kirq->masked); + if (ret) + dev_err(dev->dev, "failed to change IRQ mask\n"); + +-- +2.43.0 + diff --git a/queue-6.6/net-dsa-microchip-use-collision-based-back-pressure-.patch b/queue-6.6/net-dsa-microchip-use-collision-based-back-pressure-.patch new file mode 100644 index 00000000000..1f305b4acc4 --- /dev/null +++ b/queue-6.6/net-dsa-microchip-use-collision-based-back-pressure-.patch @@ -0,0 +1,55 @@ +From 33d70a84a2a87f51cd4ac39e91bff1c7c3bc1dfc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 16:43:21 +0200 +Subject: net: dsa: microchip: use collision based back pressure mode + +From: Enguerrand de Ribaucourt + +[ Upstream commit d963c95bc9840d070a788c35e41b715a648717f7 ] + +Errata DS80000758 states that carrier sense back pressure mode can cause +link down issues in 100BASE-TX half duplex mode. The datasheet also +recommends to always use the collision based back pressure mode. + +Fixes: b987e98e50ab ("dsa: add DSA switch driver for Microchip KSZ9477") +Signed-off-by: Enguerrand de Ribaucourt +Reviewed-by: Woojung Huh +Acked-by: Arun Ramadoss +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/microchip/ksz9477.c | 4 ++++ + drivers/net/dsa/microchip/ksz9477_reg.h | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c +index 353c41e031f1a..a7e8fcdf25768 100644 +--- a/drivers/net/dsa/microchip/ksz9477.c ++++ b/drivers/net/dsa/microchip/ksz9477.c +@@ -1112,6 +1112,10 @@ int ksz9477_setup(struct dsa_switch *ds) + /* Enable REG_SW_MTU__2 reg by setting SW_JUMBO_PACKET */ + ksz_cfg(dev, REG_SW_MAC_CTRL_1, SW_JUMBO_PACKET, true); + ++ /* Use collision based back pressure mode. */ ++ ksz_cfg(dev, REG_SW_MAC_CTRL_1, SW_BACK_PRESSURE, ++ SW_BACK_PRESSURE_COLLISION); ++ + /* Now we can configure default MTU value */ + ret = regmap_update_bits(ksz_regmap_16(dev), REG_SW_MTU__2, REG_SW_MTU_MASK, + VLAN_ETH_FRAME_LEN + ETH_FCS_LEN); +diff --git a/drivers/net/dsa/microchip/ksz9477_reg.h b/drivers/net/dsa/microchip/ksz9477_reg.h +index cba3dba58bc37..a2ef4b18349c4 100644 +--- a/drivers/net/dsa/microchip/ksz9477_reg.h ++++ b/drivers/net/dsa/microchip/ksz9477_reg.h +@@ -267,6 +267,7 @@ + #define REG_SW_MAC_CTRL_1 0x0331 + + #define SW_BACK_PRESSURE BIT(5) ++#define SW_BACK_PRESSURE_COLLISION 0 + #define FAIR_FLOW_CTRL BIT(4) + #define NO_EXC_COLLISION_DROP BIT(3) + #define SW_JUMBO_PACKET BIT(2) +-- +2.43.0 + diff --git a/queue-6.6/net-mana-fix-possible-double-free-in-error-handling-.patch b/queue-6.6/net-mana-fix-possible-double-free-in-error-handling-.patch new file mode 100644 index 00000000000..c88a097ca75 --- /dev/null +++ b/queue-6.6/net-mana-fix-possible-double-free-in-error-handling-.patch @@ -0,0 +1,39 @@ +From 5d457970045fafc245bc6776ec0c06ee0338d011 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jun 2024 21:03:14 +0800 +Subject: net: mana: Fix possible double free in error handling path + +From: Ma Ke + +[ Upstream commit 1864b8224195d0e43ddb92a8151f54f6562090cc ] + +When auxiliary_device_add() returns error and then calls +auxiliary_device_uninit(), callback function adev_release +calls kfree(madev). We shouldn't call kfree(madev) again +in the error handling path. Set 'madev' to NULL. + +Fixes: a69839d4327d ("net: mana: Add support for auxiliary device") +Signed-off-by: Ma Ke +Link: https://patch.msgid.link/20240625130314.2661257-1-make24@iscas.ac.cn +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/microsoft/mana/mana_en.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c +index e443d69e39511..a09001d22b49c 100644 +--- a/drivers/net/ethernet/microsoft/mana/mana_en.c ++++ b/drivers/net/ethernet/microsoft/mana/mana_en.c +@@ -2752,6 +2752,8 @@ static int add_adev(struct gdma_dev *gd) + if (ret) + goto init_fail; + ++ /* madev is owned by the auxiliary device */ ++ madev = NULL; + ret = auxiliary_device_add(adev); + if (ret) + goto add_fail; +-- +2.43.0 + diff --git a/queue-6.6/net-phy-micrel-add-microchip-ksz-9477-to-the-device-.patch b/queue-6.6/net-phy-micrel-add-microchip-ksz-9477-to-the-device-.patch new file mode 100644 index 00000000000..5cf3ca8bade --- /dev/null +++ b/queue-6.6/net-phy-micrel-add-microchip-ksz-9477-to-the-device-.patch @@ -0,0 +1,36 @@ +From 9c07c5767559df72bc5d3d1b6f9e211f9e28f4a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 16:43:20 +0200 +Subject: net: phy: micrel: add Microchip KSZ 9477 to the device table + +From: Enguerrand de Ribaucourt + +[ Upstream commit 54a4e5c16382e871c01dd82b47e930fdce30406b ] + +PHY_ID_KSZ9477 was supported but not added to the device table passed to +MODULE_DEVICE_TABLE. + +Fixes: fc3973a1fa09 ("phy: micrel: add Microchip KSZ 9477 Switch PHY support") +Signed-off-by: Enguerrand de Ribaucourt +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/micrel.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c +index 366ae22534373..029c82f88ee38 100644 +--- a/drivers/net/phy/micrel.c ++++ b/drivers/net/phy/micrel.c +@@ -5030,6 +5030,7 @@ static struct mdio_device_id __maybe_unused micrel_tbl[] = { + { PHY_ID_KSZ8081, MICREL_PHY_ID_MASK }, + { PHY_ID_KSZ8873MLL, MICREL_PHY_ID_MASK }, + { PHY_ID_KSZ886X, MICREL_PHY_ID_MASK }, ++ { PHY_ID_KSZ9477, MICREL_PHY_ID_MASK }, + { PHY_ID_LAN8814, MICREL_PHY_ID_MASK }, + { PHY_ID_LAN8804, MICREL_PHY_ID_MASK }, + { PHY_ID_LAN8841, MICREL_PHY_ID_MASK }, +-- +2.43.0 + diff --git a/queue-6.6/netfilter-fix-undefined-reference-to-netfilter_lwtun.patch b/queue-6.6/netfilter-fix-undefined-reference-to-netfilter_lwtun.patch new file mode 100644 index 00000000000..632cdbe248c --- /dev/null +++ b/queue-6.6/netfilter-fix-undefined-reference-to-netfilter_lwtun.patch @@ -0,0 +1,47 @@ +From ad744d065d600638d8db86c9db43a6afc50225c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 10:41:13 +0800 +Subject: netfilter: fix undefined reference to 'netfilter_lwtunnel_*' when + CONFIG_SYSCTL=n + +From: Jianguo Wu + +[ Upstream commit aef5daa2c49d510436b733827d4f0bab79fcc4a0 ] + +if CONFIG_SYSFS is not enabled in config, we get the below compile error, + +All errors (new ones prefixed by >>): + + csky-linux-ld: net/netfilter/core.o: in function `netfilter_init': + core.c:(.init.text+0x42): undefined reference to `netfilter_lwtunnel_init' +>> csky-linux-ld: core.c:(.init.text+0x56): undefined reference to `netfilter_lwtunnel_fini' +>> csky-linux-ld: core.c:(.init.text+0x70): undefined reference to `netfilter_lwtunnel_init' + csky-linux-ld: core.c:(.init.text+0x78): undefined reference to `netfilter_lwtunnel_fini' + +Fixes: a2225e0250c5 ("netfilter: move the sysctl nf_hooks_lwtunnel into the netfilter core") +Reported-by: Mirsad Todorovac +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202406210511.8vbByYj3-lkp@intel.com/ +Closes: https://lore.kernel.org/oe-kbuild-all/202406210520.6HmrUaA2-lkp@intel.com/ +Signed-off-by: Jianguo Wu +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nf_hooks_lwtunnel.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/net/netfilter/nf_hooks_lwtunnel.c b/net/netfilter/nf_hooks_lwtunnel.c +index 7cdb59bb4459f..d8ebebc9775d7 100644 +--- a/net/netfilter/nf_hooks_lwtunnel.c ++++ b/net/netfilter/nf_hooks_lwtunnel.c +@@ -117,4 +117,7 @@ void netfilter_lwtunnel_fini(void) + { + unregister_pernet_subsys(&nf_lwtunnel_net_ops); + } ++#else ++int __init netfilter_lwtunnel_init(void) { return 0; } ++void netfilter_lwtunnel_fini(void) {} + #endif /* CONFIG_SYSCTL */ +-- +2.43.0 + diff --git a/queue-6.6/netfilter-nf_tables-fully-validate-nft_data_value-on.patch b/queue-6.6/netfilter-nf_tables-fully-validate-nft_data_value-on.patch new file mode 100644 index 00000000000..5dd4bca682d --- /dev/null +++ b/queue-6.6/netfilter-nf_tables-fully-validate-nft_data_value-on.patch @@ -0,0 +1,92 @@ +From c132aa1abc2ee6274f7724303dce0dd195e817cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jun 2024 23:15:38 +0200 +Subject: netfilter: nf_tables: fully validate NFT_DATA_VALUE on store to data + registers + +From: Pablo Neira Ayuso + +[ Upstream commit 7931d32955e09d0a11b1fe0b6aac1bfa061c005c ] + +register store validation for NFT_DATA_VALUE is conditional, however, +the datatype is always either NFT_DATA_VALUE or NFT_DATA_VERDICT. This +only requires a new helper function to infer the register type from the +set datatype so this conditional check can be removed. Otherwise, +pointer to chain object can be leaked through the registers. + +Fixes: 96518518cc41 ("netfilter: add nftables") +Reported-by: Linus Torvalds +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/net/netfilter/nf_tables.h | 5 +++++ + net/netfilter/nf_tables_api.c | 8 ++++---- + net/netfilter/nft_lookup.c | 3 ++- + 3 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h +index 5bb8a83e26046..8af2543520b99 100644 +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -587,6 +587,11 @@ static inline void *nft_set_priv(const struct nft_set *set) + return (void *)set->data; + } + ++static inline enum nft_data_types nft_set_datatype(const struct nft_set *set) ++{ ++ return set->dtype == NFT_DATA_VERDICT ? NFT_DATA_VERDICT : NFT_DATA_VALUE; ++} ++ + static inline bool nft_set_gc_is_pending(const struct nft_set *s) + { + return refcount_read(&s->refs) != 1; +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 387eee416b0bf..7547f7b869395 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -5648,8 +5648,7 @@ static int nf_tables_fill_setelem(struct sk_buff *skb, + + if (nft_set_ext_exists(ext, NFT_SET_EXT_DATA) && + nft_data_dump(skb, NFTA_SET_ELEM_DATA, nft_set_ext_data(ext), +- set->dtype == NFT_DATA_VERDICT ? NFT_DATA_VERDICT : NFT_DATA_VALUE, +- set->dlen) < 0) ++ nft_set_datatype(set), set->dlen) < 0) + goto nla_put_failure; + + if (nft_set_ext_exists(ext, NFT_SET_EXT_EXPRESSIONS) && +@@ -10881,6 +10880,9 @@ static int nft_validate_register_store(const struct nft_ctx *ctx, + + return 0; + default: ++ if (type != NFT_DATA_VALUE) ++ return -EINVAL; ++ + if (reg < NFT_REG_1 * NFT_REG_SIZE / NFT_REG32_SIZE) + return -EINVAL; + if (len == 0) +@@ -10889,8 +10891,6 @@ static int nft_validate_register_store(const struct nft_ctx *ctx, + sizeof_field(struct nft_regs, data)) + return -ERANGE; + +- if (data != NULL && type != NFT_DATA_VALUE) +- return -EINVAL; + return 0; + } + } +diff --git a/net/netfilter/nft_lookup.c b/net/netfilter/nft_lookup.c +index 870e5b113d13e..7ba4b1454db46 100644 +--- a/net/netfilter/nft_lookup.c ++++ b/net/netfilter/nft_lookup.c +@@ -132,7 +132,8 @@ static int nft_lookup_init(const struct nft_ctx *ctx, + return -EINVAL; + + err = nft_parse_register_store(ctx, tb[NFTA_LOOKUP_DREG], +- &priv->dreg, NULL, set->dtype, ++ &priv->dreg, NULL, ++ nft_set_datatype(set), + set->dlen); + if (err < 0) + return err; +-- +2.43.0 + diff --git a/queue-6.6/openvswitch-get-related-ct-labels-from-its-master-if.patch b/queue-6.6/openvswitch-get-related-ct-labels-from-its-master-if.patch new file mode 100644 index 00000000000..3823ee7098c --- /dev/null +++ b/queue-6.6/openvswitch-get-related-ct-labels-from-its-master-if.patch @@ -0,0 +1,59 @@ +From b81dec663584bf81c26a49e2a50ef80425e87485 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Jun 2024 18:08:56 -0400 +Subject: openvswitch: get related ct labels from its master if it is not + confirmed + +From: Xin Long + +[ Upstream commit a23ac973f67f37e77b3c634e8b1ad5b0164fcc1f ] + +Ilya found a failure in running check-kernel tests with at_groups=144 +(144: conntrack - FTP SNAT orig tuple) in OVS repo. After his further +investigation, the root cause is that the labels sent to userspace +for related ct are incorrect. + +The labels for unconfirmed related ct should use its master's labels. +However, the changes made in commit 8c8b73320805 ("openvswitch: set +IPS_CONFIRMED in tmpl status only when commit is set in conntrack") +led to getting labels from this related ct. + +So fix it in ovs_ct_get_labels() by changing to copy labels from its +master ct if it is a unconfirmed related ct. Note that there is no +fix needed for ct->mark, as it was already copied from its master +ct for related ct in init_conntrack(). + +Fixes: 8c8b73320805 ("openvswitch: set IPS_CONFIRMED in tmpl status only when commit is set in conntrack") +Reported-by: Ilya Maximets +Signed-off-by: Xin Long +Reviewed-by: Ilya Maximets +Tested-by: Ilya Maximets +Reviewed-by: Aaron Conole +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/openvswitch/conntrack.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c +index 2928c142a2ddb..3b980bf2770bb 100644 +--- a/net/openvswitch/conntrack.c ++++ b/net/openvswitch/conntrack.c +@@ -168,8 +168,13 @@ static u32 ovs_ct_get_mark(const struct nf_conn *ct) + static void ovs_ct_get_labels(const struct nf_conn *ct, + struct ovs_key_ct_labels *labels) + { +- struct nf_conn_labels *cl = ct ? nf_ct_labels_find(ct) : NULL; ++ struct nf_conn_labels *cl = NULL; + ++ if (ct) { ++ if (ct->master && !nf_ct_is_confirmed(ct)) ++ ct = ct->master; ++ cl = nf_ct_labels_find(ct); ++ } + if (cl) + memcpy(labels, cl->bits, OVS_CT_LABELS_LEN); + else +-- +2.43.0 + diff --git a/queue-6.6/parisc-use-correct-compat-recv-recvfrom-syscalls.patch b/queue-6.6/parisc-use-correct-compat-recv-recvfrom-syscalls.patch new file mode 100644 index 00000000000..88b445d0d6c --- /dev/null +++ b/queue-6.6/parisc-use-correct-compat-recv-recvfrom-syscalls.patch @@ -0,0 +1,48 @@ +From 71c26ac72fd555ca764f8cccd932ba8bd2876565 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Jun 2024 14:27:55 +0200 +Subject: parisc: use correct compat recv/recvfrom syscalls + +From: Arnd Bergmann + +[ Upstream commit 20a50787349fadf66ac5c48f62e58d753878d2bb ] + +Johannes missed parisc back when he introduced the compat version +of these syscalls, so receiving cmsg messages that require a compat +conversion is still broken. + +Use the correct calls like the other architectures do. + +Fixes: 1dacc76d0014 ("net/compat/wext: send different messages to compat tasks") +Acked-by: Helge Deller +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/parisc/kernel/syscalls/syscall.tbl | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/parisc/kernel/syscalls/syscall.tbl b/arch/parisc/kernel/syscalls/syscall.tbl +index e97c175b56f96..47b3bb90080de 100644 +--- a/arch/parisc/kernel/syscalls/syscall.tbl ++++ b/arch/parisc/kernel/syscalls/syscall.tbl +@@ -108,7 +108,7 @@ + 95 common fchown sys_fchown + 96 common getpriority sys_getpriority + 97 common setpriority sys_setpriority +-98 common recv sys_recv ++98 common recv sys_recv compat_sys_recv + 99 common statfs sys_statfs compat_sys_statfs + 100 common fstatfs sys_fstatfs compat_sys_fstatfs + 101 common stat64 sys_stat64 +@@ -135,7 +135,7 @@ + 120 common clone sys_clone_wrapper + 121 common setdomainname sys_setdomainname + 122 common sendfile sys_sendfile compat_sys_sendfile +-123 common recvfrom sys_recvfrom ++123 common recvfrom sys_recvfrom compat_sys_recvfrom + 124 32 adjtimex sys_adjtimex_time32 + 124 64 adjtimex sys_adjtimex + 125 common mprotect sys_mprotect +-- +2.43.0 + diff --git a/queue-6.6/powerpc-restore-some-missing-spu-syscalls.patch b/queue-6.6/powerpc-restore-some-missing-spu-syscalls.patch new file mode 100644 index 00000000000..59572d11e69 --- /dev/null +++ b/queue-6.6/powerpc-restore-some-missing-spu-syscalls.patch @@ -0,0 +1,54 @@ +From 751aea2949d46b2581b6e0c196b47aaf0c126272 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Apr 2024 16:36:13 +0200 +Subject: powerpc: restore some missing spu syscalls + +From: Arnd Bergmann + +[ Upstream commit b1e31c134a8ab2e8f5fd62323b6b45a950ac704d ] + +A couple of system calls were inadventently removed from the table during +a bugfix for 32-bit powerpc entry. Restore the original behavior. + +Fixes: e23750623835 ("powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs") +Acked-by: Michael Ellerman +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/syscalls/syscall.tbl | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl +index 20e50586e8a26..b012579247ee8 100644 +--- a/arch/powerpc/kernel/syscalls/syscall.tbl ++++ b/arch/powerpc/kernel/syscalls/syscall.tbl +@@ -230,8 +230,10 @@ + 178 nospu rt_sigsuspend sys_rt_sigsuspend compat_sys_rt_sigsuspend + 179 32 pread64 sys_ppc_pread64 compat_sys_ppc_pread64 + 179 64 pread64 sys_pread64 ++179 spu pread64 sys_pread64 + 180 32 pwrite64 sys_ppc_pwrite64 compat_sys_ppc_pwrite64 + 180 64 pwrite64 sys_pwrite64 ++180 spu pwrite64 sys_pwrite64 + 181 common chown sys_chown + 182 common getcwd sys_getcwd + 183 common capget sys_capget +@@ -246,6 +248,7 @@ + 190 common ugetrlimit sys_getrlimit compat_sys_getrlimit + 191 32 readahead sys_ppc_readahead compat_sys_ppc_readahead + 191 64 readahead sys_readahead ++191 spu readahead sys_readahead + 192 32 mmap2 sys_mmap2 compat_sys_mmap2 + 193 32 truncate64 sys_ppc_truncate64 compat_sys_ppc_truncate64 + 194 32 ftruncate64 sys_ppc_ftruncate64 compat_sys_ppc_ftruncate64 +@@ -293,6 +296,7 @@ + 232 nospu set_tid_address sys_set_tid_address + 233 32 fadvise64 sys_ppc32_fadvise64 compat_sys_ppc32_fadvise64 + 233 64 fadvise64 sys_fadvise64 ++233 spu fadvise64 sys_fadvise64 + 234 nospu exit_group sys_exit_group + 235 nospu lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie + 236 common epoll_create sys_epoll_create +-- +2.43.0 + diff --git a/queue-6.6/s390-pci-add-missing-virt_to_phys-for-directed-dibv.patch b/queue-6.6/s390-pci-add-missing-virt_to_phys-for-directed-dibv.patch new file mode 100644 index 00000000000..c19974d9fd4 --- /dev/null +++ b/queue-6.6/s390-pci-add-missing-virt_to_phys-for-directed-dibv.patch @@ -0,0 +1,39 @@ +From e0bbaaa24f9a0f5397713d230b449b6227103d6a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Jun 2024 14:06:31 +0200 +Subject: s390/pci: Add missing virt_to_phys() for directed DIBV + +From: Niklas Schnelle + +[ Upstream commit 4181b51c38875de9f6f11248fa0bcf3246c19c82 ] + +In commit 4e4dc65ab578 ("s390/pci: use phys_to_virt() for AIBVs/DIBVs") +the setting of dibv_addr was missed when adding virt_to_phys(). This +only affects systems with directed interrupt delivery enabled which are +not generally available. + +Fixes: 4e4dc65ab578 ("s390/pci: use phys_to_virt() for AIBVs/DIBVs") +Reviewed-by: Heiko Carstens +Signed-off-by: Niklas Schnelle +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/pci/pci_irq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c +index ff8f24854c646..0ef83b6ac0db7 100644 +--- a/arch/s390/pci/pci_irq.c ++++ b/arch/s390/pci/pci_irq.c +@@ -410,7 +410,7 @@ static void __init cpu_enable_directed_irq(void *unused) + union zpci_sic_iib iib = {{0}}; + union zpci_sic_iib ziib = {{0}}; + +- iib.cdiib.dibv_addr = (u64) zpci_ibv[smp_processor_id()]->vector; ++ iib.cdiib.dibv_addr = virt_to_phys(zpci_ibv[smp_processor_id()]->vector); + + zpci_set_irq_ctrl(SIC_IRQ_MODE_SET_CPU, 0, &iib); + zpci_set_irq_ctrl(SIC_IRQ_MODE_D_SINGLE, PCI_ISC, &ziib); +-- +2.43.0 + diff --git a/queue-6.6/series b/queue-6.6/series index e6818a2f197..9baddab0893 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -13,3 +13,38 @@ mips-pci-lantiq-restore-reset-gpio-polarity.patch selftests-mptcp-print_test-out-of-verify_listener_ev.patch selftests-mptcp-userspace_pm-fixed-subtest-names.patch wifi-mac80211-use-flexible-array-in-struct-ieee80211.patch +asoc-rockchip-i2s-tdm-fix-trcm-mode-by-setting-clock.patch +asoc-mediatek-mt8183-da7219-max98357-fix-kcontrol-na.patch +asoc-atmel-convert-not-to-use-asoc_xxx.patch +asoc-atmel-atmel-classd-re-add-dai_link-platform-to-.patch +workqueue-increase-worker-desc-s-length-to-32.patch +asoc-q6apm-lpass-dai-close-graph-on-prepare-errors.patch +bpf-add-missed-var_off-setting-in-set_sext32_default.patch +bpf-add-missed-var_off-setting-in-coerce_subreg_to_s.patch +s390-pci-add-missing-virt_to_phys-for-directed-dibv.patch +asoc-amd-acp-add-a-null-check-for-chip_pdev-structur.patch +asoc-amd-acp-remove-i2s-configuration-check-in-acp_i.patch +asoc-fsl-asoc-card-set-priv-pdev-before-using-it.patch +net-dsa-microchip-fix-initial-port-flush-problem.patch +openvswitch-get-related-ct-labels-from-its-master-if.patch +mlxsw-spectrum_buffers-fix-memory-corruptions-on-spe.patch +bpf-fix-overrunning-reservations-in-ringbuf.patch +ibmvnic-free-any-outstanding-tx-skbs-during-scrq-res.patch +net-phy-micrel-add-microchip-ksz-9477-to-the-device-.patch +net-dsa-microchip-use-collision-based-back-pressure-.patch +ice-rebuild-tc-queues-on-vsi-queue-reconfiguration.patch +xdp-remove-warn-from-__xdp_reg_mem_model.patch +netfilter-fix-undefined-reference-to-netfilter_lwtun.patch +btrfs-use-nofs-context-when-getting-inodes-during-lo.patch +fix-race-for-duplicate-reqsk-on-identical-syn.patch +alsa-seq-fix-missing-channel-at-encoding-rpn-nrpn-mi.patch +net-dsa-microchip-fix-wrong-register-write-when-mask.patch +sparc-fix-old-compat_sys_select.patch +sparc-fix-compat-recv-recvfrom-syscalls.patch +parisc-use-correct-compat-recv-recvfrom-syscalls.patch +powerpc-restore-some-missing-spu-syscalls.patch +tcp-fix-tcp_rcv_fastopen_synack-to-enter-tcp_ca_loss.patch +alsa-seq-fix-missing-msb-in-midi2-spp-conversion.patch +netfilter-nf_tables-fully-validate-nft_data_value-on.patch +tracing-net_sched-null-pointer-dereference-in-perf_t.patch +net-mana-fix-possible-double-free-in-error-handling-.patch diff --git a/queue-6.6/sparc-fix-compat-recv-recvfrom-syscalls.patch b/queue-6.6/sparc-fix-compat-recv-recvfrom-syscalls.patch new file mode 100644 index 00000000000..c456bedf6b2 --- /dev/null +++ b/queue-6.6/sparc-fix-compat-recv-recvfrom-syscalls.patch @@ -0,0 +1,279 @@ +From e32dd6a6d403e06fce4e8d9affa886ebccd224db Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Jun 2024 12:49:39 +0200 +Subject: sparc: fix compat recv/recvfrom syscalls + +From: Arnd Bergmann + +[ Upstream commit d6fbd26fb872ec518d25433a12e8ce8163e20909 ] + +sparc has the wrong compat version of recv() and recvfrom() for both the +direct syscalls and socketcall(). + +The direct syscalls just need to use the compat version. For socketcall, +the same thing could be done, but it seems better to completely remove +the custom assembler code for it and just use the same implementation that +everyone else has. + +Fixes: 1dacc76d0014 ("net/compat/wext: send different messages to compat tasks") +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/sparc/kernel/sys32.S | 221 ------------------------- + arch/sparc/kernel/syscalls/syscall.tbl | 4 +- + 2 files changed, 2 insertions(+), 223 deletions(-) + +diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S +index a45f0f31fe51a..a3d308f2043e5 100644 +--- a/arch/sparc/kernel/sys32.S ++++ b/arch/sparc/kernel/sys32.S +@@ -18,224 +18,3 @@ sys32_mmap2: + sethi %hi(sys_mmap), %g1 + jmpl %g1 + %lo(sys_mmap), %g0 + sllx %o5, 12, %o5 +- +- .align 32 +- .globl sys32_socketcall +-sys32_socketcall: /* %o0=call, %o1=args */ +- cmp %o0, 1 +- bl,pn %xcc, do_einval +- cmp %o0, 18 +- bg,pn %xcc, do_einval +- sub %o0, 1, %o0 +- sllx %o0, 5, %o0 +- sethi %hi(__socketcall_table_begin), %g2 +- or %g2, %lo(__socketcall_table_begin), %g2 +- jmpl %g2 + %o0, %g0 +- nop +-do_einval: +- retl +- mov -EINVAL, %o0 +- +- .align 32 +-__socketcall_table_begin: +- +- /* Each entry is exactly 32 bytes. */ +-do_sys_socket: /* sys_socket(int, int, int) */ +-1: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_socket), %g1 +-2: ldswa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(sys_socket), %g0 +-3: ldswa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_bind: /* sys_bind(int fd, struct sockaddr *, int) */ +-4: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_bind), %g1 +-5: ldswa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(sys_bind), %g0 +-6: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_connect: /* sys_connect(int, struct sockaddr *, int) */ +-7: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_connect), %g1 +-8: ldswa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(sys_connect), %g0 +-9: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_listen: /* sys_listen(int, int) */ +-10: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_listen), %g1 +- jmpl %g1 + %lo(sys_listen), %g0 +-11: ldswa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +- nop +-do_sys_accept: /* sys_accept(int, struct sockaddr *, int *) */ +-12: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_accept), %g1 +-13: lduwa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(sys_accept), %g0 +-14: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_getsockname: /* sys_getsockname(int, struct sockaddr *, int *) */ +-15: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_getsockname), %g1 +-16: lduwa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(sys_getsockname), %g0 +-17: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_getpeername: /* sys_getpeername(int, struct sockaddr *, int *) */ +-18: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_getpeername), %g1 +-19: lduwa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(sys_getpeername), %g0 +-20: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_socketpair: /* sys_socketpair(int, int, int, int *) */ +-21: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_socketpair), %g1 +-22: ldswa [%o1 + 0x8] %asi, %o2 +-23: lduwa [%o1 + 0xc] %asi, %o3 +- jmpl %g1 + %lo(sys_socketpair), %g0 +-24: ldswa [%o1 + 0x4] %asi, %o1 +- nop +- nop +-do_sys_send: /* sys_send(int, void *, size_t, unsigned int) */ +-25: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_send), %g1 +-26: lduwa [%o1 + 0x8] %asi, %o2 +-27: lduwa [%o1 + 0xc] %asi, %o3 +- jmpl %g1 + %lo(sys_send), %g0 +-28: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +-do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ +-29: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_recv), %g1 +-30: lduwa [%o1 + 0x8] %asi, %o2 +-31: lduwa [%o1 + 0xc] %asi, %o3 +- jmpl %g1 + %lo(sys_recv), %g0 +-32: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +-do_sys_sendto: /* sys_sendto(int, u32, compat_size_t, unsigned int, u32, int) */ +-33: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_sendto), %g1 +-34: lduwa [%o1 + 0x8] %asi, %o2 +-35: lduwa [%o1 + 0xc] %asi, %o3 +-36: lduwa [%o1 + 0x10] %asi, %o4 +-37: ldswa [%o1 + 0x14] %asi, %o5 +- jmpl %g1 + %lo(sys_sendto), %g0 +-38: lduwa [%o1 + 0x4] %asi, %o1 +-do_sys_recvfrom: /* sys_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */ +-39: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_recvfrom), %g1 +-40: lduwa [%o1 + 0x8] %asi, %o2 +-41: lduwa [%o1 + 0xc] %asi, %o3 +-42: lduwa [%o1 + 0x10] %asi, %o4 +-43: lduwa [%o1 + 0x14] %asi, %o5 +- jmpl %g1 + %lo(sys_recvfrom), %g0 +-44: lduwa [%o1 + 0x4] %asi, %o1 +-do_sys_shutdown: /* sys_shutdown(int, int) */ +-45: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_shutdown), %g1 +- jmpl %g1 + %lo(sys_shutdown), %g0 +-46: ldswa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +- nop +-do_sys_setsockopt: /* sys_setsockopt(int, int, int, char *, int) */ +-47: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_setsockopt), %g1 +-48: ldswa [%o1 + 0x8] %asi, %o2 +-49: lduwa [%o1 + 0xc] %asi, %o3 +-50: ldswa [%o1 + 0x10] %asi, %o4 +- jmpl %g1 + %lo(sys_setsockopt), %g0 +-51: ldswa [%o1 + 0x4] %asi, %o1 +- nop +-do_sys_getsockopt: /* sys_getsockopt(int, int, int, u32, u32) */ +-52: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_getsockopt), %g1 +-53: ldswa [%o1 + 0x8] %asi, %o2 +-54: lduwa [%o1 + 0xc] %asi, %o3 +-55: lduwa [%o1 + 0x10] %asi, %o4 +- jmpl %g1 + %lo(sys_getsockopt), %g0 +-56: ldswa [%o1 + 0x4] %asi, %o1 +- nop +-do_sys_sendmsg: /* compat_sys_sendmsg(int, struct compat_msghdr *, unsigned int) */ +-57: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(compat_sys_sendmsg), %g1 +-58: lduwa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(compat_sys_sendmsg), %g0 +-59: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_recvmsg: /* compat_sys_recvmsg(int, struct compat_msghdr *, unsigned int) */ +-60: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(compat_sys_recvmsg), %g1 +-61: lduwa [%o1 + 0x8] %asi, %o2 +- jmpl %g1 + %lo(compat_sys_recvmsg), %g0 +-62: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- nop +-do_sys_accept4: /* sys_accept4(int, struct sockaddr *, int *, int) */ +-63: ldswa [%o1 + 0x0] %asi, %o0 +- sethi %hi(sys_accept4), %g1 +-64: lduwa [%o1 + 0x8] %asi, %o2 +-65: ldswa [%o1 + 0xc] %asi, %o3 +- jmpl %g1 + %lo(sys_accept4), %g0 +-66: lduwa [%o1 + 0x4] %asi, %o1 +- nop +- nop +- +- .section __ex_table,"a" +- .align 4 +- .word 1b, __retl_efault, 2b, __retl_efault +- .word 3b, __retl_efault, 4b, __retl_efault +- .word 5b, __retl_efault, 6b, __retl_efault +- .word 7b, __retl_efault, 8b, __retl_efault +- .word 9b, __retl_efault, 10b, __retl_efault +- .word 11b, __retl_efault, 12b, __retl_efault +- .word 13b, __retl_efault, 14b, __retl_efault +- .word 15b, __retl_efault, 16b, __retl_efault +- .word 17b, __retl_efault, 18b, __retl_efault +- .word 19b, __retl_efault, 20b, __retl_efault +- .word 21b, __retl_efault, 22b, __retl_efault +- .word 23b, __retl_efault, 24b, __retl_efault +- .word 25b, __retl_efault, 26b, __retl_efault +- .word 27b, __retl_efault, 28b, __retl_efault +- .word 29b, __retl_efault, 30b, __retl_efault +- .word 31b, __retl_efault, 32b, __retl_efault +- .word 33b, __retl_efault, 34b, __retl_efault +- .word 35b, __retl_efault, 36b, __retl_efault +- .word 37b, __retl_efault, 38b, __retl_efault +- .word 39b, __retl_efault, 40b, __retl_efault +- .word 41b, __retl_efault, 42b, __retl_efault +- .word 43b, __retl_efault, 44b, __retl_efault +- .word 45b, __retl_efault, 46b, __retl_efault +- .word 47b, __retl_efault, 48b, __retl_efault +- .word 49b, __retl_efault, 50b, __retl_efault +- .word 51b, __retl_efault, 52b, __retl_efault +- .word 53b, __retl_efault, 54b, __retl_efault +- .word 55b, __retl_efault, 56b, __retl_efault +- .word 57b, __retl_efault, 58b, __retl_efault +- .word 59b, __retl_efault, 60b, __retl_efault +- .word 61b, __retl_efault, 62b, __retl_efault +- .word 63b, __retl_efault, 64b, __retl_efault +- .word 65b, __retl_efault, 66b, __retl_efault +- .previous +diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl +index 6dd1e2df87a03..be69b53cbdf0b 100644 +--- a/arch/sparc/kernel/syscalls/syscall.tbl ++++ b/arch/sparc/kernel/syscalls/syscall.tbl +@@ -155,7 +155,7 @@ + 123 32 fchown sys_fchown16 + 123 64 fchown sys_fchown + 124 common fchmod sys_fchmod +-125 common recvfrom sys_recvfrom ++125 common recvfrom sys_recvfrom compat_sys_recvfrom + 126 32 setreuid sys_setreuid16 + 126 64 setreuid sys_setreuid + 127 32 setregid sys_setregid16 +@@ -247,7 +247,7 @@ + 204 32 readdir sys_old_readdir compat_sys_old_readdir + 204 64 readdir sys_nis_syscall + 205 common readahead sys_readahead compat_sys_readahead +-206 common socketcall sys_socketcall sys32_socketcall ++206 common socketcall sys_socketcall compat_sys_socketcall + 207 common syslog sys_syslog + 208 common lookup_dcookie sys_lookup_dcookie compat_sys_lookup_dcookie + 209 common fadvise64 sys_fadvise64 compat_sys_fadvise64 +-- +2.43.0 + diff --git a/queue-6.6/sparc-fix-old-compat_sys_select.patch b/queue-6.6/sparc-fix-old-compat_sys_select.patch new file mode 100644 index 00000000000..f11a696e57e --- /dev/null +++ b/queue-6.6/sparc-fix-old-compat_sys_select.patch @@ -0,0 +1,39 @@ +From b6c2f4e0b0b310cd012218a90e5af6f2995d1bd5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Jun 2024 14:07:30 +0200 +Subject: sparc: fix old compat_sys_select() + +From: Arnd Bergmann + +[ Upstream commit bae6428a9fffb2023191b0723e276cf1377a7c9f ] + +sparc has two identical select syscalls at numbers 93 and 230, respectively. +During the conversion to the modern syscall.tbl format, the older one of the +two broke in compat mode, and now refers to the native 64-bit syscall. + +Restore the correct behavior. This has very little effect, as glibc has +been using the newer number anyway. + +Fixes: 6ff645dd683a ("sparc: add system call table generation support") +Signed-off-by: Arnd Bergmann +Signed-off-by: Sasha Levin +--- + arch/sparc/kernel/syscalls/syscall.tbl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl +index 4ed06c71c43fb..6dd1e2df87a03 100644 +--- a/arch/sparc/kernel/syscalls/syscall.tbl ++++ b/arch/sparc/kernel/syscalls/syscall.tbl +@@ -117,7 +117,7 @@ + 90 common dup2 sys_dup2 + 91 32 setfsuid32 sys_setfsuid + 92 common fcntl sys_fcntl compat_sys_fcntl +-93 common select sys_select ++93 common select sys_select compat_sys_select + 94 32 setfsgid32 sys_setfsgid + 95 common fsync sys_fsync + 96 common setpriority sys_setpriority +-- +2.43.0 + diff --git a/queue-6.6/tcp-fix-tcp_rcv_fastopen_synack-to-enter-tcp_ca_loss.patch b/queue-6.6/tcp-fix-tcp_rcv_fastopen_synack-to-enter-tcp_ca_loss.patch new file mode 100644 index 00000000000..57ccbf7d9bb --- /dev/null +++ b/queue-6.6/tcp-fix-tcp_rcv_fastopen_synack-to-enter-tcp_ca_loss.patch @@ -0,0 +1,168 @@ +From 6bccad6b60d9797d9ca030ad850192ef724786ee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Jun 2024 14:43:23 +0000 +Subject: tcp: fix tcp_rcv_fastopen_synack() to enter TCP_CA_Loss for failed + TFO + +From: Neal Cardwell + +[ Upstream commit 5dfe9d273932c647bdc9d664f939af9a5a398cbc ] + +Testing determined that the recent commit 9e046bb111f1 ("tcp: clear +tp->retrans_stamp in tcp_rcv_fastopen_synack()") has a race, and does +not always ensure retrans_stamp is 0 after a TFO payload retransmit. + +If transmit completion for the SYN+data skb happens after the client +TCP stack receives the SYNACK (which sometimes happens), then +retrans_stamp can erroneously remain non-zero for the lifetime of the +connection, causing a premature ETIMEDOUT later. + +Testing and tracing showed that the buggy scenario is the following +somewhat tricky sequence: + ++ Client attempts a TFO handshake. tcp_send_syn_data() sends SYN + TFO + cookie + data in a single packet in the syn_data skb. It hands the + syn_data skb to tcp_transmit_skb(), which makes a clone. Crucially, + it then reuses the same original (non-clone) syn_data skb, + transforming it by advancing the seq by one byte and removing the + FIN bit, and enques the resulting payload-only skb in the + sk->tcp_rtx_queue. + ++ Client sets retrans_stamp to the start time of the three-way + handshake. + ++ Cookie mismatches or server has TFO disabled, and server only ACKs + SYN. + ++ tcp_ack() sees SYN is acked, tcp_clean_rtx_queue() clears + retrans_stamp. + ++ Since the client SYN was acked but not the payload, the TFO failure + code path in tcp_rcv_fastopen_synack() tries to retransmit the + payload skb. However, in some cases the transmit completion for the + clone of the syn_data (which had SYN + TFO cookie + data) hasn't + happened. In those cases, skb_still_in_host_queue() returns true + for the retransmitted TFO payload, because the clone of the syn_data + skb has not had its tx completetion. + ++ Because skb_still_in_host_queue() finds skb_fclone_busy() is true, + it sets the TSQ_THROTTLED bit and the retransmit does not happen in + the tcp_rcv_fastopen_synack() call chain. + ++ The tcp_rcv_fastopen_synack() code next implicitly assumes the + retransmit process is finished, and sets retrans_stamp to 0 to clear + it, but this is later overwritten (see below). + ++ Later, upon tx completion, tcp_tsq_write() calls + tcp_xmit_retransmit_queue(), which puts the retransmit in flight and + sets retrans_stamp to a non-zero value. + ++ The client receives an ACK for the retransmitted TFO payload data. + ++ Since we're in CA_Open and there are no dupacks/SACKs/DSACKs/ECN to + make tcp_ack_is_dubious() true and make us call + tcp_fastretrans_alert() and reach a code path that clears + retrans_stamp, retrans_stamp stays nonzero. + ++ Later, if there is a TLP, RTO, RTO sequence, then the connection + will suffer an early ETIMEDOUT due to the erroneously ancient + retrans_stamp. + +The fix: this commit refactors the code to have +tcp_rcv_fastopen_synack() retransmit by reusing the relevant parts of +tcp_simple_retransmit() that enter CA_Loss (without changing cwnd) and +call tcp_xmit_retransmit_queue(). We have tcp_simple_retransmit() and +tcp_rcv_fastopen_synack() share code in this way because in both cases +we get a packet indicating non-congestion loss (MTU reduction or TFO +failure) and thus in both cases we want to retransmit as many packets +as cwnd allows, without reducing cwnd. And given that retransmits will +set retrans_stamp to a non-zero value (and may do so in a later +calling context due to TSQ), we also want to enter CA_Loss so that we +track when all retransmitted packets are ACked and clear retrans_stamp +when that happens (to ensure later recurring RTOs are using the +correct retrans_stamp and don't declare ETIMEDOUT prematurely). + +Fixes: 9e046bb111f1 ("tcp: clear tp->retrans_stamp in tcp_rcv_fastopen_synack()") +Fixes: a7abf3cd76e1 ("tcp: consider using standard rtx logic in tcp_rcv_fastopen_synack()") +Signed-off-by: Neal Cardwell +Signed-off-by: Eric Dumazet +Cc: Yuchung Cheng +Link: https://patch.msgid.link/20240624144323.2371403-1-ncardwell.sw@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_input.c | 38 +++++++++++++++++++++++++++----------- + 1 file changed, 27 insertions(+), 11 deletions(-) + +diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c +index 64707a5227f5a..6743b6bfbc9c5 100644 +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -2759,13 +2759,37 @@ static void tcp_mtup_probe_success(struct sock *sk) + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMTUPSUCCESS); + } + ++/* Sometimes we deduce that packets have been dropped due to reasons other than ++ * congestion, like path MTU reductions or failed client TFO attempts. In these ++ * cases we call this function to retransmit as many packets as cwnd allows, ++ * without reducing cwnd. Given that retransmits will set retrans_stamp to a ++ * non-zero value (and may do so in a later calling context due to TSQ), we ++ * also enter CA_Loss so that we track when all retransmitted packets are ACKed ++ * and clear retrans_stamp when that happens (to ensure later recurring RTOs ++ * are using the correct retrans_stamp and don't declare ETIMEDOUT ++ * prematurely). ++ */ ++static void tcp_non_congestion_loss_retransmit(struct sock *sk) ++{ ++ const struct inet_connection_sock *icsk = inet_csk(sk); ++ struct tcp_sock *tp = tcp_sk(sk); ++ ++ if (icsk->icsk_ca_state != TCP_CA_Loss) { ++ tp->high_seq = tp->snd_nxt; ++ tp->snd_ssthresh = tcp_current_ssthresh(sk); ++ tp->prior_ssthresh = 0; ++ tp->undo_marker = 0; ++ tcp_set_ca_state(sk, TCP_CA_Loss); ++ } ++ tcp_xmit_retransmit_queue(sk); ++} ++ + /* Do a simple retransmit without using the backoff mechanisms in + * tcp_timer. This is used for path mtu discovery. + * The socket is already locked here. + */ + void tcp_simple_retransmit(struct sock *sk) + { +- const struct inet_connection_sock *icsk = inet_csk(sk); + struct tcp_sock *tp = tcp_sk(sk); + struct sk_buff *skb; + int mss; +@@ -2805,14 +2829,7 @@ void tcp_simple_retransmit(struct sock *sk) + * in network, but units changed and effective + * cwnd/ssthresh really reduced now. + */ +- if (icsk->icsk_ca_state != TCP_CA_Loss) { +- tp->high_seq = tp->snd_nxt; +- tp->snd_ssthresh = tcp_current_ssthresh(sk); +- tp->prior_ssthresh = 0; +- tp->undo_marker = 0; +- tcp_set_ca_state(sk, TCP_CA_Loss); +- } +- tcp_xmit_retransmit_queue(sk); ++ tcp_non_congestion_loss_retransmit(sk); + } + EXPORT_SYMBOL(tcp_simple_retransmit); + +@@ -6175,8 +6192,7 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, + tp->fastopen_client_fail = TFO_DATA_NOT_ACKED; + skb_rbtree_walk_from(data) + tcp_mark_skb_lost(sk, data); +- tcp_xmit_retransmit_queue(sk); +- tp->retrans_stamp = 0; ++ tcp_non_congestion_loss_retransmit(sk); + NET_INC_STATS(sock_net(sk), + LINUX_MIB_TCPFASTOPENACTIVEFAIL); + return true; +-- +2.43.0 + diff --git a/queue-6.6/tracing-net_sched-null-pointer-dereference-in-perf_t.patch b/queue-6.6/tracing-net_sched-null-pointer-dereference-in-perf_t.patch new file mode 100644 index 00000000000..fd4dc66f8a8 --- /dev/null +++ b/queue-6.6/tracing-net_sched-null-pointer-dereference-in-perf_t.patch @@ -0,0 +1,306 @@ +From 657aedb0c4bdd7cdf13ad9ab7a8e19099d6cc0ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jun 2024 02:33:23 +0900 +Subject: tracing/net_sched: NULL pointer dereference in + perf_trace_qdisc_reset() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Yunseong Kim + +[ Upstream commit bab4923132feb3e439ae45962979c5d9d5c7c1f1 ] + +In the TRACE_EVENT(qdisc_reset) NULL dereference occurred from + + qdisc->dev_queue->dev ->name + +This situation simulated from bunch of veths and Bluetooth disconnection +and reconnection. + +During qdisc initialization, qdisc was being set to noop_queue. +In veth_init_queue, the initial tx_num was reduced back to one, +causing the qdisc reset to be called with noop, which led to the kernel +panic. + +I've attached the GitHub gist link that C converted syz-execprogram +source code and 3 log of reproduced vmcore-dmesg. + + https://gist.github.com/yskelg/cc64562873ce249cdd0d5a358b77d740 + +Yeoreum and I use two fuzzing tool simultaneously. + +One process with syz-executor : https://github.com/google/syzkaller + + $ ./syz-execprog -executor=./syz-executor -repeat=1 -sandbox=setuid \ + -enable=none -collide=false log1 + +The other process with perf fuzzer: + https://github.com/deater/perf_event_tests/tree/master/fuzzer + + $ perf_event_tests/fuzzer/perf_fuzzer + +I think this will happen on the kernel version. + + Linux kernel version +v6.7.10, +v6.8, +v6.9 and it could happen in v6.10. + +This occurred from 51270d573a8d. I think this patch is absolutely +necessary. Previously, It was showing not intended string value of name. + +I've reproduced 3 time from my fedora 40 Debug Kernel with any other module +or patched. + + version: 6.10.0-0.rc2.20240608gitdc772f8237f9.29.fc41.aarch64+debug + +[ 5287.164555] veth0_vlan: left promiscuous mode +[ 5287.164929] veth1_macvtap: left promiscuous mode +[ 5287.164950] veth0_macvtap: left promiscuous mode +[ 5287.164983] veth1_vlan: left promiscuous mode +[ 5287.165008] veth0_vlan: left promiscuous mode +[ 5287.165450] veth1_macvtap: left promiscuous mode +[ 5287.165472] veth0_macvtap: left promiscuous mode +[ 5287.165502] veth1_vlan: left promiscuous mode +… +[ 5297.598240] bridge0: port 2(bridge_slave_1) entered blocking state +[ 5297.598262] bridge0: port 2(bridge_slave_1) entered forwarding state +[ 5297.598296] bridge0: port 1(bridge_slave_0) entered blocking state +[ 5297.598313] bridge0: port 1(bridge_slave_0) entered forwarding state +[ 5297.616090] 8021q: adding VLAN 0 to HW filter on device bond0 +[ 5297.620405] bridge0: port 1(bridge_slave_0) entered disabled state +[ 5297.620730] bridge0: port 2(bridge_slave_1) entered disabled state +[ 5297.627247] 8021q: adding VLAN 0 to HW filter on device team0 +[ 5297.629636] bridge0: port 1(bridge_slave_0) entered blocking state +… +[ 5298.002798] bridge_slave_0: left promiscuous mode +[ 5298.002869] bridge0: port 1(bridge_slave_0) entered disabled state +[ 5298.309444] bond0 (unregistering): (slave bond_slave_0): Releasing backup interface +[ 5298.315206] bond0 (unregistering): (slave bond_slave_1): Releasing backup interface +[ 5298.320207] bond0 (unregistering): Released all slaves +[ 5298.354296] hsr_slave_0: left promiscuous mode +[ 5298.360750] hsr_slave_1: left promiscuous mode +[ 5298.374889] veth1_macvtap: left promiscuous mode +[ 5298.374931] veth0_macvtap: left promiscuous mode +[ 5298.374988] veth1_vlan: left promiscuous mode +[ 5298.375024] veth0_vlan: left promiscuous mode +[ 5299.109741] team0 (unregistering): Port device team_slave_1 removed +[ 5299.185870] team0 (unregistering): Port device team_slave_0 removed +… +[ 5300.155443] Bluetooth: hci3: unexpected cc 0x0c03 length: 249 > 1 +[ 5300.155724] Bluetooth: hci3: unexpected cc 0x1003 length: 249 > 9 +[ 5300.155988] Bluetooth: hci3: unexpected cc 0x1001 length: 249 > 9 +…. +[ 5301.075531] team0: Port device team_slave_1 added +[ 5301.085515] bridge0: port 1(bridge_slave_0) entered blocking state +[ 5301.085531] bridge0: port 1(bridge_slave_0) entered disabled state +[ 5301.085588] bridge_slave_0: entered allmulticast mode +[ 5301.085800] bridge_slave_0: entered promiscuous mode +[ 5301.095617] bridge0: port 1(bridge_slave_0) entered blocking state +[ 5301.095633] bridge0: port 1(bridge_slave_0) entered disabled state +… +[ 5301.149734] bond0: (slave bond_slave_0): Enslaving as an active interface with an up link +[ 5301.173234] bond0: (slave bond_slave_0): Enslaving as an active interface with an up link +[ 5301.180517] bond0: (slave bond_slave_1): Enslaving as an active interface with an up link +[ 5301.193481] hsr_slave_0: entered promiscuous mode +[ 5301.204425] hsr_slave_1: entered promiscuous mode +[ 5301.210172] debugfs: Directory 'hsr0' with parent 'hsr' already present! +[ 5301.210185] Cannot create hsr debugfs directory +[ 5301.224061] bond0: (slave bond_slave_1): Enslaving as an active interface with an up link +[ 5301.246901] bond0: (slave bond_slave_0): Enslaving as an active interface with an up link +[ 5301.255934] team0: Port device team_slave_0 added +[ 5301.256480] team0: Port device team_slave_1 added +[ 5301.256948] team0: Port device team_slave_0 added +… +[ 5301.435928] hsr_slave_0: entered promiscuous mode +[ 5301.446029] hsr_slave_1: entered promiscuous mode +[ 5301.455872] debugfs: Directory 'hsr0' with parent 'hsr' already present! +[ 5301.455884] Cannot create hsr debugfs directory +[ 5301.502664] hsr_slave_0: entered promiscuous mode +[ 5301.513675] hsr_slave_1: entered promiscuous mode +[ 5301.526155] debugfs: Directory 'hsr0' with parent 'hsr' already present! +[ 5301.526164] Cannot create hsr debugfs directory +[ 5301.563662] hsr_slave_0: entered promiscuous mode +[ 5301.576129] hsr_slave_1: entered promiscuous mode +[ 5301.580259] debugfs: Directory 'hsr0' with parent 'hsr' already present! +[ 5301.580270] Cannot create hsr debugfs directory +[ 5301.590269] 8021q: adding VLAN 0 to HW filter on device bond0 + +[ 5301.595872] KASAN: null-ptr-deref in range [0x0000000000000130-0x0000000000000137] +[ 5301.595877] Mem abort info: +[ 5301.595881] ESR = 0x0000000096000006 +[ 5301.595885] EC = 0x25: DABT (current EL), IL = 32 bits +[ 5301.595889] SET = 0, FnV = 0 +[ 5301.595893] EA = 0, S1PTW = 0 +[ 5301.595896] FSC = 0x06: level 2 translation fault +[ 5301.595900] Data abort info: +[ 5301.595903] ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000 +[ 5301.595907] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 +[ 5301.595911] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 +[ 5301.595915] [dfff800000000026] address between user and kernel address ranges +[ 5301.595971] Internal error: Oops: 0000000096000006 [#1] SMP +… +[ 5301.596076] CPU: 2 PID: 102769 Comm: +syz-executor.3 Kdump: loaded Tainted: + G W ------- --- 6.10.0-0.rc2.20240608gitdc772f8237f9.29.fc41.aarch64+debug #1 +[ 5301.596080] Hardware name: VMware, Inc. VMware20,1/VBSA, + BIOS VMW201.00V.21805430.BA64.2305221830 05/22/2023 +[ 5301.596082] pstate: 01400005 (nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--) +[ 5301.596085] pc : strnlen+0x40/0x88 +[ 5301.596114] lr : trace_event_get_offsets_qdisc_reset+0x6c/0x2b0 +[ 5301.596124] sp : ffff8000beef6b40 +[ 5301.596126] x29: ffff8000beef6b40 x28: dfff800000000000 x27: 0000000000000001 +[ 5301.596131] x26: 6de1800082c62bd0 x25: 1ffff000110aa9e0 x24: ffff800088554f00 +[ 5301.596136] x23: ffff800088554ec0 x22: 0000000000000130 x21: 0000000000000140 +[ 5301.596140] x20: dfff800000000000 x19: ffff8000beef6c60 x18: ffff7000115106d8 +[ 5301.596143] x17: ffff800121bad000 x16: ffff800080020000 x15: 0000000000000006 +[ 5301.596147] x14: 0000000000000002 x13: ffff0001f3ed8d14 x12: ffff700017ddeda5 +[ 5301.596151] x11: 1ffff00017ddeda4 x10: ffff700017ddeda4 x9 : ffff800082cc5eec +[ 5301.596155] x8 : 0000000000000004 x7 : 00000000f1f1f1f1 x6 : 00000000f2f2f200 +[ 5301.596158] x5 : 00000000f3f3f3f3 x4 : ffff700017dded80 x3 : 00000000f204f1f1 +[ 5301.596162] x2 : 0000000000000026 x1 : 0000000000000000 x0 : 0000000000000130 +[ 5301.596166] Call trace: +[ 5301.596175] strnlen+0x40/0x88 +[ 5301.596179] trace_event_get_offsets_qdisc_reset+0x6c/0x2b0 +[ 5301.596182] perf_trace_qdisc_reset+0xb0/0x538 +[ 5301.596184] __traceiter_qdisc_reset+0x68/0xc0 +[ 5301.596188] qdisc_reset+0x43c/0x5e8 +[ 5301.596190] netif_set_real_num_tx_queues+0x288/0x770 +[ 5301.596194] veth_init_queues+0xfc/0x130 [veth] +[ 5301.596198] veth_newlink+0x45c/0x850 [veth] +[ 5301.596202] rtnl_newlink_create+0x2c8/0x798 +[ 5301.596205] __rtnl_newlink+0x92c/0xb60 +[ 5301.596208] rtnl_newlink+0xd8/0x130 +[ 5301.596211] rtnetlink_rcv_msg+0x2e0/0x890 +[ 5301.596214] netlink_rcv_skb+0x1c4/0x380 +[ 5301.596225] rtnetlink_rcv+0x20/0x38 +[ 5301.596227] netlink_unicast+0x3c8/0x640 +[ 5301.596231] netlink_sendmsg+0x658/0xa60 +[ 5301.596234] __sock_sendmsg+0xd0/0x180 +[ 5301.596243] __sys_sendto+0x1c0/0x280 +[ 5301.596246] __arm64_sys_sendto+0xc8/0x150 +[ 5301.596249] invoke_syscall+0xdc/0x268 +[ 5301.596256] el0_svc_common.constprop.0+0x16c/0x240 +[ 5301.596259] do_el0_svc+0x48/0x68 +[ 5301.596261] el0_svc+0x50/0x188 +[ 5301.596265] el0t_64_sync_handler+0x120/0x130 +[ 5301.596268] el0t_64_sync+0x194/0x198 +[ 5301.596272] Code: eb15001f 54000120 d343fc02 12000801 (38f46842) +[ 5301.596285] SMP: stopping secondary CPUs +[ 5301.597053] Starting crashdump kernel... +[ 5301.597057] Bye! + +After applying our patch, I didn't find any kernel panic errors. + +We've found a simple reproducer + + # echo 1 > /sys/kernel/debug/tracing/events/qdisc/qdisc_reset/enable + + # ip link add veth0 type veth peer name veth1 + + Error: Unknown device type. + +However, without our patch applied, I tested upstream 6.10.0-rc3 kernel +using the qdisc_reset event and the ip command on my qemu virtual machine. + +This 2 commands makes always kernel panic. + +Linux version: 6.10.0-rc3 + +[ 0.000000] Linux version 6.10.0-rc3-00164-g44ef20baed8e-dirty +(paran@fedora) (gcc (GCC) 14.1.1 20240522 (Red Hat 14.1.1-4), GNU ld +version 2.41-34.fc40) #20 SMP PREEMPT Sat Jun 15 16:51:25 KST 2024 + +Kernel panic message: + +[ 615.236484] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP +[ 615.237250] Dumping ftrace buffer: +[ 615.237679] (ftrace buffer empty) +[ 615.238097] Modules linked in: veth crct10dif_ce virtio_gpu +virtio_dma_buf drm_shmem_helper drm_kms_helper zynqmp_fpga xilinx_can +xilinx_spi xilinx_selectmap xilinx_core xilinx_pr_decoupler versal_fpga +uvcvideo uvc videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videodev +videobuf2_common mc usbnet deflate zstd ubifs ubi rcar_canfd rcar_can +omap_mailbox ntb_msi_test ntb_hw_epf lattice_sysconfig_spi +lattice_sysconfig ice40_spi gpio_xilinx dwmac_altr_socfpga mdio_regmap +stmmac_platform stmmac pcs_xpcs dfl_fme_region dfl_fme_mgr dfl_fme_br +dfl_afu dfl fpga_region fpga_bridge can can_dev br_netfilter bridge stp +llc atl1c ath11k_pci mhi ath11k_ahb ath11k qmi_helpers ath10k_sdio +ath10k_pci ath10k_core ath mac80211 libarc4 cfg80211 drm fuse backlight ipv6 +Jun 22 02:36:5[3 6k152.62-4sm98k4-0k]v kCePUr:n e1l :P IUDn:a b4le6 +8t oC ohmma: nidpl eN oketr nteali nptaedg i6n.g1 0re.0q-urecs3t- 0at0 +1v6i4r-tgu4a4le fa2d0dbraeeds0se-dir tyd f#f2f08 + 615.252376] Hardware name: linux,dummy-virt (DT) +[ 615.253220] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS +BTYPE=--) +[ 615.254433] pc : strnlen+0x6c/0xe0 +[ 615.255096] lr : trace_event_get_offsets_qdisc_reset+0x94/0x3d0 +[ 615.256088] sp : ffff800080b269a0 +[ 615.256615] x29: ffff800080b269a0 x28: ffffc070f3f98500 x27: +0000000000000001 +[ 615.257831] x26: 0000000000000010 x25: ffffc070f3f98540 x24: +ffffc070f619cf60 +[ 615.259020] x23: 0000000000000128 x22: 0000000000000138 x21: +dfff800000000000 +[ 615.260241] x20: ffffc070f631ad00 x19: 0000000000000128 x18: +ffffc070f448b800 +[ 615.261454] x17: 0000000000000000 x16: 0000000000000001 x15: +ffffc070f4ba2a90 +[ 615.262635] x14: ffff700010164d73 x13: 1ffff80e1e8d5eb3 x12: +1ffff00010164d72 +[ 615.263877] x11: ffff700010164d72 x10: dfff800000000000 x9 : +ffffc070e85d6184 +[ 615.265047] x8 : ffffc070e4402070 x7 : 000000000000f1f1 x6 : +000000001504a6d3 +[ 615.266336] x5 : ffff28ca21122140 x4 : ffffc070f5043ea8 x3 : +0000000000000000 +[ 615.267528] x2 : 0000000000000025 x1 : 0000000000000000 x0 : +0000000000000000 +[ 615.268747] Call trace: +[ 615.269180] strnlen+0x6c/0xe0 +[ 615.269767] trace_event_get_offsets_qdisc_reset+0x94/0x3d0 +[ 615.270716] trace_event_raw_event_qdisc_reset+0xe8/0x4e8 +[ 615.271667] __traceiter_qdisc_reset+0xa0/0x140 +[ 615.272499] qdisc_reset+0x554/0x848 +[ 615.273134] netif_set_real_num_tx_queues+0x360/0x9a8 +[ 615.274050] veth_init_queues+0x110/0x220 [veth] +[ 615.275110] veth_newlink+0x538/0xa50 [veth] +[ 615.276172] __rtnl_newlink+0x11e4/0x1bc8 +[ 615.276944] rtnl_newlink+0xac/0x120 +[ 615.277657] rtnetlink_rcv_msg+0x4e4/0x1370 +[ 615.278409] netlink_rcv_skb+0x25c/0x4f0 +[ 615.279122] rtnetlink_rcv+0x48/0x70 +[ 615.279769] netlink_unicast+0x5a8/0x7b8 +[ 615.280462] netlink_sendmsg+0xa70/0x1190 + +Yeoreum and I don't know if the patch we wrote will fix the underlying +cause, but we think that priority is to prevent kernel panic happening. +So, we're sending this patch. + +Fixes: 51270d573a8d ("tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string") +Link: https://lore.kernel.org/lkml/20240229143432.273b4871@gandalf.local.home/t/ +Cc: netdev@vger.kernel.org +Tested-by: Yunseong Kim +Signed-off-by: Yunseong Kim +Signed-off-by: Yeoreum Yun +Link: https://lore.kernel.org/r/20240624173320.24945-4-yskelg@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + include/trace/events/qdisc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/trace/events/qdisc.h b/include/trace/events/qdisc.h +index 1f4258308b967..69453b8de29e6 100644 +--- a/include/trace/events/qdisc.h ++++ b/include/trace/events/qdisc.h +@@ -81,7 +81,7 @@ TRACE_EVENT(qdisc_reset, + TP_ARGS(q), + + TP_STRUCT__entry( +- __string( dev, qdisc_dev(q)->name ) ++ __string( dev, qdisc_dev(q) ? qdisc_dev(q)->name : "(null)" ) + __string( kind, q->ops->id ) + __field( u32, parent ) + __field( u32, handle ) +-- +2.43.0 + diff --git a/queue-6.6/workqueue-increase-worker-desc-s-length-to-32.patch b/queue-6.6/workqueue-increase-worker-desc-s-length-to-32.patch new file mode 100644 index 00000000000..21c24aa45c5 --- /dev/null +++ b/queue-6.6/workqueue-increase-worker-desc-s-length-to-32.patch @@ -0,0 +1,40 @@ +From 11380e97801e63cf35c1b7d2490e2892de761ff9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Jun 2024 16:52:15 +0800 +Subject: workqueue: Increase worker desc's length to 32 + +From: Wenchao Hao + +[ Upstream commit 231035f18d6b80e5c28732a20872398116a54ecd ] + +Commit 31c89007285d ("workqueue.c: Increase workqueue name length") +increased WQ_NAME_LEN from 24 to 32, but forget to increase +WORKER_DESC_LEN, which would cause truncation when setting kworker's +desc from workqueue_struct's name, process_one_work() for example. + +Fixes: 31c89007285d ("workqueue.c: Increase workqueue name length") + +Signed-off-by: Wenchao Hao +CC: Audra Mitchell +Signed-off-by: Tejun Heo +Signed-off-by: Sasha Levin +--- + include/linux/workqueue.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h +index 24b1e5070f4d4..52c6dd6d80ac0 100644 +--- a/include/linux/workqueue.h ++++ b/include/linux/workqueue.h +@@ -84,7 +84,7 @@ enum { + WORK_BUSY_RUNNING = 1 << 1, + + /* maximum string length for set_worker_desc() */ +- WORKER_DESC_LEN = 24, ++ WORKER_DESC_LEN = 32, + }; + + /* Convenience constants - of type 'unsigned long', not 'enum'! */ +-- +2.43.0 + diff --git a/queue-6.6/xdp-remove-warn-from-__xdp_reg_mem_model.patch b/queue-6.6/xdp-remove-warn-from-__xdp_reg_mem_model.patch new file mode 100644 index 00000000000..54a8e393ac6 --- /dev/null +++ b/queue-6.6/xdp-remove-warn-from-__xdp_reg_mem_model.patch @@ -0,0 +1,76 @@ +From 998be0502878433c02e0aff78436aeacc2d10db4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Jun 2024 11:07:47 +0300 +Subject: xdp: Remove WARN() from __xdp_reg_mem_model() + +From: Daniil Dulov + +[ Upstream commit 7e9f79428372c6eab92271390851be34ab26bfb4 ] + +syzkaller reports a warning in __xdp_reg_mem_model(). + +The warning occurs only if __mem_id_init_hash_table() returns an error. It +returns the error in two cases: + + 1. memory allocation fails; + 2. rhashtable_init() fails when some fields of rhashtable_params + struct are not initialized properly. + +The second case cannot happen since there is a static const rhashtable_params +struct with valid fields. So, warning is only triggered when there is a +problem with memory allocation. + +Thus, there is no sense in using WARN() to handle this error and it can be +safely removed. + +WARNING: CPU: 0 PID: 5065 at net/core/xdp.c:299 __xdp_reg_mem_model+0x2d9/0x650 net/core/xdp.c:299 + +CPU: 0 PID: 5065 Comm: syz-executor883 Not tainted 6.8.0-syzkaller-05271-gf99c5f563c17 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 +RIP: 0010:__xdp_reg_mem_model+0x2d9/0x650 net/core/xdp.c:299 + +Call Trace: + xdp_reg_mem_model+0x22/0x40 net/core/xdp.c:344 + xdp_test_run_setup net/bpf/test_run.c:188 [inline] + bpf_test_run_xdp_live+0x365/0x1e90 net/bpf/test_run.c:377 + bpf_prog_test_run_xdp+0x813/0x11b0 net/bpf/test_run.c:1267 + bpf_prog_test_run+0x33a/0x3b0 kernel/bpf/syscall.c:4240 + __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5649 + __do_sys_bpf kernel/bpf/syscall.c:5738 [inline] + __se_sys_bpf kernel/bpf/syscall.c:5736 [inline] + __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5736 + do_syscall_64+0xfb/0x240 + entry_SYSCALL_64_after_hwframe+0x6d/0x75 + +Found by Linux Verification Center (linuxtesting.org) with syzkaller. + +Fixes: 8d5d88527587 ("xdp: rhashtable with allocator ID to pointer mapping") +Signed-off-by: Daniil Dulov +Signed-off-by: Daniel Borkmann +Acked-by: Jesper Dangaard Brouer +Link: https://lore.kernel.org/all/20240617162708.492159-1-d.dulov@aladdin.ru +Link: https://lore.kernel.org/bpf/20240624080747.36858-1-d.dulov@aladdin.ru +Signed-off-by: Sasha Levin +--- + net/core/xdp.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/net/core/xdp.c b/net/core/xdp.c +index a70670fe9a2dc..5fe4c099f30a3 100644 +--- a/net/core/xdp.c ++++ b/net/core/xdp.c +@@ -294,10 +294,8 @@ static struct xdp_mem_allocator *__xdp_reg_mem_model(struct xdp_mem_info *mem, + mutex_lock(&mem_id_lock); + ret = __mem_id_init_hash_table(); + mutex_unlock(&mem_id_lock); +- if (ret < 0) { +- WARN_ON(1); ++ if (ret < 0) + return ERR_PTR(ret); +- } + } + + xdp_alloc = kzalloc(sizeof(*xdp_alloc), gfp); +-- +2.43.0 + -- 2.47.3