From: Sasha Levin Date: Tue, 23 Jul 2024 00:20:23 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v6.10.1~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b516b61b80be5b9dc733a8688328f04b41fe0580;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/acpi-ec-abort-address-space-access-upon-error.patch b/queue-4.19/acpi-ec-abort-address-space-access-upon-error.patch new file mode 100644 index 00000000000..2e71594b686 --- /dev/null +++ b/queue-4.19/acpi-ec-abort-address-space-access-upon-error.patch @@ -0,0 +1,45 @@ +From 3dea807a207b164d965bdf22972d6df9ac9b3d26 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 May 2024 23:36:48 +0200 +Subject: ACPI: EC: Abort address space access upon error + +From: Armin Wolf + +[ Upstream commit f6f172dc6a6d7775b2df6adfd1350700e9a847ec ] + +When a multi-byte address space access is requested, acpi_ec_read()/ +acpi_ec_write() is being called multiple times. + +Abort such operations if a single call to acpi_ec_read() / +acpi_ec_write() fails, as the data read from / written to the EC +might be incomplete. + +Signed-off-by: Armin Wolf +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/ec.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c +index d2fde87e4d0d4..78f8b8b5a8099 100644 +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -1330,10 +1330,13 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, + if (ec->busy_polling || bits > 8) + acpi_ec_burst_enable(ec); + +- for (i = 0; i < bytes; ++i, ++address, ++value) ++ for (i = 0; i < bytes; ++i, ++address, ++value) { + result = (function == ACPI_READ) ? + acpi_ec_read(ec, address, value) : + acpi_ec_write(ec, address, *value); ++ if (result < 0) ++ break; ++ } + + if (ec->busy_polling || bits > 8) + acpi_ec_burst_disable(ec); +-- +2.43.0 + diff --git a/queue-4.19/acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch b/queue-4.19/acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch new file mode 100644 index 00000000000..2d21ca621a6 --- /dev/null +++ b/queue-4.19/acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch @@ -0,0 +1,43 @@ +From c301df16e571584cd8c396448d2a05ccaf2bb4f7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 May 2024 23:36:49 +0200 +Subject: ACPI: EC: Avoid returning AE_OK on errors in address space handler + +From: Armin Wolf + +[ Upstream commit c4bd7f1d78340e63de4d073fd3dbe5391e2996e5 ] + +If an error code other than EINVAL, ENODEV or ETIME is returned +by acpi_ec_read() / acpi_ec_write(), then AE_OK is incorrectly +returned by acpi_ec_space_handler(). + +Fix this by only returning AE_OK on success, and return AE_ERROR +otherwise. + +Signed-off-by: Armin Wolf +[ rjw: Subject and changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/ec.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c +index 78f8b8b5a8099..7db62dec2ee53 100644 +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -1348,8 +1348,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, + return AE_NOT_FOUND; + case -ETIME: + return AE_TIME; +- default: ++ case 0: + return AE_OK; ++ default: ++ return AE_ERROR; + } + } + +-- +2.43.0 + diff --git a/queue-4.19/alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch b/queue-4.19/alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch new file mode 100644 index 00000000000..0e6abd9f29c --- /dev/null +++ b/queue-4.19/alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch @@ -0,0 +1,66 @@ +From e6fd629853b799833acd4a047aeb4745c0426774 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jun 2024 10:40:18 +0800 +Subject: ALSA: dmaengine_pcm: terminate dmaengine before synchronize + +From: Shengjiu Wang + +[ Upstream commit 6a7db25aad8ce6512b366d2ce1d0e60bac00a09d ] + +When dmaengine supports pause function, in suspend state, +dmaengine_pause() is called instead of dmaengine_terminate_async(), + +In end of playback stream, the runtime->state will go to +SNDRV_PCM_STATE_DRAINING, if system suspend & resume happen +at this time, application will not resume playback stream, the +stream will be closed directly, the dmaengine_terminate_async() +will not be called before the dmaengine_synchronize(), which +violates the call sequence for dmaengine_synchronize(). + +This behavior also happens for capture streams, but there is no +SNDRV_PCM_STATE_DRAINING state for capture. So use +dmaengine_tx_status() to check the DMA status if the status is +DMA_PAUSED, then call dmaengine_terminate_async() to terminate +dmaengine before dmaengine_synchronize(). + +Signed-off-by: Shengjiu Wang +Link: https://patch.msgid.link/1718851218-27803-1-git-send-email-shengjiu.wang@nxp.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/pcm_dmaengine.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c +index 6f6da1128edc2..80188d5c11187 100644 +--- a/sound/core/pcm_dmaengine.c ++++ b/sound/core/pcm_dmaengine.c +@@ -354,6 +354,12 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan); + int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream) + { + struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); ++ struct dma_tx_state state; ++ enum dma_status status; ++ ++ status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); ++ if (status == DMA_PAUSED) ++ dmaengine_terminate_async(prtd->dma_chan); + + dmaengine_synchronize(prtd->dma_chan); + kfree(prtd); +@@ -371,6 +377,12 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close); + int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream) + { + struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); ++ struct dma_tx_state state; ++ enum dma_status status; ++ ++ status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state); ++ if (status == DMA_PAUSED) ++ dmaengine_terminate_async(prtd->dma_chan); + + dmaengine_synchronize(prtd->dma_chan); + dma_release_channel(prtd->dma_chan); +-- +2.43.0 + diff --git a/queue-4.19/bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch b/queue-4.19/bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch new file mode 100644 index 00000000000..9714ca74a62 --- /dev/null +++ b/queue-4.19/bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch @@ -0,0 +1,54 @@ +From 4454b92b75478f08657beb69a51db5766d09896a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 10 Jun 2024 20:00:32 +0900 +Subject: Bluetooth: hci_core: cancel all works upon hci_unregister_dev() + +From: Tetsuo Handa + +[ Upstream commit 0d151a103775dd9645c78c97f77d6e2a5298d913 ] + +syzbot is reporting that calling hci_release_dev() from hci_error_reset() +due to hci_dev_put() from hci_error_reset() can cause deadlock at +destroy_workqueue(), for hci_error_reset() is called from +hdev->req_workqueue which destroy_workqueue() needs to flush. + +We need to make sure that hdev->{rx_work,cmd_work,tx_work} which are +queued into hdev->workqueue and hdev->{power_on,error_reset} which are +queued into hdev->req_workqueue are no longer running by the moment + + destroy_workqueue(hdev->workqueue); + destroy_workqueue(hdev->req_workqueue); + +are called from hci_release_dev(). + +Call cancel_work_sync() on these work items from hci_unregister_dev() +as soon as hdev->list is removed from hci_dev_list. + +Reported-by: syzbot +Closes: https://syzkaller.appspot.com/bug?extid=da0a9c9721e36db712e8 +Signed-off-by: Tetsuo Handa +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/hci_core.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c +index 47f1eec0eb35f..504f6aa4e95db 100644 +--- a/net/bluetooth/hci_core.c ++++ b/net/bluetooth/hci_core.c +@@ -3288,7 +3288,11 @@ void hci_unregister_dev(struct hci_dev *hdev) + list_del(&hdev->list); + write_unlock(&hci_dev_list_lock); + ++ cancel_work_sync(&hdev->rx_work); ++ cancel_work_sync(&hdev->cmd_work); ++ cancel_work_sync(&hdev->tx_work); + cancel_work_sync(&hdev->power_on); ++ cancel_work_sync(&hdev->error_reset); + + hci_dev_do_close(hdev); + +-- +2.43.0 + diff --git a/queue-4.19/bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch b/queue-4.19/bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch new file mode 100644 index 00000000000..5fad8aa8f9d --- /dev/null +++ b/queue-4.19/bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch @@ -0,0 +1,48 @@ +From 7f26bd8ea1c7dcaeb5163a0f544f5b8b678512c9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 Jun 2024 19:02:51 +0200 +Subject: bytcr_rt5640 : inverse jack detect for Archos 101 cesium + +From: Thomas GENTY + +[ Upstream commit e3209a1827646daaab744aa6a5767b1f57fb5385 ] + +When headphones are plugged in, they appear absent; when they are removed, +they appear present. +Add a specific entry in bytcr_rt5640 for this device + +Signed-off-by: Thomas GENTY +Reviewed-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20240608170251.99936-1-tomlohave@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/bytcr_rt5640.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c +index 19f425eb4a40f..16e2ab2903754 100644 +--- a/sound/soc/intel/boards/bytcr_rt5640.c ++++ b/sound/soc/intel/boards/bytcr_rt5640.c +@@ -474,6 +474,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { + BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, ++ { ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ARCHOS 101 CESIUM"), ++ }, ++ .driver_data = (void *)(BYTCR_INPUT_DEFAULTS | ++ BYT_RT5640_JD_NOT_INV | ++ BYT_RT5640_DIFF_MIC | ++ BYT_RT5640_SSP0_AIF1 | ++ BYT_RT5640_MCLK_EN), ++ }, + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"), +-- +2.43.0 + diff --git a/queue-4.19/can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch b/queue-4.19/can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch new file mode 100644 index 00000000000..a32f0755aa1 --- /dev/null +++ b/queue-4.19/can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch @@ -0,0 +1,36 @@ +From cc28f2099b2129d8527c8c34c3157cb06806695c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 May 2024 12:10:20 +0800 +Subject: can: kvaser_usb: fix return value for hif_usb_send_regout + +From: Chen Ni + +[ Upstream commit 0d34d8163fd87978a6abd792e2d8ad849f4c3d57 ] + +As the potential failure of usb_submit_urb(), it should be better to +return the err variable to catch the error. + +Signed-off-by: Chen Ni +Link: https://lore.kernel.org/all/20240521041020.1519416-1-nichen@iscas.ac.cn +Signed-off-by: Marc Kleine-Budde +Signed-off-by: Sasha Levin +--- + drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +index a8c7879095de7..0d23d3c5624a4 100644 +--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c ++++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +@@ -266,7 +266,7 @@ int kvaser_usb_send_cmd_async(struct kvaser_usb_net_priv *priv, void *cmd, + } + usb_free_urb(urb); + +- return 0; ++ return err; + } + + int kvaser_usb_can_rx_over_error(struct net_device *netdev) +-- +2.43.0 + diff --git a/queue-4.19/fs-better-handle-deep-ancestor-chains-in-is_subdir.patch b/queue-4.19/fs-better-handle-deep-ancestor-chains-in-is_subdir.patch new file mode 100644 index 00000000000..9298bb15878 --- /dev/null +++ b/queue-4.19/fs-better-handle-deep-ancestor-chains-in-is_subdir.patch @@ -0,0 +1,80 @@ +From b33b7c1ddc9d66ceaa360182bb7e03e9af984d57 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Jul 2024 21:03:26 +0200 +Subject: fs: better handle deep ancestor chains in is_subdir() + +From: Christian Brauner + +[ Upstream commit 391b59b045004d5b985d033263ccba3e941a7740 ] + +Jan reported that 'cd ..' may take a long time in deep directory +hierarchies under a bind-mount. If concurrent renames happen it is +possible to livelock in is_subdir() because it will keep retrying. + +Change is_subdir() from simply retrying over and over to retry once and +then acquire the rename lock to handle deep ancestor chains better. The +list of alternatives to this approach were less then pleasant. Change +the scope of rcu lock to cover the whole walk while at it. + +A big thanks to Jan and Linus. Both Jan and Linus had proposed +effectively the same thing just that one version ended up being slightly +more elegant. + +Reported-by: Jan Kara +Signed-off-by: Linus Torvalds +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/dcache.c | 31 ++++++++++++++----------------- + 1 file changed, 14 insertions(+), 17 deletions(-) + +diff --git a/fs/dcache.c b/fs/dcache.c +index 4d96eb591f5d9..93671238abce1 100644 +--- a/fs/dcache.c ++++ b/fs/dcache.c +@@ -3003,28 +3003,25 @@ EXPORT_SYMBOL(d_splice_alias); + + bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry) + { +- bool result; ++ bool subdir; + unsigned seq; + + if (new_dentry == old_dentry) + return true; + +- do { +- /* for restarting inner loop in case of seq retry */ +- seq = read_seqbegin(&rename_lock); +- /* +- * Need rcu_readlock to protect against the d_parent trashing +- * due to d_move +- */ +- rcu_read_lock(); +- if (d_ancestor(old_dentry, new_dentry)) +- result = true; +- else +- result = false; +- rcu_read_unlock(); +- } while (read_seqretry(&rename_lock, seq)); +- +- return result; ++ /* Access d_parent under rcu as d_move() may change it. */ ++ rcu_read_lock(); ++ seq = read_seqbegin(&rename_lock); ++ subdir = d_ancestor(old_dentry, new_dentry); ++ /* Try lockless once... */ ++ if (read_seqretry(&rename_lock, seq)) { ++ /* ...else acquire lock for progress even on deep chains. */ ++ read_seqlock_excl(&rename_lock); ++ subdir = d_ancestor(old_dentry, new_dentry); ++ read_sequnlock_excl(&rename_lock); ++ } ++ rcu_read_unlock(); ++ return subdir; + } + EXPORT_SYMBOL(is_subdir); + +-- +2.43.0 + diff --git a/queue-4.19/fs-file-fix-the-check-in-find_next_fd.patch b/queue-4.19/fs-file-fix-the-check-in-find_next_fd.patch new file mode 100644 index 00000000000..73c82a3799d --- /dev/null +++ b/queue-4.19/fs-file-fix-the-check-in-find_next_fd.patch @@ -0,0 +1,51 @@ +From 0899744903b07aaed992314e3faf236e96c9d5a6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 May 2024 00:06:56 +0800 +Subject: fs/file: fix the check in find_next_fd() + +From: Yuntao Wang + +[ Upstream commit ed8c7fbdfe117abbef81f65428ba263118ef298a ] + +The maximum possible return value of find_next_zero_bit(fdt->full_fds_bits, +maxbit, bitbit) is maxbit. This return value, multiplied by BITS_PER_LONG, +gives the value of bitbit, which can never be greater than maxfd, it can +only be equal to maxfd at most, so the following check 'if (bitbit > maxfd)' +will never be true. + +Moreover, when bitbit equals maxfd, it indicates that there are no unused +fds, and the function can directly return. + +Fix this check. + +Signed-off-by: Yuntao Wang +Link: https://lore.kernel.org/r/20240529160656.209352-1-yuntao.wang@linux.dev +Reviewed-by: Jan Kara +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/file.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/file.c b/fs/file.c +index 928ba7b8df1e9..f5ba0e6f1a4c6 100644 +--- a/fs/file.c ++++ b/fs/file.c +@@ -462,12 +462,12 @@ struct files_struct init_files = { + + static unsigned int find_next_fd(struct fdtable *fdt, unsigned int start) + { +- unsigned int maxfd = fdt->max_fds; ++ unsigned int maxfd = fdt->max_fds; /* always multiple of BITS_PER_LONG */ + unsigned int maxbit = maxfd / BITS_PER_LONG; + unsigned int bitbit = start / BITS_PER_LONG; + + bitbit = find_next_zero_bit(fdt->full_fds_bits, maxbit, bitbit) * BITS_PER_LONG; +- if (bitbit > maxfd) ++ if (bitbit >= maxfd) + return maxfd; + if (bitbit > start) + start = bitbit; +-- +2.43.0 + diff --git a/queue-4.19/gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch b/queue-4.19/gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch new file mode 100644 index 00000000000..06dda58fd8b --- /dev/null +++ b/queue-4.19/gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch @@ -0,0 +1,56 @@ +From b8b5a7f210780d8d7ffd6efe0339756db7c8b58e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jun 2024 07:29:15 +0300 +Subject: gpio: pca953x: fix pca953x_irq_bus_sync_unlock race + +From: Ian Ray + +[ Upstream commit bfc6444b57dc7186b6acc964705d7516cbaf3904 ] + +Ensure that `i2c_lock' is held when setting interrupt latch and mask in +pca953x_irq_bus_sync_unlock() in order to avoid races. + +The other (non-probe) call site pca953x_gpio_set_multiple() ensures the +lock is held before calling pca953x_write_regs(). + +The problem occurred when a request raced against irq_bus_sync_unlock() +approximately once per thousand reboots on an i.MX8MP based system. + + * Normal case + + 0-0022: write register AI|3a {03,02,00,00,01} Input latch P0 + 0-0022: write register AI|49 {fc,fd,ff,ff,fe} Interrupt mask P0 + 0-0022: write register AI|08 {ff,00,00,00,00} Output P3 + 0-0022: write register AI|12 {fc,00,00,00,00} Config P3 + + * Race case + + 0-0022: write register AI|08 {ff,00,00,00,00} Output P3 + 0-0022: write register AI|08 {03,02,00,00,01} *** Wrong register *** + 0-0022: write register AI|12 {fc,00,00,00,00} Config P3 + 0-0022: write register AI|49 {fc,fd,ff,ff,fe} Interrupt mask P0 + +Signed-off-by: Ian Ray +Link: https://lore.kernel.org/r/20240620042915.2173-1-ian.ray@gehealthcare.com +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-pca953x.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index dc4088a47ab2d..5dcc31e5fb3eb 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -489,6 +489,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d) + u8 invert_irq_mask[MAX_BANK]; + + if (chip->driver_data & PCA_PCAL) { ++ guard(mutex)(&chip->i2c_lock); ++ + /* Enable latch on interrupt-enabled inputs */ + pca953x_write_regs(chip, PCAL953X_IN_LATCH, chip->irq_mask); + +-- +2.43.0 + diff --git a/queue-4.19/hfsplus-fix-uninit-value-in-copy_name.patch b/queue-4.19/hfsplus-fix-uninit-value-in-copy_name.patch new file mode 100644 index 00000000000..4a8ee364afd --- /dev/null +++ b/queue-4.19/hfsplus-fix-uninit-value-in-copy_name.patch @@ -0,0 +1,70 @@ +From 753d9cb71377067d61416d3789c9183dbd155f75 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 May 2024 13:21:46 +0800 +Subject: hfsplus: fix uninit-value in copy_name + +From: Edward Adam Davis + +[ Upstream commit 0570730c16307a72f8241df12363f76600baf57d ] + +[syzbot reported] +BUG: KMSAN: uninit-value in sized_strscpy+0xc4/0x160 + sized_strscpy+0xc4/0x160 + copy_name+0x2af/0x320 fs/hfsplus/xattr.c:411 + hfsplus_listxattr+0x11e9/0x1a50 fs/hfsplus/xattr.c:750 + vfs_listxattr fs/xattr.c:493 [inline] + listxattr+0x1f3/0x6b0 fs/xattr.c:840 + path_listxattr fs/xattr.c:864 [inline] + __do_sys_listxattr fs/xattr.c:876 [inline] + __se_sys_listxattr fs/xattr.c:873 [inline] + __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873 + x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Uninit was created at: + slab_post_alloc_hook mm/slub.c:3877 [inline] + slab_alloc_node mm/slub.c:3918 [inline] + kmalloc_trace+0x57b/0xbe0 mm/slub.c:4065 + kmalloc include/linux/slab.h:628 [inline] + hfsplus_listxattr+0x4cc/0x1a50 fs/hfsplus/xattr.c:699 + vfs_listxattr fs/xattr.c:493 [inline] + listxattr+0x1f3/0x6b0 fs/xattr.c:840 + path_listxattr fs/xattr.c:864 [inline] + __do_sys_listxattr fs/xattr.c:876 [inline] + __se_sys_listxattr fs/xattr.c:873 [inline] + __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873 + x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f +[Fix] +When allocating memory to strbuf, initialize memory to 0. + +Reported-and-tested-by: syzbot+efde959319469ff8d4d7@syzkaller.appspotmail.com +Signed-off-by: Edward Adam Davis +Link: https://lore.kernel.org/r/tencent_8BBB6433BC9E1C1B7B4BDF1BF52574BA8808@qq.com +Reported-and-tested-by: syzbot+01ade747b16e9c8030e0@syzkaller.appspotmail.com +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/hfsplus/xattr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c +index d5403b4004c97..cf8647a4c35bd 100644 +--- a/fs/hfsplus/xattr.c ++++ b/fs/hfsplus/xattr.c +@@ -700,7 +700,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) + return err; + } + +- strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + ++ strbuf = kzalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); + if (!strbuf) { + res = -ENOMEM; +-- +2.43.0 + diff --git a/queue-4.19/ila-block-bh-in-ila_output.patch b/queue-4.19/ila-block-bh-in-ila_output.patch new file mode 100644 index 00000000000..dff0bc36867 --- /dev/null +++ b/queue-4.19/ila-block-bh-in-ila_output.patch @@ -0,0 +1,60 @@ +From a124bc72bc050f320f140ce690d5d3d1c9566d80 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 May 2024 13:26:35 +0000 +Subject: ila: block BH in ila_output() + +From: Eric Dumazet + +[ Upstream commit cf28ff8e4c02e1ffa850755288ac954b6ff0db8c ] + +As explained in commit 1378817486d6 ("tipc: block BH +before using dst_cache"), net/core/dst_cache.c +helpers need to be called with BH disabled. + +ila_output() is called from lwtunnel_output() +possibly from process context, and under rcu_read_lock(). + +We might be interrupted by a softirq, re-enter ila_output() +and corrupt dst_cache data structures. + +Fix the race by using local_bh_disable(). + +Signed-off-by: Eric Dumazet +Acked-by: Paolo Abeni +Link: https://lore.kernel.org/r/20240531132636.2637995-5-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv6/ila/ila_lwt.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c +index 3d56a2fb6f86f..c7630776bd8e8 100644 +--- a/net/ipv6/ila/ila_lwt.c ++++ b/net/ipv6/ila/ila_lwt.c +@@ -58,7 +58,9 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) + return orig_dst->lwtstate->orig_output(net, sk, skb); + } + ++ local_bh_disable(); + dst = dst_cache_get(&ilwt->dst_cache); ++ local_bh_enable(); + if (unlikely(!dst)) { + struct ipv6hdr *ip6h = ipv6_hdr(skb); + struct flowi6 fl6; +@@ -86,8 +88,11 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb) + goto drop; + } + +- if (ilwt->connected) ++ if (ilwt->connected) { ++ local_bh_disable(); + dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr); ++ local_bh_enable(); ++ } + } + + skb_dst_set(skb, dst); +-- +2.43.0 + diff --git a/queue-4.19/input-elantech-fix-touchpad-state-on-resume-for-leno.patch b/queue-4.19/input-elantech-fix-touchpad-state-on-resume-for-leno.patch new file mode 100644 index 00000000000..e3002bbe010 --- /dev/null +++ b/queue-4.19/input-elantech-fix-touchpad-state-on-resume-for-leno.patch @@ -0,0 +1,79 @@ +From 7e4108a8933fd128a3f21ac373e2cd006e30f6d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 May 2024 16:12:07 +0000 +Subject: Input: elantech - fix touchpad state on resume for Lenovo N24 + +From: Jonathan Denose + +[ Upstream commit a69ce592cbe0417664bc5a075205aa75c2ec1273 ] + +The Lenovo N24 on resume becomes stuck in a state where it +sends incorrect packets, causing elantech_packet_check_v4 to fail. +The only way for the device to resume sending the correct packets is for +it to be disabled and then re-enabled. + +This change adds a dmi check to trigger this behavior on resume. + +Signed-off-by: Jonathan Denose +Link: https://lore.kernel.org/r/20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/mouse/elantech.c | 31 +++++++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c +index 6759cab82a723..6f747c59cd652 100644 +--- a/drivers/input/mouse/elantech.c ++++ b/drivers/input/mouse/elantech.c +@@ -1527,16 +1527,47 @@ static void elantech_disconnect(struct psmouse *psmouse) + psmouse->private = NULL; + } + ++/* ++ * Some hw_version 4 models fail to properly activate absolute mode on ++ * resume without going through disable/enable cycle. ++ */ ++static const struct dmi_system_id elantech_needs_reenable[] = { ++#if defined(CONFIG_DMI) && defined(CONFIG_X86) ++ { ++ /* Lenovo N24 */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "81AF"), ++ }, ++ }, ++#endif ++ { } ++}; ++ + /* + * Put the touchpad back into absolute mode when reconnecting + */ + static int elantech_reconnect(struct psmouse *psmouse) + { ++ int err; ++ + psmouse_reset(psmouse); + + if (elantech_detect(psmouse, 0)) + return -1; + ++ if (dmi_check_system(elantech_needs_reenable)) { ++ err = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE); ++ if (err) ++ psmouse_warn(psmouse, "failed to deactivate mouse on %s: %d\n", ++ psmouse->ps2dev.serio->phys, err); ++ ++ err = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE); ++ if (err) ++ psmouse_warn(psmouse, "failed to reactivate mouse on %s: %d\n", ++ psmouse->ps2dev.serio->phys, err); ++ } ++ + if (elantech_set_absolute_mode(psmouse)) { + psmouse_err(psmouse, + "failed to put touchpad back into absolute mode.\n"); +-- +2.43.0 + diff --git a/queue-4.19/input-silead-always-support-10-fingers.patch b/queue-4.19/input-silead-always-support-10-fingers.patch new file mode 100644 index 00000000000..004184dc555 --- /dev/null +++ b/queue-4.19/input-silead-always-support-10-fingers.patch @@ -0,0 +1,100 @@ +From fc206abedf1f81ba59dee03ac9dfb0cfff417c03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 May 2024 21:38:53 +0200 +Subject: Input: silead - Always support 10 fingers + +From: Hans de Goede + +[ Upstream commit 38a38f5a36da9820680d413972cb733349400532 ] + +When support for Silead touchscreens was orginal added some touchscreens +with older firmware versions only supported 5 fingers and this was made +the default requiring the setting of a "silead,max-fingers=10" uint32 +device-property for all touchscreen models which do support 10 fingers. + +There are very few models with the old 5 finger fw, so in practice the +setting of the "silead,max-fingers=10" is boilerplate which needs to +be copy and pasted to every touchscreen config. + +Reporting that 10 fingers are supported on devices which only support +5 fingers doesn't cause any problems for userspace in practice, since +at max 4 finger gestures are supported anyways. Drop the max_fingers +configuration and simply always assume 10 fingers. + +Signed-off-by: Hans de Goede +Acked-by: Dmitry Torokhov +Link: https://lore.kernel.org/r/20240525193854.39130-2-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/input/touchscreen/silead.c | 19 +++++-------------- + 1 file changed, 5 insertions(+), 14 deletions(-) + +diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c +index a787a6aefc69f..78f08ca3f8442 100644 +--- a/drivers/input/touchscreen/silead.c ++++ b/drivers/input/touchscreen/silead.c +@@ -78,7 +78,6 @@ struct silead_ts_data { + struct regulator_bulk_data regulators[2]; + char fw_name[64]; + struct touchscreen_properties prop; +- u32 max_fingers; + u32 chip_id; + struct input_mt_pos pos[SILEAD_MAX_FINGERS]; + int slots[SILEAD_MAX_FINGERS]; +@@ -106,7 +105,7 @@ static int silead_ts_request_input_dev(struct silead_ts_data *data) + input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0); + touchscreen_parse_properties(data->input, true, &data->prop); + +- input_mt_init_slots(data->input, data->max_fingers, ++ input_mt_init_slots(data->input, SILEAD_MAX_FINGERS, + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED | + INPUT_MT_TRACK); + +@@ -153,10 +152,10 @@ static void silead_ts_read_data(struct i2c_client *client) + return; + } + +- if (buf[0] > data->max_fingers) { ++ if (buf[0] > SILEAD_MAX_FINGERS) { + dev_warn(dev, "More touches reported then supported %d > %d\n", +- buf[0], data->max_fingers); +- buf[0] = data->max_fingers; ++ buf[0], SILEAD_MAX_FINGERS); ++ buf[0] = SILEAD_MAX_FINGERS; + } + + touch_nr = 0; +@@ -208,7 +207,6 @@ static void silead_ts_read_data(struct i2c_client *client) + + static int silead_ts_init(struct i2c_client *client) + { +- struct silead_ts_data *data = i2c_get_clientdata(client); + int error; + + error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET, +@@ -218,7 +216,7 @@ static int silead_ts_init(struct i2c_client *client) + usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); + + error = i2c_smbus_write_byte_data(client, SILEAD_REG_TOUCH_NR, +- data->max_fingers); ++ SILEAD_MAX_FINGERS); + if (error) + goto i2c_write_err; + usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX); +@@ -445,13 +443,6 @@ static void silead_ts_read_props(struct i2c_client *client) + const char *str; + int error; + +- error = device_property_read_u32(dev, "silead,max-fingers", +- &data->max_fingers); +- if (error) { +- dev_dbg(dev, "Max fingers read error %d\n", error); +- data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ +- } +- + error = device_property_read_string(dev, "firmware-name", &str); + if (!error) + snprintf(data->fw_name, sizeof(data->fw_name), +-- +2.43.0 + diff --git a/queue-4.19/kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch b/queue-4.19/kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch new file mode 100644 index 00000000000..8f594625ab3 --- /dev/null +++ b/queue-4.19/kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch @@ -0,0 +1,46 @@ +From 8ec6b3ff7937e9ff8035d33c56bd4996aae057c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 2 Jun 2024 03:20:40 +0900 +Subject: kconfig: gconf: give a proper initial state to the Save button + +From: Masahiro Yamada + +[ Upstream commit 46edf4372e336ef3a61c3126e49518099d2e2e6d ] + +Currently, the initial state of the "Save" button is always active. + +If none of the CONFIG options are changed while loading the .config +file, the "Save" button should be greyed out. + +This can be fixed by calling conf_read() after widget initialization. + +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + scripts/kconfig/gconf.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c +index 36f578415c4a6..5e0ea015394e9 100644 +--- a/scripts/kconfig/gconf.c ++++ b/scripts/kconfig/gconf.c +@@ -1485,7 +1485,6 @@ int main(int ac, char *av[]) + + conf_parse(name); + fixup_rootmenu(&rootmenu); +- conf_read(NULL); + + /* Load the interface and connect signals */ + init_main_window(glade_file); +@@ -1493,6 +1492,8 @@ int main(int ac, char *av[]) + init_left_tree(); + init_right_tree(); + ++ conf_read(NULL); ++ + switch (view_mode) { + case SINGLE_VIEW: + display_tree_part(); +-- +2.43.0 + diff --git a/queue-4.19/kconfig-remove-wrong-expr_trans_bool.patch b/queue-4.19/kconfig-remove-wrong-expr_trans_bool.patch new file mode 100644 index 00000000000..d50ac718686 --- /dev/null +++ b/queue-4.19/kconfig-remove-wrong-expr_trans_bool.patch @@ -0,0 +1,158 @@ +From cff920ddbe5e90b35ba144e3eacbbd24cd29d2f9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Jun 2024 01:19:04 +0900 +Subject: kconfig: remove wrong expr_trans_bool() + +From: Masahiro Yamada + +[ Upstream commit 77a92660d8fe8d29503fae768d9f5eb529c88b36 ] + +expr_trans_bool() performs an incorrect transformation. + +[Test Code] + + config MODULES + def_bool y + modules + + config A + def_bool y + select C if B != n + + config B + def_tristate m + + config C + tristate + +[Result] + + CONFIG_MODULES=y + CONFIG_A=y + CONFIG_B=m + CONFIG_C=m + +This output is incorrect because CONFIG_C=y is expected. + +Documentation/kbuild/kconfig-language.rst clearly explains the function +of the '!=' operator: + + If the values of both symbols are equal, it returns 'n', + otherwise 'y'. + +Therefore, the statement: + + select C if B != n + +should be equivalent to: + + select C if y + +Or, more simply: + + select C + +Hence, the symbol C should be selected by the value of A, which is 'y'. + +However, expr_trans_bool() wrongly transforms it to: + + select C if B + +Therefore, the symbol C is selected by (A && B), which is 'm'. + +The comment block of expr_trans_bool() correctly explains its intention: + + * bool FOO!=n => FOO + ^^^^ + +If FOO is bool, FOO!=n can be simplified into FOO. This is correct. + +However, the actual code performs this transformation when FOO is +tristate: + + if (e->left.sym->type == S_TRISTATE) { + ^^^^^^^^^^ + +While it can be fixed to S_BOOLEAN, there is no point in doing so +because expr_tranform() already transforms FOO!=n to FOO when FOO is +bool. (see the "case E_UNEQUAL" part) + +expr_trans_bool() is wrong and unnecessary. + +Signed-off-by: Masahiro Yamada +Acked-by: Randy Dunlap +Signed-off-by: Sasha Levin +--- + scripts/kconfig/expr.c | 29 ----------------------------- + scripts/kconfig/expr.h | 1 - + scripts/kconfig/menu.c | 2 -- + 3 files changed, 32 deletions(-) + +diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c +index 7e38070ee523b..1c69de8cacf6d 100644 +--- a/scripts/kconfig/expr.c ++++ b/scripts/kconfig/expr.c +@@ -395,35 +395,6 @@ static struct expr *expr_eliminate_yn(struct expr *e) + return e; + } + +-/* +- * bool FOO!=n => FOO +- */ +-struct expr *expr_trans_bool(struct expr *e) +-{ +- if (!e) +- return NULL; +- switch (e->type) { +- case E_AND: +- case E_OR: +- case E_NOT: +- e->left.expr = expr_trans_bool(e->left.expr); +- e->right.expr = expr_trans_bool(e->right.expr); +- break; +- case E_UNEQUAL: +- // FOO!=n -> FOO +- if (e->left.sym->type == S_TRISTATE) { +- if (e->right.sym == &symbol_no) { +- e->type = E_SYMBOL; +- e->right.sym = NULL; +- } +- } +- break; +- default: +- ; +- } +- return e; +-} +- + /* + * e1 || e2 -> ? + */ +diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h +index 43a87f8ea738c..968219750244a 100644 +--- a/scripts/kconfig/expr.h ++++ b/scripts/kconfig/expr.h +@@ -302,7 +302,6 @@ struct expr *expr_copy(const struct expr *org); + void expr_free(struct expr *e); + void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); + tristate expr_calc_value(struct expr *e); +-struct expr *expr_trans_bool(struct expr *e); + struct expr *expr_eliminate_dups(struct expr *e); + struct expr *expr_transform(struct expr *e); + int expr_contains_symbol(struct expr *dep, struct symbol *sym); +diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c +index 4cf15d449c05d..4d48ff3083bd8 100644 +--- a/scripts/kconfig/menu.c ++++ b/scripts/kconfig/menu.c +@@ -390,8 +390,6 @@ void menu_finalize(struct menu *parent) + dep = expr_transform(dep); + dep = expr_alloc_and(expr_copy(basedep), dep); + dep = expr_eliminate_dups(dep); +- if (menu->sym && menu->sym->type != S_TRISTATE) +- dep = expr_trans_bool(dep); + prop->visible.expr = dep; + + /* +-- +2.43.0 + diff --git a/queue-4.19/mei-demote-client-disconnect-warning-on-suspend-to-d.patch b/queue-4.19/mei-demote-client-disconnect-warning-on-suspend-to-d.patch new file mode 100644 index 00000000000..60503153f00 --- /dev/null +++ b/queue-4.19/mei-demote-client-disconnect-warning-on-suspend-to-d.patch @@ -0,0 +1,48 @@ +From 6ce6ed9a5b233784b4352165a00cbab47e62ab17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 May 2024 12:14:15 +0300 +Subject: mei: demote client disconnect warning on suspend to debug + +From: Alexander Usyskin + +[ Upstream commit 1db5322b7e6b58e1b304ce69a50e9dca798ca95b ] + +Change level for the "not connected" client message in the write +callback from error to debug. + +The MEI driver currently disconnects all clients upon system suspend. +This behavior is by design and user-space applications with +open connections before the suspend are expected to handle errors upon +resume, by reopening their handles, reconnecting, +and retrying their operations. + +However, the current driver implementation logs an error message every +time a write operation is attempted on a disconnected client. +Since this is a normal and expected flow after system resume +logging this as an error can be misleading. + +Signed-off-by: Alexander Usyskin +Signed-off-by: Tomas Winkler +Link: https://lore.kernel.org/r/20240530091415.725247-1-tomas.winkler@intel.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/mei/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c +index 87281b3695e60..e87c2b13c381e 100644 +--- a/drivers/misc/mei/main.c ++++ b/drivers/misc/mei/main.c +@@ -271,7 +271,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, + } + + if (!mei_cl_is_connected(cl)) { +- cl_err(dev, cl, "is not connected"); ++ cl_dbg(dev, cl, "is not connected"); + rets = -ENODEV; + goto out; + } +-- +2.43.0 + diff --git a/queue-4.19/net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch b/queue-4.19/net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch new file mode 100644 index 00000000000..b02e8b71a49 --- /dev/null +++ b/queue-4.19/net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch @@ -0,0 +1,51 @@ +From 3f019095f0ac398a8603dc13e318cdc1e0ffbcd8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 May 2024 16:07:39 +0800 +Subject: net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and + DEV_STATS_ADD() + +From: Yunshui Jiang + +[ Upstream commit b8ec0dc3845f6c9089573cb5c2c4b05f7fc10728 ] + +mac802154 devices update their dev->stats fields locklessly. Therefore +these counters should be updated atomically. Adopt SMP safe DEV_STATS_INC() +and DEV_STATS_ADD() to achieve this. + +Signed-off-by: Yunshui Jiang +Message-ID: <20240531080739.2608969-1-jiangyunshui@kylinos.cn> +Signed-off-by: Stefan Schmidt +Signed-off-by: Sasha Levin +--- + net/mac802154/tx.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c +index 2f873a0dc5836..0f192174a5693 100644 +--- a/net/mac802154/tx.c ++++ b/net/mac802154/tx.c +@@ -42,8 +42,8 @@ void ieee802154_xmit_worker(struct work_struct *work) + if (res) + goto err_tx; + +- dev->stats.tx_packets++; +- dev->stats.tx_bytes += skb->len; ++ DEV_STATS_INC(dev, tx_packets); ++ DEV_STATS_ADD(dev, tx_bytes, skb->len); + + ieee802154_xmit_complete(&local->hw, skb, false); + +@@ -94,8 +94,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) + goto err_tx; + } + +- dev->stats.tx_packets++; +- dev->stats.tx_bytes += len; ++ DEV_STATS_INC(dev, tx_packets); ++ DEV_STATS_ADD(dev, tx_bytes, len); + } else { + local->tx_skb = skb; + queue_work(local->workqueue, &local->tx_work); +-- +2.43.0 + diff --git a/queue-4.19/net-usb-qmi_wwan-add-telit-fn912-compositions.patch b/queue-4.19/net-usb-qmi_wwan-add-telit-fn912-compositions.patch new file mode 100644 index 00000000000..7a02621740e --- /dev/null +++ b/queue-4.19/net-usb-qmi_wwan-add-telit-fn912-compositions.patch @@ -0,0 +1,88 @@ +From 1eb57fa4f873d8d10352d77a00dd56d5b03c2358 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Jun 2024 12:22:36 +0200 +Subject: net: usb: qmi_wwan: add Telit FN912 compositions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Daniele Palmas + +[ Upstream commit 77453e2b015b5ced5b3f45364dd5a72dfc3bdecb ] + +Add the following Telit FN912 compositions: + +0x3000: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag) +T: Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#= 8 Spd=480 MxCh= 0 +D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1bc7 ProdID=3000 Rev=05.15 +S: Manufacturer=Telit Cinterion +S: Product=FN912 +S: SerialNumber=92c4c4d8 +C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA +I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +0x3001: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb +T: Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#= 7 Spd=480 MxCh= 0 +D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1bc7 ProdID=3001 Rev=05.15 +S: Manufacturer=Telit Cinterion +S: Product=FN912 +S: SerialNumber=92c4c4d8 +C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA +I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I: If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none) +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +Signed-off-by: Daniele Palmas +Acked-by: Bjørn Mork +Link: https://patch.msgid.link/20240625102236.69539-1-dnlplm@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 3e59b63b838f6..3c65549a8688a 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1337,6 +1337,8 @@ static const struct usb_device_id products[] = { + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */ ++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x3000, 0)}, /* Telit FN912 series */ ++ {QMI_QUIRK_SET_DTR(0x1bc7, 0x3001, 0)}, /* Telit FN912 series */ + {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)}, /* Telewell TW-3G HSPA+ */ + {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)}, /* Telewell TW-3G HSPA+ */ + {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ +-- +2.43.0 + diff --git a/queue-4.19/s390-sclp-fix-sclp_init-cleanup-on-failure.patch b/queue-4.19/s390-sclp-fix-sclp_init-cleanup-on-failure.patch new file mode 100644 index 00000000000..497fe3dde62 --- /dev/null +++ b/queue-4.19/s390-sclp-fix-sclp_init-cleanup-on-failure.patch @@ -0,0 +1,57 @@ +From 491dcbf42fd033cbd854bb198f4ade3d2d697556 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 14 Jun 2024 18:09:01 +0200 +Subject: s390/sclp: Fix sclp_init() cleanup on failure + +From: Heiko Carstens + +[ Upstream commit 6434b33faaa063df500af355ee6c3942e0f8d982 ] + +If sclp_init() fails it only partially cleans up: if there are multiple +failing calls to sclp_init() sclp_state_change_event will be added several +times to sclp_reg_list, which results in the following warning: + +------------[ cut here ]------------ +list_add double add: new=000003ffe1598c10, prev=000003ffe1598bf0, next=000003ffe1598c10. +WARNING: CPU: 0 PID: 1 at lib/list_debug.c:35 __list_add_valid_or_report+0xde/0xf8 +CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.10.0-rc3 +Krnl PSW : 0404c00180000000 000003ffe0d6076a (__list_add_valid_or_report+0xe2/0xf8) + R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3 +... +Call Trace: + [<000003ffe0d6076a>] __list_add_valid_or_report+0xe2/0xf8 +([<000003ffe0d60766>] __list_add_valid_or_report+0xde/0xf8) + [<000003ffe0a8d37e>] sclp_init+0x40e/0x450 + [<000003ffe00009f2>] do_one_initcall+0x42/0x1e0 + [<000003ffe15b77a6>] do_initcalls+0x126/0x150 + [<000003ffe15b7a0a>] kernel_init_freeable+0x1ba/0x1f8 + [<000003ffe0d6650e>] kernel_init+0x2e/0x180 + [<000003ffe000301c>] __ret_from_fork+0x3c/0x60 + [<000003ffe0d759ca>] ret_from_fork+0xa/0x30 + +Fix this by removing sclp_state_change_event from sclp_reg_list when +sclp_init() fails. + +Reviewed-by: Peter Oberparleiter +Signed-off-by: Heiko Carstens +Signed-off-by: Alexander Gordeev +Signed-off-by: Sasha Levin +--- + drivers/s390/char/sclp.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c +index e9aa71cdfc44e..74df353d2244c 100644 +--- a/drivers/s390/char/sclp.c ++++ b/drivers/s390/char/sclp.c +@@ -1206,6 +1206,7 @@ sclp_init(void) + fail_unregister_reboot_notifier: + unregister_reboot_notifier(&sclp_reboot_notifier); + fail_init_state_uninitialized: ++ list_del(&sclp_state_change_event.list); + sclp_init_state = sclp_init_state_uninitialized; + fail_unlock: + spin_unlock_irqrestore(&sclp_lock, flags); +-- +2.43.0 + diff --git a/queue-4.19/scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch b/queue-4.19/scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch new file mode 100644 index 00000000000..32d3b8a836e --- /dev/null +++ b/queue-4.19/scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch @@ -0,0 +1,35 @@ +From 847bea22b6273397793818f9b1d3b6a69eeef8cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 May 2024 14:41:01 +0530 +Subject: scsi: qedf: Set qed_slowpath_params to zero before use + +From: Saurav Kashyap + +[ Upstream commit 6c3bb589debd763dc4b94803ddf3c13b4fcca776 ] + +Zero qed_slowpath_params before use. + +Signed-off-by: Saurav Kashyap +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20240515091101.18754-4-skashyap@marvell.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedf/qedf_main.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c +index 01e27285b26ba..33fb0e1926831 100644 +--- a/drivers/scsi/qedf/qedf_main.c ++++ b/drivers/scsi/qedf/qedf_main.c +@@ -3101,6 +3101,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode) + } + + /* Start the Slowpath-process */ ++ memset(&slowpath_params, 0, sizeof(struct qed_slowpath_params)); + slowpath_params.int_mode = QED_INT_MODE_MSIX; + slowpath_params.drv_major = QEDF_DRIVER_MAJOR_VER; + slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER; +-- +2.43.0 + diff --git a/queue-4.19/selftests-vdso-fix-clang-build-errors-and-warnings.patch b/queue-4.19/selftests-vdso-fix-clang-build-errors-and-warnings.patch new file mode 100644 index 00000000000..8ca5a2cb7b5 --- /dev/null +++ b/queue-4.19/selftests-vdso-fix-clang-build-errors-and-warnings.patch @@ -0,0 +1,123 @@ +From 235fe442448c106131dafd508d7dc79ef22fd6fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Jul 2024 09:57:34 -1000 +Subject: selftests/vDSO: fix clang build errors and warnings + +From: John Hubbard + +[ Upstream commit 73810cd45b99c6c418e1c6a487b52c1e74edb20d ] + +When building with clang, via: + + make LLVM=1 -C tools/testing/selftests + +...there are several warnings, and an error. This fixes all of those and +allows these tests to run and pass. + +1. Fix linker error (undefined reference to memcpy) by providing a local + version of memcpy. + +2. clang complains about using this form: + + if (g = h & 0xf0000000) + +...so factor out the assignment into a separate step. + +3. The code is passing a signed const char* to elf_hash(), which expects + a const unsigned char *. There are several callers, so fix this at + the source by allowing the function to accept a signed argument, and + then converting to unsigned operations, once inside the function. + +4. clang doesn't have __attribute__((externally_visible)) and generates + a warning to that effect. Fortunately, gcc 12 and gcc 13 do not seem + to require that attribute in order to build, run and pass tests here, + so remove it. + +Reviewed-by: Carlos Llamas +Reviewed-by: Edward Liaw +Reviewed-by: Muhammad Usama Anjum +Tested-by: Muhammad Usama Anjum +Signed-off-by: John Hubbard +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/vDSO/parse_vdso.c | 16 +++++++++++----- + .../selftests/vDSO/vdso_standalone_test_x86.c | 18 ++++++++++++++++-- + 2 files changed, 27 insertions(+), 7 deletions(-) + +diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c +index 1dbb4b87268fa..9ef3ad3789c17 100644 +--- a/tools/testing/selftests/vDSO/parse_vdso.c ++++ b/tools/testing/selftests/vDSO/parse_vdso.c +@@ -77,14 +77,20 @@ static struct vdso_info + ELF(Verdef) *verdef; + } vdso_info; + +-/* Straight from the ELF specification. */ +-static unsigned long elf_hash(const unsigned char *name) ++/* ++ * Straight from the ELF specification...and then tweaked slightly, in order to ++ * avoid a few clang warnings. ++ */ ++static unsigned long elf_hash(const char *name) + { + unsigned long h = 0, g; +- while (*name) ++ const unsigned char *uch_name = (const unsigned char *)name; ++ ++ while (*uch_name) + { +- h = (h << 4) + *name++; +- if (g = h & 0xf0000000) ++ h = (h << 4) + *uch_name++; ++ g = h & 0xf0000000; ++ if (g) + h ^= g >> 24; + h &= ~g; + } +diff --git a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c +index 93b0ebf8cc38d..805e8c1892764 100644 +--- a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c ++++ b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c +@@ -20,7 +20,7 @@ extern void *vdso_sym(const char *version, const char *name); + extern void vdso_init_from_sysinfo_ehdr(uintptr_t base); + extern void vdso_init_from_auxv(void *auxv); + +-/* We need a libc functions... */ ++/* We need some libc functions... */ + int strcmp(const char *a, const char *b) + { + /* This implementation is buggy: it never returns -1. */ +@@ -36,6 +36,20 @@ int strcmp(const char *a, const char *b) + return 0; + } + ++/* ++ * The clang build needs this, although gcc does not. ++ * Stolen from lib/string.c. ++ */ ++void *memcpy(void *dest, const void *src, size_t count) ++{ ++ char *tmp = dest; ++ const char *s = src; ++ ++ while (count--) ++ *tmp++ = *s++; ++ return dest; ++} ++ + /* ...and two syscalls. This is x86-specific. */ + static inline long x86_syscall3(long nr, long a0, long a1, long a2) + { +@@ -72,7 +86,7 @@ void to_base10(char *lastdig, time_t n) + } + } + +-__attribute__((externally_visible)) void c_main(void **stack) ++void c_main(void **stack) + { + /* Parse the stack */ + long argc = (long)*stack; +-- +2.43.0 + diff --git a/queue-4.19/series b/queue-4.19/series index 17637ed2a37..507e4aa2bf1 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -1,2 +1,27 @@ gcc-plugins-rename-last_stmt-for-gcc-14.patch filelock-remove-locks-reliably-when-fcntl-close-race-is-detected.patch +scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch +acpi-ec-abort-address-space-access-upon-error.patch +acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch +wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch +wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch +input-silead-always-support-10-fingers.patch +ila-block-bh-in-ila_output.patch +kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch +kconfig-remove-wrong-expr_trans_bool.patch +fs-file-fix-the-check-in-find_next_fd.patch +mei-demote-client-disconnect-warning-on-suspend-to-d.patch +wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch +input-elantech-fix-touchpad-state-on-resume-for-leno.patch +bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch +can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch +gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch +s390-sclp-fix-sclp_init-cleanup-on-failure.patch +alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch +net-usb-qmi_wwan-add-telit-fn912-compositions.patch +net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch +bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch +fs-better-handle-deep-ancestor-chains-in-is_subdir.patch +spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch +selftests-vdso-fix-clang-build-errors-and-warnings.patch +hfsplus-fix-uninit-value-in-copy_name.patch diff --git a/queue-4.19/spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch b/queue-4.19/spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch new file mode 100644 index 00000000000..ba02ddf7ca5 --- /dev/null +++ b/queue-4.19/spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch @@ -0,0 +1,50 @@ +From 58a07f302897f2f99731b852e4cadc835b1187fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 May 2024 11:56:10 +0200 +Subject: spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit ce1dac560a74220f2e53845ec0723b562288aed4 ] + +While in commit 2dd33f9cec90 ("spi: imx: support DMA for imx35") it was +claimed that DMA works on i.MX25, i.MX31 and i.MX35 the respective +device trees don't add DMA channels. The Reference manuals of i.MX31 and +i.MX25 also don't mention the CSPI core being DMA capable. (I didn't +check the others.) + +Since commit e267a5b3ec59 ("spi: spi-imx: Use dev_err_probe for failed +DMA channel requests") this results in an error message + + spi_imx 43fa4000.spi: error -ENODEV: can't get the TX DMA channel! + +during boot. However that isn't fatal and the driver gets loaded just +fine, just without using DMA. + +Signed-off-by: Uwe Kleine-König +Link: https://patch.msgid.link/20240508095610.2146640-2-u.kleine-koenig@pengutronix.de +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-imx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c +index 0078cb365d8c2..adcd519c70b19 100644 +--- a/drivers/spi/spi-imx.c ++++ b/drivers/spi/spi-imx.c +@@ -968,7 +968,7 @@ static struct spi_imx_devtype_data imx35_cspi_devtype_data = { + .rx_available = mx31_rx_available, + .reset = mx31_reset, + .fifo_size = 8, +- .has_dmamode = true, ++ .has_dmamode = false, + .dynamic_burst = false, + .has_slavemode = false, + .devtype = IMX35_CSPI, +-- +2.43.0 + diff --git a/queue-4.19/wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch b/queue-4.19/wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch new file mode 100644 index 00000000000..537d728c115 --- /dev/null +++ b/queue-4.19/wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch @@ -0,0 +1,47 @@ +From 609aa27dd3c1dc3af7b4942e6fb23ff9779521f0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 May 2024 06:20:10 +0300 +Subject: wifi: cfg80211: wext: add extra SIOCSIWSCAN data check + +From: Dmitry Antipov + +[ Upstream commit 6ef09cdc5ba0f93826c09d810c141a8d103a80fc ] + +In 'cfg80211_wext_siwscan()', add extra check whether number of +channels passed via 'ioctl(sock, SIOCSIWSCAN, ...)' doesn't exceed +IW_MAX_FREQUENCIES and reject invalid request with -EINVAL otherwise. + +Reported-by: syzbot+253cd2d2491df77c93ac@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=253cd2d2491df77c93ac +Signed-off-by: Dmitry Antipov +Link: https://msgid.link/20240531032010.451295-1-dmantipov@yandex.ru +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/scan.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index dacb9ceee3efd..0dc27703443c8 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -1405,10 +1405,14 @@ int cfg80211_wext_siwscan(struct net_device *dev, + wiphy = &rdev->wiphy; + + /* Determine number of channels, needed to allocate creq */ +- if (wreq && wreq->num_channels) ++ if (wreq && wreq->num_channels) { ++ /* Passed from userspace so should be checked */ ++ if (unlikely(wreq->num_channels > IW_MAX_FREQUENCIES)) ++ return -EINVAL; + n_channels = wreq->num_channels; +- else ++ } else { + n_channels = ieee80211_get_num_supported_channels(wiphy); ++ } + + creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) + + n_channels * sizeof(void *), +-- +2.43.0 + diff --git a/queue-4.19/wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch b/queue-4.19/wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch new file mode 100644 index 00000000000..aa44815c921 --- /dev/null +++ b/queue-4.19/wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch @@ -0,0 +1,80 @@ +From 621ca0df27573dfb0380753ddf3e51424a30a034 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 May 2024 18:33:32 +0300 +Subject: wifi: mac80211: fix UBSAN noise in ieee80211_prep_hw_scan() + +From: Dmitry Antipov + +[ Upstream commit 92ecbb3ac6f3fe8ae9edf3226c76aa17b6800699 ] + +When testing the previous patch with CONFIG_UBSAN_BOUNDS, I've +noticed the following: + +UBSAN: array-index-out-of-bounds in net/mac80211/scan.c:372:4 +index 0 is out of range for type 'struct ieee80211_channel *[]' +CPU: 0 PID: 1435 Comm: wpa_supplicant Not tainted 6.9.0+ #1 +Hardware name: LENOVO 20UN005QRT/20UN005QRT <...BIOS details...> +Call Trace: + + dump_stack_lvl+0x2d/0x90 + __ubsan_handle_out_of_bounds+0xe7/0x140 + ? timerqueue_add+0x98/0xb0 + ieee80211_prep_hw_scan+0x2db/0x480 [mac80211] + ? __kmalloc+0xe1/0x470 + __ieee80211_start_scan+0x541/0x760 [mac80211] + rdev_scan+0x1f/0xe0 [cfg80211] + nl80211_trigger_scan+0x9b6/0xae0 [cfg80211] + ... + +Since '__ieee80211_start_scan()' leaves 'hw_scan_req->req.n_channels' +uninitialized, actual boundaries of 'hw_scan_req->req.channels' can't +be checked in 'ieee80211_prep_hw_scan()'. Although an initialization +of 'hw_scan_req->req.n_channels' introduces some confusion around +allocated vs. used VLA members, this shouldn't be a problem since +everything is correctly adjusted soon in 'ieee80211_prep_hw_scan()'. + +Cleanup 'kmalloc()' math in '__ieee80211_start_scan()' by using the +convenient 'struct_size()' as well. + +Signed-off-by: Dmitry Antipov +Link: https://msgid.link/20240517153332.18271-2-dmantipov@yandex.ru +[improve (imho) indentation a bit] +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/scan.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c +index e3d8be4feea50..76fb858dc890d 100644 +--- a/net/mac80211/scan.c ++++ b/net/mac80211/scan.c +@@ -652,15 +652,21 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, + local->hw_scan_ies_bufsize *= n_bands; + } + +- local->hw_scan_req = kmalloc( +- sizeof(*local->hw_scan_req) + +- req->n_channels * sizeof(req->channels[0]) + +- local->hw_scan_ies_bufsize, GFP_KERNEL); ++ local->hw_scan_req = kmalloc(struct_size(local->hw_scan_req, ++ req.channels, ++ req->n_channels) + ++ local->hw_scan_ies_bufsize, ++ GFP_KERNEL); + if (!local->hw_scan_req) + return -ENOMEM; + + local->hw_scan_req->req.ssids = req->ssids; + local->hw_scan_req->req.n_ssids = req->n_ssids; ++ /* None of the channels are actually set ++ * up but let UBSAN know the boundaries. ++ */ ++ local->hw_scan_req->req.n_channels = req->n_channels; ++ + ies = (u8 *)local->hw_scan_req + + sizeof(*local->hw_scan_req) + + req->n_channels * sizeof(req->channels[0]); +-- +2.43.0 + diff --git a/queue-4.19/wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch b/queue-4.19/wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch new file mode 100644 index 00000000000..d20b11f38d2 --- /dev/null +++ b/queue-4.19/wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch @@ -0,0 +1,53 @@ +From 89d00f684c8395130b9950ca29a2528cde03a353 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 May 2024 16:17:59 +0200 +Subject: wifi: mac80211: mesh: init nonpeer_pm to active by default in mesh + sdata + +From: Nicolas Escande + +[ Upstream commit 6f6291f09a322c1c1578badac8072d049363f4e6 ] + +With a ath9k device I can see that: + iw phy phy0 interface add mesh0 type mp + ip link set mesh0 up + iw dev mesh0 scan + +Will start a scan with the Power Management bit set in the Frame Control Field. +This is because we set this bit depending on the nonpeer_pm variable of the mesh +iface sdata and when there are no active links on the interface it remains to +NL80211_MESH_POWER_UNKNOWN. + +As soon as links starts to be established, it wil switch to +NL80211_MESH_POWER_ACTIVE as it is the value set by befault on the per sta +nonpeer_pm field. +As we want no power save by default, (as expressed with the per sta ini values), +lets init it to the expected default value of NL80211_MESH_POWER_ACTIVE. + +Also please note that we cannot change the default value from userspace prior to +establishing a link as using NL80211_CMD_SET_MESH_CONFIG will not work before +NL80211_CMD_JOIN_MESH has been issued. So too late for our initial scan. + +Signed-off-by: Nicolas Escande +Link: https://msgid.link/20240527141759.299411-1-nico.escande@gmail.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/mesh.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c +index 3162f955f3ae2..c9a5271d9b59d 100644 +--- a/net/mac80211/mesh.c ++++ b/net/mac80211/mesh.c +@@ -1454,6 +1454,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) + ifmsh->last_preq = jiffies; + ifmsh->next_perr = jiffies; + ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE; ++ ifmsh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE; + /* Allocate all mesh structures when creating the first mesh interface. */ + if (!mesh_allocated) + ieee80211s_init(); +-- +2.43.0 +