6.6.163-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 2735/3318 mailbox: qcom-ipcc: remove stray disable_irq_wake() call
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anup Vishwakarma <[email protected]>
[ Upstream commit 134ef0278d4e48bcc325a7699250dfe861c11953 ]
Commit afaf2ba5b430 ("mailbox: qcom-ipcc: Support interrupt wake up from suspend") replaced enable_irq_wake() with IRQF_NO_SUSPEND on the IRQ request, but left the paired disable_irq_wake() in remove() behind.
disable_irq_wake() decrements the IRQ's wake_depth. With no matching enable_irq_wake() left to increment it, wake_depth stays at 0 and irq_set_irq_wake() reports:
WARN(1, "Unbalanced IRQ %d wake disable\n", irq)
on every unbind. Since there is no enable_irq_wake() to pair it with, remove the stray disable_irq_wake() call; IRQF_NO_SUSPEND already provides the intended wake behaviour.
--- drivers/mailbox/qcom-ipcc.c | 1 - 1 file changed, 1 deletion(-)
drivers/mailbox/qcom-ipcc.c +0 -1
@@ -341,7 +341,6 @@ static int qcom_ipcc_remove(struct platform_device *pdev) {struct qcom_ipcc *ipcc =platform_get_drvdata (pdev); -disable_irq_wake (ipcc->irq);irq_domain_remove (ipcc->irq_domain);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2736/3318 RDMA/mlx5: Cancel deferred page-fault EQ work before teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathamesh Deshpande <[email protected]>
[ Upstream commit aea64024ac37d29e99b82b315a56a9145dc0bc23 ]
Page-fault EQ work can remain queued after the notifier is disabled. Destroying the EQ before cancelling that work can let the worker access freed EQ memory.
Cancel the deferred work before destroying the EQ.
--- drivers/infiniband/hw/mlx5/odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/odp.c +1 -1
@@ -1598,8 +1598,8 @@ mlx5_ib_odp_destroy_eq(struct mlx5_ib_dev *dev, struct mlx5_ib_pf_eq *eq)if (!eq->core)return 0 ;mlx5_eq_disable (dev->mdev, eq->core, &eq->irq_nb); - err =mlx5_eq_destroy_generic (dev->mdev, eq->core);cancel_work_sync (&eq->work); + err =mlx5_eq_destroy_generic (dev->mdev, eq->core);destroy_workqueue (eq->wq);mempool_destroy (eq->pool);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2737/3318 RDMA/mlx5: Support driver APIs pre_destroy_cq and post_destroy_cq
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Zhang <[email protected]>
[ Upstream commit b5eeb8365d196c95dbb0fd0a5b5a69a44832f16f ]
- pre_destroy_cq: Destroy FW CQ object so that no new CQ event would
be generated;
- post_destroy_cq: Release all resources.
This patch, along with last one, fixes the crash below.
Unable to handle kernel paging request at virtual address ffff8000114b1180 Mem abort info: ESR = 0x96000047 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x00000047 CM = 0, WnR = 1 swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000f4582000 [ffff8000114b1180] pgd=00000447fffff003, p4d=00000447fffff003, pud=00000447ffffe003, pmd=00000447ffffb003, pte=0000000000000000 Internal error: Oops: 96000047 [#1] SMP Modules linked in: udp_diag uio_pci_generic uio tcp_diag inet_diag binfmt_misc sn_core_odd(OE) rpcrdma(OE) xprtrdma(OE) ib_isert(OE) ib_iser(OE) ib_srpt(OE) ib_srp(OE) ib_ipoib(OE) kpatch_9658536(OK) kpatch_9322385(OK) kpatch_8843421(OK) kpatch_8636216(OK) vfat fat aes_ce_blk crypto_simd cryptd aes_ce_cipher crct10dif_ce ghash_ce sm4_ce sha2_ce sha256_arm64 sha1_ce sbsa_gwdt sg acpi_ipmi ipmi_si ipmi_msghandler m1_uncore_ddrss_pmu m1_uncore_cmn_pmu team_yosemite9rc6(OE) vnic(OE) ip_tables mlx5_ib(OE) sd_mod ast mlx5_core(OE) i2c_algo_bit drm_vram_helper psample drm_kms_helper mlxdevm(OE) auxiliary(OE) mlxfw(OE) syscopyarea sysfillrect tls sysimgblt fb_sys_fops drm_ttm_helper nvme ttm nvme_core drm t10_pi i2c_designware_platform i2c_designware_core i2c_core ahci libahci libata rdma_ucm(OE) ib_uverbs(OE) rdma_cm(OE) iw_cm(OE) ib_cm(OE) ib_umad(OE) ib_core(OE) ib_ucm(OE) mlx_compat(OE) [last unloaded: ipmi_devintf] CPU: 83 PID: 59375 Comm: kworker/u253:1 Kdump: loaded Tainted: G OE K 5.10.84-004.ali5000.alios7.aarch64 #1 Hardware name: Inspur AliServer-Xuanwu2.0AM-02-2UM1P-5B/AS1221MG1, BIOS 1.2.M1.AL.P.158.00 08/31/2023 Workqueue: ib-comp-unb-wq ib_cq_poll_work [ib_core] pstate: 82c00089 (Nzcv daIf +PAN +UAO +TCO BTYPE=--) pc : native_queued_spin_lock_slowpath+0x1c4/0x31c lr : mlx5_ib_poll_cq+0x18c/0x2f8 [mlx5_ib] sp : ffff80002be1bc80 x29: ffff80002be1bc80 x28: ffff000810e69000 x27: ffff000810e69000 x26: ffff000810e69200 x25: 0000000000000000 x24: ffff8000117db000 x23: ffff04000156b780 x22: 0000000000000000 x21: ffff04000ce6c160 x20: ffff0008196a4000 x19: 0000000000000010 x18: 0000000000000020 x17: 0000000000000000 x16: 0000000000000000 x15: ffff040055a364e8 x14: ffffffffffffffff x13: ffff80002318bda8 x12: ffff0400358836e8 x11: 0000000000000040 x10: 0000000000000eb0 x9 : 0000000000000000 x8 : 0000000000000000 x7 : ffff04477fa20140 x6 : ffff8000114b1140 x5 : ffff04477fa20140 x4 : ffff8000114b1180 x3 : ffff000810e69200 x2 : ffff8000114b1180 x1 : 0000000001500000 x0 : ffff04477fa20148 Call trace: native_queued_spin_lock_slowpath+0x1c4/0x31c __ib_process_cq+0x74/0x1b8 [ib_core] ib_cq_poll_work+0x34/0xa0 [ib_core] process_one_work+0x1d8/0x4b0 worker_thread+0x180/0x440 kthread+0x114/0x120 Code: 910020e0 8b0400c4 f862d929 aa0403e2 (f8296847) ---[ end trace 387be2290557729c ]--- Kernel panic - not syncing: Oops: Fatal exception SMP: stopping secondary CPUs Kernel Offset: disabled CPU features: 0x9850817,7a60aa38 Memory Limit: none Starting crashdump kernel... Bye!
Stable-dep-of: a0ab2bb269e7 ("RDMA/mlx5: Cancel software CQ notifications before teardown")
--- drivers/infiniband/hw/mlx5/cq.c | 19 +++++++++++++++---- drivers/infiniband/hw/mlx5/main.c | 2 ++ drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/cq.c +15 -4
@@ -1050,20 +1050,31 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,return err; } -int mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +int mlx5_ib_pre_destroy_cq (struct ib_cq *cq) {struct mlx5_ib_dev *dev =to_mdev (cq->device);struct mlx5_ib_cq *mcq =to_mcq (cq); + +return mlx5_core_destroy_cq (dev->mdev, &mcq->mcq); +} + +void mlx5_ib_post_destroy_cq (struct ib_cq *cq) +{ +destroy_cq_kernel (to_mdev (cq->device),to_mcq (cq)); +} + +int mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata) +{int ret; - ret =mlx5_core_destroy_cq (dev->mdev, &mcq->mcq); + ret =mlx5_ib_pre_destroy_cq (cq);if (ret)return ret;if (udata) -destroy_cq_user (mcq, udata); +destroy_cq_user (to_mcq (cq), udata);else -destroy_cq_kernel (dev, mcq); +mlx5_ib_post_destroy_cq (cq);return 0 ; }
drivers/infiniband/hw/mlx5/main.c +2 -0
@@ -3956,7 +3956,9 @@ static const struct ib_device_ops mlx5_ib_dev_ops = { .modify_port = mlx5_ib_modify_port, .modify_qp = mlx5_ib_modify_qp, .modify_srq = mlx5_ib_modify_srq, + .pre_destroy_cq = mlx5_ib_pre_destroy_cq, .poll_cq = mlx5_ib_poll_cq, + .post_destroy_cq = mlx5_ib_post_destroy_cq, .post_recv = mlx5_ib_post_recv_nodrain, .post_send = mlx5_ib_post_send_nodrain, .post_srq_recv = mlx5_ib_post_srq_recv,
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -0
@@ -1319,6 +1319,8 @@ int mlx5_ib_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, struct ib_udata *udata);int mlx5_ib_destroy_cq (struct ib_cq *cq,struct ib_udata *udata);int mlx5_ib_poll_cq (struct ib_cq *ibcq,int num_entries,struct ib_wc *wc); +int mlx5_ib_pre_destroy_cq (struct ib_cq *cq); +void mlx5_ib_post_destroy_cq (struct ib_cq *cq);int mlx5_ib_arm_cq (struct ib_cq *ibcq,enum ib_cq_notify_flags flags);int mlx5_ib_modify_cq (struct ib_cq *cq,u16 cq_count,u16 cq_period);int mlx5_ib_resize_cq (struct ib_cq *ibcq,int entries,struct ib_udata *udata);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2738/3318 RDMA/mlx5: Cancel software CQ notifications before teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prathamesh Deshpande <[email protected]>
[ Upstream commit a0ab2bb269e7fd8523f87950b91a42a36c7f8f2a ]
GSI completions queue notify_work to invoke the CQ completion handler. CQ destruction drains hardware events and core polling, but does not cancel this software notifier.
--- drivers/infiniband/hw/mlx5/cq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/mlx5/cq.c +3 -0
@@ -1055,6 +1055,9 @@ int mlx5_ib_pre_destroy_cq(struct ib_cq *cq)struct mlx5_ib_dev *dev =to_mdev (cq->device);struct mlx5_ib_cq *mcq =to_mcq (cq); +if (!cq->uobject) +cancel_work_sync (&mcq->notify_work); +return mlx5_core_destroy_cq (dev->mdev, &mcq->mcq); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2739/3318 bpftool: Fix out-of-bounds read in kprobe_multi link info dump
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit 0d5e3fc78a6f2522e6339743b8e5ecc02351a9dd ]
show_kprobe_multi_{plain,json}() walk the sorted kallsyms array against the sorted addr/cookie array with j as a cursor into the latter. The loop terminating condition is checked after the cursor has already been used to access the array:
if (j++ == info->kprobe_multi.count)
break;After all count entries have been printed, j has been bumped to count, but the loop keeps running and dereferences data[count] -- one element past the end of the calloc(count, sizeof(*data)) allocation -- while comparing every remaining kallsyms symbol. If the out-of-bounds value happens to match a symbol address, a bogus entry with a garbage addr/cookie pair is printed to boot.
Fix the off-by-one by advancing the cursor before the comparison, so the loop terminates as soon as the last entry has been printed.
Verified with an ASAN build of bpftool against a live kprobe_multi link of 3 symbols:
before: ERROR: AddressSanitizer: heap-buffer-overflow READ of size 8
at link.c:860 (show_kprobe_multi_plain) and link.c:352 (show_kprobe_multi_json), 0 bytes after the 48-byte get_addr_cookie_array() allocation
after: clean output, no ASAN report
--- tools/bpf/bpftool/link.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/bpf/bpftool/link.c +2 -2
@@ -287,7 +287,7 @@ show_kprobe_multi_json(struct bpf_link_info *info, json_writer_t *wtr)jsonw_string_field (json_wtr,"module" , dd.sym_mapping[i].module); }jsonw_end_object (json_wtr); -if (j++ == info->kprobe_multi.count) +if (++j == info->kprobe_multi.count)break ; }jsonw_end_array (json_wtr);
@@ -695,7 +695,7 @@ static void show_kprobe_multi_plain(struct bpf_link_info *info)else printf (" " ); -if (j++ == info->kprobe_multi.count) +if (++j == info->kprobe_multi.count)break ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2740/3318 dm-snapshot: make the chunk list sorted by the chunk number
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
[ Upstream commit bbd6f974d0386036e560af332b6b8cdd17010a72 ]
Commit 8581b19eb2c5 ("dm-snapshot: fix 'scheduling while atomic' on real-time kernels") replaced hlist_bl_for_each_entry with hlist_for_each_entry, but the two iteration macros differ after the loop
ends: hlist_bl_for_each_entry leaves "e" pointing at the last element, while hlist_for_each_entry() sets it to NULL.
The result is that the list is no longer sorted by chunk number as it was intended to be. This bug doesn't cause data corruption because dm_lookup_exception walks the full list.
Restore the invariant by tracking the list tail in the "prev" variable and appending after it with hlist_add_behind.
--- drivers/md/dm-snap.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/md/dm-snap.c +10 -8
@@ -770,7 +770,7 @@ static void dm_insert_exception(struct dm_exception_table *eh, struct dm_exception *new_e) {struct hlist_head *l; -struct dm_exception *e =NULL ; +struct dm_exception *e =NULL , *prev =NULL ; l = &eh->table[exception_hash (eh, new_e->old_chunk)].head;
@@ -802,21 +802,23 @@ static void dm_insert_exception(struct dm_exception_table *eh,if (new_e->old_chunk < e->old_chunk)break ; + + prev = e; } out: -if (!e) { +if (e && new_e->old_chunk < e->old_chunk) { +/* Add before an existing exception */ +hlist_add_before (&new_e->hash_list, &e->hash_list); + }else if (prev) { +/* Add to l's tail: prev is the last exception in this slot */ +hlist_add_behind (&new_e->hash_list, &prev->hash_list); + }else {/* * Either the table doesn't support consecutive chunks or slot * l is empty. */ hlist_add_head (&new_e->hash_list, l); - }else if (new_e->old_chunk < e->old_chunk) { -/* Add before an existing exception */ -hlist_add_before (&new_e->hash_list, &e->hash_list); - }else { -/* Add to l's tail: e is the last exception in this slot */ -hlist_add_behind (&new_e->hash_list, &e->hash_list); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2741/3318 drm/panfrost: Explicitly enable MMU interrupts at device init
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrián Larumbe <[email protected]>
[ Upstream commit 8a597d099b8b2f25df655cbe8e30765013784fed ]
Because the device must be in a position to accept jobs between the time drm_dev_register() is called and autosuspend first kicks in, there's a very narrow window inbetween during which jobs targeting the tiler buffer object would time out, since the device's PM status is 'Active', but no MMU interrupts were enabled at device initialisation time.
--- drivers/gpu/drm/panfrost/panfrost_mmu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/panfrost/panfrost_mmu.c +9 -2
@@ -227,6 +227,12 @@ void panfrost_mmu_as_put(struct panfrost_device *pfdev, struct panfrost_mmu *mmuWARN_ON (atomic_read (&mmu->as_count) <0 ); } +static void panfrost_mmu_enable_interrupts (struct panfrost_device *pfdev) +{ +mmu_write (pfdev,MMU_INT_CLEAR , ~0 ); +mmu_write (pfdev,MMU_INT_MASK , ~0 ); +} +void panfrost_mmu_reset (struct panfrost_device *pfdev) {struct panfrost_mmu *mmu, *mmu_tmp;
@@ -244,8 +250,7 @@ void panfrost_mmu_reset(struct panfrost_device *pfdev)spin_unlock (&pfdev->as_lock); -mmu_write (pfdev,MMU_INT_CLEAR , ~0 ); -mmu_write (pfdev,MMU_INT_MASK , ~0 ); +panfrost_mmu_enable_interrupts (pfdev); }static size_t get_pgsize (u64 addr,size_t size,size_t *count)
@@ -774,6 +779,8 @@ int panfrost_mmu_init(struct panfrost_device *pfdev)return err; } +panfrost_mmu_enable_interrupts (pfdev); +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2742/3318 ACPI: PCI: pci_link: clear driver_data before free
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 691c33289b4d7a50b6fe1e03918bfbc21d4641c5 ]
acpi_pci_link_remove() frees the link object without clearing the ACPI device's driver_data pointer. The ACPI device survives hot-removal and can later be retrieved by acpi_fetch_acpi_dev(), leaving callers with a dangling pointer.
Clear driver_data before freeing the link.
--- drivers/acpi/pci_link.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/pci_link.c +1 -0
@@ -778,6 +778,7 @@ static void acpi_pci_link_remove(struct acpi_device *device)list_del (&link->list);mutex_unlock (&acpi_link_lock); + device->driver_data =NULL ;kfree (link); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2743/3318 block: use iomap_dirty_folio for block devices
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tal Zussman <[email protected]>
[ Upstream commit be1e33eda3e6699e57ed3fe6e34078f115b4a1ec ]
With CONFIG_BUFFER_HEAD=n, block devices are written back through iomap, but def_blk_aops uses filemap_dirty_folio, which only sets PG_dirty. It does not set the per-block dirty bits in the folio's iomap_folio_state, so iomap_writeback_folio() finds no dirty range, submits no I/O and clears PG_dirty, resulting in data loss.
Other iomap users set .dirty_folio to iomap_dirty_folio, which marks the folio's blocks dirty before calling filemap_dirty_folio().
This is only observable with block size < folio size. With a single block there is no iomap_folio_state to get out of sync and iomap_writeback_folio() marks the whole folio dirty itself. For a page-aligned device, this may require using the BLKBSZSET ioctl to set the block size, which requires CAP_SYS_ADMIN. A device whose size is not page aligned already gets a sub-page block size from set_init_blocksize(), so no ioctl and no privilege is needed.
To reproduce, on a device with a sub-page block size, write a known pattern with O_DIRECT, mmap the same range, store to it, msync() and fsync(), then read it back with O_DIRECT. A reproducer is available at [1].
[1] https://gist.github.com/tzussman/18ab05cba4b3fdc79cce0a69d1fd05b4
--- block/fops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/fops.c +1 -1
@@ -493,7 +493,7 @@ static int blkdev_writepages(struct address_space *mapping, }const struct address_space_operations def_blk_aops = { - .dirty_folio = filemap_dirty_folio, + .dirty_folio = iomap_dirty_folio, .release_folio = iomap_release_folio, .invalidate_folio = iomap_invalidate_folio, .read_folio = blkdev_read_folio,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2744/3318 block: honor IOCB_NOWAIT in the block device buffered read path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tal Zussman <[email protected]>
[ Upstream commit d16519a561f4ccc2cebbf52831435833cac1fec6 ]
blkdev_read_iter() takes inode_lock_shared() unconditionally around filemap_read(). Unlike blkdev_write_iter(), it does not reject IOCB_NOWAIT for buffered I/O, so a non-blocking read, or the buffered tail of a short IOCB_NOWAIT direct read, blocks behind set_blocksize() holding i_rwsem across sync_blockdev().
A preadv2(RWF_NOWAIT) issued while another thread changes the block size with a dirty page cache blocks for as long as sync_blockdev() takes, 4 to 6 seconds on a scsi_debug device with delay=5.
Use inode_trylock_shared() for IOCB_NOWAIT and return the bytes the direct path already read, or -EAGAIN if none, when the lock is contended, preserving NOWAIT semantics.
--- block/fops.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
block/fops.c +9 -1
@@ -740,7 +740,15 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)* Take i_rwsem and invalidate_lock to avoid racing with set_blocksize * changing i_blkbits/folio order and punching out the pagecache. */ -inode_lock_shared (bd_inode); +if (iocb->ki_flags &IOCB_NOWAIT ) { +if (!inode_trylock_shared (bd_inode)) { +if (!ret) + ret = -EAGAIN ; + goto reexpand; + } + }else { +inode_lock_shared (bd_inode); + } ret =filemap_read (iocb, to, ret);inode_unlock_shared (bd_inode);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2745/3318 btrfs: convert read_key_bytes() to take a folio
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zetao <[email protected]>
[ Upstream commit 884937793db595928961397dd3ec2287b40371c6 ]
The old page API is being gradually replaced and converted to use folio to improve code readability and avoid repeated conversion between page and folio. Moreover, use kmap_local_folio() instead of kmap_local_page(), which is more consistent with folio usage.
Stable-dep-of: fdf56b9d03d4 ("btrfs: refactor read_key_bytes() to remove the dest_folio parameter")
--- fs/btrfs/verity.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/verity.c +7 -7
@@ -285,7 +285,7 @@ static int write_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,* page and ignore dest, but it must still be non-NULL to avoid the * counting-only behavior. * @len: length in bytes to read -* @dest_page: copy into this page instead of the dest buffer +* @dest_folio: copy into this folio instead of the dest buffer * * Helper function to read items from the btree. This returns the number of * bytes read or < 0 for errors. We can return short reads if the items don't
@@ -295,7 +295,7 @@ static int write_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,* Returns number of bytes read or a negative error code on failure. */ static int read_key_bytes (struct btrfs_inode *inode,u8 key_type,u64 offset, -char *dest,u64 len,struct page *dest_page) +char *dest,u64 len,struct folio *dest_folio) {struct btrfs_path *path;struct btrfs_root *root = inode->root;
@@ -315,7 +315,7 @@ static int read_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,if (!path)return -ENOMEM ; -if (dest_page) +if (dest_folio) path->reada =READA_FORWARD ; key.objectid =btrfs_ino (inode);
@@ -372,15 +372,15 @@ static int read_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset, copy_offset = offset - key.offset;if (dest) { -if (dest_page) - kaddr =kmap_local_page (dest_page); +if (dest_folio) + kaddr =kmap_local_folio (dest_folio,0 ); data =btrfs_item_ptr (leaf, path->slots[0 ], void);read_extent_buffer (leaf, kaddr + dest_offset, (unsigned long )data + copy_offset, copy_bytes); -if (dest_page) +if (dest_folio)kunmap_local (kaddr); }
@@ -768,7 +768,7 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode,* [ inode objectid, BTRFS_MERKLE_ITEM_KEY, offset in bytes ] */ ret =read_key_bytes (BTRFS_I (inode),BTRFS_VERITY_MERKLE_ITEM_KEY , off, -folio_address (folio),PAGE_SIZE , &folio->page); +folio_address (folio),PAGE_SIZE , folio);if (ret <0 ) {folio_unlock (folio);folio_put (folio);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2746/3318 btrfs: refactor read_key_bytes() to remove the dest_folio parameter
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit fdf56b9d03d475881d73b75afbdbe4058db04ffc ]
The function read_key_bytes() have 3 call sites:
- For BTRFS_VERITY_DESC_ITEM_KEY offset 0 inside btrfs_get_verity_descriptor()
- For BTRFS_VERITY_DESC_ITEM_KEY offset 1 inside btrfs_get_verity_descriptor() Those are to read the description items, which are pretty small with fixed item size.
Those call sites do not utilize the @dest_folio parameter.
- For btrfs_read_merkle_tree_page()
This is to read the BTRFS_VERITY_MERKLE_ITEM_KEY, which can be pretty large and split into multiple items.
This is the only call site utilizing the @dest_folio parameter.
Just for the only btrfs_read_merkle_tree_page() call site, we have a complex scheme for @dest and @dest_folio parameters.
Since @dest can be NULL, it means if we pass @dest as NULL, then no matter if @dest_folio is provided, the merkle data will not be loaded into that @dest_folio.
This can lead to a bug where a highmem folio is not mapped, then we pass folio_address(folio), which is NULL, into read_key_bytes(), causing no data to be written into @dest_folio.
To address the complex scheme between @dest and @dest_folio, remove the @dest_folio parameter completely, and let the only caller to map the folio and pass the mapped kernel address into read_key_bytes() instead.
This not only reduces the parameter list, but also make it much clear on the @dest parameter handling.
The only downside is a longer duration of locally mapped page, but this should still be fine, as kmap_local_folio() can survive context switch.
--- fs/btrfs/verity.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
fs/btrfs/verity.c +14 -17
@@ -281,21 +281,17 @@ static int write_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,* @dest: Buffer to read into. This parameter has slightly tricky * semantics. If it is NULL, the function will not do any copying * and will just return the size of all the items up to len bytes. -* If dest_page is passed, then the function will kmap_local the -* page and ignore dest, but it must still be non-NULL to avoid the -* counting-only behavior. * @len: length in bytes to read -* @dest_folio: copy into this folio instead of the dest buffer * * Helper function to read items from the btree. This returns the number of * bytes read or < 0 for errors. We can return short reads if the items don't * exist on disk or aren't big enough to fill the desired length. Supports -* reading into a provided buffer (dest) or into the page cache +* reading into a provided buffer (dest). * * Returns number of bytes read or a negative error code on failure. */ static int read_key_bytes (struct btrfs_inode *inode,u8 key_type,u64 offset, -char *dest,u64 len,struct folio *dest_folio) +char *dest,u64 len) {struct btrfs_path *path;struct btrfs_root *root = inode->root;
@@ -315,7 +311,11 @@ static int read_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,if (!path)return -ENOMEM ; -if (dest_folio) +/* +* Merkle items can be large and split across multiple items, so enable +* readahead for such cases. +*/ +if (key_type ==BTRFS_VERITY_MERKLE_ITEM_KEY ) path->reada =READA_FORWARD ; key.objectid =btrfs_ino (inode);
@@ -359,7 +359,7 @@ static int read_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset,break ; } -/* desc = NULL to just sum all the item lengths */ +/* dest == NULL to just sum all the item lengths */ if (!dest) copy_end = item_end;else
@@ -372,16 +372,10 @@ static int read_key_bytes(struct btrfs_inode *inode, u8 key_type, u64 offset, copy_offset = offset - key.offset;if (dest) { -if (dest_folio) - kaddr =kmap_local_folio (dest_folio,0 ); - data =btrfs_item_ptr (leaf, path->slots[0 ], void);read_extent_buffer (leaf, kaddr + dest_offset, (unsigned long )data + copy_offset, copy_bytes); - -if (dest_folio) -kunmap_local (kaddr); } offset += copy_bytes;
@@ -673,7 +667,7 @@ int btrfs_get_verity_descriptor(struct inode *inode, void *buf, size_t buf_size)memset (&item,0 ,sizeof (item)); ret =read_key_bytes (BTRFS_I (inode),BTRFS_VERITY_DESC_ITEM_KEY ,0 , - (char *)&item,sizeof (item),NULL ); + (char *)&item,sizeof (item));if (ret <0 )return ret;
@@ -690,7 +684,7 @@ int btrfs_get_verity_descriptor(struct inode *inode, void *buf, size_t buf_size)return -ERANGE ; ret =read_key_bytes (BTRFS_I (inode),BTRFS_VERITY_DESC_ITEM_KEY ,1 , - buf, buf_size,NULL ); + buf, buf_size);if (ret <0 )return ret;if (ret != true_size)
@@ -718,6 +712,7 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode,struct folio *folio;u64 off = (u64 )index <<PAGE_SHIFT ;loff_t merkle_pos =merkle_file_pos (inode); +void *kaddr;int ret;if (merkle_pos <0 )
@@ -761,6 +756,7 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode, } read_folio: + kaddr =kmap_local_folio (folio,0 );/* * Merkle item keys are indexed from byte 0 in the merkle tree. * They have the form:
@@ -768,7 +764,8 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode,* [ inode objectid, BTRFS_MERKLE_ITEM_KEY, offset in bytes ] */ ret =read_key_bytes (BTRFS_I (inode),BTRFS_VERITY_MERKLE_ITEM_KEY , off, -folio_address (folio),PAGE_SIZE , folio); + kaddr,PAGE_SIZE ); +kunmap_local (kaddr);if (ret <0 ) {folio_unlock (folio);folio_put (folio);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2747/3318 btrfs: fix off by one super block end offset calculation when writing super blocks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 7884a8f3279c28ff990e2eacd5c2479bb1c930d0 ]
We are skipping the write of a super block mirror if its end offset matches exactly the device's end offset. This happens because we are using a greater than or equals comparison instead of just a greater than comparison.
--- fs/btrfs/disk-io.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/btrfs/disk-io.c +2 -4
@@ -3784,8 +3784,7 @@ static int write_dev_supers(struct btrfs_device *device, errors++;continue ; } -if (bytenr +BTRFS_SUPER_INFO_SIZE >= - device->commit_total_bytes) +if (bytenr +BTRFS_SUPER_INFO_SIZE > device->commit_total_bytes)break ;btrfs_set_super_bytenr (sb, bytenr_orig);
@@ -3871,8 +3870,7 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors) primary_failed = true;continue ; } -if (bytenr +BTRFS_SUPER_INFO_SIZE >= - device->commit_total_bytes) +if (bytenr +BTRFS_SUPER_INFO_SIZE > device->commit_total_bytes)break ; page = find_get_page(device->bdev->bd_inode->i_mapping,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2748/3318 btrfs: fix dangling nodes in tree-mod-log after error in btrfs_tree_mod_log_insert_root()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 057e3c350a9185df598c88b4081168ed047c9247 ]
If in btrfs_tree_mod_log_insert_root() there is an error in the call to tree_mod_log_insert() (the only possible error is -EEXIST, which means we have a bug or some memory corruption maybe) we free all the nodes in the 'tm_list' array but we don't remove them from the tree-mod-log rbtree, which can result in use-after-free bugs later.
So make sure we remove the nodes from the rbtree before freeing them after an error.
--- fs/btrfs/tree-mod-log.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/btrfs/tree-mod-log.c +10 -3
@@ -447,10 +447,17 @@ int btrfs_tree_mod_log_insert_root(struct extent_buffer *old_root, goto out_unlock; } -if (tm_list) +if (tm_list) { ret =tree_mod_log_free_eb (fs_info, tm_list, nritems); -if (!ret) - ret =tree_mod_log_insert (fs_info, tm); +if (ret) + goto out_unlock; + } + + ret =tree_mod_log_insert (fs_info, tm); +if (ret && tm_list) { +for (i =0 ; i < nritems; i++) +rb_erase (&tm_list[i]->node, &fs_info->tree_mod_log); + } out_unlock:write_unlock (&fs_info->tree_mod_log_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2749/3318 btrfs: zoned: fix double list add in btrfs_load_block_group_zone_info
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Thumshirn <[email protected]>
[ Upstream commit 9bdef63e2b5d4a88810329a1cab3642d6378a895 ]
For DUP and RAID profiles with zones in a mismatching active state, i.e. due to one of the zones of the block-group being on a conventional zone, btrfs_zone_activate() has already put the block group on the list.
This leads to a double list add and refcounting problems.
--- fs/btrfs/zoned.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/btrfs/zoned.c +5 -3
@@ -1575,10 +1575,12 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new)if (!ret) { cache->meta_write_pointer = cache->alloc_offset + cache->start;if (test_bit (BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE , &cache->runtime_flags)) { -btrfs_get_block_group (cache);spin_lock (&fs_info->zone_active_bgs_lock); -list_add_tail (&cache->active_bg_list, - &fs_info->zone_active_bgs); +if (list_empty (&cache->active_bg_list)) { +btrfs_get_block_group (cache); +list_add_tail (&cache->active_bg_list, + &fs_info->zone_active_bgs); + }spin_unlock (&fs_info->zone_active_bgs_lock); } }else {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2750/3318 btrfs: fix incomplete iteration over fs state when logging messages
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit d1d74665ab9a8971d42177ca865cfbe2897c1fc7 ]
In btrfs_state_to_string() we iterate over all the bits set in fs_info->fs_state using for_each_set_bit(), which requires its third argument to match the number of bits, but we pass it the number of bytes of the type used by fs_info->fs_state, an unsigned long, which is 8 on 64 bits platforms and 4 on 32 bits platforms. This means we are not iterating over bits in the ranges [8, 63] or [4, 31].
Fix this by passing BTRFS_FS_STATE_COUNT instead of sizeof(fs_state). Note that we could pass BITS_PER_TYPE(fs_state), but since BTRFS_FS_STATE_COUNT is 11 and we have no bits beyond that, it would cause pointless iterations over fs_state.
This also makes pointless the checks for the bit being inside the limit of BTRFS_FS_STATE_COUNT inside the loop.
--- fs/btrfs/messages.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/messages.c +2 -3
@@ -41,9 +41,8 @@ static void btrfs_state_to_string(const struct btrfs_fs_info *info, char *buf) states_printed = true; } -for_each_set_bit (bit, &fs_state,sizeof (fs_state)) { -WARN_ON_ONCE (bit >=BTRFS_FS_STATE_COUNT ); -if ((bit <BTRFS_FS_STATE_COUNT ) && fs_state_chars[bit]) { +for_each_set_bit (bit, &fs_state,BTRFS_FS_STATE_COUNT ) { +if (fs_state_chars[bit]) { *curr++ = fs_state_chars[bit]; states_printed = true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2751/3318 btrfs: qgroup: do not treat "ret > 0" as error when deleting a qgroup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit dd906477cc2c33c82ec17e6301bd4be4ea588565 ]
[BUG]
There is a bug report that when removing a child qgroup, if removing the qgroup requires a rescan, it will delete the on-disk relation and qgroup items but not the in-memory qgroup rb entry.
This makes all later qgroup rescan to fail.
[CAUSE]
The call chain looks like the following:
btrfs_remove_qgroup()
|- __del_qgroup_relation() | |- quick_update_accounting() | Which returns 1, showing this operation will require | a qgroup rescan |- if (ret) goto out;
Which skips the del_qgroup_rb() call, leaving the in-memory qgroup rb entry still intact.
Then later qgroup rescan/update will always fail and mark qgroup inconsistent:
btrfs_run_qgroups()
|- update_qgroup_info_item() | |- btrfs_search_slot() | Which returns -ENOENT, as the qgroup info item is already | deleted. |- qgroup_mark_inconsistent() |- return -ENOENT;
[FIX]
Do not treat "ret > 0" as an error.
--- fs/btrfs/qgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/qgroup.c +1 -1
@@ -1722,7 +1722,7 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid) struct btrfs_qgroup_list, next_group); ret =__del_qgroup_relation (trans, qgroupid, list->group->qgroupid); -if (ret) +if (ret <0 ) goto out; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2752/3318 btrfs: qgroup: fix swapped blocks existence check when tracing after COW
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 0388b5bd3a6eb8bcb20208c3b6dbee96fd30bbe0 ]
In btrfs_qgroup_trace_subtree_after_cow(), after we erase the swapped block, iterate over all possible tree levels to check if we sill have other swapped blocks. However the check is wrong, it considers that there are other swapped blocks if any rbtree for any level is empty, instead of not empty. As a consequence we set blocks->swapped to true basically every time since we always find an empty rbtree at least at level 7, since in practice it's nearly impossible to find such a huge btree. This makes every future call to btrfs_qgroup_trace_subtree_after_cow() do an unnecessary rbtree search instead of returning immediately.
Fix this by updating the condition to set swapped to true if we find an rbtree that is not empty.
--- fs/btrfs/ctree.h | 2 +- fs/btrfs/qgroup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/ctree.h +1 -1
@@ -180,7 +180,7 @@ enum {*/ struct btrfs_qgroup_swapped_blocks {spinlock_t lock; -/* RM_EMPTY_ROOT() of above blocks[] */ +/* True if any of the rbtrees in the blocks array below is not empty. */ bool swapped;struct rb_root blocks[BTRFS_MAX_LEVEL ]; };
fs/btrfs/qgroup.c +1 -1
@@ -4432,7 +4432,7 @@ int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,/* Found one, remove it from @blocks first and update blocks->swapped */ rb_erase (&block->node, &blocks->blocks[level]);for (i =0 ; i <BTRFS_MAX_LEVEL ; i++) { -if (RB_EMPTY_ROOT (&blocks->blocks[i])) { +if (!RB_EMPTY_ROOT (&blocks->blocks[i])) { swapped = true;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2753/3318 btrfs: defrag: fix check to see if next extent can be defragged too
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit eb55bc2bfe204e6bfccfe179226d7fb5024cb010 ]
We want to check if the next extent is at maximum capacity but we are passing the current extent map to get_extent_max_capacity() and not the next extent map. For example if the current extent is compressed (its maximum capacity is 128K) and the next extent is uncompressed (its maximum capacity is 128M), then we can bail out and not defrag the next extent too - when for example the next extent as a size of 128K, is uncompressed, and the extent threshold is >= 256K.
--- fs/btrfs/defrag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/defrag.c +1 -1
@@ -690,7 +690,7 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em,* If the next extent is at its max capacity, defragging current extent * makes no sense, as the total number of extents won't change. */ -if (next->len >=get_extent_max_capacity (fs_info, em)) +if (next->len >=get_extent_max_capacity (fs_info, next)) goto out;/* Skip older extent */ if (next->generation < newer_than)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2754/3318 power: supply: generic-adc-battery: Propagate charged GPIO errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 36b0abe904ac9cbdce6161d9c7c0bcac963bb3fe ]
devm_gpiod_get_optional() may return an error pointer such as -EPROBE_DEFER, but gab_probe() only checks for NULL. The error pointer is then passed to gpiod_to_irq() and the original error, including -EPROBE_DEFER, is lost.
Check the return value and propagate errors from the charged GPIO lookup.
--- drivers/power/supply/generic-adc-battery.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/power/supply/generic-adc-battery.c +3 -0
@@ -243,6 +243,9 @@ static int gab_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, ret,"Failed to register delayed work\n" ); adc_bat->charge_finished =devm_gpiod_get_optional (&pdev->dev,"charged" ,GPIOD_IN ); +if (IS_ERR (adc_bat->charge_finished)) +return dev_err_probe (&pdev->dev,PTR_ERR (adc_bat->charge_finished), +"failed to get charged GPIO\n" );if (adc_bat->charge_finished) {int irq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2755/3318 mtd: rawnand: pl353: fix clk reference leak in pl35x_nfc_setup_interface()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haotian Zhang <[email protected]>
[ Upstream commit 1ce45f0e74d60e8279ed380c97047e6c351aee1b ]
pl35x_nfc_setup_interface() obtains a reference to the SMC "memclk" with of_clk_get_by_name() and only uses it to read the clock rate. The reference is never released: the function has many early return paths and no clk_put() call anywhere, so the clock reference is leaked.
The hook is invoked repeatedly by the NAND core (nand_reset(), nand_setup_interface() and the NAND_DATA_IFACE_CHECK_ONLY mode probing loops), so the reference count keeps growing.
Release the clock reference with clk_put() as soon as its rate has been read.
--- drivers/mtd/nand/raw/pl35x-nand-controller.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/pl35x-nand-controller.c +1 -0
@@ -807,6 +807,7 @@ static int pl35x_nfc_setup_interface(struct nand_chip *chip, int cs,* macro to convert from one to the other. */ period_ns =NSEC_PER_SEC /clk_get_rate (mclk); +clk_put (mclk);/* * PL35X SMC needs one extra read cycle in SDR Mode 5. This is not
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2756/3318 nfs: set gencount on protocol-specific remove
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Bergantinos Corpas <[email protected]>
[ Upstream commit 8c955dacf45f8964b98f26910ffecb5e26c02e31 ]
commit bd4928ec799b ("NFS: Avoid changing nlink when file removes and attribute updates race") avoids races on attribute cache with any inflight RPC that may modify inode attributes (and gencount) during i.e. REMOVE.
However it does not take into account that REMOVE may trigger a delegation return which also advances gencount (via the attribute refresh during delegation return), and in that case the gencount mismatch is not due to an inflight RPC that already reflected the removal.
Push the setting of gencount under each version-specific layer, reordering correctly for nfsv4 case after the delegation returns.
This fixes LTP/inotify04 failure after bd4928ec799b.
--- fs/nfs/dir.c | 13 +++---------- fs/nfs/internal.h | 1 + fs/nfs/nfs3proc.c | 8 ++++++++ fs/nfs/nfs4proc.c | 5 +++++ fs/nfs/proc.c | 8 ++++++++ 5 files changed, 25 insertions(+), 10 deletions(-)
fs/nfs/dir.c +3 -10
@@ -1902,7 +1902,7 @@ static int nfs_dentry_delete(const struct dentry *dentry) }/* Ensure that we revalidate inode->i_nlink */ -static void nfs_drop_nlink (struct inode *inode,unsigned long gencount) +void nfs_drop_nlink (struct inode *inode,unsigned long gencount) {struct nfs_inode *nfsi =NFS_I (inode);
@@ -1916,6 +1916,7 @@ static void nfs_drop_nlink(struct inode *inode, unsigned long gencount) NFS_INO_INVALID_NLINK);spin_unlock (&inode->i_lock); } +EXPORT_SYMBOL_GPL (nfs_drop_nlink);/* * Called when the dentry loses inode.
@@ -2467,7 +2468,6 @@ EXPORT_SYMBOL_GPL(nfs_rmdir);static int nfs_safe_remove (struct dentry *dentry) {struct inode *dir =d_inode (dentry->d_parent); -struct inode *inode =d_inode (dentry);int error = -EBUSY ;dfprintk (VFS ,"NFS: safe_remove(%pd2)\n" , dentry);
@@ -2479,14 +2479,7 @@ static int nfs_safe_remove(struct dentry *dentry) }trace_nfs_remove_enter (dir, dentry); -if (inode !=NULL ) { -unsigned long gencount =READ_ONCE (NFS_I (inode)->attr_gencount); - - error =NFS_PROTO (dir)->remove (dir, dentry); -if (error ==0 ) -nfs_drop_nlink (inode, gencount); - }else - error =NFS_PROTO (dir)->remove (dir, dentry); + error =NFS_PROTO (dir)->remove (dir, dentry);if (error == -ENOENT )nfs_dentry_handle_enoent (dentry);trace_nfs_remove_exit (dir, dentry, error);
fs/nfs/internal.h +1 -0
@@ -387,6 +387,7 @@ extern unsigned long nfs_access_cache_count(struct shrinker *shrink, struct shrink_control *sc);extern unsigned long nfs_access_cache_scan (struct shrinker *shrink,struct shrink_control *sc); +extern void nfs_drop_nlink (struct inode *inode,unsigned long gencount);struct dentry *nfs_lookup (struct inode *,struct dentry *,unsigned int );void nfs_d_prune_case_insensitive_aliases (struct inode *inode); int nfs_create(struct mnt_idmap *, struct inode *, struct dentry *,
fs/nfs/nfs3proc.c +8 -0
@@ -443,13 +443,21 @@ nfs3_proc_remove(struct inode *dir, struct dentry *dentry) .rpc_resp = &res, };int status = -ENOMEM ; +struct inode *inode =d_inode (dentry); +unsigned long gencount;dprintk ("NFS call remove %pd2\n" , dentry); res.dir_attr =nfs_alloc_fattr ();if (res.dir_attr ==NULL ) goto out; +if (inode) + gencount =READ_ONCE (NFS_I (inode)->attr_gencount); + status =rpc_call_sync (NFS_CLIENT (dir), &msg,0 ); +if (status ==0 && inode) +nfs_drop_nlink (inode, gencount); +nfs_post_op_update_inode (dir, res.dir_attr);nfs_free_fattr (res.dir_attr); out:
fs/nfs/nfs4proc.c +5 -0
@@ -4799,12 +4799,14 @@ static int nfs4_proc_remove(struct inode *dir, struct dentry *dentry) };struct inode *inode =d_inode (dentry);int err; +unsigned long gencount;if (inode) {if (inode->i_nlink ==1 )nfs4_inode_return_delegation (inode);else nfs4_inode_make_writeable (inode); + gencount =READ_ONCE (NFS_I (inode)->attr_gencount); } do { err = _nfs4_proc_remove(dir, &dentry->d_name, NF4REG);
@@ -4812,6 +4814,9 @@ static int nfs4_proc_remove(struct inode *dir, struct dentry *dentry) err =nfs4_handle_exception (NFS_SERVER (dir), err, &exception); }while (exception.retry); + +if (err ==0 && inode) +nfs_drop_nlink (inode, gencount);return err; }
fs/nfs/proc.c +8 -0
@@ -322,9 +322,17 @@ nfs_proc_remove(struct inode *dir, struct dentry *dentry) .rpc_argp = &arg, };int status; +struct inode *inode =d_inode (dentry); +unsigned long gencount;dprintk ("NFS call remove %pd2\n" ,dentry); +if (inode) + gencount =READ_ONCE (NFS_I (inode)->attr_gencount); + status =rpc_call_sync (NFS_CLIENT (dir), &msg,0 ); +if (status ==0 && inode) +nfs_drop_nlink (inode, gencount); +nfs_mark_for_revalidate (dir);dprintk ("NFS reply remove: %d\n" , status);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2757/3318 ASoC: codecs: rt5659: propagate GPIO errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit c1e321bd5ce6ae3702db65837cfe0c792634d603 ]
devm_gpiod_get_optional() may return an error pointer, including -EPROBE_DEFER, but rt5659_i2c_probe() does not handle these errors for the ldo1-en GPIO and does not check for errors for the reset GPIO.
Check the return values and propagate GPIO lookup errors.
--- sound/soc/codecs/rt5659.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5659.c +5 -1
@@ -4112,10 +4112,14 @@ static int rt5659_i2c_probe(struct i2c_client *i2c) rt5659->gpiod_ldo1_en =devm_gpiod_get_optional (&i2c->dev,"ldo1-en" ,GPIOD_OUT_HIGH );if (IS_ERR (rt5659->gpiod_ldo1_en)) -dev_warn (&i2c->dev,"Request ldo1-en GPIO failed\n" ); +return dev_err_probe (&i2c->dev,PTR_ERR (rt5659->gpiod_ldo1_en), +"failed to get ldo1-en GPIO\n" ); rt5659->gpiod_reset =devm_gpiod_get_optional (&i2c->dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (rt5659->gpiod_reset)) +return dev_err_probe (&i2c->dev,PTR_ERR (rt5659->gpiod_reset), +"failed to get reset GPIO\n" );/* Sleep for 300 ms miniumum */ msleep (300 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2758/3318 rcutorture: Fix divide-by-zero with fwd_progress_div=1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunwu Chan <[email protected]>
[ Upstream commit 5b748d8aa6833f2dec3f545311be69a2064bc6d1 ]
When fwd_progress_div=1, the forward-progress test computes:
sd4 = (sd + div - 1) / div = sd
dur = sd4 + torture_random(&trs) % (sd - sd4) = sd4 + % 0
The modulo operation with a zero divisor triggers an integer division by zero (undefined behavior at the C level, #DE trap on x86), causing a kernel Oops and panic. On x86_64, this manifests as:
rcu_torture_fwd_prog_nr: Starting forward-progress test 0
Oops: divide error: 0000 [#1] SMP PTI RIP: 0010:rcu_torture_fwd_prog+0x90b/0x1160 R12: 0000000000000000
The existing guard only handles non-positive values. However, fwd_progress_div=1 also makes the random range empty because sd4 == sd.
Change the guard to reject values below 2. The forward-progress test only reaches this calculation when stall_dur() is positive, so sd = stall_dur() + 1 >= 2. For fwd_progress_div >= 2, sd4 < sd, ensuring that sd - sd4 is at least 1.
Keep the existing fallback to the default value of 4 for invalid values.
Verified with QEMU/KVM: a 138-second run with fwd_progress_div=1 completed 81 forward-progress test cycles without a crash.
--- kernel/rcu/rcutorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcutorture.c +1 -1
@@ -2957,7 +2957,7 @@ static int __init rcu_torture_fwd_prog_init(void) }if (fwd_progress_holdoff <=0 ) fwd_progress_holdoff =1 ; -if (fwd_progress_div <=0 ) +if (fwd_progress_div <2 ) fwd_progress_div =4 ; rfp =kcalloc (fwd_progress,sizeof (*rfp),GFP_KERNEL ); fwd_prog_tasks =kcalloc (fwd_progress,sizeof (*fwd_prog_tasks),GFP_KERNEL );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2759/3318 wifi: ath10k: avoid IDR mutation during TX cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 1c1a208e65a08191901cfded3bbccc4a54e4a75c ]
ath10k_htt_flush_tx_queue() walks pending_tx with idr_for_each(). Its callback calls ath10k_txrx_tx_unref(), which removes the current entry from pending_tx through ath10k_htt_tx_free_msdu_id().
idr_for_each() keeps radix-tree iterator state across the callback. Removing the current entry can therefore invalidate that state and make the remaining walk unsafe.
Use idr_for_each_entry(), which starts a fresh lookup after each callback. The current entry can then be removed safely, while the following idr_destroy() continues to release the IDR itself.
--- drivers/net/wireless/ath/ath10k/htt_tx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +7 -5
@@ -505,9 +505,8 @@ int ath10k_htt_tx_start(struct ath10k_htt *htt)return ret; } -static int ath10k_htt_tx_clean_up_pending (int msdu_id,void *skb,void *ctx) +static void ath10k_htt_tx_clean_up_pending (int msdu_id,struct ath10k *ar) { -struct ath10k *ar = ctx;struct ath10k_htt *htt = &ar->htt;struct htt_tx_done tx_done = {0 };
@@ -517,8 +516,6 @@ static int ath10k_htt_tx_clean_up_pending(int msdu_id, void *skb, void *ctx) tx_done.status =HTT_TX_COMPL_STATE_DISCARD ;ath10k_txrx_tx_unref (htt, &tx_done); - -return 0 ; }void ath10k_htt_tx_destroy (struct ath10k_htt *htt)
@@ -535,8 +532,13 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt)static void ath10k_htt_flush_tx_queue (struct ath10k_htt *htt) { +struct sk_buff *msdu; +int msdu_id; +ath10k_htc_stop_hl (htt->ar); -idr_for_each (&htt->pending_tx, ath10k_htt_tx_clean_up_pending, htt->ar); + +idr_for_each_entry (&htt->pending_tx, msdu, msdu_id) +ath10k_htt_tx_clean_up_pending (msdu_id, htt->ar); }void ath10k_htt_tx_stop (struct ath10k_htt *htt)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2760/3318 wifi: ath11k: avoid IDR mutation during pending mgmt TX cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 3e7f5d362b2b3a21b3adb4b860aad14b69a896ad ]
The pending management TX cleanup walks txmgmt_idr with idr_for_each(), and its callback removes the current entry. This can invalidate the radix-tree iterator retained by idr_for_each().
Use idr_for_each_entry() so every iteration starts with a fresh lookup. Continue to remove each entry under txmgmt_idr_lock before freeing its skb, preventing concurrent TX completion from finding a stale skb pointer.
--- drivers/net/wireless/ath/ath11k/core.c | 3 +-- drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ drivers/net/wireless/ath/ath11k/mac.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +1 -2
@@ -1942,8 +1942,7 @@ void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab)complete (&ar->thermal.wmi_sync);wake_up (&ar->dp.tx_empty_waitq); -idr_for_each (&ar->txmgmt_idr, - ath11k_mac_tx_mgmt_pending_free, ar); +ath11k_mac_tx_mgmt_pending_free (ar);idr_destroy (&ar->txmgmt_idr);wake_up (&ar->txmgmt_empty_waitq);
drivers/net/wireless/ath/ath11k/mac.c +6 -6
@@ -5846,13 +5846,13 @@ static void ath11k_mac_tx_mgmt_free(struct ath11k *ar, int buf_id)ath11k_mgmt_over_wmi_tx_drop (ar, msdu); } -int ath11k_mac_tx_mgmt_pending_free (int buf_id,void *skb,void *ctx) +void ath11k_mac_tx_mgmt_pending_free (struct ath11k *ar) { -struct ath11k *ar = ctx; - -ath11k_mac_tx_mgmt_free (ar, buf_id); +struct sk_buff *msdu; +int buf_id; -return 0 ; +idr_for_each_entry (&ar->txmgmt_idr, msdu, buf_id) +ath11k_mac_tx_mgmt_free (ar, buf_id); }static int ath11k_mac_vif_txmgmt_idr_remove (int buf_id,void *skb,void *ctx)
@@ -9484,7 +9484,7 @@ static void __ath11k_mac_unregister(struct ath11k *ar)ieee80211_unregister_hw (ar->hw); -idr_for_each (&ar->txmgmt_idr, ath11k_mac_tx_mgmt_pending_free, ar); +ath11k_mac_tx_mgmt_pending_free (ar);idr_destroy (&ar->txmgmt_idr);kfree (ar->mac.sbands[NL80211_BAND_2GHZ ].channels);
drivers/net/wireless/ath/ath11k/mac.h +1 -1
@@ -162,7 +162,7 @@ struct ath11k *ath11k_mac_get_ar_by_pdev_id(struct ath11k_base *ab, u32 pdev_id)void ath11k_mac_drain_tx (struct ath11k *ar);void ath11k_mac_peer_cleanup_all (struct ath11k *ar); -int ath11k_mac_tx_mgmt_pending_free (int buf_id,void *skb,void *ctx); +void ath11k_mac_tx_mgmt_pending_free (struct ath11k *ar);u8 ath11k_mac_bw_to_mac80211_bw (u8 bw);enum nl80211_he_gi ath11k_mac_he_gi_to_nl80211_he_gi (u8 sgi);enum nl80211_he_ru_alloc ath11k_mac_phy_he_ru_to_nl80211_he_ru_alloc (u16 ru_phy);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2761/3318 wifi: ath11k: avoid IDR mutation during vif mgmt TX cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit dc29226dada34a6d19af77b4b51e90f8a3a8de34 ]
ath11k_mac_op_remove_interface() walks txmgmt_idr with idr_for_each(), and its callback removes each entry belonging to the interface. Removing the current entry can invalidate the radix-tree iterator retained by idr_for_each().
Move the walk into a helper that uses idr_for_each_entry(). It performs a fresh lookup for every iteration, so each matching entry can be removed through the locked removal helper without retaining iterator state across the removal.
--- drivers/net/wireless/ath/ath11k/mac.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +11 -10
@@ -5855,16 +5855,18 @@ void ath11k_mac_tx_mgmt_pending_free(struct ath11k *ar)ath11k_mac_tx_mgmt_free (ar, buf_id); } -static int ath11k_mac_vif_txmgmt_idr_remove (int buf_id,void *skb,void *ctx) +static void ath11k_mac_vif_txmgmt_cleanup (struct ath11k *ar, +struct ieee80211_vif *vif) { -struct ieee80211_vif *vif = ctx; -struct ath11k_skb_cb *skb_cb =ATH11K_SKB_CB ((struct sk_buff *)skb); -struct ath11k *ar = skb_cb->ar; - -if (skb_cb->vif == vif) -ath11k_mac_tx_mgmt_free (ar, buf_id); +struct ath11k_skb_cb *skb_cb; +struct sk_buff *skb; +int buf_id; -return 0 ; +idr_for_each_entry (&ar->txmgmt_idr, skb, buf_id) { + skb_cb =ATH11K_SKB_CB (skb); +if (skb_cb->vif == vif) +ath11k_mac_tx_mgmt_free (ar, buf_id); + } } static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, struct ath11k_vif *arvif,
@@ -6889,8 +6891,7 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw,ath11k_peer_cleanup (ar, arvif->vdev_id); -idr_for_each (&ar->txmgmt_idr, - ath11k_mac_vif_txmgmt_idr_remove, vif); +ath11k_mac_vif_txmgmt_cleanup (ar, vif);for (i =0 ; i < ab->hw_params.max_tx_ring; i++) {spin_lock_bh (&ab->dp.tx_ring[i].tx_idr_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2762/3318 wifi: ath12k: avoid IDR mutation during vif mgmt TX cleanup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 4aa45334eb23d40bf31c43405daea9b73469f2a6 ]
ath12k_mac_vdev_delete() walks txmgmt_idr with idr_for_each(), and its callback removes each entry belonging to the interface. Removing the current entry can invalidate the radix-tree iterator retained by idr_for_each().
Move the walk into a helper that uses idr_for_each_entry(). It performs a fresh lookup for every iteration, so each matching entry can be removed through the locked removal helper without retaining iterator state across the removal.
--- drivers/net/wireless/ath/ath12k/mac.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +11 -10
@@ -4773,16 +4773,18 @@ int ath12k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx)return 0 ; } -static int ath12k_mac_vif_txmgmt_idr_remove (int buf_id,void *skb,void *ctx) +static void ath12k_mac_vif_txmgmt_cleanup (struct ath12k *ar, +struct ieee80211_vif *vif) { -struct ieee80211_vif *vif = ctx; -struct ath12k_skb_cb *skb_cb =ATH12K_SKB_CB (skb); -struct ath12k *ar = skb_cb->ar; - -if (skb_cb->vif == vif) -ath12k_mac_tx_mgmt_free (ar, buf_id); +struct ath12k_skb_cb *skb_cb; +struct sk_buff *skb; +int buf_id; -return 0 ; +idr_for_each_entry (&ar->txmgmt_idr, skb, buf_id) { + skb_cb =ATH12K_SKB_CB (skb); +if (skb_cb->vif == vif) +ath12k_mac_tx_mgmt_free (ar, buf_id); + } } static int ath12k_mac_mgmt_tx_wmi(struct ath12k *ar, struct ath12k_vif *arvif,
@@ -5635,8 +5637,7 @@ static void ath12k_mac_op_remove_interface(struct ieee80211_hw *hw,ath12k_peer_cleanup (ar, arvif->vdev_id); -idr_for_each (&ar->txmgmt_idr, - ath12k_mac_vif_txmgmt_idr_remove, vif); +ath12k_mac_vif_txmgmt_cleanup (ar, vif);ath12k_mac_vif_unref (&ab->dp, vif);ath12k_dp_tx_put_bank_profile (&ab->dp, arvif->bank_id);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2763/3318 mm/hmm/test: reject overflowing page counts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit b59925301211ccc351d98d70b11f6d1b2c63150f ]
The number of pages comes directly from userspace. Shifting a value larger than ULONG_MAX >> PAGE_SHIFT discards its high bits before the existing end-address check. A request for a huge number of pages can therefore be accepted and processed as a much smaller request.
Reject page counts that cannot be represented as a byte size before performing the shift.
So far as ChatGPT and I can tell this doesn't cause an issue in practice but preventing this integer overflow is the correct thing to do.
--- lib/test_hmm.c | 2 ++ 1 file changed, 2 insertions(+)
lib/test_hmm.c +2 -0
@@ -1326,6 +1326,8 @@ static long dmirror_fops_unlocked_ioctl(struct file *filp,if (cmd.addr & ~PAGE_MASK )return -EINVAL ; +if (cmd.npages >ULONG_MAX >>PAGE_SHIFT ) +return -EINVAL ;if (cmd.addr >= (cmd.addr + (cmd.npages <<PAGE_SHIFT )))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2764/3318 ALSA: jack: Remove debugfs before freeing unregistered jacks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
[ Upstream commit d3b59d50e1ff206aa519ed5c13bf6907f97dd6a6 ]
Jack debugfs files store a raw snd_jack_kctl pointer, so their callbacks must be drained before the attachment is freed. snd_jack_dev_free() unlinks and frees the attachments before calling snd_jack_dev_disconnect(). Its late snd_jack_remove_debugfs() call then has no entries left to traverse.
With CONFIG_SND_JACK_INJECTION_DEBUG and input support enabled, an HDA codec rebind on a live card can publish a non-phantom jack's type file while its component is still in SNDRV_DEV_BUILD. A later jack-control allocation failure permits the following order:
1. hda_codec_driver_probe() creates a jack and publishes its debugfs files before reaching snd_card_register().
2. A later control-build failure calls snd_hda_codec_cleanup_for_unbind(), then snd_hda_jack_tbl_clear() and snd_device_free(). __snd_device_disconnect() skips BUILD components. snd_jack_dev_free() frees the attachment before its late disconnect, leaving the debugfs files published.
3. After cleanup, a reader opens the surviving type file and jack_type_read() dereferences the freed attachment's jack pointer.
The card's debugfs root remains live throughout this sequence. The result is a use-after-free even without an overlapping read. An already admitted callback is also not drained by this cleanup.
Call snd_jack_remove_debugfs() before unlinking any controls in the free callback. The existing debugfs_remove() rundown blocks new accesses and waits for active callbacks while the attachment, control and jack remain valid. Roots cleared by an earlier disconnect are NULL, so repeating the removal is harmless.
KASAN report as below:
==================================================================
BUG: KASAN: slab-use-after-free in jack_type_read+0x1da/0x1f0
Read of size 8 at addr ffff8881085f9da0 by task python3/429
CPU: 2 UID: 0 PID: 429 Comm: python3 Not tainted 7.2.0-rc6-pmb-alsa-functional-v2+ #1 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? jack_type_read+0x1da/0x1f0
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? jack_type_read+0x1da/0x1f0
kasan_report+0xe0/0x110
? jack_type_read+0x1da/0x1f0
jack_type_read+0x1da/0x1f0
? __pfx_jack_type_read+0x10/0x10
? __pfx___debugfs_file_get+0x10/0x10
? __pfx_cp_new_stat+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? srso_alias_return_thunk+0x5/0xfbef5
? selinux_file_permission+0x122/0x570
full_proxy_read+0x11f/0x180
? __pfx_full_proxy_read+0x10/0x10
vfs_read+0x1a0/0xc20
? __pfx_vfs_read+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? __do_sys_newfstat+0xa6/0x100
? find_held_lock+0x2b/0x80
? __pfx___do_sys_newfstat+0x10/0x10
ksys_read+0x111/0x200
? __pfx_ksys_read+0x10/0x10
? full_proxy_llseek+0x11e/0x170
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7e392e7687
Code: 48 89 fa 4c 89 df e8 58 b3 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fff5f7b9180 EFLAGS: 00000202 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f7e39253780 RCX: 00007f7e392e7687
RDX: 0000000000002000 RSI: 000000003d2e9b00 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 00007f7e39253700
R13: 0000000000002000 R14: 00007f7e38d7e2c0 R15: 0000000000a55b98
</TASK>
Allocated by task 425:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
snd_jack_kctl_new+0x80/0x180
snd_jack_new+0x4b/0x490
snd_hda_jack_add_kctl_mst+0x19b/0x610
add_jack_kctl+0x204/0x320
snd_hda_jack_add_kctls+0x212/0x910
snd_hda_gen_build_controls+0x233/0x600
snd_hda_codec_build_controls+0x2e4/0x9f0
hda_codec_driver_probe+0x26e/0x590
really_probe+0x21f/0xa90
__driver_probe_device+0x1ec/0x490
device_driver_attach+0xdc/0x210
bind_store+0xec/0x180
drv_attr_store+0x79/0xb0
sysfs_kf_write+0xed/0x140
kernfs_fop_write_iter+0x34b/0x500
vfs_write+0x637/0x1010
ksys_write+0x111/0x200
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 425:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
kfree+0x307/0x580
snd_jack_kctl_private_free+0x153/0x200
__snd_ctl_remove+0x29f/0x3b0
snd_ctl_remove+0x46/0x70
snd_jack_dev_free+0x1b1/0x370
__snd_device_free+0x193/0x3f0
snd_device_free+0xcf/0x190
snd_hda_jack_tbl_clear+0x159/0x2e0
snd_hda_codec_cleanup_for_unbind+0x37e/0x9c0
hda_codec_driver_probe+0x3ae/0x590
really_probe+0x21f/0xa90
__driver_probe_device+0x1ec/0x490
device_driver_attach+0xdc/0x210
bind_store+0xec/0x180
drv_attr_store+0x79/0xb0
sysfs_kf_write+0xed/0x140
kernfs_fop_write_iter+0x34b/0x500
vfs_write+0x637/0x1010
ksys_write+0x111/0x200
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
The buggy address belongs to the object at ffff8881085f9d80
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 32 bytes inside of
freed 64-byte region [ffff8881085f9d80, ffff8881085f9dc0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1085f9
flags: 0x200000000000000(node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000000 ffff8881000428c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8881085f9c80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
ffff8881085f9d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8881085f9d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff8881085f9e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8881085f9e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================--- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+)
sound/core/jack.c +3 -0
@@ -67,6 +67,9 @@ static int snd_jack_dev_free(struct snd_device *device)struct snd_card *card = device->card;struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; +/* Remove debugfs while the controls are still linked. */ +snd_jack_remove_debugfs (jack); +list_for_each_entry_safe (jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) {list_del_init (&jack_kctl->list);snd_ctl_remove (card, jack_kctl->kctl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2765/3318 platform/x86: asus-wmi: validate custom fan curves on enable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ahmed Yaseen <[email protected]>
[ Upstream commit bcbdfe03566ad0d01c6af3b5476e8cadffe4d3df ]
Custom fan curves reach firmware unchecked, so a curve whose temperature or PWM decreases from one point to the next is accepted. The firmware does not respect such a curve: a first point of 100% followed by 50% leaves every point running at 100%. The kernel keeps reporting the points that were written, so sysfs stops describing what the fans are actually doing.
Check the curve when enabling and reject it if it is invalid. Validation is done on enable rather than on write because fan curves are written one point at a time and are inconsistent mid-write.
--- drivers/platform/x86/asus-wmi.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/platform/x86/asus-wmi.c +32 -0
@@ -3025,6 +3025,33 @@ static int fan_curve_write(struct asus_wmi *asus, arg1, arg2, arg3, arg4, &ret); } +/* +* A fan curve is a set of points the firmware interpolates between, so it +* only makes sense if neither temperature nor PWM ever decreases along it. +*/ +static int fan_curve_validate (struct device *dev,struct fan_curve_data *data) +{ +u8 *percents = data->percents; +u8 *temps = data->temps; +int i; + +for (i =1 ; i <FAN_CURVE_POINTS ; i++) { +if (temps[i] < temps[i -1 ]) { +dev_warn (dev,"fan curve: temperature decreases at point %d (%u < %u)\n" , + i, temps[i], temps[i -1 ]); +return -EINVAL ; + } + +if (percents[i] < percents[i -1 ]) { +dev_warn (dev,"fan curve: pwm decreases at point %d (%u < %u)\n" , + i, percents[i], percents[i -1 ]); +return -EINVAL ; + } + } + +return 0 ; +} +static ssize_t fan_curve_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count)
@@ -3109,6 +3136,11 @@ static ssize_t fan_curve_enable_store(struct device *dev, }if (data->enabled) { + err =fan_curve_validate (dev, data); +if (err) { + data->enabled = false; +return err; + } err =fan_curve_write (asus, data);if (err)return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2766/3318 platform/x86: msi-ec: Report valid charge thresholds when unset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daasaradhi Mannava <[email protected]>
[ Upstream commit a102207eaf4a18c60c2ffbdc421ad3d30bfed591 ]
The charge thresholds are computed by subtracting a fixed offset from the raw EC value. When no charge limit has been set, the EC can hold a value below range_min (0x80 on an MSI GL65 Leopard 9SCXK), and reading the sysfs attributes returns nonsense:
charge_control_start_threshold: -10
charge_control_end_threshold: 0
Both attributes are documented to be within 0 - 100, and an end threshold of 0 wrongly suggests that charging is disabled.
The store path already rejects values outside range_min..range_max. Apply the same range to the show path and report the maximum threshold for any value outside of it.
Tested on an MSI GL65 Leopard 9SCXK (EC firmware 16U8EMS2.100) with the EC holding 0x80: the attributes now read 90 and 100.
--- drivers/platform/x86/msi-ec.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/msi-ec.c +9 -0
@@ -728,6 +728,15 @@ static ssize_t charge_control_threshold_show(u8 offset,if (result <0 )return result; +/* +* The EC may hold an out-of-range value (e.g. 0x80) when no charge +* limit has been set. Report the maximum threshold instead of a +* meaningless (possibly negative) percentage. +*/ +if (rdata < conf.charge_control.range_min || + rdata > conf.charge_control.range_max) + rdata = conf.charge_control.range_max; +return sysfs_emit (buf,"%i\n" , rdata - offset); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2767/3318 platform/x86: intel_telemetry: initialize default trace verbosity
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandrova Alyona <[email protected]>
[ Upstream commit 1b55ec81926eb7f6e4fad692fa4040a569e9daf7 ]
telemetry_def_get_trace_verbosity() returns success without initializing the output verbosity value.
The default telemetry operations are installed when the core driver is initialized and again by telemetry_clear_pltdata() when the platform driver is removed. The telemetry debugfs files can remain available after the platform driver removal.
A subsequent read of pss_trace_verbosity or ioss_trace_verbosity calls telemetry_get_trace_verbosity(), which may use the default callback and return success without setting verbosity. The uninitialized value is then passed to seq_printf().
Validate the output pointer and initialize the default verbosity to zero so callers never use an uninitialized value after a successful call.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/platform/x86/intel/telemetry/core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/platform/x86/intel/telemetry/core.c +4 -0
@@ -51,6 +51,10 @@ static int telemetry_def_get_eventconfig(static int telemetry_def_get_trace_verbosity (enum telemetry_unit telem_unit,u32 *verbosity) { +if (!verbosity) +return -EINVAL ; + + *verbosity =0 ;return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2768/3318 platform/olpc: Reserve space for a string terminator
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiale Yao <[email protected]>
[ Upstream commit 1fe88b1741ff655bb59e4fd78178fe2c557b9185 ]
ec_dbgfs_cmd_write() copies user input into a zero-initialized stack buffer and passes it to sscanf(). A write that overwrites the entire buffer leaves no terminator, so the subsequent parsing can read beyond the buffer.
Limit the copy to leave room for the trailing NUL.
--- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/olpc/olpc-ec.c +1 -1
@@ -269,7 +269,7 @@ static ssize_t ec_dbgfs_cmd_write(struct file *file, const char __user *buf,mutex_lock (&ec_dbgfs_lock); - size =simple_write_to_buffer (cmdbuf,sizeof (cmdbuf), ppos, buf, size); + size =simple_write_to_buffer (cmdbuf,sizeof (cmdbuf) -1 , ppos, buf, size); m = sscanf(cmdbuf, "%x:%u %x %x %x %x %x", &ec_cmd_int[0], &ec_dbgfs_resp_bytes, &ec_cmd_int[1], &ec_cmd_int[2],
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2769/3318 fbdev: gxt4500: Release WC setup on probe failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Myeonghun Pak <[email protected]>
[ Upstream commit b71e0bb7ad40c005b167e9b48be3af5a3fa51974 ]
gxt4500_probe() adds a write-combining range before allocating the cmap and registering the framebuffer. If a later step fails, the range is not released. Add the missing cleanup before unmapping the framebuffer, matching the successful remove path.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/video/fbdev/gxt4500.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/gxt4500.c +1 -0
@@ -719,6 +719,7 @@ static int gxt4500_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_free_cmap:fb_dealloc_cmap (&info->cmap); err_unmap_all: +arch_phys_wc_del (par->wc_cookie);iounmap (info->screen_base); err_unmap_regs:iounmap (par->regs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2770/3318 ALSA: rawmidi: Drain input work before freeing the runtime
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
[ Upstream commit 8c3529f0a8faaac7d73333486f69da1617ecc579 ]
The input runtime embeds event_work, so the work must be drained before close_substream() frees the runtime. The cancellation in snd_rawmidi_input_trigger() runs before close clears substream->opened, leaving a window for snd_rawmidi_receive() to enqueue more work.
With a sequencer subscription to a USB MIDI input port, an in-flight completion can overlap the last subscription's midisynth_unsubscribe():
1. snd_usbmidi_input_data() observes input_triggered and is delayed before calling snd_rawmidi_receive().
2. Unsubscribe enters close_substream(), clears input_triggered through the provider trigger callback and returns from cancel_work_sync(). The substream is still opened.
3. The completion resumes. snd_rawmidi_receive() takes substream->lock, sees opened set and queues runtime->event_work before dropping the lock.
4. Close clears opened under that lock, closes the provider and frees the runtime. Stopping USB URBs does not drain the raw-MIDI work.
5. The queued work runs and snd_rawmidi_input_event_work() reads event or substream from the freed runtime, causing a use-after-free.
Cancel input event_work again after clearing opened, before closing the provider or releasing the runtime's private data. Receive holds substream->lock through its opened check and work enqueue, so once close has cleared opened under that lock, no further receive can queue work. The final cancellation therefore drains any late work before the runtime is freed. Keep it outside the spinlock so a running callback can finish.
--- sound/core/rawmidi.c | 3 +++ 1 file changed, 3 insertions(+)
sound/core/rawmidi.c +3 -0
@@ -557,6 +557,9 @@ static void close_substream(struct snd_rawmidi *rmidi, substream->opened =0 ; substream->append =0 ; } +/* Drain input work queued after the earlier cancellation. */ +if (substream->stream ==SNDRV_RAWMIDI_STREAM_INPUT ) +cancel_work_sync (&substream->runtime->event_work); substream->ops->close (substream);if (substream->runtime->private_free) substream->runtime->private_free (substream);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2771/3318 PCI: qcom: Honor IOMMU providers #iommu-cells in qcom_pcie_config_sid_1_9_0()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 5121d76cb9dde74662962cd5678a64abeaf3b3e4 ]
qcom_pcie_config_sid_1_9_0() reads the "iommu-map" property as an array of fixed four-word {rid-base, phandle, sid, rid-len} entries to program the BDF to SID translation table. But that layout only holds for an IOMMU with '#iommu-cells = <1>'. The PCIe SMMUs on these SoCs use '#iommu-cells = <2>' (SID and mask), so per the pci-iommu binding each entry is really five cells long.
This used to work only because the DTs were themselves broken. They described iommu-map with four-cell entries that omitted the SID mask, which of_map_id() tolerated via its of_check_bad_map() fallback, and the four-word parsing coincidentally matched that malformed shape.
Since commit ccb2fd725d41 ("of: Respect #{iommu,msi}-cells in maps") the OF core parses such maps correctly, so the device trees were converted to proper five-cell entries, e.g. commit c41749e9554d ("arm64: dts:
qcom: sm8250: Fix the PCIe iommu-map entries"). With five-cell entries the fixed four-word stride slips by one cell for each entry after the first, so qcom_pcie_config_sid_1_9_0() reads the endpoint mapping's RID from the preceding entry's length cell and its SID from the phandle cell. As the RID is the hash key, the endpoint's real RID is never programmed into the BDF to SID table. Its DMA then hashes to an unprogrammed slot, gets tagged with SID 0 and the SMMU faults like below on QCS8300:
arm-smmu 15200000.iommu: Unhandled context fault: fsr=0x402, iova=0xffa00000, cbfrsynra=0x0, cb=1
To fix this, walk the map with a stride of 3 + '#iommu-cells' of the referenced IOMMU and take the SID from the first specifier cell, which is all the BDF to SID table needs. Validate the layout instead of trusting the array size. Also, preserve the legacy behavior of the old DTs by detecting the same pattern that of_check_bad_map() recognizes and falling back to a stride of four.
--- drivers/pci/controller/dwc/pcie-qcom.c | 90 ++++++++++++++++++-------- 1 file changed, 64 insertions(+), 26 deletions(-)
drivers/pci/controller/dwc/pcie-qcom.c +64 -26
@@ -977,50 +977,90 @@ static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)static int qcom_pcie_config_sid_1_9_0 (struct qcom_pcie *pcie) { -/* iommu map structure */ -struct { -u32 bdf; -u32 phandle; -u32 smmu_sid; -u32 smmu_sid_len; - } *map;void __iomem *bdf_to_sid_base = pcie->parf +PARF_BDF_TO_SID_TABLE_N ;struct device *dev = pcie->pci->dev; +struct device_node *iommu_np;u8 qcom_pcie_crc8_table[CRC8_TABLE_SIZE ]; -int i, nr_map, size =0 ; -u32 smmu_sid_base; +const __be32 *map; +u32 iommu_cells, entry_cells, phandle, smmu_sid_base; +int i, nr_cells, nr_map, size =0 ;u32 val; -of_get_property (dev->of_node,"iommu-map" , &size); -if (!size) + map =of_get_property (dev->of_node,"iommu-map" , &size); +if (!map || !size)return 0 ; +if (size %sizeof (*map)) { +dev_err (dev,"Malformed iommu-map property\n" ); +return -EINVAL ; + } + nr_cells = size /sizeof (*map); + +/* +* Each iommu-map entry is: rid-base (1 cell), phandle (1 cell), +* IOMMU specifier (#iommu-cells cells), length (1 cell). Read +* #iommu-cells from the IOMMU provider referenced by the first +* entry to compute the per-entry stride. +*/ + phandle =be32_to_cpu (map[1 ]); + iommu_np =of_find_node_by_phandle (phandle); +if (!iommu_np) { +dev_err (dev,"Failed to find IOMMU node in iommu-map\n" ); +return -ENODEV ; + } + +if (of_property_read_u32 (iommu_np,"#iommu-cells" , &iommu_cells)) + iommu_cells =1 ; +of_node_put (iommu_np); + + entry_cells =3 + iommu_cells; + +/* +* Retain backward compatibility with DTs that describe iommu-map +* with 4-cell entries against an IOMMU declaring #iommu-cells = 2, +* matching the fallback in drivers/of/base.c::of_check_bad_map(). +*/ +if (iommu_cells ==2 && !(nr_cells %4 )) { +bool legacy = true; + +for (i =0 ; i < nr_cells; i +=4 ) { +if (be32_to_cpu (map[i +1 ]) != phandle || +be32_to_cpu (map[i +3 ]) !=1 ) { + legacy = false; +break ; + } + } + +if (legacy) { +dev_warn_once (dev,"iommu-map has 1-cell entries with #iommu-cells=2, using 1-cell\n" ); + entry_cells =4 ; + } + } + +if (nr_cells % entry_cells) { +dev_err (dev,"Malformed iommu-map property\n" ); +return -EINVAL ; + } + nr_map = nr_cells / entry_cells; +/* Enable BDF to SID translation by disabling bypass mode (default) */ val =readl (pcie->parf +PARF_BDF_TO_SID_CFG ); val &= ~BDF_TO_SID_BYPASS ;writel (val, pcie->parf +PARF_BDF_TO_SID_CFG ); - map =kzalloc (size,GFP_KERNEL ); -if (!map) -return -ENOMEM ; - -of_property_read_u32_array (dev->of_node,"iommu-map" , (u32 *)map, - size /sizeof (u32)); - - nr_map = size / (sizeof (*map)); -crc8_populate_msb (qcom_pcie_crc8_table,QCOM_PCIE_CRC8_POLYNOMIAL );/* Registers need to be zero out first */ memset_io (bdf_to_sid_base,0 ,CRC8_TABLE_SIZE *sizeof (u32));/* Extract the SMMU SID base from the first entry of iommu-map */ - smmu_sid_base = map[0 ].smmu_sid; + smmu_sid_base =be32_to_cpu (map[2 ]);/* Look for an available entry to hold the mapping */ for (i =0 ; i < nr_map; i++) { -__be16 bdf_be =cpu_to_be16 (map[i].bdf); -u32 val; +u32 bdf =be32_to_cpu (map[i * entry_cells]); +u32 sid =be32_to_cpu (map[i * entry_cells +2 ]); +__be16 bdf_be =cpu_to_be16 (bdf);u8 hash; hash =crc8 (qcom_pcie_crc8_table, (u8 *)&bdf_be,sizeof (bdf_be),0 );
@@ -1042,12 +1082,10 @@ static int qcom_pcie_config_sid_1_9_0(struct qcom_pcie *pcie) }/* BDF [31:16] | SID [15:8] | NEXT [7:0] */ - val = map[i].bdf <<16 | (map[i].smmu_sid - smmu_sid_base) <<8 |0 ; + val = bdf <<16 | (sid - smmu_sid_base) <<8 |0 ;writel (val, bdf_to_sid_base + hash *sizeof (u32)); } -kfree (map); -return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2772/3318 calipso: hash the cache key, not the option start, in calipso_cache_add()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joas Antonio dos Santos <[email protected]>
[ Upstream commit d538cc3ec0bc4cb7b40981b3213a6c6671959ed5 ]
calipso_cache_add() stores calipso_ptr + 2 as the cache key, but computes entry->hash over calipso_ptr, i.e. starting two bytes earlier at the option type and length. calipso_opt_getattr() looks entries up with calipso_cache_check(calipso + 2, calipso[1], ...), which hashes the key itself.
The two hashes only match on a jhash collision, so the CALIPSO label cache never hits and every labelled packet takes the full DOI lookup and category conversion path. The memcmp() on the key keeps lookups correct, so this is a performance bug only.
Hash the stored key, as cipso_v4_cache_add() does for CIPSO.
--- net/ipv6/calipso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/calipso.c +1 -1
@@ -284,7 +284,7 @@ static int calipso_cache_add(const unsigned char *calipso_ptr, goto cache_add_failure; } entry->key_len = calipso_ptr_len; - entry->hash =calipso_map_cache_hash (calipso_ptr, calipso_ptr_len); + entry->hash =calipso_map_cache_hash (entry->key, calipso_ptr_len);refcount_inc (&secattr->cache->refcount); entry->lsm_data = secattr->cache;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2773/3318 clocksource/drivers/timer-mediatek: Fix random crash at boot
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Leonardo Scorcia <[email protected]>
[ Upstream commit 8496a1d234e8cf9cb15c4282cb3a11c6550bd242 ]
MediaTek bootloaders generally enable APXGPT timers at boot. This means that a timer IRQ can sometimes happen between the IRQ line request and the configuration of the clock event handler. This leads to a hard crash with an instruction abort, branch to pc 0x0 in mtk_gpt_interrupt handler as clkevt is null.
To avoid this issue request the IRQ with IRQF_NO_AUTOEN and enable it explicitly after the clock event is configured.
Issue was reported and fix tested on the Lenovo Tab E7 (TB-7104F, mt8167).
--- drivers/clocksource/timer-mediatek.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clocksource/timer-mediatek.c +3 -1
@@ -277,7 +277,7 @@ static struct timer_of to = { }, .of_irq = { - .flags = IRQF_TIMER | IRQF_IRQPOLL, + .flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_NO_AUTOEN, }, };
@@ -298,6 +298,7 @@ static int __init mtk_syst_init(struct device_node *node)clockevents_config_and_register (&to.clkevt,timer_of_rate (&to),TIMER_SYNC_TICKS ,0xffffffff ); +enable_irq (timer_of_irq (&to));return 0 ; }
@@ -334,6 +335,7 @@ static int __init mtk_gpt_init(struct device_node *node) TIMER_SYNC_TICKS, 0xffffffff);mtk_gpt_enable_irq (&to,TIMER_CLK_EVT ); +enable_irq (timer_of_irq (&to));return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2774/3318 RDMA/siw: Enforce IB_ACCESS_REMOTE_READ for read responses
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haitam Lazaar <[email protected]>
[ Upstream commit f74eac4fc6c56274fb96c2c44ffad8f01c325f17 ]
When generating an RDMA READ response (SIW_OP_READ_RESPONSE), siw_check_sgl_tx() unconditionally passes 0 as the required permission mask:
/* Reference memory to be tx'd w/o checking access for LOCAL_READ */
rv = siw_check_sgl_tx(qp->pd, wqe, 0);Because perms is 0, siw_check_mem()'s authorization test:
if ((mem->perms & perms) < perms)
evaluates to (mem->perms & 0) < 0, which is always false. Consequently, an untrusted remote peer can issue an RDMA Read targeting any valid STag in the Protection Domain, even if the memory was registered strictly as write-only (IB_ACCESS_REMOTE_WRITE) without IB_ACCESS_REMOTE_READ.
Enforce that the target memory region was granted IB_ACCESS_REMOTE_READ when answering SIW_OP_READ_RESPONSE work queue entries, while preserving perms = 0 for standard local sends.
--- drivers/infiniband/sw/siw/siw_qp_tx.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/infiniband/sw/siw/siw_qp_tx.c +11 -7
@@ -813,17 +813,21 @@ static int siw_qp_sq_proc_tx(struct siw_qp *qp, struct siw_wqe *wqe)if (wqe->wr_status ==SIW_WR_QUEUED ) {if (!(wqe->sqe.flags &SIW_WQE_INLINE )) { -if (tx_type (wqe) ==SIW_OP_READ_RESPONSE ) - wqe->sqe.num_sge =1 ; -if (tx_type (wqe) !=SIW_OP_READ &&tx_type (wqe) !=SIW_OP_READ_LOCAL_INV ) { +enum ib_access_flags perms =0 ; +/* -* Reference memory to be tx'd w/o checking -* access for LOCAL_READ permission, since -* not defined in RDMA core. +* Local READ permission doesn't exist in RDMA core. +* A READ RESPONSE source is read by the remote peer, +* so it must be checked for REMOTE_READ permission. */ - rv =siw_check_sgl_tx (qp->pd, wqe,0 ); +if (tx_type (wqe) ==SIW_OP_READ_RESPONSE ) { + perms =IB_ACCESS_REMOTE_READ ; + wqe->sqe.num_sge =1 ; + } + + rv =siw_check_sgl_tx (qp->pd, wqe, perms);if (rv <0 ) {if (tx_type (wqe) ==SIW_OP_READ_RESPONSE )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2775/3318 RDMA/efa: Fix race between admin command timeout and completion
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonatan Nachum <[email protected]>
[ Upstream commit 466612f8a8020c6b3af6377c730775a4c630f12c ]
An admin command that times out can race with the interrupt handler processing its completion, in two ways.
The timeout path releases the completion context without synchronizing against the handler. A handler that has already seen the command as submitted then copies the CQE into the caller's response buffer after the waiter returned and that buffer went out of scope.
The waiter can also observe the command as completed before the CQE was copied, since the status is published first. It decodes its own uninitialized response buffer, returns success with garbage contents and leaks stack data to the caller. Both wait paths read the status without the CQ lock.
Add a timed-out state and publish it under the CQ lock in both wait paths before returning, so the handler, which only completes commands in submitted state, cannot act on an abandoned context. In the interrupt wait path test the return value of the wait instead of the status: the handler signals the completion after copying the CQE, so a successful wait implies a valid response. Read the status in the polling wait path inside the critical section that drains the CQ, which also lets a completion arriving on the last iteration be honored instead of reported as a timeout.
--- drivers/infiniband/hw/efa/efa_com.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
drivers/infiniband/hw/efa/efa_com.c +20 -8
@@ -23,6 +23,7 @@enum efa_cmd_status {EFA_CMD_SUBMITTED ,EFA_CMD_COMPLETED , +EFA_CMD_TIMED_OUT , };struct efa_comp_ctx {
@@ -497,6 +498,7 @@ static int efa_com_comp_status_to_errno(u8 comp_status)static int efa_com_wait_and_process_admin_cq_polling (struct efa_comp_ctx *comp_ctx,struct efa_com_admin_queue *aq) { +bool comp_timeout = false;unsigned long timeout;unsigned long flags;
@@ -505,12 +507,19 @@ static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_cwhile (1 ) {spin_lock_irqsave (&aq->cq.lock, flags);efa_com_handle_admin_completion (aq); -spin_unlock_irqrestore (&aq->cq.lock, flags); - -if (comp_ctx->status !=EFA_CMD_SUBMITTED ) +if (comp_ctx->status !=EFA_CMD_SUBMITTED ) { +spin_unlock_irqrestore (&aq->cq.lock, flags);break ; + }if (time_is_before_jiffies (timeout)) { + comp_ctx->status =EFA_CMD_TIMED_OUT ; + comp_timeout = true; + } + +spin_unlock_irqrestore (&aq->cq.lock, flags); + +if (comp_timeout) {ibdev_err_ratelimited ( aq->efa_dev,"Wait for completion (polling) timeout\n" );
@@ -531,10 +540,11 @@ static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_cstatic int efa_com_wait_and_process_admin_cq_interrupts (struct efa_comp_ctx *comp_ctx,struct efa_com_admin_queue *aq) { -unsigned long flags; +unsigned long flags, remaining_jiffies; +bool completed; -wait_for_completion_timeout (&comp_ctx->wait_event, -usecs_to_jiffies (aq->completion_timeout)); + remaining_jiffies =wait_for_completion_timeout ( + &comp_ctx->wait_event,usecs_to_jiffies (aq->completion_timeout));/* * In case the command wasn't completed find out the root cause.
@@ -542,14 +552,16 @@ static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *com* 1) No completion (timeout reached) * 2) There is completion but the device didn't get any msi-x interrupt. */ -if (comp_ctx->status ==EFA_CMD_SUBMITTED ) { +if (remaining_jiffies ==0 ) {spin_lock_irqsave (&aq->cq.lock, flags);efa_com_handle_admin_completion (aq); + completed = (comp_ctx->status ==EFA_CMD_COMPLETED ); + comp_ctx->status =EFA_CMD_TIMED_OUT ;spin_unlock_irqrestore (&aq->cq.lock, flags);atomic64_inc (&aq->stats.no_completion); -if (comp_ctx->status ==EFA_CMD_COMPLETED ) +if (completed) ibdev_err_ratelimited( aq->efa_dev, "The device sent a completion but the driver didn't receive any MSI-X interrupt for admin cmd %s(%d) status %d (ctx: 0x%p, sq producer: %d, sq consumer: %d, cq consumer: %d)\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2776/3318 wifi: mac80211: fix encryption tailroom
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chien Wong <[email protected]>
[ Upstream commit c49f54fd2abff08964677db8fdc1674c713ab42c ]
BIP-CMAC-256 and BIP-GMAC append a 26-byte MME but mac80211 currently reserves only 18 bytes of encryption tailroom.
Generating 26-byte MME may happen to work because the actual skb tailroom can exceed the requested amount. For example, dev_alloc_skb() rounds the allocation to kmalloc size buckets or alignment boundaries, and the extra space may cover the 8-byte shortfall.
Reserve enough tailroom for the 26-byte MME.
--- net/mac80211/ieee80211_i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -51,7 +51,7 @@ struct ieee80211_mesh_fast_tx;/* Required encryption head and tailroom */ #define IEEE80211_ENCRYPT_HEADROOM 8 -#define IEEE80211_ENCRYPT_TAILROOM 18 +#define IEEE80211_ENCRYPT_TAILROOM 26/* current max: GMAC/CMAC-256 MME */ /* power level hasn't been configured (or set to automatic) */ #define IEEE80211_UNSET_POWER_LEVEL INT_MIN
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2777/3318 wifi: mac80211: reserve MME tailroom for protected beacons
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chien Wong <[email protected]>
[ Upstream commit 48002331da85c7c962cfbc09c8bd84d219a6fe1c ]
Beacon protection appends an MME to beacons, but the skb allocation does not reserve tailroom for it. If the available tailroom is too small, the crypto path drops the beacon.
Two factors often mask this: the 256-byte TIM reservation is rarely fully used, and dev_alloc_skb() may round up the allocation, leaving extra tailroom. Neither guarantees enough room for the MME.
Reserve enough room for the largest MME.
--- net/mac80211/tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/tx.c +2 -1
@@ -5468,7 +5468,8 @@ ieee80211_beacon_get_ap(struct ieee80211_hw *hw, skb =dev_alloc_skb (local->tx_headroom + beacon->head_len + beacon->tail_len +256 + - local->hw.extra_beacon_tailroom + mbssid_len); + local->hw.extra_beacon_tailroom + mbssid_len + +IEEE80211_ENCRYPT_TAILROOM );if (!skb)return NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2778/3318 wifi: mwifiex: append hotfix number to firmware version string
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Chen <[email protected]>
[ Upstream commit 958f20d5aa0aa645068454fdb62ebc625ac9a115 ]
mwifiex_ret_get_hw_spec() parses and logs the FW_HOTFIX_VER_ID TLV, but the hotfix value is not stored in the adapter structure. As a result, the hotfix number never appears in the firmware version string returned by mwifiex_drv_get_driver_version().
Store the hotfix version from FW_HOTFIX_VER_ID and append it to the firmware version string.
--- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 10 ++++++++-- drivers/net/wireless/marvell/mwifiex/fw.h | 6 ++++++ drivers/net/wireless/marvell/mwifiex/init.c | 1 + drivers/net/wireless/marvell/mwifiex/main.h | 1 + drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 ++- 5 files changed, 18 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/cmdevt.c +8 -2
@@ -1607,11 +1607,17 @@ int mwifiex_ret_get_hw_spec(struct mwifiex_private *priv, api_rev->major_ver, api_rev->minor_ver);break ; -case FW_HOTFIX_VER_ID : +case FW_HOTFIX_VER_ID : { +struct hw_spec_fw_hotfix_ver *hf; + + hf = (void *)tlv; + adapter->fw_hotfix_ver = +le16_to_cpu (hf->hotfix_ver);mwifiex_dbg (adapter,INFO ,"Firmware hotfix version %d\n" , - api_rev->major_ver); + adapter->fw_hotfix_ver);break ; + }default : mwifiex_dbg(adapter, FATAL, "Unknown api_id: %d\n",
drivers/net/wireless/marvell/mwifiex/fw.h +6 -0
@@ -1059,6 +1059,12 @@ struct hw_spec_api_rev {u8 minor_ver; } __packed; +struct hw_spec_fw_hotfix_ver { +struct mwifiex_ie_types_header header; +__le16 api_id; +__le16 hotfix_ver; +} __packed; +struct host_cmd_ds_get_hw_spec {__le16 hw_if_version;__le16 version;
drivers/net/wireless/marvell/mwifiex/init.c +1 -0
@@ -289,6 +289,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->config_bands =0 ; adapter->adhoc_start_band =0 ; adapter->fw_release_number =0 ; + adapter->fw_hotfix_ver =0 ; adapter->fw_cap_info =0 ;memset (&adapter->upld_buf,0 ,sizeof (adapter->upld_buf)); adapter->event_cause =0 ;
drivers/net/wireless/marvell/mwifiex/main.h +1 -0
@@ -999,6 +999,7 @@ struct mwifiex_adapter {bool ext_scan;u8 fw_api_ver; +u16 fw_hotfix_ver;u8 key_api_major_ver, key_api_minor_ver;u8 max_p2p_conn, max_sta_conn;struct memory_type_mapping *mem_type_mapping_tbl;
drivers/net/wireless/marvell/mwifiex/sta_ioctl.c +2 -1
@@ -1090,7 +1090,8 @@ mwifiex_drv_get_driver_version(struct mwifiex_adapter *adapter, char *version,char fw_ver[32 ]; ver.l =cpu_to_le32 (adapter->fw_release_number); -sprintf (fw_ver,"%u.%u.%u.p%u" , ver.c[2 ], ver.c[1 ], ver.c[0 ], ver.c[3 ]); +sprintf (fw_ver,"%u.%u.%u.p%u.%u" , ver.c[2 ], ver.c[1 ], + ver.c[0 ], ver.c[3 ], adapter->fw_hotfix_ver);snprintf (version, max_len, driver_version, fw_ver);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2779/3318 tcp_bic: fix divide by zero on max_increment == 0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 8edbf6c23363563e508a61f3f26f4e4b6eec9dd5 ]
max_increment is how many packets cwnd can grow per RTT, so 0 makes no sense, and bictcp_update() divides by it.
Reject values below 1 when the parameter is written.
--- net/ipv4/tcp_bic.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/ipv4/tcp_bic.c +12 -2
@@ -27,15 +27,25 @@*/ static int fast_convergence =1 ; -static int max_increment =16 ; +static unsigned int max_increment =16 ;static int low_window =14 ;static int beta =819 ;/* = 819/1024 (BICTCP_BETA_SCALE) */ static int initial_ssthresh;static int smooth_part =20 ; +static int max_increment_set (const char *val,const struct kernel_param *kp) +{ +return param_set_uint_minmax (val, kp,1 ,INT_MAX ); +} + +static const struct kernel_param_ops max_increment_ops = { + .set = max_increment_set, + .get = param_get_uint, +}; +module_param (fast_convergence, int,0644 );MODULE_PARM_DESC (fast_convergence,"turn on/off fast convergence" ); -module_param (max_increment, int,0644 ); +module_param_cb (max_increment, &max_increment_ops, &max_increment,0644 );MODULE_PARM_DESC (max_increment,"Limit on increment allowed during binary search" );module_param (low_window, int,0644 );MODULE_PARM_DESC (low_window,"lower bound on congestion window (for TCP friendliness)" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2780/3318 tcp_hybla: fix divide by zero on rtt0 == 0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit f09eb97322b16a6f709a47599c95b62f786905f9 ]
rtt0 is the reference RTT in ms, so 0 makes no sense, and hybla_recalc_param() divides by it right from hybla_init().
Reject values below 1 when the parameter is written. Also cap it at U32_MAX / USEC_PER_MSEC, since rtt0 * USEC_PER_MSEC can wrap to 0 on 32-bit. An rtt0 above that (about 71 minutes) makes no sense anyway.
--- net/ipv4/tcp_hybla.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
net/ipv4/tcp_hybla.c +14 -2
@@ -26,8 +26,20 @@ struct hybla { };/* Hybla reference round trip time (default= 1/40 sec = 25 ms), in ms */ -static int rtt0 =25 ; -module_param (rtt0, int,0644 ); +static unsigned int rtt0 =25 ; + +static int rtt0_set (const char *val,const struct kernel_param *kp) +{ +/* avoid rtt0 * USEC_PER_MSEC overflow */ +return param_set_uint_minmax (val, kp,1 ,U32_MAX /USEC_PER_MSEC ); +} + +static const struct kernel_param_ops rtt0_ops = { + .set = rtt0_set, + .get = param_get_uint, +}; + +module_param_cb (rtt0, &rtt0_ops, &rtt0,0644 );MODULE_PARM_DESC (rtt0,"reference rout trip time (ms)" );/* This is called to refresh values for hybla parameters */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2781/3318 tcp_cubic: fix divide by zero and endless loop on bad module params
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 7d52b5d16afc1cf8484ae321658e217a80e3ff4d ]
beta_scale and cube_factor are computed once at module init, and beta == 1024 or bic_scale == 0 is a divide by zero right there. Other out of range values give garbage: negative beta can make beta_scale 0, and bic_scale * 10 can overflow. Reject them. Read beta once, as it can be written through sysfs before the init function runs.
A small beta also gives a small beta_scale, and (cwnd * beta_scale) >> 3 truncates to 0 for a tiny cwnd, so the TCP friendliness loop never ends. Rather than testing delta on every ACK, make sure beta_scale is at least 8 at init, so delta is >= 1 within the cwnd < 1 million packets limit this code is designed for. This slows the TCP friendly estimate for beta < 512, a backoff harder than Reno's 0.5, which is not a setting anyone should use.
--- net/ipv4/tcp_cubic.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/ipv4/tcp_cubic.c +12 -2
@@ -507,16 +507,26 @@ static const struct btf_kfunc_id_set tcp_cubic_kfunc_set = {static int __init cubictcp_register (void ) { +int b =READ_ONCE (beta);int ret;BUILD_BUG_ON (sizeof (struct bictcp ) >ICSK_CA_PRIV_SIZE ); +if (b <0 || b >=BICTCP_BETA_SCALE || + bic_scale <=0 || bic_scale >INT_MAX /10 ) { +pr_err ("tcp_cubic: invalid beta %d or bic_scale %d\n" , + b, bic_scale); +return -EINVAL ; + } +/* Precompute a bunch of the scaling factors that are used per-packet * based on SRTT of 100ms */ - beta_scale =8 *(BICTCP_BETA_SCALE +beta) /3 - / (BICTCP_BETA_SCALE - beta); + beta_scale =8 * (BICTCP_BETA_SCALE + b) /3 + / (BICTCP_BETA_SCALE - b); +/* bictcp_update() needs (cwnd * beta_scale) >> 3 to be >= 1 */ + beta_scale =max (beta_scale,8U ); cube_rtt_scale = (bic_scale *10 );/* 1024*c/rtt */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2782/3318 serial: max310x: dont clobber the TX break bit in set_termios
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit 3b2de448ec0332c1cb8c38b4c5ff0c8e860befbc ]
A TX break asserted with TIOCSBRK ends early, with no error reported, as soon as any termios change lands on the port: a break is a state that must hold until TIOCCBRK, but max310x_set_termios() overwrites the whole LCR register, and LCR also carries the TX break bit that break_ctl() drives. No concurrency is required - a baud or parity change from the same process ends the break just as well, and break-led protocols lose their break with nothing in the logs.
Update only the LCR bits that are derived from termios and leave the TX break and RTS pin control bits untouched. Since nothing clears a break when a port is closed with the break still asserted - the tty core sends no break-off on release, and the unconditional write here was the accidental recovery - clear TXBREAK in startup(), the same way 8250 does.
--- drivers/tty/serial/max310x.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/tty/serial/max310x.c +15 -2
@@ -154,6 +154,8 @@#define MAX310X_LCR_FORCEPARITY_BIT (1 << 5)/* 9-bit multidrop parity */ #define MAX310X_LCR_TXBREAK_BIT (1 << 6)/* TX break enable */ #define MAX310X_LCR_RTS_BIT (1 << 7)/* RTS pin control */ +/* LCR bits owned by termios; TX break and RTS are driven elsewhere */ +#define MAX310X_LCR_TERMIOS_MASK GENMASK(5, 0)/* IRDA register bits */ #define MAX310X_IRDA_IRDAEN_BIT (1 << 0)/* IRDA mode enable */
@@ -959,8 +961,12 @@ static void max310x_set_termios(struct uart_port *port,if (termios->c_cflag &CSTOPB ) lcr |=MAX310X_LCR_STOPLEN_BIT ;/* 2 stops */ -/* Update LCR register */ -max310x_port_write (port,MAX310X_LCR_REG , lcr); +/* +* Update LCR register. Leave the TX break bit alone: it is driven by +* break_ctl(), and a whole-register write here would end a break in +* progress. +*/ +max310x_port_update (port,MAX310X_LCR_REG ,MAX310X_LCR_TERMIOS_MASK , lcr);/* Set read status mask */ port->read_status_mask =MAX310X_LSR_RXOVR_BIT ;
@@ -1077,6 +1083,13 @@ static int max310x_startup(struct uart_port *port) s->devtype->power (port,1 ); +/* +* Clear a latched break: nothing clears TXBREAK when a port is +* closed with a break still asserted, and set_termios() no longer +* rewrites it. +*/ +max310x_port_update (port,MAX310X_LCR_REG ,MAX310X_LCR_TXBREAK_BIT ,0 ); +/* Configure MODE1 register */ max310x_port_update (port,MAX310X_MODE1_REG ,MAX310X_MODE1_TRNSCVCTRL_BIT ,0 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2783/3318 serial: max310x: remove trailing whitespaces
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit cee8e0cc9308ab55d4c3bd8eae5f6b4b65898e59 ]
Fix coding style. No functional changes.
Stable-dep-of: 4efacb600bf9 ("serial: max310x: fix breaks not reaching the wire in RS485 mode")
--- drivers/tty/serial/max310x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/max310x.c +1 -1
@@ -412,7 +412,7 @@ static int max14830_detect(struct device *dev) ret = s->if_cfg->extended_reg_enable (dev, true);if (ret)return ret; - +regmap_read (s->regmap, s->if_cfg->rev_id_reg, &val); s->if_cfg->extended_reg_enable (dev, false);if (((val & MAX310x_REV_MASK) !=MAX14830_REV_ID )) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2784/3318 serial: max310x: remove holes in struct max310x_devtype
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit eaf29135abb1c152a05572a5454c61dcd65bdeea ]
Running pahole shows that there are some holes within the max310x_devtype structure.
Remove holes and optimize alignment by reorganizing structure members.
This can also lead to data structure size reduction for some CPUs.
On 64-bit CPU (arm64):
Before:
/* size: 40, cachelines: 1, members: 6 */
/* sum members: 34, holes: 2, sum holes: 6 */
/* last cacheline: 40 bytes */
After:
/* size: 40, cachelines: 1, members: 6 */
/* padding: 6 */
/* last cacheline: 40 bytes */On 32-bit CPU (i386):
Before:
/* size: 32, cachelines: 1, members: 6 */
/* sum members: 26, holes: 2, sum holes: 6 */
/* last cacheline: 32 bytes */
After:
/* size: 24, cachelines: 1, members: 8 */
/* padding: 2 */
/* last cacheline: 24 bytes */Stable-dep-of: 4efacb600bf9 ("serial: max310x: fix breaks not reaching the wire in RS485 mode")
--- drivers/tty/serial/max310x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/max310x.c +2 -2
@@ -268,11 +268,11 @@ struct max310x_devtype {unsigned short min;unsigned short max; } slave_addr; -char name[9 ];int nr; -u8 mode1;int (*detect)(struct device *);void (*power)(struct uart_port *,int ); +char name[9 ]; +u8 mode1; };struct max310x_one {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2785/3318 serial: max310x: simplify probe() and remove() error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 5d888f1c32e2281843d58eef963e3ebd625b77a9 ]
Simplify error handling and only call uart_remove_one_port() if line bit is set, instead of having to manually set s->p[i].port.dev to NULL.
Stable-dep-of: 4efacb600bf9 ("serial: max310x: fix breaks not reaching the wire in RS485 mode")
--- drivers/tty/serial/max310x.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/tty/serial/max310x.c +7 -8
@@ -1451,10 +1451,9 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty/* Register port */ ret =uart_add_one_port (&max310x_uart, &s->p[i].port); -if (ret) { - s->p[i].port.dev =NULL ; +if (ret) goto out_uart; - } +set_bit (line, max310x_lines);/* Go to suspend mode */
@@ -1490,10 +1489,8 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty out_uart:for (i =0 ; i < devtype->nr; i++) { -if (s->p[i].port.dev) { +if (test_and_clear_bit (s->p[i].port.line, max310x_lines))uart_remove_one_port (&max310x_uart, &s->p[i].port); -clear_bit (s->p[i].port.line, max310x_lines); - } } out_clk:
@@ -1511,8 +1508,10 @@ static void max310x_remove(struct device *dev)cancel_work_sync (&s->p[i].tx_work);cancel_work_sync (&s->p[i].md_work);cancel_work_sync (&s->p[i].rs_work); -uart_remove_one_port (&max310x_uart, &s->p[i].port); -clear_bit (s->p[i].port.line, max310x_lines); + +if (test_and_clear_bit (s->p[i].port.line, max310x_lines)) +uart_remove_one_port (&max310x_uart, &s->p[i].port); + s->devtype->power (&s->p[i].port,0 ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2786/3318 serial: max310x: use common detect function for all variants
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 74fe93eae5389c96d4cfd4bc0cc5a547373ab96a ]
Simplify driver by defining a common function to handle the detection of all variants.
Stable-dep-of: 4efacb600bf9 ("serial: max310x: fix breaks not reaching the wire in RS485 mode")
--- drivers/tty/serial/max310x.c | 134 ++++++++++++++--------------------- 1 file changed, 54 insertions(+), 80 deletions(-)
drivers/tty/serial/max310x.c +54 -80
@@ -66,6 +66,7 @@#define MAX310X_BRGDIVMSB_REG (0x1d)/* Baud rate divisor MSB */ #define MAX310X_CLKSRC_REG (0x1e)/* Clock source */ #define MAX310X_REG_1F (0x1f) +#define MAX310X_EXTREG_START (0x20)/* Only relevant in SPI mode. */ #define MAX310X_REVID_REG MAX310X_REG_1F/* Revision ID */
@@ -73,9 +74,9 @@#define MAX310X_GLOBALCMD_REG MAX310X_REG_1F/* Global Command (WO) */ /* Extended registers */ -#define MAX310X_SPI_REVID_EXTREG MAX310X_REG_05/* Revision ID */ -#define MAX310X_I2C_REVID_EXTREG (0x25)/* Revision ID */ - +#define MAX310X_REVID_EXTREG (0x25)/* Revision ID +* (extended addressing space) +*/ /* IRQ register bits */ #define MAX310X_IRQ_LSR_BIT (1 << 0)/* LSR interrupt */ #define MAX310X_IRQ_SPCHR_BIT (1 << 1)/* Special char interrupt */
@@ -259,8 +260,7 @@struct max310x_if_cfg {int (*extended_reg_enable)(struct device *dev,bool enable); - -unsigned int rev_id_reg; +u8 rev_id_offset; };struct max310x_devtype {
@@ -269,10 +269,11 @@ struct max310x_devtype {unsigned short max; } slave_addr;int nr; -int (*detect)(struct device *);void (*power)(struct uart_port *,int );char name[9 ];u8 mode1; +u8 rev_id_val; +u8 rev_id_reg;/* Relevant only if rev_id_val is defined. */ };struct max310x_one {
@@ -333,62 +334,52 @@ static void max310x_port_update(struct uart_port *port, u8 reg, u8 mask, u8 val)regmap_update_bits (one->regmap, reg, mask, val); } -static int max3107_detect (struct device *dev) +static int max310x_detect (struct device *dev) {struct max310x_port *s =dev_get_drvdata (dev);unsigned int val =0 ;int ret; - ret =regmap_read (s->regmap,MAX310X_REVID_REG , &val); -if (ret) -return ret; - -if (((val & MAX310x_REV_MASK) !=MAX3107_REV_ID )) { -dev_err (dev, -"%s ID 0x%02x does not match\n" , s->devtype->name, val); -return -ENODEV ; - } +/* Check if variant supports REV ID register: */ +if (s->devtype->rev_id_val) { +u8 rev_id_reg = s->devtype->rev_id_reg; -return 0 ; -} +/* Check if REV ID is in extended addressing space: */ +if (s->devtype->rev_id_reg >=MAX310X_EXTREG_START ) { + ret = s->if_cfg->extended_reg_enable (dev, true); +if (ret) +return ret; -static int max3108_detect (struct device *dev) -{ -struct max310x_port *s =dev_get_drvdata (dev); -unsigned int val =0 ; -int ret; - -/* MAX3108 have not REV ID register, we just check default value -* from clocksource register to make sure everything works. -*/ - ret =regmap_read (s->regmap,MAX310X_CLKSRC_REG , &val); -if (ret) -return ret; - -if (val != (MAX310X_CLKSRC_EXTCLK_BIT |MAX310X_CLKSRC_PLLBYP_BIT )) { -dev_err (dev,"%s not present\n" , s->devtype->name); -return -ENODEV ; - } +/* Adjust REV ID extended addressing space address: */ +if (s->if_cfg->rev_id_offset) + rev_id_reg -= s->if_cfg->rev_id_offset; + } -return 0 ; -} +regmap_read (s->regmap, rev_id_reg, &val); -static int max3109_detect (struct device *dev) -{ -struct max310x_port *s =dev_get_drvdata (dev); -unsigned int val =0 ; -int ret; +if (s->devtype->rev_id_reg >=MAX310X_EXTREG_START ) { + ret = s->if_cfg->extended_reg_enable (dev, false); +if (ret) +return ret; + } - ret = s->if_cfg->extended_reg_enable (dev, true); -if (ret) -return ret; +if (((val & MAX310x_REV_MASK) != s->devtype->rev_id_val)) +return dev_err_probe (dev, -ENODEV , +"%s ID 0x%02x does not match\n" , + s->devtype->name, val); + }else { +/* +* For variant without REV ID register, just check default value +* from clocksource register to make sure everything works. +*/ + ret =regmap_read (s->regmap,MAX310X_CLKSRC_REG , &val); +if (ret) +return ret; -regmap_read (s->regmap, s->if_cfg->rev_id_reg, &val); - s->if_cfg->extended_reg_enable (dev, false); -if (((val & MAX310x_REV_MASK) !=MAX3109_REV_ID )) { -dev_err (dev, -"%s ID 0x%02x does not match\n" , s->devtype->name, val); -return -ENODEV ; +if (val != (MAX310X_CLKSRC_EXTCLK_BIT |MAX310X_CLKSRC_PLLBYP_BIT )) +return dev_err_probe (dev, -ENODEV , +"%s not present\n" , + s->devtype->name); }return 0 ;
@@ -403,27 +394,6 @@ static void max310x_power(struct uart_port *port, int on)msleep (50 ); } -static int max14830_detect (struct device *dev) -{ -struct max310x_port *s =dev_get_drvdata (dev); -unsigned int val =0 ; -int ret; - - ret = s->if_cfg->extended_reg_enable (dev, true); -if (ret) -return ret; - -regmap_read (s->regmap, s->if_cfg->rev_id_reg, &val); - s->if_cfg->extended_reg_enable (dev, false); -if (((val & MAX310x_REV_MASK) !=MAX14830_REV_ID )) { -dev_err (dev, -"%s ID 0x%02x does not match\n" , s->devtype->name, val); -return -ENODEV ; - } - -return 0 ; -} -static void max14830_power (struct uart_port *port,int on) { max310x_port_update(port, MAX310X_BRGCFG_REG,
@@ -437,7 +407,8 @@ static const struct max310x_devtype max3107_devtype = { .name = "MAX3107", .nr = 1, .mode1 = MAX310X_MODE1_AUTOSLEEP_BIT | MAX310X_MODE1_IRQSEL_BIT, - .detect = max3107_detect, + .rev_id_val = MAX3107_REV_ID, + .rev_id_reg = MAX310X_REVID_REG, .power = max310x_power, .slave_addr = { .min = 0x2c,
@@ -449,7 +420,8 @@ static const struct max310x_devtype max3108_devtype = { .name = "MAX3108", .nr = 1, .mode1 = MAX310X_MODE1_AUTOSLEEP_BIT, - .detect = max3108_detect, + .rev_id_val = 0, /* Unsupported. */ + .rev_id_reg = 0, /* Irrelevant when rev_id_val is not defined. */ .power = max310x_power, .slave_addr = { .min = 0x60,
@@ -461,7 +433,8 @@ static const struct max310x_devtype max3109_devtype = { .name = "MAX3109", .nr = 2, .mode1 = MAX310X_MODE1_AUTOSLEEP_BIT, - .detect = max3109_detect, + .rev_id_val = MAX3109_REV_ID, + .rev_id_reg = MAX310X_REVID_EXTREG, .power = max310x_power, .slave_addr = { .min = 0x60,
@@ -473,7 +446,8 @@ static const struct max310x_devtype max14830_devtype = { .name = "MAX14830", .nr = 4, .mode1 = MAX310X_MODE1_IRQSEL_BIT, - .detect = max14830_detect, + .rev_id_val = MAX14830_REV_ID, + .rev_id_reg = MAX310X_REVID_EXTREG, .power = max14830_power, .slave_addr = { .min = 0x60,
@@ -1369,7 +1343,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtydev_set_drvdata (dev, s);/* Check device to ensure we are talking to what we expect */ - ret = devtype->detect (dev); + ret =max310x_detect (dev);if (ret) goto out_clk;
@@ -1553,7 +1527,7 @@ static int max310x_spi_extended_reg_enable(struct device *dev, bool enable)static const struct max310x_if_cfg __maybe_unused max310x_spi_if_cfg = { .extended_reg_enable = max310x_spi_extended_reg_enable, - .rev_id_reg =MAX310X_SPI_REVID_EXTREG , + .rev_id_offset =MAX310X_EXTREG_START , };static int max310x_spi_probe (struct spi_device *spi)
@@ -1624,7 +1598,7 @@ static struct regmap_config regcfg_i2c = { .writeable_reg = max310x_reg_writeable, .volatile_reg = max310x_reg_volatile, .precious_reg = max310x_reg_precious, - .max_register = MAX310X_I2C_REVID_EXTREG, + .max_register = MAX310X_REVID_EXTREG, .writeable_noinc_reg = max310x_reg_noinc, .readable_noinc_reg = max310x_reg_noinc, .max_raw_read = MAX310X_FIFO_SIZE,
@@ -1633,7 +1607,7 @@ static struct regmap_config regcfg_i2c = {static const struct max310x_if_cfg max310x_i2c_if_cfg = { .extended_reg_enable = max310x_i2c_extended_reg_enable, - .rev_id_reg =MAX310X_I2C_REVID_EXTREG , + .rev_id_offset =0 ,/* No offset in I2C mode. */ }; static unsigned short max310x_i2c_slave_addr(unsigned short addr,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2787/3318 serial: max310x: use common power function for all variants
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 9464833a765f66a9fbc0b972e89c1e1a13f4d3a0 ]
Simplify driver by defining a common function to handle the power control of all variants.
Stable-dep-of: 4efacb600bf9 ("serial: max310x: fix breaks not reaching the wire in RS485 mode")
--- drivers/tty/serial/max310x.c | 44 ++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 25 deletions(-)
drivers/tty/serial/max310x.c +19 -25
@@ -269,11 +269,12 @@ struct max310x_devtype {unsigned short max; } slave_addr;int nr; -void (*power)(struct uart_port *,int );char name[9 ];u8 mode1;u8 rev_id_val;u8 rev_id_reg;/* Relevant only if rev_id_val is defined. */ +u8 power_reg;/* Register address for power/sleep control. */ +u8 power_bit;/* Bit for sleep or power-off mode (active high). */ };struct max310x_one {
@@ -387,18 +388,10 @@ static int max310x_detect(struct device *dev)static void max310x_power (struct uart_port *port,int on) { -max310x_port_update (port,MAX310X_MODE1_REG , -MAX310X_MODE1_FORCESLEEP_BIT , - on ?0 :MAX310X_MODE1_FORCESLEEP_BIT ); -if (on) -msleep (50 ); -} +struct max310x_port *s =dev_get_drvdata (port->dev); -static void max14830_power (struct uart_port *port,int on) -{ -max310x_port_update (port,MAX310X_BRGCFG_REG , -MAX14830_BRGCFG_CLKDIS_BIT , - on ?0 :MAX14830_BRGCFG_CLKDIS_BIT ); +max310x_port_update (port, s->devtype->power_reg, s->devtype->power_bit, + on ?0 : s->devtype->power_bit);if (on)msleep (50 ); }
@@ -409,7 +402,8 @@ static const struct max310x_devtype max3107_devtype = { .mode1 = MAX310X_MODE1_AUTOSLEEP_BIT | MAX310X_MODE1_IRQSEL_BIT, .rev_id_val = MAX3107_REV_ID, .rev_id_reg = MAX310X_REVID_REG, - .power = max310x_power, + .power_reg = MAX310X_MODE1_REG, + .power_bit = MAX310X_MODE1_FORCESLEEP_BIT, .slave_addr = { .min = 0x2c, .max = 0x2f,
@@ -422,7 +416,8 @@ static const struct max310x_devtype max3108_devtype = { .mode1 = MAX310X_MODE1_AUTOSLEEP_BIT, .rev_id_val = 0, /* Unsupported. */ .rev_id_reg = 0, /* Irrelevant when rev_id_val is not defined. */ - .power = max310x_power, + .power_reg = MAX310X_MODE1_REG, + .power_bit = MAX310X_MODE1_FORCESLEEP_BIT, .slave_addr = { .min = 0x60, .max = 0x6f,
@@ -435,7 +430,8 @@ static const struct max310x_devtype max3109_devtype = { .mode1 = MAX310X_MODE1_AUTOSLEEP_BIT, .rev_id_val = MAX3109_REV_ID, .rev_id_reg = MAX310X_REVID_EXTREG, - .power = max310x_power, + .power_reg = MAX310X_MODE1_REG, + .power_bit = MAX310X_MODE1_FORCESLEEP_BIT, .slave_addr = { .min = 0x60, .max = 0x6f,
@@ -448,7 +444,8 @@ static const struct max310x_devtype max14830_devtype = { .mode1 = MAX310X_MODE1_IRQSEL_BIT, .rev_id_val = MAX14830_REV_ID, .rev_id_reg = MAX310X_REVID_EXTREG, - .power = max14830_power, + .power_reg = MAX310X_BRGCFG_REG, + .power_bit = MAX14830_BRGCFG_CLKDIS_BIT, .slave_addr = { .min = 0x60, .max = 0x6f,
@@ -1052,10 +1049,9 @@ static int max310x_rs485_config(struct uart_port *port, struct ktermios *termiosstatic int max310x_startup (struct uart_port *port) { -struct max310x_port *s =dev_get_drvdata (port->dev);unsigned int val; - s->devtype->power (port,1 ); +max310x_power (port,1 );/* * Clear a latched break: nothing clears TXBREAK when a port is
@@ -1107,12 +1103,10 @@ static int max310x_startup(struct uart_port *port)static void max310x_shutdown (struct uart_port *port) { -struct max310x_port *s =dev_get_drvdata (port->dev); -/* Disable all interrupts */ max310x_port_write (port,MAX310X_IRQEN_REG ,0 ); - s->devtype->power (port,0 ); +max310x_power (port,0 ); }static const char *max310x_type (struct uart_port *port)
@@ -1174,7 +1168,7 @@ static int __maybe_unused max310x_suspend(struct device *dev)for (i =0 ; i < s->devtype->nr; i++) {uart_suspend_port (&max310x_uart, &s->p[i].port); - s->devtype->power (&s->p[i].port,0 ); +max310x_power (&s->p[i].port,0 ); }return 0 ;
@@ -1186,7 +1180,7 @@ static int __maybe_unused max310x_resume(struct device *dev)int i;for (i =0 ; i < s->devtype->nr; i++) { - s->devtype->power (&s->p[i].port,1 ); +max310x_power (&s->p[i].port,1 );uart_resume_port (&max310x_uart, &s->p[i].port); }
@@ -1431,7 +1425,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtyset_bit (line, max310x_lines);/* Go to suspend mode */ - devtype->power (&s->p[i].port,0 ); +max310x_power (&s->p[i].port,0 ); }#ifdef CONFIG_GPIOLIB
@@ -1486,7 +1480,7 @@ static void max310x_remove(struct device *dev)if (test_and_clear_bit (s->p[i].port.line, max310x_lines))uart_remove_one_port (&max310x_uart, &s->p[i].port); - s->devtype->power (&s->p[i].port,0 ); +max310x_power (&s->p[i].port,0 ); }clk_disable_unprepare (s->clk);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2788/3318 serial: max310x: fix breaks not reaching the wire in RS485 mode
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit 4efacb600bf98b13e0659f05afa4549795277e35 ]
The chip's auto-RTS (MODE1.TRNSCVCTRL) asserts the RS485 transceiver only while FIFO data is shifting out, and a break is not FIFO data: on an RS485 port a requested break sets the TX break bit but the transceiver is never enabled, so the break never reaches the wire. Break-led protocols cannot work at all.
Disable auto-RTS for the break duration and drive RTS manually via the LCR RTS bit, then restore auto-RTS when the break ends. Track the break in tx_break and leave MODE1 alone in the rs485-config worker while it is set - a TIOCSRS485 arriving mid-break would otherwise re-enable auto-RTS on top of the manual RTS and release the transceiver before the break ends; break_ctl() restores auto-RTS from the then-current configuration when the break completes. The worker runs under port->mutex - break_ctl() and set_termios() already do - so the tx_break test and the MODE1 write cannot straddle a break starting or ending, and startup() clears tx_break alongside the latched TXBREAK bit, since a port can be closed with a break still asserted.
Only the break assertion is gated on RS485 being enabled; the restore at break end runs unconditionally and derives MODE1 from the current configuration. Returning early for a port whose RS485 was disabled mid-break - that reconfigure is deferred like any other - would leak the manually driven RTS and leave the transceiver holding the bus indefinitely after the break ends. On a non-RS485 port the restore is a no-op: nothing else writes the LCR RTS bit.
--- drivers/tty/serial/max310x.c | 49 ++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-)
drivers/tty/serial/max310x.c +47 -2
@@ -283,6 +283,7 @@ struct max310x_one {struct work_struct md_work;struct work_struct rs_work;struct regmap *regmap; +bool tx_break;/* break_ctl() owns the transceiver */ u8 rx_buf[MAX310X_FIFO_SIZE ]; };
@@ -655,6 +656,12 @@ static void max310x_batch_read(struct uart_port *port, u8 *rxbuf, unsigned int lregmap_noinc_read (one->regmap,MAX310X_RHR_REG , rxbuf, len); } +static void max310x_rts_ctl (struct uart_port *port,bool rts_state) +{ +max310x_port_update (port,MAX310X_LCR_REG ,MAX310X_LCR_RTS_BIT , + rts_state ?MAX310X_LCR_RTS_BIT :0 ); +} +static void max310x_handle_rx (struct uart_port *port,unsigned int rxlen) {struct max310x_one *one =to_max310x_port (port);
@@ -890,9 +897,32 @@ static void max310x_set_mctrl(struct uart_port *port, unsigned int mctrl)static void max310x_break_ctl (struct uart_port *port,int break_state) { +struct max310x_one *one =to_max310x_port (port); + + one->tx_break = break_state; +max310x_port_update (port,MAX310X_LCR_REG ,MAX310X_LCR_TXBREAK_BIT , break_state ?MAX310X_LCR_TXBREAK_BIT :0 ); + +/* +* The chip's auto-RTS asserts the transceiver only while FIFO data is +* shifting out, and a break is not FIFO data. Disable auto-RTS for the +* break duration and drive RTS manually so the break reaches the wire; +* restore auto-RTS when the break ends. +*/ +if (break_state) { +if (!(port->rs485.flags &SER_RS485_ENABLED )) +return ; +max310x_port_update (port,MAX310X_MODE1_REG , +MAX310X_MODE1_TRNSCVCTRL_BIT ,0 ); + }else { +max310x_port_update (port,MAX310X_MODE1_REG , +MAX310X_MODE1_TRNSCVCTRL_BIT , + (port->rs485.flags &SER_RS485_ENABLED ) ? +MAX310X_MODE1_TRNSCVCTRL_BIT :0 ); + } +max310x_rts_ctl (port, break_state); } static void max310x_set_termios(struct uart_port *port,
@@ -1014,6 +1044,13 @@ static void max310x_rs_proc(struct work_struct *ws) struct max310x_one *one = container_of(ws, struct max310x_one, rs_work);unsigned int delay, mode1 =0 , mode2 =0 ; +/* +* Serialize against break_ctl() and set_termios(), which run under +* port->mutex: the tx_break test below and the MODE1 write must not +* straddle a break starting or ending. +*/ +guard (mutex)(&one->port.state->port.mutex); + delay = (one->port.rs485.delay_rts_before_send <<4 ) | one->port.rs485.delay_rts_after_send;max310x_port_write (&one->port,MAX310X_HDPIXDELAY_REG , delay);
@@ -1025,8 +1062,14 @@ static void max310x_rs_proc(struct work_struct *ws) mode2 =MAX310X_MODE2_ECHOSUPR_BIT ; } -max310x_port_update (&one->port,MAX310X_MODE1_REG , -MAX310X_MODE1_TRNSCVCTRL_BIT , mode1); +/* +* A break owns the transceiver: break_ctl() disabled auto-RTS and +* drives RTS manually, and restores it when the break ends. Leave +* MODE1 alone meanwhile or the break goes undriven mid-way. +*/ +if (!one->tx_break) +max310x_port_update (&one->port,MAX310X_MODE1_REG , +MAX310X_MODE1_TRNSCVCTRL_BIT , mode1);max310x_port_update (&one->port,MAX310X_MODE2_REG ,MAX310X_MODE2_ECHOSUPR_BIT , mode2); }
@@ -1049,6 +1092,7 @@ static int max310x_rs485_config(struct uart_port *port, struct ktermios *termiosstatic int max310x_startup (struct uart_port *port) { +struct max310x_one *one =to_max310x_port (port);unsigned int val;max310x_power (port,1 );
@@ -1058,6 +1102,7 @@ static int max310x_startup(struct uart_port *port)* closed with a break still asserted, and set_termios() no longer * rewrites it. */ + one->tx_break = false;max310x_port_update (port,MAX310X_LCR_REG ,MAX310X_LCR_TXBREAK_BIT ,0 );/* Configure MODE1 register */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2789/3318 serial: max310x: centralize the RS485 transceiver programming
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit 56051740bf9720335a1a56e87a99e3491c33ce54 ]
The HDPIXDELAY RTS delays and the MODE1 auto-transceiver enable are programmed in three places - the rs485-config worker, startup() and break_ctl()'s break-off restore - each with its own copy of the register sequence. Move the sequence into a helper, max310x_set_rts_ctl_params(), together with the tx_break guard that keeps the MODE1 write away from a break in progress; the break-off restore reapplies the current configuration through the same helper.
No functional change intended. The copies differed only in that startup() clamped the delays to the 4-bit field while the worker wrote them unclamped; the helper clamps, and the difference is unreachable while rs485_config() still rejects delays above 15 ms with -ERANGE. Break-off additionally rewrites HDPIXDELAY with the values it already holds, a no-op on the wire.
Stable-dep-of: 7784d6aee59a ("serial: max310x: fix RS485 delays being programmed as bit-times")
--- drivers/tty/serial/max310x.c | 85 ++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 38 deletions(-)
drivers/tty/serial/max310x.c +47 -38
@@ -895,6 +895,38 @@ static void max310x_set_mctrl(struct uart_port *port, unsigned int mctrl)schedule_work (&one->md_work); } +/* +* Program the chip's RS485 RTS timing (HDPIXDELAY) and the auto +* transceiver control (MODE1) from the current configuration. The +* rs485-config worker, startup() and break_ctl()'s break-off restore +* each carried their own copy of this sequence. +*/ +static void max310x_set_rts_ctl_params (struct max310x_one *one) +{ +struct uart_port *port = &one->port; +unsigned int delay; +u8 mode1 =0 ; + + delay = (clamp (port->rs485.delay_rts_before_send,0U ,15U ) <<4 ) | +clamp (port->rs485.delay_rts_after_send,0U ,15U ); +max310x_port_write (port,MAX310X_HDPIXDELAY_REG , delay); + +if (port->rs485.flags &SER_RS485_ENABLED ) + mode1 =MAX310X_MODE1_TRNSCVCTRL_BIT ; + +/* +* A break owns the transceiver: break_ctl() disabled auto-RTS and +* drives RTS manually, and restores it from the current +* configuration when the break ends. Touching MODE1 here would +* release the transceiver mid-break. +*/ +if (one->tx_break) +return ; + +max310x_port_update (port,MAX310X_MODE1_REG , +MAX310X_MODE1_TRNSCVCTRL_BIT , mode1); +} +static void max310x_break_ctl (struct uart_port *port,int break_state) {struct max310x_one *one =to_max310x_port (port);
@@ -917,10 +949,7 @@ static void max310x_break_ctl(struct uart_port *port, int break_state)max310x_port_update (port,MAX310X_MODE1_REG ,MAX310X_MODE1_TRNSCVCTRL_BIT ,0 ); }else { -max310x_port_update (port,MAX310X_MODE1_REG , -MAX310X_MODE1_TRNSCVCTRL_BIT , - (port->rs485.flags &SER_RS485_ENABLED ) ? -MAX310X_MODE1_TRNSCVCTRL_BIT :0 ); +max310x_set_rts_ctl_params (one); }max310x_rts_ctl (port, break_state); }
@@ -1042,36 +1071,23 @@ static void max310x_set_termios(struct uart_port *port,static void max310x_rs_proc (struct work_struct *ws) { struct max310x_one *one = container_of(ws, struct max310x_one, rs_work); -unsigned int delay, mode1 =0 , mode2 =0 ; +unsigned int mode2 =0 ;/* * Serialize against break_ctl() and set_termios(), which run under -* port->mutex: the tx_break test below and the MODE1 write must not +* port->mutex: the tx_break-guarded register writes must not * straddle a break starting or ending. */ guard (mutex)(&one->port.state->port.mutex); - delay = (one->port.rs485.delay_rts_before_send <<4 ) | - one->port.rs485.delay_rts_after_send; -max310x_port_write (&one->port,MAX310X_HDPIXDELAY_REG , delay); +max310x_set_rts_ctl_params (one); -if (one->port.rs485.flags &SER_RS485_ENABLED ) { - mode1 =MAX310X_MODE1_TRNSCVCTRL_BIT ; +if (one->port.rs485.flags &SER_RS485_ENABLED && + !(one->port.rs485.flags &SER_RS485_RX_DURING_TX )) + mode2 =MAX310X_MODE2_ECHOSUPR_BIT ; -if (!(one->port.rs485.flags &SER_RS485_RX_DURING_TX )) - mode2 =MAX310X_MODE2_ECHOSUPR_BIT ; - } - -/* -* A break owns the transceiver: break_ctl() disabled auto-RTS and -* drives RTS manually, and restores it when the break ends. Leave -* MODE1 alone meanwhile or the break goes undriven mid-way. -*/ -if (!one->tx_break) -max310x_port_update (&one->port,MAX310X_MODE1_REG , -MAX310X_MODE1_TRNSCVCTRL_BIT , mode1);max310x_port_update (&one->port,MAX310X_MODE2_REG , -MAX310X_MODE2_ECHOSUPR_BIT , mode2); +MAX310X_MODE2_ECHOSUPR_BIT , mode2); } static int max310x_rs485_config(struct uart_port *port, struct ktermios *termios,
@@ -1115,21 +1131,14 @@ static int max310x_startup(struct uart_port *port)max310x_port_update (port,MAX310X_MODE2_REG ,MAX310X_MODE2_FIFORST_BIT ,0 ); -/* Configure mode1/mode2 to have rs485/rs232 enabled at startup */ - val = (clamp (port->rs485.delay_rts_before_send,0U ,15U ) <<4 ) | -clamp (port->rs485.delay_rts_after_send,0U ,15U ); -max310x_port_write (port,MAX310X_HDPIXDELAY_REG , val); - -if (port->rs485.flags &SER_RS485_ENABLED ) { -max310x_port_update (port,MAX310X_MODE1_REG , -MAX310X_MODE1_TRNSCVCTRL_BIT , -MAX310X_MODE1_TRNSCVCTRL_BIT ); +/* Configure the RS485 RTS timing and the RS485/RS232 mode bits. */ +max310x_set_rts_ctl_params (one); -if (!(port->rs485.flags &SER_RS485_RX_DURING_TX )) -max310x_port_update (port,MAX310X_MODE2_REG , -MAX310X_MODE2_ECHOSUPR_BIT , -MAX310X_MODE2_ECHOSUPR_BIT ); - } +if (port->rs485.flags &SER_RS485_ENABLED && + !(port->rs485.flags &SER_RS485_RX_DURING_TX )) +max310x_port_update (port,MAX310X_MODE2_REG , +MAX310X_MODE2_ECHOSUPR_BIT , +MAX310X_MODE2_ECHOSUPR_BIT );/* Configure flow control levels */ /* Flow control halt level 96, resume level 48 */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2790/3318 serial: max310x: fix RS485 delays being programmed as bit-times
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit 7784d6aee59a142505072b3fbea97932b2fd1fa0 ]
The HDPIXDELAY register counts the RTS setup and hold delays in bit-times, four bits per direction, but the driver has been writing the struct serial_rs485 delay_rts_before_send/delay_rts_after_send values into it unconverted - and the uapi expresses those in milliseconds. A requested 9 ms setup delay is programmed as 9 bit-times, which at 9600 baud is 0.94 ms, roughly a tenth of what userspace asked for; the error grows with the baud rate.
Cache the baud rate in set_termios() and convert the delays to bit-times at the current rate, rounding up so the delay on the wire is never shorter than requested, and capping at the 15 bit-times the 4-bit field can hold. The conversion lives in max310x_set_rts_ctl_params(); set_termios() now calls it as well, since the conversion depends on the baud rate.
The delays a 4-bit bit-time field can represent still fall well short of the milliseconds the uapi can express; requests beyond 15 bit-times are capped, and the -ERANGE rejection of values above 15 ms remains in place for now.
--- drivers/tty/serial/max310x.c | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-)
drivers/tty/serial/max310x.c +31 -9
@@ -162,6 +162,10 @@#define MAX310X_IRDA_IRDAEN_BIT (1 << 0)/* IRDA mode enable */ #define MAX310X_IRDA_SIR_BIT (1 << 1)/* SIR mode enable */ +/* HDPIXDELAY accessor macros */ +#define MAX310X_HDPIXDELAY_SETUP (val) (((val) & 0x0f) << 4) +#define MAX310X_HDPIXDELAY_HOLD (val) ((val) & 0x0f) +/* Flow control trigger level register masks */ #define MAX310X_FLOWLVL_HALT_MASK (0x000f)/* Flow control halt level */ #define MAX310X_FLOWLVL_RES_MASK (0x00f0)/* Flow control resume level */
@@ -283,6 +287,7 @@ struct max310x_one {struct work_struct md_work;struct work_struct rs_work;struct regmap *regmap; +unsigned int baud;bool tx_break;/* break_ctl() owns the transceiver */ u8 rx_buf[MAX310X_FIFO_SIZE ];
@@ -896,23 +901,33 @@ static void max310x_set_mctrl(struct uart_port *port, unsigned int mctrl) }/* -* Program the chip's RS485 RTS timing (HDPIXDELAY) and the auto -* transceiver control (MODE1) from the current configuration. The -* rs485-config worker, startup() and break_ctl()'s break-off restore -* each carried their own copy of this sequence. +* Program the chip's RS485 RTS timing. The HDPIXDELAY setup and hold fields +* count bit-times, four bits per direction, while the uapi expresses the +* delays in milliseconds: convert at the current baud rate, rounding up, and +* cap at the field maximum. */ static void max310x_set_rts_ctl_params (struct max310x_one *one) { +const unsigned int max_bit_dly =15 ;struct uart_port *port = &one->port; -unsigned int delay; +unsigned int setup =0 , hold =0 ;u8 mode1 =0 ; - delay = (clamp (port->rs485.delay_rts_before_send,0U ,15U ) <<4 ) | -clamp (port->rs485.delay_rts_after_send,0U ,15U ); -max310x_port_write (port,MAX310X_HDPIXDELAY_REG , delay); +if (port->rs485.flags &SER_RS485_ENABLED ) { +/* Convert milliseconds to bit-times, rounding up. */ + setup =DIV_ROUND_UP (one->baud * port->rs485.delay_rts_before_send, +MSEC_PER_SEC ); + hold =DIV_ROUND_UP (one->baud * port->rs485.delay_rts_after_send, +MSEC_PER_SEC ); + setup =min (setup, max_bit_dly); + hold =min (hold, max_bit_dly); -if (port->rs485.flags &SER_RS485_ENABLED ) mode1 =MAX310X_MODE1_TRNSCVCTRL_BIT ; + } + +max310x_port_write (port,MAX310X_HDPIXDELAY_REG , +MAX310X_HDPIXDELAY_SETUP (setup) | +MAX310X_HDPIXDELAY_HOLD (hold));/* * A break owns the transceiver: break_ctl() disabled auto-RTS and
@@ -1066,6 +1081,13 @@ static void max310x_set_termios(struct uart_port *port,/* Update timeout according to new baud rate */ uart_update_timeout (port, termios->c_cflag, baud); + +/* +* Cache the new baud rate and reprogram the RS485 RTS delays, whose +* millisecond-to-bit-time conversion depends on it. +*/ +to_max310x_port (port)->baud = baud; +max310x_set_rts_ctl_params (to_max310x_port (port)); }static void max310x_rs_proc (struct work_struct *ws)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2791/3318 serial: max310x: dont power down the port mid-transmission on close
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tapio Reijonen <[email protected]>
[ Upstream commit c3ad42ccd303113a08bd0b441fb5b3380f29c5bf ]
max310x_shutdown() powers the port down regardless of what the transmitter is doing. The power-off stops the UART clock mid-character, truncating the final frame, and on the auto-RTS path it freezes the RTS output at its current level: a close() with data still queued leaves the RS485 transceiver asserted until the next open, which also emits the interrupted character corrupted.
Waiting for the data to drain is no better: the tty layer's wait-until-sent is bounded by closing_wait, configurable to none, and a hangup arrives with no wait at all, so draining a full FIFO blocks close() in uninterruptible sleep for seconds at low baud rates - and forever when CTS flow control blocks the FIFO.
Instead, set MODE1 TxDisabl: the character in flight completes and the transmitter ceases with TX_ at idle. Give that character one character time (the chip has no transmitter-idle status), then reset the FIFOs so the auto-RTS engine sees the transmitter empty and releases RTS within the configured after-send hold; wait that hold plus one bit time before powering off. Abandoned data was explicitly not waited for, and startup() resets the FIFOs and TxDisabl on open anyway.
Measured on a MAX14830: a truncating close() at 50 baud takes 0.23 s, RTS releases one character plus the hold after the last stop bit on both polarities, and the reopen corruption is gone.
--- drivers/tty/serial/max310x.c | 44 ++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-)
drivers/tty/serial/max310x.c +40 -4
@@ -287,6 +287,7 @@ struct max310x_one {struct work_struct md_work;struct work_struct rs_work;struct regmap *regmap; +unsigned int char_time_us;unsigned int baud;bool tx_break;/* break_ctl() owns the transceiver */
@@ -973,6 +974,7 @@ static void max310x_set_termios(struct uart_port *port,struct ktermios *termios, const struct ktermios *old) { + unsigned int frame_bits = tty_get_frame_size(termios->c_cflag);unsigned int lcr =0 , flow =0 ;int baud;
@@ -1083,10 +1085,13 @@ static void max310x_set_termios(struct uart_port *port,uart_update_timeout (port, termios->c_cflag, baud);/* -* Cache the new baud rate and reprogram the RS485 RTS delays, whose -* millisecond-to-bit-time conversion depends on it. +* Cache the new baud rate and the time it takes to clock out one +* character before reprogramming the RS485 RTS delays: the +* millisecond-to-bit-time conversion divides by the baud rate. */ to_max310x_port (port)->baud = baud; +to_max310x_port (port)->char_time_us = +DIV_ROUND_UP (USEC_PER_SEC * frame_bits, baud);max310x_set_rts_ctl_params (to_max310x_port (port)); }
@@ -1143,9 +1148,10 @@ static int max310x_startup(struct uart_port *port) one->tx_break = false;max310x_port_update (port,MAX310X_LCR_REG ,MAX310X_LCR_TXBREAK_BIT ,0 ); -/* Configure MODE1 register */ +/* Configure MODE1: re-enable the transmitter shutdown() stopped */ max310x_port_update (port,MAX310X_MODE1_REG , -MAX310X_MODE1_TRNSCVCTRL_BIT ,0 ); +MAX310X_MODE1_TRNSCVCTRL_BIT | +MAX310X_MODE1_TXDIS_BIT ,0 );/* Configure MODE2 register & Reset FIFOs*/ val =MAX310X_MODE2_RXEMPTINV_BIT |MAX310X_MODE2_FIFORST_BIT ;
@@ -1179,9 +1185,39 @@ static int max310x_startup(struct uart_port *port)static void max310x_shutdown (struct uart_port *port) { +struct max310x_one *one =to_max310x_port (port); +/* Disable all interrupts */ max310x_port_write (port,MAX310X_IRQEN_REG ,0 ); +/* +* Stop the transmitter: the character in flight completes, data +* still queued is abandoned (the next startup() resets the FIFOs). +*/ +max310x_port_update (port,MAX310X_MODE1_REG , +MAX310X_MODE1_TXDIS_BIT ,MAX310X_MODE1_TXDIS_BIT ); + +/* +* Let the character in flight finish (the chip has no +* transmitter-idle status), then empty the FIFO: auto-RTS releases +* only once the transmitter is empty, and the power-off below +* would freeze an asserted pin until the next open. +*/ +fsleep (one->char_time_us); +max310x_port_update (port,MAX310X_MODE2_REG , +MAX310X_MODE2_FIFORST_BIT , +MAX310X_MODE2_FIFORST_BIT ); +max310x_port_update (port,MAX310X_MODE2_REG , +MAX310X_MODE2_FIFORST_BIT ,0 ); +if (port->rs485.flags &SER_RS485_ENABLED && one->baud) { +unsigned int hold =DIV_ROUND_UP (one->baud * + port->rs485.delay_rts_after_send, +MSEC_PER_SEC ); + +fsleep (max (DIV_ROUND_UP ((hold +1 ) *USEC_PER_SEC , + one->baud),100U )); + } +max310x_power (port,0 ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2792/3318 net: alacritech: fix dma_free_coherent() in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 05b5019b01fb9443b09ae4ed34af1135a80a84c8 ]
In slic_init_stat_queue(), a series of coherent buffers is allocated with the length size. The size is then stored in stq->mem_size for normal deallocation. However, in the error path, stq->mem_size is also used but is not initialized. This error may leave the freed buffers mapped, leaking a resource and allowing the device to access freed memory.
Change the length in error path to size.
--- drivers/net/ethernet/alacritech/slicoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/alacritech/slicoss.c +1 -1
@@ -813,7 +813,7 @@ static int slic_init_stat_queue(struct slic_device *sdev) free_descs:while (i--) { -dma_free_coherent (&sdev->pdev->dev, stq->mem_size, +dma_free_coherent (&sdev->pdev->dev, size, stq->descs[i] - stq->addr_offset[i], stq->paddr[i] - stq->addr_offset[i]); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2793/3318 comedi: comedi_parport: validate the IRQ supplied by userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 790ea6844593bcd03b0379986fc821d8c511746e ]
comedi boards are configured through the COMEDI_DEVCONFIG ioctl, so it->options[1] is a number chosen by userspace. comedi_parport passes it to request_irq() without checking it first, which lets an interrupt owned by another irqdomain -- a PCI device's IO-APIC GSI, for instance -- be claimed for this board. When the owner of that interrupt is later released the descriptor is freed while this driver's handler is still installed on it.
A parallel port asserts a legacy ISA interrupt, so the ISA range is the right bound; it is also sufficient, because mp_chip_data->isa_irq is set only by alloc_isa_irq_from_domain() and mp_unmap_irq() returns early when it is set.
syzbot hit this one:
remove_proc_entry: removing non-empty directory 'irq/20', leaking at least 'comedi_parport' WARNING: fs/proc/generic.c:747 at remove_proc_entry+0x4e7/0x610 fs/proc/generic.c:747 Call Trace: <TASK> unregister_irq_proc+0x206/0x2a0 kernel/irq/proc.c:406 free_desc+0x89/0x330 kernel/irq/irqdesc.c:482 irq_free_descs+0x84/0xc0 kernel/irq/irqdesc.c:865 irq_domain_free_irqs+0x46a/0x5c0 kernel/irq/irqdomain.c:1917 mp_unmap_irq+0xf8/0x130 arch/x86/kernel/apic/io_apic.c:1061 acpi_unregister_gsi_ioapic+0x40/0x60 arch/x86/kernel/acpi/boot.c:722 acpi_pci_irq_disable+0x275/0x360 drivers/acpi/pci_irq.c:517 pci_disable_device+0x130/0x270 drivers/pci/pci.c:2206 pci_device_remove+0xb2/0x1d0 drivers/pci/pci-driver.c:512 device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372 unbind_store+0xf8/0x110 drivers/base/bus.c:244 </TASK>
The leaked /proc entry the warning names is the mild part. mp_chip_data->count tracks GSI mappings rather than request_irq() users, and __setup_irq() takes no reference on the descriptor, so the irq_desc is freed with the comedi irqaction still attached to it.
Bound the value before requesting it, as das16m1.c already does. An out-of-range value is ignored rather than rejected, so the board still attaches without interrupt support, exactly as it does today when request_irq() fails.
--- drivers/comedi/drivers/comedi_parport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/comedi/drivers/comedi_parport.c +2 -1
@@ -241,7 +241,8 @@ static int parport_attach(struct comedi_device *dev,outb (0 , dev->iobase +PARPORT_DATA_REG );outb (0 , dev->iobase +PARPORT_CTRL_REG ); -if (it->options[1 ]) { +/* only ISA interrupts are valid on a parallel port */ +if (it->options[1 ] >=1 && it->options[1 ] <=15 ) { ret =request_irq (it->options[1 ], parport_interrupt,0 , dev->board_name, dev);if (ret ==0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2794/3318 comedi: ni_atmio16d: validate the IRQ supplied by userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 71424db0ebb5f484fa3f386910f8ce9da95b8b2e ]
comedi boards are configured through the COMEDI_DEVCONFIG ioctl, so it->options[1] is a number chosen by userspace. ni_atmio16d passes it to request_irq() without checking it first, which lets an interrupt owned by another irqdomain -- a PCI device's IO-APIC GSI, for instance -- be claimed for this board. When the owner of that interrupt is later released the descriptor is freed while this driver's handler is still installed on it.
The driver already documents which interrupts the board can assert -- "0 == no irq; or 3,4,5,6,7,9,10,11,12,14,15" -- so use exactly that set rather than the whole ISA range.
Bound the value before requesting it, as das16m1.c already does. An out-of-range value is ignored rather than rejected, so the board still attaches without interrupt support, exactly as it does today when request_irq() fails.
--- drivers/comedi/drivers/ni_atmio16d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/comedi/drivers/ni_atmio16d.c +3 -1
@@ -592,7 +592,9 @@ static int atmio16d_attach(struct comedi_device *dev,/* reset the atmio16d hardware */ reset_atmio16d (dev); -if (it->options[1 ]) { +/* only irqs 3, 4, 5, 6, 7, 9, 10, 11, 12, 14, and 15 are valid */ +if (it->options[1 ] >=3 && it->options[1 ] <=15 && + (1 << it->options[1 ]) &0xdef8 ) { ret =request_irq (it->options[1 ], atmio16d_interrupt,0 , dev->board_name, dev);if (ret ==0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2795/3318 comedi: dt2814: validate the IRQ supplied by userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 81026c2b3f9096cdfdfa02918f94865629fb7f90 ]
comedi boards are configured through the COMEDI_DEVCONFIG ioctl, so it->options[1] is a number chosen by userspace. dt2814 passes it to request_irq() without checking it first, which lets an interrupt owned by another irqdomain -- a PCI device's IO-APIC GSI, for instance -- be claimed for this board. When the owner of that interrupt is later released the descriptor is freed while this driver's handler is still installed on it.
Every interrupt this board can assert is a legacy ISA one, so the ISA range is the right bound; it is also sufficient, because mp_chip_data->isa_irq is set only by alloc_isa_irq_from_domain() and mp_unmap_irq() returns early when it is set.
Bound the value before requesting it, as das16m1.c already does. An out-of-range value is ignored rather than rejected, so the board still attaches without interrupt support, exactly as it does today when request_irq() fails.
--- drivers/comedi/drivers/dt2814.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/comedi/drivers/dt2814.c +2 -1
@@ -315,7 +315,8 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)return -EIO ; } -if (it->options[1 ]) { +/* only ISA interrupts are valid on this board */ +if (it->options[1 ] >=1 && it->options[1 ] <=15 ) { ret =request_irq (it->options[1 ], dt2814_interrupt,0 , dev->board_name, dev);if (ret ==0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2796/3318 comedi: dmm32at: validate the IRQ supplied by userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 797d56d7f90864e67424f8e82639a9b3aedf37e0 ]
comedi boards are configured through the COMEDI_DEVCONFIG ioctl, so it->options[1] is a number chosen by userspace. dmm32at passes it to request_irq() without checking it first, which lets an interrupt owned by another irqdomain -- a PCI device's IO-APIC GSI, for instance -- be claimed for this board. When the owner of that interrupt is later released the descriptor is freed while this driver's handler is still installed on it.
Every interrupt this board can assert is a legacy ISA one, so the ISA range is the right bound; it is also sufficient, because mp_chip_data->isa_irq is set only by alloc_isa_irq_from_domain() and mp_unmap_irq() returns early when it is set.
Bound the value before requesting it, as das16m1.c already does. An out-of-range value is ignored rather than rejected, so the board still attaches without interrupt support, exactly as it does today when request_irq() fails.
--- drivers/comedi/drivers/dmm32at.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/comedi/drivers/dmm32at.c +2 -1
@@ -584,7 +584,8 @@ static int dmm32at_attach(struct comedi_device *dev,return ret; } -if (it->options[1 ]) { +/* only ISA interrupts are valid on this board */ +if (it->options[1 ] >=1 && it->options[1 ] <=15 ) { ret =request_irq (it->options[1 ], dmm32at_isr,0 , dev->board_name, dev);if (ret ==0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2797/3318 comedi: pcmmio: validate the IRQ supplied by userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 23c6fc62e754f8bc412ceb5c0d9aaa14f2c9ff31 ]
comedi boards are configured through the COMEDI_DEVCONFIG ioctl, so it->options[1] is a number chosen by userspace. pcmmio passes it to request_irq() without checking it first, which lets an interrupt owned by another irqdomain -- a PCI device's IO-APIC GSI, for instance -- be claimed for this board. When the owner of that interrupt is later released the descriptor is freed while this driver's handler is still installed on it.
The board's interrupt is routed in software rather than jumpered, and the driver notes that "any IRQ from 1-15 is OK", so the ISA range is exactly the right bound.
Bound the value before requesting it, as das16m1.c already does. An out-of-range value is ignored rather than rejected, so the board still attaches without interrupt support, exactly as it does today when request_irq() fails.
--- drivers/comedi/drivers/pcmmio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/comedi/drivers/pcmmio.c +2 -1
@@ -683,7 +683,8 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)pcmmio_reset (dev); -if (it->options[1 ]) { +/* the irq is configured in software, so any ISA irq is OK */ +if (it->options[1 ] >=1 && it->options[1 ] <=15 ) { ret =request_irq (it->options[1 ], interrupt_pcmmio,0 , dev->board_name, dev);if (ret ==0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2798/3318 comedi: pcmuio: validate the IRQs supplied by userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
[ Upstream commit 9c325b21bba99e597771137fc11b9427c86618d8 ]
comedi boards are configured through the COMEDI_DEVCONFIG ioctl, so it->options[1] is a number chosen by userspace. pcmuio passes it to request_irq() without checking it first, which lets an interrupt owned by another irqdomain -- a PCI device's IO-APIC GSI, for instance -- be claimed for this board. When the owner of that interrupt is later released the descriptor is freed while this driver's handler is still installed on it.
Every interrupt this board can assert is a legacy ISA one, so the ISA range is the right bound; it is also sufficient, because mp_chip_data->isa_irq is set only by alloc_isa_irq_from_domain() and mp_unmap_irq() returns early when it is set.
Bound the value before requesting it, as das16m1.c already does. An out-of-range value is ignored rather than rejected, so the board still attaches without interrupt support, exactly as it does today when request_irq() fails.
This board takes two interrupts, one per ASIC, so options[1] and options[2] both need the check. The existing options[2] == dev->irq case is left alone: it covers both ASICs sharing one interrupt and neither having one, and by then options[1] has already been validated.
--- drivers/comedi/drivers/pcmuio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/comedi/drivers/pcmuio.c +3 -2
@@ -545,7 +545,8 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)pcmuio_reset (dev); -if (it->options[1 ]) { +/* only ISA interrupts are valid on this board */ +if (it->options[1 ] >=1 && it->options[1 ] <=15 ) {/* request the irq for the 1st asic */ ret =request_irq (it->options[1 ], pcmuio_interrupt,0 , dev->board_name, dev);
@@ -557,7 +558,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)if (it->options[2 ] == dev->irq) {/* the same irq (or none) is used by both asics */ devpriv->irq2 = it->options[2 ]; - }else if (it->options[2 ]) { + }else if (it->options[2 ] >=1 && it->options[2 ] <=15 ) {/* request the irq for the 2nd asic */ ret =request_irq (it->options[2 ], pcmuio_interrupt,0 , dev->board_name, dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2799/3318 thermal/drivers/ti-soc-thermal: Cancel pending alert work on remove
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weigang He <[email protected]>
[ Upstream commit aaa6c8dec49339710f9fd2a2af5646cf4111dbd4 ]
On a threshold crossing, the talert IRQ handler calls ti_thermal_report_sensor_temperature(), which queues the work embedded in the sensor's ti_thermal_data on the system workqueue. Nothing ever cancels or flushes that work.
ti_bandgap_remove() frees the talert IRQ last. free_irq() waits for a running handler, but not for the work the handler has queued. When remove returns, devres unregisters and frees the thermal zones and then frees the devm-allocated ti_thermal_data, so a work item that is still pending runs ti_thermal_work() on freed memory:
ti_thermal_work() data = container_of(work, struct ti_thermal_data, thermal_wq); thermal_zone_device_update(data->ti_thermal, ...);
Free the talert IRQ before removing the sensors, so that no new work can be queued, and cancel the work in ti_thermal_remove_sensor().
This needs an OMAP4460/4470 or OMAP5 SoC (DRA7 has TALERT but no ->report_temperature, so it never queues the work), a threshold crossing just before the driver is unbound or unloaded, and the work still pending when devres frees the data.
Found by static analysis tool CodeQL.
--- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 7 ++++--- drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +4 -3
@@ -1077,6 +1077,10 @@ int ti_bandgap_remove(struct platform_device *pdev)if (!soc_device_match (soc_no_cpu_notifier))cpu_pm_unregister_notifier (&bgp->nb); +/* Stop the alerts first: they queue work on the sensors' data */ +if (TI_BANDGAP_HAS (bgp,TALERT )) +free_irq (bgp->irq, bgp); +/* Remove sensor interfaces */ for (i =0 ; i < bgp->conf->sensor_count; i++) {if (bgp->conf->sensors[i].unregister_cooling)
@@ -1093,9 +1097,6 @@ int ti_bandgap_remove(struct platform_device *pdev)clk_put (bgp->fclock);clk_put (bgp->div_clk); -if (TI_BANDGAP_HAS (bgp,TALERT )) -free_irq (bgp->irq, bgp); -if (TI_BANDGAP_HAS (bgp,TSHUT ))free_irq (gpiod_to_irq (bgp->tshut_gpiod),NULL );
drivers/thermal/ti-soc-thermal/ti-thermal-common.c +4 -0
@@ -195,6 +195,10 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) data =ti_bandgap_get_sensor_data (bgp, id); +/* Work queued by the talert IRQ must not outlive the data */ +if (!IS_ERR_OR_NULL (data)) +cancel_work_sync (&data->thermal_wq); +if (!IS_ERR_OR_NULL (data) && data->ti_thermal) {if (data->our_zone)thermal_zone_device_unregister (data->ti_thermal);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2800/3318 char: scx200_gpio: check cdev_add() return value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linkai Gong <[email protected]>
[ Upstream commit fe26c195c265c033e474d015061a0183c7a02193 ]
cdev_add() can fail. The driver currently ignores the return value and reports probe success even when the cdev was not registered, leaving a chrdev region allocated with no working file operations.
Check the return value, emit an error, and unwind the chrdev region and platform device on failure.
--- drivers/char/scx200_gpio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/char/scx200_gpio.c +7 -1
@@ -108,10 +108,16 @@ static int __init scx200_gpio_init(void) }cdev_init (&scx200_gpio_cdev, &scx200_gpio_fileops); -cdev_add (&scx200_gpio_cdev, devid,MAX_PINS ); + rc =cdev_add (&scx200_gpio_cdev, devid,MAX_PINS ); +if (rc) { +dev_err (&pdev->dev,"cdev_add err: %d\n" , rc); + goto undo_chrdev_region; + }return 0 ;/* succeed */ +undo_chrdev_region: +unregister_chrdev_region (devid,MAX_PINS ); undo_platform_device_add:platform_device_del (pdev); undo_malloc:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2801/3318 bus: arm-cci: Drop CPU node reference in cci_ace_init_ports()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 41d6c0fcd4d75bf78c304c6660d60fcf757885ce ]
cci_ace_init_ports() looks up each possible CPU's node with of_get_cpu_node(), which returns the node with its reference count raised, but never releases it: neither when the CPU has no ACE port nor after the port has been recorded. Before the commit below the loop used for_each_child_of_node(), which manages the references itself.
The node is only needed for the port lookup, so drop the reference right after __cci_ace_get_port().
--- drivers/bus/arm-cci.c | 1 + 1 file changed, 1 insertion(+)
drivers/bus/arm-cci.c +1 -0
@@ -199,6 +199,7 @@ static void cci_ace_init_ports(void)continue ; port =__cci_ace_get_port (cpun,ACE_PORT ); +of_node_put (cpun);if (port <0 )continue ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2802/3318 bus: arm-cci: Drop cci-control-port node reference in __cci_ace_get_port()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuho Choi <[email protected]>
[ Upstream commit 810ccc792193909ba9bbb4246e0eb0de14dad724 ]
__cci_ace_get_port() looks up the device's "cci-control-port" node with of_parse_phandle(), which returns the node with its reference count raised, and only compares the pointer against the probed ports. Neither the match nor the no-match return releases it.
Drop the reference on both paths once the comparison is done.
--- drivers/bus/arm-cci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bus/arm-cci.c +4 -1
@@ -167,9 +167,12 @@ static int __cci_ace_get_port(struct device_node *dn, int type) cci_portn =of_parse_phandle (dn,"cci-control-port" ,0 );for (i =0 ; i < nb_cci_ports; i++) { ace_match = ports[i].type == type; -if (ace_match && cci_portn == ports[i].dn) +if (ace_match && cci_portn == ports[i].dn) { +of_node_put (cci_portn);return i; + } } +of_node_put (cci_portn);return -ENODEV ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2803/3318 clk: qcom: mmcc-msm8996: Fix FD AHB clock register offset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 7cb2d65286b817d8d7e26f454a9c374d65e87072 ]
The FD AHB clock branch register is at offset 0x3b74, not 0x3ba74. The incorrect offset exceeds the regmap maximum of 0xb008, so regmap rejects accesses to it and the clock cannot be enabled.
Correct both the enable and halt register offsets so the driver can enable the branch and check its status.
--- drivers/clk/qcom/mmcc-msm8996.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/mmcc-msm8996.c +2 -2
@@ -3136,9 +3136,9 @@ static struct clk_branch fd_core_uar_clk = { };static struct clk_branch fd_ahb_clk = { - .halt_reg =0x3ba74 , + .halt_reg =0x3b74 , .clkr = { - .enable_reg =0x3ba74 , + .enable_reg =0x3b74 , .enable_mask =BIT (0 ), .hw.init = &(struct clk_init_data ){ .name ="fd_ahb_clk" ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2804/3318 clk: qcom: mmcc-sdm660: Fix MDSS AHB clock HWCG register offset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit c5f338329a2d0d60f7874aa7a1addaa0e4e75a3b ]
The MDSS AHB clock HWCG bit resides in the same register as the branch enable and halt status bits, at offset 0x2308. The current HWCG register offset of 0x8a004 exceeds the regmap maximum of 0x40000, so regmap rejects the read in clk_branch_in_hwcg_mode(). Since the read error is ignored, the helper uses an uninitialized value to decide whether to skip the halt status check.
Correct the HWCG register offset so the helper reads the actual hardware clock gating state.
--- drivers/clk/qcom/mmcc-sdm660.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/mmcc-sdm660.c +1 -1
@@ -2022,7 +2022,7 @@ static struct clk_branch csiphy_ahb2crif_clk = {static struct clk_branch mdss_ahb_clk = { .halt_reg =0x2308 , .halt_check =BRANCH_HALT , - .hwcg_reg =0x8a004 , + .hwcg_reg =0x2308 , .hwcg_bit =1 , .clkr = { .enable_reg =0x2308 ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2805/3318 clk: Use device_get_match_data()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
[ Upstream commit 409c39ec92a35e3708f5b5798c78eae78512cd71 ]
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers.
Stable-dep-of: 342db3b6cf7b ("clk: qcom: mmcc-msm8960: Configure PLL15 only on APQ8064")
--- drivers/clk/clk-lochnagar.c | 9 ++------- drivers/clk/davinci/da8xx-cfgchip.c | 8 +++----- drivers/clk/davinci/pll.c | 10 +++------- drivers/clk/davinci/psc.c | 10 +++------- drivers/clk/qcom/gcc-msm8960.c | 13 +++++-------- drivers/clk/qcom/gcc-msm8974.c | 10 +++------- drivers/clk/qcom/kpss-xcc.c | 9 ++------- drivers/clk/qcom/krait-cc.c | 14 +++++--------- drivers/clk/qcom/mmcc-msm8960.c | 16 +++++----------- drivers/clk/qcom/mmcc-sdm660.c | 8 ++------ drivers/clk/rockchip/clk-rk3399.c | 9 ++------- drivers/clk/samsung/clk-exynos-clkout.c | 8 +++----- drivers/clk/ti/adpll.c | 14 ++++---------- 13 files changed, 42 insertions(+), 96 deletions(-)
drivers/clk/clk-lochnagar.c +2 -7
@@ -12,8 +12,8 @@#include <linux/device.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/mfd/lochnagar1_regs.h>
@@ -242,22 +242,17 @@ static int lochnagar_clk_probe(struct platform_device *pdev) };struct device *dev = &pdev->dev;struct lochnagar_clk_priv *priv; -const struct of_device_id *of_id;struct lochnagar_clk *lclk;struct lochnagar_config *conf;int ret, i; - of_id =of_match_device (lochnagar_of_match, dev); -if (!of_id) -return -EINVAL ; - priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; priv->dev = dev; priv->regmap =dev_get_regmap (dev->parent,NULL ); - conf = (struct lochnagar_config *)of_id->data; + conf = (struct lochnagar_config *)device_get_match_data (dev);memcpy (priv->lclks, conf->clks,sizeof (priv->lclks));
drivers/clk/davinci/da8xx-cfgchip.c +3 -5
@@ -11,10 +11,10 @@#include <linux/init.h> #include <linux/mfd/da8xx-cfgchip.h> #include <linux/mfd/syscon.h> -#include <linux/of_device.h> #include <linux/of.h> #include <linux/platform_data/clk-da8xx-cfgchip.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/slab.h>
@@ -744,15 +744,13 @@ static int da8xx_cfgchip_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct da8xx_cfgchip_clk_platform_data *pdata = dev->platform_data; -const struct of_device_id *of_id;da8xx_cfgchip_init clk_init =NULL ;struct regmap *regmap =NULL ; - of_id =of_match_device (da8xx_cfgchip_of_match, dev); -if (of_id) { + clk_init =device_get_match_data (dev); +if (clk_init) {struct device_node *parent; - clk_init = of_id->data; parent =of_get_parent (dev->of_node); regmap =syscon_node_to_regmap (parent);of_node_put (parent);
drivers/clk/davinci/pll.c +3 -7
@@ -18,11 +18,10 @@#include <linux/kernel.h> #include <linux/mfd/syscon.h> #include <linux/notifier.h> -#include <linux/of_address.h> -#include <linux/of_device.h> #include <linux/of.h> #include <linux/platform_data/clk-davinci-pll.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/slab.h> #include <linux/types.h>
@@ -892,14 +891,11 @@ static int davinci_pll_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct davinci_pll_platform_data *pdata; -const struct of_device_id *of_id;davinci_pll_init pll_init =NULL ;void __iomem *base; - of_id =of_match_device (davinci_pll_of_match, dev); -if (of_id) - pll_init = of_id->data; -else if (pdev->id_entry) + pll_init =device_get_match_data (dev); +if (!pll_init && pdev->id_entry) pll_init = (void *)pdev->id_entry->driver_data;if (!pll_init) {
drivers/clk/davinci/psc.c +3 -7
@@ -18,10 +18,9 @@#include <linux/clk/davinci.h> #include <linux/clkdev.h> #include <linux/err.h> -#include <linux/of_address.h> -#include <linux/of_device.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/pm_clock.h> #include <linux/pm_domain.h> #include <linux/regmap.h>
@@ -522,15 +521,12 @@ static const struct platform_device_id davinci_psc_id_table[] = {static int davinci_psc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *of_id;const struct davinci_psc_init_data *init_data =NULL ;void __iomem *base;int ret; - of_id =of_match_device (davinci_psc_of_match, dev); -if (of_id) - init_data = of_id->data; -else if (pdev->id_entry) + init_data =device_get_match_data (dev); +if (!init_data && pdev->id_entry) init_data = (void *)pdev->id_entry->driver_data;if (!init_data) {
drivers/clk/qcom/gcc-msm8960.c +5 -8
@@ -7,9 +7,10 @@#include <linux/bitops.h> #include <linux/err.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> +#include <linux/of_platform.h> #include <linux/clk-provider.h> #include <linux/regmap.h> #include <linux/reset-controller.h>
@@ -3716,14 +3717,10 @@ MODULE_DEVICE_TABLE(of, gcc_msm8960_match_table);static int gcc_msm8960_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *match;struct platform_device *tsens; +const struct qcom_cc_desc *desc =device_get_match_data (dev);int ret; - match =of_match_device (gcc_msm8960_match_table, &pdev->dev); -if (!match) -return -EINVAL ; - ret =qcom_cc_register_board_clk (dev,"cxo_board" ,"cxo" ,19200000 );if (ret)return ret;
@@ -3732,11 +3729,11 @@ static int gcc_msm8960_probe(struct platform_device *pdev)if (ret)return ret; - ret =qcom_cc_probe (pdev, match->data); + ret =qcom_cc_probe (pdev, desc);if (ret)return ret; -if (match->data == &gcc_apq8064_desc) { +if (desc == &gcc_apq8064_desc) { hfpll1.d = &hfpll1_8064_data; hfpll_l2.d = &hfpll_l2_8064_data; }
drivers/clk/qcom/gcc-msm8974.c +3 -7
@@ -7,9 +7,9 @@#include <linux/bitops.h> #include <linux/err.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/clk-provider.h> #include <linux/regmap.h> #include <linux/reset-controller.h>
@@ -2875,14 +2875,10 @@ static int gcc_msm8974_probe(struct platform_device *pdev) {int ret;struct device *dev = &pdev->dev; -const struct of_device_id *id; - - id =of_match_device (gcc_msm8974_match_table, dev); -if (!id) -return -ENODEV ; +const void *data =device_get_match_data (dev);if (!of_device_is_compatible (dev->of_node,"qcom,gcc-msm8974" )) { -if (id->data == &gcc_msm8226_desc) +if (data == &gcc_msm8226_desc)msm8226_clock_override ();else msm8974_pro_clock_override ();
drivers/clk/qcom/kpss-xcc.c +2 -7
@@ -5,10 +5,10 @@#include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/err.h> #include <linux/io.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/clk.h> #include <linux/clk-provider.h>
@@ -32,20 +32,15 @@ MODULE_DEVICE_TABLE(of, kpss_xcc_match_table);static int kpss_xcc_driver_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *id;void __iomem *base;struct clk_hw *hw;const char *name; - id =of_match_device (kpss_xcc_match_table, dev); -if (!id) -return -ENODEV ; - base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (base))return PTR_ERR (base); -if (id->data) { +if (device_get_match_data (&pdev->dev)) {if (of_property_read_string_index (dev->of_node,"clock-output-names" ,0 , &name))
drivers/clk/qcom/krait-cc.c +5 -9
@@ -5,10 +5,10 @@#include <linux/init.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/err.h> #include <linux/io.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/slab.h>
@@ -347,22 +347,18 @@ MODULE_DEVICE_TABLE(of, krait_cc_match_table);static int krait_cc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *id;unsigned long cur_rate, aux_rate;int cpu;struct clk_hw *mux, *l2_pri_mux;struct clk *clk, **clks; - - id =of_match_device (krait_cc_match_table, dev); -if (!id) -return -ENODEV ; +bool unique_aux = !!device_get_match_data (dev);/* Rate is 1 because 0 causes problems for __clk_mux_determine_rate */ clk =clk_register_fixed_rate (dev,"qsb" ,NULL ,0 ,1 );if (IS_ERR (clk))return PTR_ERR (clk); -if (!id->data) { +if (!unique_aux) { clk =clk_register_fixed_factor (dev,"acpu_aux" ,"gpll0_vote" ,0 ,1 ,2 );if (IS_ERR (clk))
@@ -375,13 +371,13 @@ static int krait_cc_probe(struct platform_device *pdev)return -ENOMEM ;for_each_possible_cpu (cpu) { - mux =krait_add_clks (dev, cpu, id->data); + mux =krait_add_clks (dev, cpu, unique_aux);if (IS_ERR (mux))return PTR_ERR (mux); clks[cpu] = mux->clk; } - l2_pri_mux =krait_add_clks (dev,-1 , id->data); + l2_pri_mux =krait_add_clks (dev,-1 , unique_aux);if (IS_ERR (l2_pri_mux))return PTR_ERR (l2_pri_mux); clks[l2_mux] = l2_pri_mux->clk;
drivers/clk/qcom/mmcc-msm8960.c +5 -11
@@ -8,9 +8,9 @@#include <linux/err.h> #include <linux/delay.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/regmap.h>
@@ -3105,30 +3105,24 @@ MODULE_DEVICE_TABLE(of, mmcc_msm8960_match_table);static int mmcc_msm8960_probe (struct platform_device *pdev) { -const struct of_device_id *match;struct regmap *regmap; -bool is_8064;struct device *dev = &pdev->dev; +const struct qcom_cc_desc *desc =device_get_match_data (dev); - match =of_match_device (mmcc_msm8960_match_table, dev); -if (!match) -return -EINVAL ; - - is_8064 =of_device_is_compatible (dev->of_node,"qcom,mmcc-apq8064" ); -if (is_8064) { +if (desc == &mmcc_apq8064_desc) { gfx3d_src.freq_tbl = clk_tbl_gfx3d_8064; gfx3d_src.clkr.hw.init = &gfx3d_8064_init; gfx3d_src.s[0 ].parent_map = mmcc_pxo_pll8_pll2_pll15_map; gfx3d_src.s[1 ].parent_map = mmcc_pxo_pll8_pll2_pll15_map; } - regmap =qcom_cc_map (pdev, match->data); + regmap =qcom_cc_map (pdev, desc);if (IS_ERR (regmap))return PTR_ERR (regmap);clk_pll_configure_sr (&pll15, regmap, &pll15_config, false); -return qcom_cc_really_probe (pdev, match->data, regmap); +return qcom_cc_really_probe (pdev, desc, regmap); }static struct platform_driver mmcc_msm8960_driver = {
drivers/clk/qcom/mmcc-sdm660.c +2 -6
@@ -9,9 +9,9 @@#include <linux/bitops.h> #include <linux/err.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/clk-provider.h> #include <linux/regmap.h> #include <linux/reset-controller.h>
@@ -2828,14 +2828,10 @@ static void sdm630_clock_override(void)static int mmcc_660_probe (struct platform_device *pdev) { -const struct of_device_id *id;struct regmap *regmap;bool is_sdm630; - id =of_match_device (mmcc_660_match_table, &pdev->dev); -if (!id) -return -ENODEV ; - is_sdm630 = !!(id->data); + is_sdm630 = !!device_get_match_data (&pdev->dev); regmap =qcom_cc_map (pdev, &mmcc_660_desc);if (IS_ERR (regmap))
drivers/clk/rockchip/clk-rk3399.c +2 -7
@@ -9,8 +9,8 @@#include <linux/io.h> #include <linux/of.h> #include <linux/of_address.h> -#include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include <dt-bindings/clock/rk3399-cru.h> #include "clk.h"
@@ -1634,14 +1634,9 @@ static const struct of_device_id clk_rk3399_match_table[] = {static int __init clk_rk3399_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; -const struct of_device_id *match;const struct clk_rk3399_inits *init_data; - match =of_match_device (clk_rk3399_match_table, &pdev->dev); -if (!match || !match->data) -return -EINVAL ; - - init_data = match->data; + init_data =device_get_match_data (&pdev->dev);if (init_data->inits) init_data->inits (np);
drivers/clk/samsung/clk-exynos-clkout.c +3 -5
@@ -13,9 +13,9 @@#include <linux/io.h> #include <linux/of.h> #include <linux/of_address.h> -#include <linux/of_device.h> #include <linux/platform_device.h> #include <linux/pm.h> +#include <linux/property.h> #define EXYNOS_CLKOUT_NR_CLKS 1#define EXYNOS_CLKOUT_PARENTS 32
@@ -84,19 +84,17 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids);static int exynos_clkout_match_parent_dev (struct device *dev,u32 *mux_mask) {const struct exynos_clkout_variant *variant; -const struct of_device_id *match;if (!dev->parent) {dev_err (dev,"not instantiated from MFD\n" );return -EINVAL ; } - match =of_match_device (exynos_clkout_ids, dev->parent); -if (!match) { + variant =device_get_match_data (dev->parent); +if (!variant) {dev_err (dev,"cannot match parent device\n" );return -EINVAL ; } - variant = match->data; *mux_mask = variant->mux_mask;
drivers/clk/ti/adpll.c +4 -10
@@ -8,7 +8,9 @@#include <linux/io.h> #include <linux/math64.h> #include <linux/module.h> -#include <linux/of_device.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/property.h> #include <linux/string.h> #define ADPLL_PLLSS_MMR_LOCK_OFFSET 0x00/* Managed by MPPULL */
@@ -860,24 +862,16 @@ static int ti_adpll_probe(struct platform_device *pdev) {struct device_node *node = pdev->dev.of_node;struct device *dev = &pdev->dev; -const struct of_device_id *match; -const struct ti_adpll_platform_data *pdata;struct ti_adpll_data *d;struct resource *res;int err; - match =of_match_device (ti_adpll_match, dev); -if (match) - pdata = match->data; -else -return -ENODEV ; - d =devm_kzalloc (dev,sizeof (*d),GFP_KERNEL );if (!d)return -ENOMEM ; d->dev = dev; d->np = node; - d->c = pdata; + d->c =device_get_match_data (dev);dev_set_drvdata (d->dev, d);spin_lock_init (&d->lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2806/3318 clk: qcom: mmcc-msm8960: Configure PLL15 only on APQ8064
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit 342db3b6cf7bad2a53ccd5e2d844faf260953d9d ]
PLL15 is specific to APQ8064, but the shared probe function configures it unconditionally, including on MSM8960. Its configuration registers at offsets 0x33c through 0x348 exceed the MSM8960 regmap maximum of 0x334, so regmap rejects these accesses. The PLL configuration helper ignores the errors and probe continues.
Only configure PLL15 when the selected descriptor is for APQ8064, matching the existing variant check for the GFX3D clock adjustments.
--- drivers/clk/qcom/mmcc-msm8960.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/qcom/mmcc-msm8960.c +2 -1
@@ -3120,7 +3120,8 @@ static int mmcc_msm8960_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); -clk_pll_configure_sr (&pll15, regmap, &pll15_config, false); +if (desc == &mmcc_apq8064_desc) +clk_pll_configure_sr (&pll15, regmap, &pll15_config, false);return qcom_cc_really_probe (pdev, desc, regmap); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2807/3318 clk: qcom: rcg2: Initialize shared floor clock state
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 72f34d429f6e51b0ef8c43ab7667c4fb4099dd46 ]
Shared floor RCGs use the cached parked_cfg whenever CCF considers the clock disabled. Unlike the other shared RCG variants, their ops do not initialize that cache, leaving it zeroed until the first disable or rate change. This can make registration report an undivided XO configuration instead of the boot-programmed parent and divider.
Initialize parked_cfg from CFG_REG without parking or otherwise changing the hardware. Propagate read failures so a clock with unknown initial state is not registered.
--- drivers/clk/qcom/clk-rcg2.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/clk/qcom/clk-rcg2.c +13 -13
@@ -1207,7 +1207,20 @@ const struct clk_ops clk_rcg2_shared_ops = { };EXPORT_SYMBOL_GPL (clk_rcg2_shared_ops); +static int clk_rcg2_shared_no_init_park (struct clk_hw *hw) +{ +struct clk_rcg2 *rcg =to_clk_rcg2 (hw); + +/* +* Read the config register so that the parent is properly mapped at +* registration time. +*/ +return regmap_read (rcg->clkr.regmap, rcg->cmd_rcgr +CFG_REG , + &rcg->parked_cfg); +} +const struct clk_ops clk_rcg2_shared_floor_ops = { + .init = clk_rcg2_shared_no_init_park, .enable = clk_rcg2_shared_enable, .disable = clk_rcg2_shared_disable, .get_parent = clk_rcg2_shared_get_parent,
@@ -1219,19 +1232,6 @@ const struct clk_ops clk_rcg2_shared_floor_ops = { };EXPORT_SYMBOL_GPL (clk_rcg2_shared_floor_ops); -static int clk_rcg2_shared_no_init_park (struct clk_hw *hw) -{ -struct clk_rcg2 *rcg =to_clk_rcg2 (hw); - -/* -* Read the config register so that the parent is properly mapped at -* registration time. -*/ -regmap_read (rcg->clkr.regmap, rcg->cmd_rcgr +CFG_REG , &rcg->parked_cfg); - -return 0 ; -} -/* * Like clk_rcg2_shared_ops but skip the init so that the clk frequency is left * unchanged at registration time.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2808/3318 clk: qcom: rcg2: Propagate force-enable status errors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 8c0f93e10fa9e34009817bd37bb75c1b5a691fa2 ]
clk_rcg2_is_enabled() returns either a hardware status or a negative regmap error. The force-enable polling loop treats every nonzero return as an enabled clock, so a failed status read is incorrectly reported as success and clock reconfiguration can continue with unknown hardware state.
Check for negative returns before testing the enabled status and propagate the read error to the caller.
--- drivers/clk/qcom/clk-rcg2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/qcom/clk-rcg2.c +4 -1
@@ -984,7 +984,10 @@ static int clk_rcg2_set_force_enable(struct clk_hw *hw)/* wait for RCG to turn ON */ for (count =500 ; count >0 ; count--) { -if (clk_rcg2_is_enabled (hw)) + ret =clk_rcg2_is_enabled (hw); +if (ret <0 ) +return ret; +if (ret)return 0 ;udelay (1 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2809/3318 clk: qcom: rcg2: Clear force enable after rate failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit d4e8c6b9aef42d06cf5755543ad10097b2217990 ]
Shared RCG rate changes assert force-enable before programming the new configuration. If programming fails, the function returns without clearing force-enable, leaving the root running while CCF can release temporary parent and resource references.
Attempt to clear force-enable on the configuration error path before returning the original programming error. This restores the same cleanup performed after a successful configuration while preserving the primary failure for callers.
--- drivers/clk/qcom/clk-rcg2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/qcom/clk-rcg2.c +3 -1
@@ -1016,8 +1016,10 @@ clk_rcg2_shared_force_enable_clear(struct clk_hw *hw, const struct freq_tbl *f)return ret; ret =clk_rcg2_configure (rcg, f); -if (ret) +if (ret) { +clk_rcg2_clear_force_enable (hw);return ret; + }return clk_rcg2_clear_force_enable (hw); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2810/3318 s390/uprobes: Fix off-by-one bug in emulated PER handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 2ba01cf7b2598571486425a0605f1434909b532d ]
The uprobes code emulates some instructions, and with that also PER storage-alteration handling, in case a debugger is attached.
The PER storage-alteration handling contains an off-by-one bug, which may lead to PER traps which should not happen. Adjust the comparison in sim_stor_event() to fix that.
--- arch/s390/kernel/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/uprobes.c +1 -1
@@ -248,7 +248,7 @@ static void sim_stor_event(struct pt_regs *regs, void *addr, int len)return ;if (!(current->thread.per_user.control &PER_EVENT_STORE ))return ; -if ((void *)current->thread.per_user.start > (addr + len)) +if ((void *)current->thread.per_user.start > (addr + len -1 ))return ;if ((void *)current->thread.per_user.end < addr)return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2811/3318 nvme: tcp: split controller bringup handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
[ Upstream commit 10fd7fb676d71482b64bc61f5058b1011133f984 ]
Drivers must call nvme_uninit_ctrl after a successful nvme_init_ctrl. Split the allocation side out to make the error handling boundary easier to navigate. The nvme tcp driver's error handling had different returns in the error goto label's, which harm readability.
Stable-dep-of: 87a1ac965502 ("nvme-tcp: store and use the caller's network namespace")
--- drivers/nvme/host/tcp.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/nvme/host/tcp.c +19 -6
@@ -2670,7 +2670,7 @@ nvme_tcp_existing_controller(struct nvmf_ctrl_options *opts)return found; } -static struct nvme_ctrl *nvme_tcp_create_ctrl (struct device *dev, +static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl (struct device *dev,struct nvmf_ctrl_options *opts) {struct nvme_tcp_ctrl *ctrl;
@@ -2746,6 +2746,24 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev,if (ret) goto out_kfree_queues; +return ctrl; +out_kfree_queues: +kfree (ctrl->queues); +out_free_ctrl: +kfree (ctrl); +return ERR_PTR (ret); +} + +static struct nvme_ctrl *nvme_tcp_create_ctrl (struct device *dev, +struct nvmf_ctrl_options *opts) +{ +struct nvme_tcp_ctrl *ctrl; +int ret; + + ctrl =nvme_tcp_alloc_ctrl (dev, opts); +if (IS_ERR (ctrl)) +return ERR_CAST (ctrl); +if (!nvme_change_ctrl_state (&ctrl->ctrl,NVME_CTRL_CONNECTING )) {WARN_ON_ONCE (1 ); ret = -EINTR ;
@@ -2771,11 +2789,6 @@ static struct nvme_ctrl *nvme_tcp_create_ctrl(struct device *dev,if (ret >0 ) ret = -EIO ;return ERR_PTR (ret); -out_kfree_queues: -kfree (ctrl->queues); -out_free_ctrl: -kfree (ctrl); -return ERR_PTR (ret); }static struct nvmf_transport_ops nvme_tcp_transport = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2812/3318 nvme-tcp: fix selinux denied when calling sock_sendmsg
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peijie Shao <[email protected]>
[ Upstream commit 1be52169c3488ef98582ed553ab35cefa3978817 ]
In a SELinux enabled kernel, socket_create() initializes the security label of the socket using the security label of the calling process, this typically works well.
However, in a containerized environment like Kubernetes, problem arises when a privileged container(domain spc_t) connects to an NVMe target and mounts the NVMe as persistent storage for unprivileged containers(domain container_t).
This is because the container_t domain cannot access resources labeled with spc_t, resulting in socket_sendmsg returning -EACCES.
The solution is to use socket_create_kern() instead of socket_create(), which labels the socket context to kernel_t. Access control will then be handled by the VFS layer rather than the socket itself.
Stable-dep-of: 87a1ac965502 ("nvme-tcp: store and use the caller's network namespace")
--- drivers/nvme/host/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +2 -1
@@ -1650,7 +1650,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid) queue->cmnd_capsule_len =sizeof (struct nvme_command ) +NVME_TCP_ADMIN_CCSZ ; - ret =sock_create (ctrl->addr.ss_family,SOCK_STREAM , + ret =sock_create_kern (current->nsproxy->net_ns, + ctrl->addr.ss_family,SOCK_STREAM ,IPPROTO_TCP , &queue->sock);if (ret) { dev_err(nctrl->device,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2813/3318 nvme-tcp: store and use the callers network namespace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Surabhi Gogte <[email protected]>
[ Upstream commit 87a1ac965502858f9207153a92c3aef8ecf6d4ae ]
nvme_tcp_alloc_queue() creates each socket using current->nsproxy->net_ns, which is correct for the initial connect that runs in userspace context. However, the reconnect and error recovery paths run from a workqueue where current netns is a kernel thread in init_net, so sockets created during reconnect end up in a different namespace than the one the controller was originally connected from.
Fix this by capturing the caller's network namespace at controller allocation time. Use ctrl->net for all socket creation so that every queue, on initial connect, reset, or reconnect, is created in the same namespace.
--- drivers/nvme/host/tcp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/tcp.c +6 -1
@@ -171,6 +171,7 @@ struct nvme_tcp_ctrl {struct delayed_work connect_work;struct nvme_tcp_request async_req;u32 io_queues[HCTX_MAX_TYPES ]; +struct net *net; };static LIST_HEAD (nvme_tcp_ctrl_list);
@@ -1650,7 +1651,7 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid) queue->cmnd_capsule_len =sizeof (struct nvme_command ) +NVME_TCP_ADMIN_CCSZ ; - ret =sock_create_kern (current->nsproxy->net_ns, + ret =sock_create_kern (ctrl->net, ctrl->addr.ss_family,SOCK_STREAM ,IPPROTO_TCP , &queue->sock);if (ret) {
@@ -2348,6 +2349,7 @@ static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctrl)nvmf_free_options (nctrl->opts); free_ctrl: +put_net (ctrl->net);kfree (ctrl->queues);kfree (ctrl); }
@@ -2743,12 +2745,15 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev, goto out_free_ctrl; } + ctrl->net =get_net (current->nsproxy->net_ns); + ret =nvme_init_ctrl (&ctrl->ctrl, dev, &nvme_tcp_ctrl_ops,0 );if (ret) goto out_kfree_queues;return ctrl; out_kfree_queues: +put_net (ctrl->net);kfree (ctrl->queues); out_free_ctrl:kfree (ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2814/3318 nvmet-fc: dont drop the last assoc reference in nvmet_fc_delete_ctrl()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Palla Raghunath <[email protected]>
[ Upstream commit 165301b5e2fd765fa05ea1044bbca8ba79820197 ]
syzbot hit a recursive locking report on subsys->lock when a subsystem is unlinked from an FC port.
nvmet_port_del_ctrls() holds subsys->lock while it calls ->delete_ctrl() for each controller. nvmet_fc_delete_ctrl() grabs a reference on the association, queues del_work and then drops the reference. If del_work gets to run to completion before that put, ours is the last reference. Freeing the assoc tears down the queues, the last nvmet_cq_put() drops the last ctrl reference, and nvmet_ctrl_free() goes for subsys->lock again:
WARNING: possible recursive locking detected
...
nvmet_ctrl_free+0xa6/0x8e0 drivers/nvme/target/core.c:1766 nvmet_cq_put+0x158/0x200 drivers/nvme/target/core.c:848 nvmet_fc_target_assoc_free+0x418/0x2220 drivers/nvme/target/fc.c:1173 nvmet_fc_delete_ctrl+0x717/0x7e0 drivers/nvme/target/fc.c:1581 nvmet_port_del_ctrls+0xfb/0x150 drivers/nvme/target/core.c:311 nvmet_port_subsys_drop_link+0x1e8/0x310 drivers/nvme/target/configfs.c:1119
It's a real hang, not only a lockdep warning. I reproduced it with fcloop by putting an msleep() before the put: rm on the configfs link gets stuck in D state for good.
I don't think we need that reference at all. del_work does list_del_rcu() and synchronize_rcu() before it drops the initial reference, so an assoc we find on assoc_list can't go away before rcu_read_unlock(). nvmet_fc_schedule_delete_assoc() doesn't sleep, so just call it inside the RCU section and get rid of the get/put. If the assoc is already being deleted, terminating is set and the call is a no-op, which matches what happened before when the get failed.
With the same msleep() in place the patched kernel unlinks cleanly and the assoc is freed from the workqueue.
--- drivers/nvme/target/fc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/nvme/target/fc.c +9 -6
@@ -1575,8 +1575,14 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl)list_for_each_entry_rcu (assoc, &tgtport->assoc_list, a_list) { queue = assoc->queues[0 ];if (queue && queue->nvme_sq.ctrl == ctrl) { -if (nvmet_fc_tgt_a_get (assoc)) - found_ctrl = true; +/* +* No assoc reference here: we're called with +* subsys->lock held, and if del_work beat us, +* our put would free the ctrl under that lock. +* RCU keeps the assoc alive until unlock. +*/ +nvmet_fc_schedule_delete_assoc (assoc); + found_ctrl = true;break ; } }
@@ -1584,11 +1590,8 @@ nvmet_fc_delete_ctrl(struct nvmet_ctrl *ctrl)nvmet_fc_tgtport_put (tgtport); -if (found_ctrl) { -nvmet_fc_schedule_delete_assoc (assoc); -nvmet_fc_tgt_a_put (assoc); +if (found_ctrl)return ; - }spin_lock_irqsave (&nvmet_fc_tgtlock, flags); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2815/3318 nvmet-auth: reject undersized AUTH_SEND payloads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sung Byeongchan <[email protected]>
[ Upstream commit c9359401036e8294c007a10e8c8d8da7030fcc76 ]
nvmet_execute_auth_send() allocates and copies the initiator-supplied transfer length, then reads auth_type and auth_id through a common DHCHAP message pointer. The existing zero and transfer-length checks do not ensure that both common-header bytes are present.
An unauthenticated NVMe/TCP initiator can complete ICReq and admin CONNECT, then send AUTH_SEND with tl equal to one. KASAN reports a one-byte slab out-of-bounds read when auth_id is loaded.
Reject payloads that do not cover the common auth_type/auth_id header before allocating or parsing them. The one-byte trigger and header-minus-one boundary were cleanly rejected in three fixed fresh-boot runs. Exact-header, valid DHCHAP, wrong-type, mismatch, and zero-length controls remained clean, and a following valid AUTH_SEND on the same connection received a response. The touched source is unchanged at 0c2669a9f4a1d607e7591ae50ccf3c432a0aff08, where the patch applies and builds cleanly.
The demonstrated impact is unauthenticated pre-authentication target-kernel denial of service. No disclosure, controlled write, RCE, or LPE was demonstrated. The source reproducer and complete logs are available on request and are not included in this public report.
OpenAI Codex assisted source inspection, test design, patch drafting, and evidence organization.
--- drivers/nvme/target/fabrics-cmd-auth.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/nvme/target/fabrics-cmd-auth.c +6 -0
@@ -256,6 +256,12 @@ void nvmet_execute_auth_send(struct nvmet_req *req)nvmet_check_transfer_len (req, tl);return ; } +if (tl < offsetof(struct nvmf_auth_dhchap_success2_data , rsvd1)) { + status =NVME_SC_INVALID_FIELD |NVME_STATUS_DNR ; + req->error_loc = + offsetof(struct nvmf_auth_send_command , tl); + goto done; + } d =kmalloc (tl,GFP_KERNEL );if (!d) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2816/3318 nvme: pass partition flags to passthrough checks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yao Sang <[email protected]>
[ Upstream commit 6908a702955929b0876baac9fdc57070780a76f0 ]
nvme_user_cmd() handles NVME_IOCTL_IO_CMD on namespace block devices, including partitions. It receives flags identifying a partition, but passes 0 to nvme_cmd_allowed(), bypassing the partition guard and allowing unprivileged passthrough commands to access sectors outside the partition.
Pass flags to the permission check, rejecting unprivileged commands on partitions.
--- drivers/nvme/host/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +1 -1
@@ -410,7 +410,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns, c.common.cdw14 =cpu_to_le32 (cmd.cdw14); c.common.cdw15 =cpu_to_le32 (cmd.cdw15); -if (!nvme_cmd_allowed (ctrl, ns, &c,0 , open_for_write)) +if (!nvme_cmd_allowed (ctrl, ns, &c, flags, open_for_write))return -EACCES ;if (cmd.timeout_ms)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2817/3318 firmware: cs_dsp: clear dsp->running on the cs_dsp_run() error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingxuan Guo <[email protected]>
[ Upstream commit ad6be54d13496a0b5c6d1edeea99504e438cdb7a ]
cs_dsp_run() sets dsp->running = true once the core has been started, but the error path below it only stops and disables the core, leaving the flag set. The first thing that can fail after that point is the post_run client hook, and it is reachable in mainline: wm_adsp registers wm_adsp_event_post_run(), which can fail in wm_adsp_buffer_init().
The core is then stopped and disabled, but dsp->running still reads true, and that stale state is acted on elsewhere: cs_dsp_coeff_write_ctrl() and cs_dsp_coeff_read_ctrl() talk to the DSP when ctl->dsp->running is set, and client drivers use the flag to decide whether the firmware is up (cs35l41 checks cs_dsp.running before its early events and on hibernate/resume).
The flag cannot simply be moved below the hook: post_run hooks such as wm_adsp_event_post_run() read controls while they run, and cs_dsp_coeff_read_ctrl() only goes to the DSP when the flag is set.
Clear the flag on the error path, before the core is stopped - the order cs_dsp_stop() already uses.
--- drivers/firmware/cirrus/cs_dsp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/firmware/cirrus/cs_dsp.c +2 -0
@@ -2834,6 +2834,8 @@ int cs_dsp_run(struct cs_dsp *dsp)return 0 ; err: + dsp->running = false; +if (dsp->ops->stop_core) dsp->ops->stop_core (dsp);if (dsp->ops->disable_core)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2818/3318 ASoC: amd: acp: Fix .close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 2c3400aa9f397da48a6760f5e84438973e01a00c ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/acp/acp-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/acp/acp-platform.c +1 -1
@@ -204,7 +204,7 @@ static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_subslist_add_tail (&stream->list, &adata->stream_list);spin_unlock_irq (&adata->acp_lock); -return ret; +return 0 ; } static int acp_dma_hw_params(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2819/3318 ASoC: amd: ps: Fix acp63_pdm_dma_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 172888114dda96492d40e4a6e0ed16146cb76e2b ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp63_pdm_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/ps/ps-pdm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/ps/ps-pdm-dma.c +1 -1
@@ -211,7 +211,7 @@ static int acp63_pdm_dma_open(struct snd_soc_component *component, pdm_data->acp63_base = adata->acp63_base; runtime->private_data = pdm_data; -return ret; +return 0 ; } static int acp63_pdm_dma_hw_params(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2820/3318 ASoC: amd: ps: Fix acp63_sdw_dma_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 45dd2b22ea8934ed69dd05e6ecbf3c66ac3baebf ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp63_sdw_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/ps/ps-sdw-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/ps/ps-sdw-dma.c +1 -1
@@ -243,7 +243,7 @@ static int acp63_sdw_dma_open(struct snd_soc_component *component, stream->stream_id = cpu_dai->id; stream->instance = amd_manager->instance; runtime->private_data = stream; -return ret; +return 0 ; } static int acp63_sdw_dma_hw_params(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2821/3318 ASoC: amd: raven: Fix acp3x_dma_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 37ceef26df57c4a86a5e984b1951995aa96d4342 ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp3x_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/raven/acp3x-pcm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/raven/acp3x-pcm-dma.c +1 -1
@@ -237,7 +237,7 @@ static int acp3x_dma_open(struct snd_soc_component *component, i2s_data->acp3x_base = adata->acp3x_base; runtime->private_data = i2s_data; -return ret; +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2822/3318 ASoC: amd: renoir: Fix acp_pdm_dma_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit a92571113ef297840270e4d8d4263a842302c9c4 ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp_pdm_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/renoir/acp3x-pdm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/renoir/acp3x-pdm-dma.c +1 -1
@@ -233,7 +233,7 @@ static int acp_pdm_dma_open(struct snd_soc_component *component, pdm_data->acp_base = adata->acp_base; runtime->private_data = pdm_data; -return ret; +return 0 ; } static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2823/3318 ASoC: amd: vangogh: Fix acp5x_dma_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 38559fcd1c518a33055ef0a2cf7c04b57bfa9215 ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp5x_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/vangogh/acp5x-pcm-dma.c +1 -1
@@ -231,7 +231,7 @@ static int acp5x_dma_open(struct snd_soc_component *component, } i2s_data->acp5x_base = adata->acp5x_base; runtime->private_data = i2s_data; -return ret; +return 0 ; } static int acp5x_dma_hw_params(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2824/3318 ASoC: amd: yc: Fix acp6x_pdm_dma_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 06654a3ef5137719be880a6cd12bd453050eafc5 ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from acp6x_pdm_dma_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/amd/yc/acp6x-pdm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/yc/acp6x-pdm-dma.c +1 -1
@@ -209,7 +209,7 @@ static int acp6x_pdm_dma_open(struct snd_soc_component *component, pdm_data->acp6x_base = adata->acp6x_base; runtime->private_data = pdm_data; -return ret; +return 0 ; } static int acp6x_pdm_dma_hw_params(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2825/3318 ASoC: atmel: atmel-pcm-pdc: Fix atmel_pcm_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 50aaca643038774b6779c911c4f96bc7e0d607e9 ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from atmel_pcm_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/atmel/atmel-pcm-pdc.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/atmel/atmel-pcm-pdc.c +2 -0
@@ -295,6 +295,8 @@ static int atmel_pcm_open(struct snd_soc_component *component, } runtime->private_data = prtd; +return 0 ; + out:return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2826/3318 ASoC: imx-pcm-rpmsg: Fix imx_rpmsg_pcm_close() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 85e56c3bbb7e8ea4626f8653afaef0d79d9cb7ba ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from imx_rpmsg_pcm_open(). ASoC only marks the component as opened when .open() returns 0, so .close() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/fsl/imx-pcm-rpmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/imx-pcm-rpmsg.c +1 -1
@@ -278,7 +278,7 @@ static int imx_rpmsg_pcm_open(struct snd_soc_component *component, info->stream_timer[substream->stream].substream = substream;timer_setup (&info->stream_timer[substream->stream].timer, imx_rpmsg_timer_callback,0 ); -return ret; +return 0 ; } static int imx_rpmsg_pcm_close(struct snd_soc_component *component,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2827/3318 ASoC: intel: atom: Use __free(kfree) for stream pointer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 4889a8a73f65b8e4feb49ea434b8a41806513574 ]
Declare 'stream' with __free(kfree) so it is automatically freed when leaving scope. This allows direct returns from error paths and removes the explicit kfree(stream) call.
Set 'stream' to NULL after ownership has been transferred to runtime->private_data to prevent it from being freed on the success path.
This cleanup is a preparation step for upcoming locking changes.
Stable-dep-of: e3bb57581104 ("ASoC: intel: atom: Fix .shutdown() being skipped on rollback")
--- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
sound/soc/intel/atom/sst-mfld-platform-pcm.c +14 -6
@@ -11,6 +11,7 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/cleanup.h> #include <linux/slab.h> #include <linux/io.h> #include <linux/module.h>
@@ -304,7 +305,7 @@ static int sst_media_open(struct snd_pcm_substream *substream, {int ret_val =0 ;struct snd_pcm_runtime *runtime = substream->runtime; -struct sst_runtime_stream *stream; + struct sst_runtime_stream *stream __free(kfree) = NULL; stream =kzalloc (sizeof (*stream),GFP_KERNEL );if (!stream)
@@ -330,7 +331,7 @@ static int sst_media_open(struct snd_pcm_substream *substream, ret_val =power_up_sst (stream);if (ret_val <0 ) - goto out_power_up; +return ret_val;/* * Make sure the period to be multiple of 1ms to align the
@@ -347,12 +348,19 @@ static int sst_media_open(struct snd_pcm_substream *substream,snd_pcm_hw_constraint_step (substream->runtime,0 ,SNDRV_PCM_HW_PARAM_PERIODS ,2 ); -return snd_pcm_hw_constraint_integer (runtime, -SNDRV_PCM_HW_PARAM_PERIODS ); + ret_val =snd_pcm_hw_constraint_integer (runtime, +SNDRV_PCM_HW_PARAM_PERIODS ); + +if (ret_val <0 ) +return ret_val; + + stream =NULL ; + +return ret_val; + out_ops:mutex_unlock (&sst_lock); -out_power_up: -kfree (stream); +return ret_val; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2828/3318 ASoC: Intel: atom: Use scoped_guard() for scoped locking
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 08d2d5e683e85a7dc33c1abfd50fdc380bfafb5a ]
Clean up the code using scoped_guard() for mutex locks. Merely code refactoring, and no behavior change.
Stable-dep-of: e3bb57581104 ("ASoC: intel: atom: Fix .shutdown() being skipped on rollback")
--- sound/soc/intel/atom/sst-atom-controls.c | 38 ++++++++++---------- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 20 ++++------- 2 files changed, 27 insertions(+), 31 deletions(-)
sound/soc/intel/atom/sst-atom-controls.c +20 -18
@@ -761,27 +761,29 @@ int sst_handle_vb_timer(struct snd_soc_dai *dai, bool enable)return ret; } -mutex_lock (&drv->lock); -if (enable) - timer_usage++; -else - timer_usage--; - -/* -* Send the command only if this call is the first enable or last -* disable -*/ -if ((enable && (timer_usage ==1 )) || - (!enable && (timer_usage ==0 ))) { - ret =sst_fill_and_send_cmd_unlocked (drv,SST_IPC_IA_CMD , -SST_FLAG_BLOCKED ,SST_TASK_SBA ,0 , &cmd, -sizeof (cmd.header) + cmd.header.length); -if (ret && enable) { + scoped_guard(mutex, &drv->lock) { +if (enable) + timer_usage++; +else timer_usage--; - enable = false; + +/* +* Send the command only if this call is the first enable or last +* disable +*/ +if ((enable && timer_usage ==1 ) || + (!enable && timer_usage ==0 )) { + ret =sst_fill_and_send_cmd_unlocked (drv,SST_IPC_IA_CMD , +SST_FLAG_BLOCKED , +SST_TASK_SBA ,0 , &cmd, +sizeof (cmd.header) + + cmd.header.length); +if (ret && enable) { + timer_usage--; + enable = false; + } } } -mutex_unlock (&drv->lock);if (!enable) sst->ops->power (sst->dev, false);
sound/soc/intel/atom/sst-mfld-platform-pcm.c +7 -13
@@ -313,15 +313,14 @@ static int sst_media_open(struct snd_pcm_substream *substream,spin_lock_init (&stream->status_lock);/* get the sst ops */ -mutex_lock (&sst_lock); -if (!sst || - !try_module_get (sst->dev->driver->owner)) { -dev_err (dai->dev,"no device available to run\n" ); - ret_val = -ENODEV ; - goto out_ops; + scoped_guard(mutex, &sst_lock) { +if (!sst || + !try_module_get (sst->dev->driver->owner)) { +dev_err (dai->dev,"no device available to run\n" ); +return -ENODEV ; + } + stream->ops = sst->ops; } - stream->ops = sst->ops; -mutex_unlock (&sst_lock); stream->stream_info.str_id =0 ;
@@ -356,11 +355,6 @@ static int sst_media_open(struct snd_pcm_substream *substream, stream =NULL ; -return ret_val; - -out_ops: -mutex_unlock (&sst_lock); -return ret_val; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2829/3318 ASoC: intel: atom: Fix .shutdown() being skipped on rollback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit e3bb575811042ca30ac9b7b4dacc74aab8efa512 ]
snd_pcm_hw_constraint_integer() may return 1, which is then returned from sst_media_open(). ASoC only marks the DAI as started when .startup() returns 0, so .shutdown() can be skipped on rollback.
Return 0 explicitly on success.
--- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/atom/sst-mfld-platform-pcm.c +1 -1
@@ -355,7 +355,7 @@ static int sst_media_open(struct snd_pcm_substream *substream, stream =NULL ; -return ret_val; +return 0 ; } static void sst_media_close(struct snd_pcm_substream *substream,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2830/3318 ASoC: atmel-i2s: fix MCK generator error handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit 2e2da92de9bffd2cdbb9a2558fe60de7f1bb09e3 ]
Disable the gclk and reset the MCK configuration when an error occurs while enabling the MCK generator.
This prevents the gclk from remaining enabled after a failed clock configuration.
--- sound/soc/atmel/atmel-i2s.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
sound/soc/atmel/atmel-i2s.c +13 -3
@@ -466,11 +466,21 @@ static int atmel_i2s_switch_mck_generator(struct atmel_i2s_dev *dev, mr |=ATMEL_I2SC_MR_IMCKMODE_I2SMCK ; ret =regmap_update_bits (dev->regmap,ATMEL_I2SC_MR , mr_mask, mr);if (ret) -return ret; + goto err_disable_gclk;/* Finally enable the I2S Master Clock generator. */ -return regmap_write (dev->regmap,ATMEL_I2SC_CR , -ATMEL_I2SC_CR_CKEN ); + ret =regmap_write (dev->regmap,ATMEL_I2SC_CR ,ATMEL_I2SC_CR_CKEN ); +if (ret) + goto err_reset_mr; + +return 0 ; + +err_reset_mr: +regmap_update_bits (dev->regmap,ATMEL_I2SC_MR , mr_mask,0 ); +err_disable_gclk: +clk_disable_unprepare (dev->gclk); + +return ret; } static int atmel_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2831/3318 ASoC: atmel-i2s: use optional API for muxclk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit be952abd69c1f2c845e42e72147751e4c910cd81 ]
The muxclk is an optional clock according to the device tree binding.
Use devm_clk_get_optional() to handle the optional muxclk instead of handling the missing clock explicitly.
When muxclk is not available, devm_clk_get_optional() returns NULL. clk_set_parent() returns 0 when passed NULL, preserving the existing behavior.
Unlike the existing code, errors other than -EPROBE_DEFER are now returned instead of being silently ignored.
--- sound/soc/atmel/atmel-i2s.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
sound/soc/atmel/atmel-i2s.c +5 -11
@@ -585,21 +585,15 @@ static int atmel_i2s_sama5d2_mck_init(struct atmel_i2s_dev *dev, struct device_node *np) {struct clk *muxclk; -int err;if (!dev->gclk)return 0 ; -/* muxclk is optional, so we return error for probe defer only */ - muxclk =devm_clk_get (dev->dev,"muxclk" ); -if (IS_ERR (muxclk)) { - err =PTR_ERR (muxclk); -if (err == -EPROBE_DEFER ) -return -EPROBE_DEFER ; -dev_dbg (dev->dev, -"failed to get the I2S clock control: %d\n" , err); -return 0 ; - } +/* muxclk is optional */ + muxclk =devm_clk_get_optional (dev->dev,"muxclk" ); +if (IS_ERR (muxclk)) +return dev_err_probe (dev->dev,PTR_ERR (muxclk), +"failed to get the I2S clock control\n" );return clk_set_parent (muxclk, dev->gclk); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2832/3318 ASoC: atmel-i2s: use optional API for gclk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: bui duc phuc <[email protected]>
[ Upstream commit b431a055fb7688c0d3725fa3c55aeef852991178 ]
The gclk is an optional clock according to the device tree binding.
Use devm_clk_get_optional() to handle the optional gclk directly.
Unlike the existing code, errors other than -EPROBE_DEFER are now returned instead of being silently ignored.
--- sound/soc/atmel/atmel-i2s.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/atmel/atmel-i2s.c +4 -7
@@ -666,13 +666,10 @@ static int atmel_i2s_probe(struct platform_device *pdev) }/* Get audio clock to generate the I2S Master Clock (I2S_MCK) */ - dev->gclk =devm_clk_get (&pdev->dev,"gclk" ); -if (IS_ERR (dev->gclk)) { -if (PTR_ERR (dev->gclk) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; -/* Master Mode not supported */ - dev->gclk =NULL ; - } + dev->gclk =devm_clk_get_optional (&pdev->dev,"gclk" ); +if (IS_ERR (dev->gclk)) +return PTR_ERR (dev->gclk); + dev->dev = &pdev->dev; dev->regmap = regmap;platform_set_drvdata (pdev, dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2833/3318 sh: sh7785lcr: Register the PCA9564 controller as I2C bus 0
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 3b8386ffc0c33b6b5a6a8e64e1487c1adec57dc9 ]
Before commit 44454baa7ca7 ("i2c: Dynamically assign adapter id if it wasn't explictly specified"), a negative ID was replaced by zero, and I2C bus zero was instantiated. Since that commit, a negative ID is passed verbatim, instantiating an I2C bus with a dynamic number. As SH boards still use i2c_register_board_info(0, ...) to register I2C devices, they rely on the I2C bus being bus zero.
The SH7785LCR is the only SH board whose I2C adapter has a negative ID and its PCA9564 controller becomes i2c-1, causing registration of the R2025S/D RTC to fail and hwclock not detecting /dev/rtc0.
Set the platform device ID to 0 so that the adapter is registered as bus zero again.
--- arch/sh/boards/board-sh7785lcr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/boards/board-sh7785lcr.c +1 -1
@@ -256,7 +256,7 @@ static struct i2c_pca9564_pf_platform_data i2c_platform_data = {static struct platform_device i2c_device = { .name ="i2c-pca-platform" , - .id =-1 , + .id =0 , .dev = { .platform_data = &i2c_platform_data, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2834/3318 lib: validate in-memory LZ4 chunk length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiling Zou <[email protected]>
[ Upstream commit 138a84817df01eda67bb23032ab49c23fe2ffc16 ]
We found and validated an issue in lib/decompress_unlz4.c. The bug is reachable by a root user through kexec_file_load() with a crafted external initrd.
unlz4() reads the compressed chunk length from an in-memory initrd and passes it to LZ4_decompress_safe(). It only checks the chunk length against the allocation size when the input is filled by a callback.
Reject an in-memory chunk that extends past the remaining input before calling the LZ4 decoder. This prevents malformed initrds from making the decoder read past the mapped archive.
--- lib/decompress_unlz4.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/decompress_unlz4.c +4 -0
@@ -139,6 +139,10 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,if (!fill) { inp +=4 ; size -=4 ; +if (chunksize > size) { +error ("data corrupted" ); + goto exit_2; + } }else {if (chunksize >LZ4_compressBound (uncomp_chunksize)) {error ("chunk length is longer than allocated" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2835/3318 ocfs2: retain all security xattrs during inode creation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit d637475617d8468c2740a3436428681bcc8d3572 ]
When creating a new inode, ocfs2_init_security_get() stores the security xattr returned by the LSM framework in ocfs2_security_xattr_info so that it can be written later within the same transaction. But ocfs2_initxattrs() only ever looks at the first element of the xattr array, and it keeps the name as a bare pointer into memory owned by the security layer instead of copying it. The value, by contrast, is already duplicated with kmemdup().
With stacked LSMs, security_inode_init_security() provides one xattr per LSM, so all labels but the first are silently dropped and never written to disk, leaving newly created files without the security xattrs the other LSMs rely on.
The borrowed name is not an outright bug with the LSMs in tree today:security_inode_init_security() frees only ->value once the callback returns, and documents ->name as the attribute name suffix, so the pointer stays valid for as long as ocfs2 uses it. It is fragile though, as an LSM that allocates the name together with the value would turn it into a use-after-free, so the rework below copies the names as well.
Fix this by storing copies of all the security xattrs: allocate an array in ocfs2_initxattrs(), copy the names and values, account for all of them in the credit calculations, and write each one in ocfs2_init_security_set().
While at it, switch the allocations from GFP_KERNEL to GFP_NOFS. The callback runs in the inode creation path with the parent directory locked, and the security layer allocates the very same xattr array with GFP_NOFS, so direct reclaim must not be allowed to recurse into the filesystem from here.
--- fs/ocfs2/namei.c | 6 +-- fs/ocfs2/xattr.c | 133 +++++++++++++++++++++++++++++++++++++---------- fs/ocfs2/xattr.h | 12 +++-- 3 files changed, 116 insertions(+), 35 deletions(-)
fs/ocfs2/namei.c +2 -4
@@ -244,7 +244,6 @@ static int ocfs2_mknod(struct mnt_idmap *idmap,int want_meta =0 ;int xattr_credits =0 ;struct ocfs2_security_xattr_info si = { - .name =NULL , .enable =1 , };int did_quota_inode =0 ;
@@ -471,7 +470,7 @@ static int ocfs2_mknod(struct mnt_idmap *idmap,brelse (new_fe_bh);brelse (parent_fe_bh); -kfree (si.value); +ocfs2_free_security_xattrs (&si);ocfs2_acl_init_release (&acl_state);
@@ -1819,7 +1818,6 @@ static int ocfs2_symlink(struct mnt_idmap *idmap,int want_clusters =0 ;int xattr_credits =0 ;struct ocfs2_security_xattr_info si = { - .name =NULL , .enable =1 , };int did_quota =0 , did_quota_inode =0 ;
@@ -2051,7 +2049,7 @@ static int ocfs2_symlink(struct mnt_idmap *idmap,brelse (new_fe_bh);brelse (parent_fe_bh); -kfree (si.value); +ocfs2_free_security_xattrs (&si);ocfs2_free_dir_lookup_result (&lookup);if (inode_ac)ocfs2_free_alloc_context (inode_ac);
fs/ocfs2/xattr.c +105 -28
193 lines not on this page · raw message
fs/ocfs2/xattr.h +9 -3
@@ -20,13 +20,18 @@ enum ocfs2_xattr_type { OCFS2_XATTR_MAX }; -struct ocfs2_security_xattr_info { -int enable; -const char *name; +struct ocfs2_security_xattr { +char *name;void *value;size_t value_len; }; +struct ocfs2_security_xattr_info { +int enable; +struct ocfs2_security_xattr *xattrs; +int count; +}; +extern const struct xattr_handler ocfs2_xattr_user_handler;extern const struct xattr_handler ocfs2_xattr_trusted_handler;extern const struct xattr_handler ocfs2_xattr_security_handler;
@@ -49,6 +54,7 @@ int ocfs2_xattr_remove(struct inode *, struct buffer_head *);int ocfs2_init_security_get (struct inode *,struct inode *,const struct qstr *,struct ocfs2_security_xattr_info *); +void ocfs2_free_security_xattrs (struct ocfs2_security_xattr_info *); int ocfs2_init_security_set(handle_t *, struct inode *, struct buffer_head *, struct ocfs2_security_xattr_info *,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2836/3318 ocfs2: fix possible deadlock between nfs_sync_rwlock and fs_reclaim
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
[ Upstream commit 169bc4d16a8efa7852b101fdaa4c028505cd6750 ]
syzbot detected a circular locking dependency on &osb->nfs_sync_rwlock:
CPU0 CPU1
---- ----
lock(fs_reclaim);
lock(&ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE]);
lock(fs_reclaim); rlock(&osb->nfs_sync_rwlock);
*** DEADLOCK ***
Chain exists of: &osb->nfs_sync_rwlock --> &ocfs2_sysfile_lock_key[INODE_ALLOC_SYSTEM_INODE] --> fs_reclaim
CPU0 is kswapd. The dentry shrinker runs under fs_reclaim and reaches ocfs2_delete_inode() through ->evict_inode():
kswapd
balance_pgdat
shrink_node
shrink_slab
super_cache_scan
prune_dcache_sb
shrink_dentry_list
dentry_kill
ocfs2_dentry_iput
evict
ocfs2_evict_inode
ocfs2_delete_inode
ocfs2_nfs_sync_lock
down_read(&osb->nfs_sync_rwlock) //C0: grabbingCPU1 is a task deleting an inode. It takes nfs_sync_rwlock first, then the orphan dir and inode alloc system inode i_rwsems, and allocates the metadata reservation with GFP_KERNEL while holding them:
evict
ocfs2_evict_inode
ocfs2_delete_inode
+ ocfs2_nfs_sync_lock
| down_read(&osb->nfs_sync_rwlock) //C1: hold
+ ocfs2_wipe_inode
+ inode_lock(orphan_dir_inode) //C1: hold
+ ocfs2_truncate_for_delete
| ocfs2_commit_truncate
| ocfs2_remove_btree_range
| ocfs2_reserve_blocks_for_rec_trunc
| ocfs2_reserve_new_metadata_blocks
| kzalloc_obj() //C1: grabbing
| // GFP_KERNEL -> might_alloc -> fs_reclaim_acquire
+ ocfs2_remove_inode
inode_lock(inode_alloc_inode)
jbd2 pins allocations to GFP_NOFS for the lifetime of a transaction handle, but these reservations are made before ocfs2_start_trans(), so fs_reclaim is acquired with ocfs2 locks still held and the cycle closes.
The same cycle is reachable from ocfs2_get_dentry() and ocfs2_get_parent(), which hold nfs_sync_rwlock for write across ocfs2_test_inode_bit() and ocfs2_iget().
This is more than a lockdep artifact. A GFP_KERNEL allocation under the orphan dir i_rwsem enters direct reclaim, which runs the shrinkers, which can evict another ocfs2 inode and re-enter ocfs2_wipe_inode() on the same task; the second inode_lock() on the singleton orphan dir inode then self-deadlocks, since i_rwsem is not recursive.
Establish a GFP_NOFS allocation context for the whole nfs_sync_rwlock critical section so that nothing holding it can recurse into filesystem reclaim. Do it in ocfs2_nfs_sync_lock()/ocfs2_nfs_sync_unlock() rather than at the call sites, so that future callers cannot forget it.
--- fs/ocfs2/dlmglue.c | 29 +++++++++++++++++++++++++---- fs/ocfs2/dlmglue.h | 5 +++-- fs/ocfs2/export.c | 10 ++++++---- fs/ocfs2/inode.c | 5 +++-- 4 files changed, 37 insertions(+), 12 deletions(-)
fs/ocfs2/dlmglue.c +25 -4
@@ -19,6 +19,7 @@#include <linux/time.h> #include <linux/delay.h> #include <linux/quotaops.h> +#include <linux/sched/mm.h> #include <linux/sched/signal.h> #define MLOG_MASK_PREFIX ML_DLM_GLUE
@@ -2855,21 +2856,34 @@ void ocfs2_rename_unlock(struct ocfs2_super *osb)ocfs2_cluster_unlock (osb, lockres,DLM_LOCK_EX ); } -int ocfs2_nfs_sync_lock (struct ocfs2_super *osb,int ex) +int ocfs2_nfs_sync_lock (struct ocfs2_super *osb,int ex,unsigned int *nofs_flag) {int status; +unsigned int flags;struct ocfs2_lock_res *lockres = &osb->osb_nfs_sync_lockres;if (ocfs2_is_hard_readonly (osb))return -EROFS ; +/* +* ocfs2_delete_inode() takes this lock from ->evict_inode(), which the +* dentry shrinker reaches while holding fs_reclaim. Anything allocated +* under the lock must therefore stay out of filesystem reclaim, or +* reclaim recurses back into the shrinker and tries to take this lock +* again. Cover the whole critical section, including the cluster lock +* and the sysfile inode locks the callers take below it. +*/ + flags =memalloc_nofs_save (); +if (ex)down_write (&osb->nfs_sync_rwlock);else down_read (&osb->nfs_sync_rwlock); -if (ocfs2_mount_local (osb)) +if (ocfs2_mount_local (osb)) { + *nofs_flag = flags;return 0 ; + } status =ocfs2_cluster_lock (osb, lockres, ex ?LKM_EXMODE :LKM_PRMODE ,0 ,0 );
@@ -2880,12 +2894,17 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex)up_write (&osb->nfs_sync_rwlock); else up_read(&osb->nfs_sync_rwlock); +memalloc_nofs_restore (flags); +return status; } -return status; + *nofs_flag = flags; + +return 0 ; } -void ocfs2_nfs_sync_unlock (struct ocfs2_super *osb,int ex) +void ocfs2_nfs_sync_unlock (struct ocfs2_super *osb,int ex, +unsigned int nofs_flag) {struct ocfs2_lock_res *lockres = &osb->osb_nfs_sync_lockres;
@@ -2896,6 +2915,8 @@ void ocfs2_nfs_sync_unlock(struct ocfs2_super *osb, int ex)up_write (&osb->nfs_sync_rwlock); else up_read(&osb->nfs_sync_rwlock); + +memalloc_nofs_restore (nofs_flag); } int ocfs2_trim_fs_lock(struct ocfs2_super *osb,
fs/ocfs2/dlmglue.h +3 -2
@@ -163,8 +163,9 @@ void ocfs2_orphan_scan_unlock(struct ocfs2_super *osb, u32 seqno);int ocfs2_rename_lock (struct ocfs2_super *osb);void ocfs2_rename_unlock (struct ocfs2_super *osb); -int ocfs2_nfs_sync_lock (struct ocfs2_super *osb,int ex); -void ocfs2_nfs_sync_unlock (struct ocfs2_super *osb,int ex); +int ocfs2_nfs_sync_lock (struct ocfs2_super *osb,int ex,unsigned int *nofs_flag); +void ocfs2_nfs_sync_unlock (struct ocfs2_super *osb,int ex, +unsigned int nofs_flag);void ocfs2_trim_fs_lock_res_init (struct ocfs2_super *osb);void ocfs2_trim_fs_lock_res_uninit (struct ocfs2_super *osb); int ocfs2_trim_fs_lock(struct ocfs2_super *osb,
fs/ocfs2/export.c +6 -4
@@ -37,6 +37,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,struct inode *inode;struct ocfs2_super *osb =OCFS2_SB (sb);u64 blkno = handle->ih_blkno; +unsigned int nofs_flag =0 ;int status, set;struct dentry *result;
@@ -59,7 +60,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,* This will synchronize us against ocfs2_delete_inode() on * all nodes */ - status =ocfs2_nfs_sync_lock (osb,1 ); + status =ocfs2_nfs_sync_lock (osb,1 , &nofs_flag);if (status <0 ) {mlog (ML_ERROR ,"getting nfs sync lock(EX) failed %d\n" , status); goto check_err;
@@ -89,7 +90,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb, inode =ocfs2_iget (osb, blkno,0 ,0 ); unlock_nfs_sync: -ocfs2_nfs_sync_unlock (osb,1 ); +ocfs2_nfs_sync_unlock (osb,1 , nofs_flag); check_err:if (status <0 ) {
@@ -132,12 +133,13 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)u64 blkno;struct dentry *parent;struct inode *dir =d_inode (child); +unsigned int nofs_flag =0 ;int set;trace_ocfs2_get_parent (child, child->d_name.len, child->d_name.name, (unsigned long long )OCFS2_I (dir)->ip_blkno); - status =ocfs2_nfs_sync_lock (OCFS2_SB (dir->i_sb),1 ); + status =ocfs2_nfs_sync_lock (OCFS2_SB (dir->i_sb),1 , &nofs_flag);if (status <0 ) {mlog (ML_ERROR ,"getting nfs sync lock(EX) failed %d\n" , status); parent =ERR_PTR (status);
@@ -181,7 +183,7 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)ocfs2_inode_unlock (dir,0 ); unlock_nfs_sync: -ocfs2_nfs_sync_unlock (OCFS2_SB (dir->i_sb),1 ); +ocfs2_nfs_sync_unlock (OCFS2_SB (dir->i_sb),1 , nofs_flag); bail:trace_ocfs2_get_parent_end (parent);
fs/ocfs2/inode.c +3 -2
@@ -1044,6 +1044,7 @@ static void ocfs2_delete_inode(struct inode *inode) {int wipe, status;sigset_t oldset; +unsigned int nofs_flag =0 ;struct buffer_head *di_bh =NULL ;struct ocfs2_dinode *di =NULL ;
@@ -1078,7 +1079,7 @@ static void ocfs2_delete_inode(struct inode *inode)* shared mode so that all nodes can still concurrently * process deletes. */ - status =ocfs2_nfs_sync_lock (OCFS2_SB (inode->i_sb),0 ); + status =ocfs2_nfs_sync_lock (OCFS2_SB (inode->i_sb),0 , &nofs_flag);if (status <0 ) {mlog (ML_ERROR ,"getting nfs sync lock(PR) failed %d\n" , status);ocfs2_cleanup_delete_inode (inode,0 );
@@ -1150,7 +1151,7 @@ static void ocfs2_delete_inode(struct inode *inode)brelse (di_bh); bail_unlock_nfs_sync: -ocfs2_nfs_sync_unlock (OCFS2_SB (inode->i_sb),0 ); +ocfs2_nfs_sync_unlock (OCFS2_SB (inode->i_sb),0 , nofs_flag); bail_unblock:ocfs2_unblock_signals (&oldset);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2837/3318 ocfs2: validate chunk and block counts of the local quota file
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nguyen Ngoc Thang <[email protected]>
[ Upstream commit b10ef5d2c2083ea4c40e963c10a73a154793c5d4 ]
ocfs2_local_read_info() trusts dqi_chunks and dqi_blocks from the local quota file header. If dqi_blocks is too small, ocfs2_extend_local_quota_file() computes a bogus chunk length, extends the file, and maps logical block dqi_blocks, which is already in the inode's metadata cache (the header or a chunk header read at mount). sb_getblk() returns that cached buffer and ocfs2_set_new_buffer_uptodate() hits BUG_ON(ocfs2_buffer_cached()):
kernel BUG at fs/ocfs2/uptodate.c:509!
ocfs2_extend_local_quota_file+0x45c/0x1100 ocfs2_create_local_dquot+0x8ac/0xb50 ocfs2_acquire_dquot+0x614/0xae0 ocfs2_get_init_inode+0xe9/0x1b0 ocfs2_mkdir+0x174/0x430
ocfs2_local_quota_add_chunk() has the same exposure.
Reject a header whose counts don't fit the chunk layout or exceed i_size.
Reproduced with a crafted image (dqi_blocks = 1, chunk 0 dqc_free = 0); syzbot has no reproducer for this report.
--- fs/ocfs2/quota_local.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/ocfs2/quota_local.c +24 -0
@@ -245,6 +245,25 @@ static void ocfs2_release_local_quota_bitmaps(struct list_head *head) } } +/* Check that the on-disk chunk and block counts match the file layout */ +static int ocfs2_check_local_quota_info (struct inode *inode, +unsigned int chunks, +unsigned int blocks) +{ +u64 chunk_len =ol_chunk_blocks (inode->i_sb) +1 ; +u64 min_blocks = chunks ?1 + chunk_len * (chunks -1 ) +1 :1 ; +u64 max_blocks =1 + chunk_len * chunks; + +if (blocks >= min_blocks && blocks <= max_blocks && + blocks <=i_size_read (inode) >> inode->i_sb->s_blocksize_bits) +return 0 ; + +return ocfs2_error (inode->i_sb, +"Quota file %llu has bad info: %u chunks, %u blocks\n" , + (unsigned long long )OCFS2_I (inode)->ip_blkno, + chunks, blocks); +} +/* Load quota bitmaps into memory */ static int ocfs2_load_local_quota_bitmaps(struct inode *inode, struct ocfs2_local_disk_dqinfo *ldinfo,
@@ -730,6 +749,11 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) oinfo->dqi_blocks =le32_to_cpu (ldinfo->dqi_blocks); oinfo->dqi_libh = bh; + status =ocfs2_check_local_quota_info (lqinode, oinfo->dqi_chunks, + oinfo->dqi_blocks); +if (status <0 ) + goto out_err; +/* We crashed when using local quota file? */ if (!(oinfo->dqi_flags &OLQF_CLEAN )) { rec =OCFS2_SB (sb)->quota_rec;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2838/3318 ALSA: pcm: Fix driver_tstamp value reporting
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amadeusz Sławiński <[email protected]>
[ Upstream commit 8ff1161ac5aa02f3261e00f07d6212be2b12384b ]
In some cases (system32 and compat64) due to incorrect assignment wrong value is being reported. Fix it.
--- sound/core/pcm_compat.c | 4 ++-- sound/core/pcm_native.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/core/pcm_compat.c +2 -2
@@ -219,8 +219,8 @@ static int snd_pcm_status_user_compat64(struct snd_pcm_substream *substream, .audio_tstamp_data = status.audio_tstamp_data, .audio_tstamp_sec = status.audio_tstamp_sec, .audio_tstamp_nsec = status.audio_tstamp_nsec, - .driver_tstamp_sec = status.audio_tstamp_sec, - .driver_tstamp_nsec = status.audio_tstamp_nsec, + .driver_tstamp_sec = status.driver_tstamp_sec, + .driver_tstamp_nsec = status.driver_tstamp_nsec, .audio_tstamp_accuracy = status.audio_tstamp_accuracy, };
sound/core/pcm_native.c +2 -2
@@ -1154,8 +1154,8 @@ static int snd_pcm_status_user32(struct snd_pcm_substream *substream, .audio_tstamp_data = status64.audio_tstamp_data, .audio_tstamp_sec = status64.audio_tstamp_sec, .audio_tstamp_nsec = status64.audio_tstamp_nsec, - .driver_tstamp_sec = status64.audio_tstamp_sec, - .driver_tstamp_nsec = status64.audio_tstamp_nsec, + .driver_tstamp_sec = status64.driver_tstamp_sec, + .driver_tstamp_nsec = status64.driver_tstamp_nsec, .audio_tstamp_accuracy = status64.audio_tstamp_accuracy, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2839/3318 ALSA: jack: Fix kctl free at error in snd_jack_kctl_new()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit f421be924fec67f74bb0b6988ea8f0a3480df2a7 ]
When an error happens in snd_jack_kctl_new(), it tries to free the new kcontrol element via snd_ctl_free_one(). But snd_ctl_free_one() releases only the memories, and the internal linked list and hash entries still remain, which may lead to bogus accesses to user.
Replace with the correct destructor, snd_ctl_remove(), for clearing the whole resources of the given kcontrol, instead.
--- sound/core/jack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/jack.c +1 -1
@@ -454,7 +454,7 @@ static struct snd_jack_kctl * snd_jack_kctl_new(struct snd_card *card, const chareturn jack_kctl; error: -snd_ctl_free_one (kctl); +snd_ctl_remove (card, kctl);return NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2840/3318 ALSA: line6: Use kzalloc() for PCM buffer allocation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 9ec633573c1d162bfc82cae52d14c220c875612f ]
LINE6 driver allocates the PCM buffer via kmalloc(), and this might leave some bytes uninitialized that are out of the actual ring buffer size, while it's still exposed via mmap.
For avoiding the leak of the uninitialized kernel memory, simply replace it with kzalloc().
--- sound/usb/line6/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/line6/pcm.c +1 -1
@@ -155,7 +155,7 @@ static int line6_buffer_acquire(struct snd_line6_pcm *line6pcm,/* Invoked multiple times in a row so allocate once only */ if (!test_and_set_bit (type, &pstr->opened) && !pstr->buffer) { pstr->buffer = -kmalloc (array3_size (line6pcm->line6->iso_buffers, +kzalloc (array3_size (line6pcm->line6->iso_buffers,LINE6_ISO_PACKETS , pkt_size),GFP_KERNEL );if (!pstr->buffer)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2841/3318 ALSA: vmaster: Serialize hook registration with control callbacks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
[ Upstream commit 6215cf3ff5b0ff1ca5ab66b79021f9e28b02eae1 ]
An HDA virtual-master hook must have its private argument initialized before a control callback can invoke it. snd_hda_add_vmaster_hook() installs the trampoline through snd_ctl_add_vmaster_hook(), which stores master->hook before master->hook_private_data without serialization.
When a codec with a vmaster mute hook binds to an already registered card, snd_hda_gen_build_controls() publishes and initializes the Master Playback Switch before installing the hook. A native write that changes the switch can then run in the following order:
1. The codec bind path publishes and initializes the master control in __snd_hda_add_vmaster(), then calls snd_hda_add_vmaster_hook().
2. The hook setter stores master->hook, but has not yet stored its private argument.
3. SNDRV_CTL_IOCTL_ELEM_WRITE takes controls_rwsem and calls master_put() while the setter remains between those stores.
4. master_put() sees the callback and invokes vmaster_hook() with a NULL argument. The trampoline dereferences it before the setter can complete publication.
The write lock held by snd_ctl_elem_write() does not exclude the hook setter, so this can cause a NULL pointer dereference. Take the same controls_rwsem for writing inside snd_ctl_add_vmaster_hook() so the callback and its argument are installed together with respect to native control callbacks. Pass the card into the helper and update the HDA caller, keeping the lock in the ALSA core. Release it when registration returns, before the caller synchronizes the hook.
KASAN report as below:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
CPU: 1 UID: 0 PID: 499 Comm: alsa-vmaster-tr Not tainted 7.2.0-rc6-pmb-bt-functional-v1+ #1 PREEMPT(lazy)
Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:vmaster_hook+0x35/0xb0
Code: f5 53 48 89 fb 48 83 ec 08 e8 57 f0 9a fc eb 50 e8 50 f0 9a fc 48 8d 7b 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 75 59 48 8d 7b 10 48 8b 43 08 48 ba 00 00 00 00 00 fc
RSP: 0018:ffff888117647cd0 EFLAGS: 00010212
RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff84e9ff50
RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000008
RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000001
R10: ffffffff89427457 R11: ffff888115ad1d00 R12: ffffffff84e9ff30
R13: ffff888114943ca0 R14: 0000000000000000 R15: 0000000000000001
FS: 00007fe8167b3780(0000) GS:ffff88826b7e3000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000557c8c2842a8 CR3: 000000011579f005 CR4: 0000000000770ef0
PKRU: 55555554
Call Trace:
<TASK>
master_put+0x20e/0x2b0
snd_ctl_elem_write+0x37f/0x5e0
snd_ctl_ioctl+0x997/0xdd0
? __pfx_snd_ctl_ioctl+0x10/0x10
? srso_alias_return_thunk+0x5/0xfbef5
? selinux_file_ioctl+0xaa/0x280
? __pfx_snd_ctl_ioctl+0x10/0x10
__x64_sys_ioctl+0x163/0x1d0
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe8168c291b
Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00
RSP: 002b:00007fffab0cb150 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fe8168c291b
RDX: 00007fffab0cb310 RSI: 00000000c4c85513 RDI: 0000000000000003
RBP: 00007fffab0cb310 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fffab0cb1c0 R14: 0000000000000001 R15: 0000557c4f71fd10
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]------ include/sound/control.h | 2 +- sound/core/vmaster.c | 7 ++++++- sound/pci/hda/hda_codec.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
include/sound/control.h +1 -1
@@ -288,7 +288,7 @@ snd_ctl_add_follower_uncached(struct snd_kcontrol *master,return _snd_ctl_add_follower (master, follower,SND_CTL_FOLLOWER_NEED_UPDATE ); } -int snd_ctl_add_vmaster_hook (struct snd_kcontrol *kctl, +int snd_ctl_add_vmaster_hook (struct snd_card *card,struct snd_kcontrol *kctl,void (*hook)(void *private_data,int ),void *private_data);void snd_ctl_sync_vmaster (struct snd_kcontrol *kctl,bool hook_only);
sound/core/vmaster.c +6 -1
@@ -463,6 +463,7 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master);/** * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control +* @card: the card instance * @kcontrol: vmaster kctl element * @hook: the hook function * @private_data: the private_data pointer to be saved
@@ -470,13 +471,17 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master);* Adds the given hook to the vmaster control element so that it's called * at each time when the value is changed. * +* Takes the card's controls_rwsem lock internally. +* * Return: Zero. */ -int snd_ctl_add_vmaster_hook (struct snd_kcontrol *kcontrol, +int snd_ctl_add_vmaster_hook (struct snd_card *card,struct snd_kcontrol *kcontrol,void (*hook)(void *private_data,int ),void *private_data) {struct link_master *master =snd_kcontrol_chip (kcontrol); + +guard (rwsem_write)(&card->controls_rwsem); master->hook = hook; master->hook_private_data = private_data;return 0 ;
sound/pci/hda/hda_codec.c +1 -1
@@ -2071,7 +2071,7 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec,if (!hook->hook || !hook->sw_kctl)return 0 ; hook->codec = codec; -snd_ctl_add_vmaster_hook (hook->sw_kctl, vmaster_hook, hook); +snd_ctl_add_vmaster_hook (codec->card, hook->sw_kctl, vmaster_hook, hook);return 0 ; }EXPORT_SYMBOL_GPL (snd_hda_add_vmaster_hook);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2842/3318 ALSA: usb-audio: Use fixed control index for us16x08 mixer elements
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit a68a688ce220f1b359bec53fa38d1504314dc70f ]
The callbacks for us16x08 mixer elements assume that id.index points to the channel to be operated, and the assumption is correct for now. However, since the kctls are added via snd_usb_mixer_add_control() and it looks for the empty slot if the same control name is already present, in theory, the index can become more than the channel numbers (if a conflicting name really happens).
Since the mixer code in us16x08 doesn't need the search for an empty slot but requires the fixed index, this patch changes slightly how to assign the kcontrols. Now, a new argument is added to snd_usb_mixer_add_list() in order to disable the empty slot search, and use it in us16x08's add_new_ctl() helper function, instead.
--- sound/usb/mixer.c | 13 +++++++++---- sound/usb/mixer.h | 5 +++-- sound/usb/mixer_quirks.c | 2 +- sound/usb/mixer_us16x08.c | 3 ++- 4 files changed, 15 insertions(+), 8 deletions(-)
sound/usb/mixer.c +9 -4
@@ -581,20 +581,25 @@ static int check_matrix_bitmap(unsigned char *bmap,/* * add an alsa control element -* search and increment the index until an empty slot is found. +* when @look_for_empty is set, search and increment the index until an empty +* slot is found. * * if failed, give up and free the control instance. */ int snd_usb_mixer_add_list (struct usb_mixer_elem_list *list,struct snd_kcontrol *kctl, -bool is_std_info) +bool is_std_info, +bool look_for_empty) {struct usb_mixer_interface *mixer = list->mixer;int err; -while (snd_ctl_find_id (mixer->chip->card, &kctl->id)) - kctl->id.index++; +if (look_for_empty) { +while (snd_ctl_find_id (mixer->chip->card, &kctl->id)) + kctl->id.index++; + } + err =snd_ctl_add (mixer->chip->card, kctl);if (err <0 ) { usb_audio_dbg(mixer->chip, "cannot add control (err = %d)\n",
sound/usb/mixer.h +3 -2
@@ -107,10 +107,11 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,int snd_usb_mixer_add_list (struct usb_mixer_elem_list *list,struct snd_kcontrol *kctl, -bool is_std_info); +bool is_std_info, +bool look_for_empty);#define snd_usb_mixer_add_control (list, kctl) \ - snd_usb_mixer_add_list(list, kctl, true) + snd_usb_mixer_add_list(list, kctl, true, true) void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list, struct usb_mixer_interface *mixer,
sound/usb/mixer_quirks.c +1 -1
@@ -162,7 +162,7 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer, } kctl->private_free = snd_usb_mixer_elem_free;/* don't use snd_usb_mixer_add_control() here, this is a special list element */ -return snd_usb_mixer_add_list (list, kctl, false); +return snd_usb_mixer_add_list (list, kctl, false, true); }/*
sound/usb/mixer_us16x08.c +2 -1
@@ -1112,7 +1112,8 @@ static int add_new_ctl(struct usb_mixer_interface *mixer,strscpy (kctl->id.name, name,sizeof (kctl->id.name)); - err =snd_usb_mixer_add_control (&elem->head, kctl); +/* look_for_empty=false, as we want the fixed id.index as channel */ + err =snd_usb_mixer_add_list (&elem->head, kctl, true, false);if (err <0 )return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2843/3318 thermal/drivers/sprd: validate the sensor id from the device tree
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weigang He <[email protected]>
[ Upstream commit b17d799ce49bfaad68be5ff3df995b3bd021a9d7 ]
sprd_thm_probe() reads each sensor child node's "reg" property into sen->id and uses it without validation: to compute the sensor's register offsets in sprd_thm_sensor_init(), as the thermal zone id, and finally as an index into thm->sensor[], which has SPRD_THM_MAX_SENSOR
(8) entries:
ret = of_property_read_u32(sen_child, "reg", &sen->id); ... thm->sensor[sen->id] = sen;
Only the number of sensor nodes is checked against SPRD_THM_MAX_SENSOR. A "reg" value of 8 or more, or one that is negative once stored in the int sen->id, makes the register offsets point outside the sensor range and the final store land outside thm->sensor[], overwriting the fields that follow it in struct sprd_thermal_data or other memory.
Reject an out-of-range id right after reading it, before it is used.
This does not address sparse ids, such as a single sensor with id 7:
they leave holes in thm->sensor[] that the later loops over 0..nr_sensors-1 dereference. That needs a separate fix.
Found by static analysis tool CodeQL.
--- drivers/thermal/sprd_thermal.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/thermal/sprd_thermal.c +6 -0
@@ -400,6 +400,12 @@ static int sprd_thm_probe(struct platform_device *pdev) goto of_put; } +if (sen->id <0 || sen->id >=SPRD_THM_MAX_SENSOR ) { +dev_err (&pdev->dev,"invalid sensor id %d\n" , sen->id); + ret = -EINVAL ; + goto of_put; + } + ret =sprd_thm_sensor_calibration (sen_child, thm, sen);if (ret) {dev_err (&pdev->dev,"efuse cal analysis failed" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2844/3318 tools/thermal/tmon: Fix string truncation warning in optarg copy
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 602da762f7a7c494a95cb204ac005965b214e556 ]
GCC warns about possible string truncation with -Wstringop-truncation:
tmon.c: In function ‘main’:
tmon.c:233:25: warning: ‘__builtin_strncpy’ specified bound 20 equals
destination size [-Wstringop-truncation]
233 | strncpy(ctrl_cdev, optarg,
CDEV_NAME_SIZE);
|^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Replace strncpy() with snprintf() to guarantee NUL-termination and silence the compiler warning.
--- tools/thermal/tmon/tmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/thermal/tmon/tmon.c +1 -1
@@ -230,7 +230,7 @@ int main(int argc, char **argv)switch (c) {case 'c' : no_control =0 ; -strncpy (ctrl_cdev, optarg,CDEV_NAME_SIZE ); +snprintf (ctrl_cdev,sizeof (ctrl_cdev),"%s" , optarg);break ;case 'd' :start_daemon_mode ();
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2845/3318 thermal: ti-soc-thermal: Fix the return value in ti_bandgap_get_sensor_data() kernel-doc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 82bb005cd9cf5a9df4cfe4a52db90346ac5fd17a ]
ti_bandgap_get_sensor_data() returns an ERR_PTR() if the bandgap instance or sensor ID is invalid. Otherwise it returns the stored sensor data, which can be NULL if no data has been set or the stored value has been cleared.
This mismatch was already present in omap_bandgap_get_sensor_data() when the driver was introduced in staging.
Document the validation errors while retaining NULL as a possible stored value.
--- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +2 -1
@@ -576,7 +576,8 @@ int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data)* @bgp: pointer to bandgap instance * @id: sensor id * -* Return: data stored by set function with sensor id on success or NULL +* Return: the stored sensor data, which may be %NULL, or an ERR_PTR() +* if @bgp or @id is invalid. */ void *ti_bandgap_get_sensor_data (struct ti_bandgap *bgp,int id) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2846/3318 module: Fix uninitialized count read of unloaded taint tracking record
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Deng <[email protected]>
[ Upstream commit 7a5c13cfdfcb1871050fdbe00ac223993f8925fa ]
try_add_tainted_module() allocates the tracking record without zeroing it and initializes the fields in this order:
mod_taint = kmalloc_obj(*mod_taint); strscpy(mod_taint->name, mod->name, MODULE_NAME_LEN); mod_taint->taints = mod->taints; list_add_rcu(&mod_taint->list, &unloaded_tainted_modules); mod_taint->count = 1;
The record is published by list_add_rcu() before the count field is written. The readers, unloaded_tainted_modules_seq_show() (debugfs, under rcu_read_lock()) and print_unloaded_tainted_modules() (panic path, under guard(rcu)), traverse the list under RCU and read mod_taint->count. module_mutex, which the writer holds, does not exclude RCU readers.
A reader that observes the new node between the list_add_rcu() and the count store reads an uninitialized u64 left over from previous slab use. This is a data race and leaks kernel heap residue through the debugfs file and the panic message.
The race window is two adjacent instructions; it is reachable when a tainted module is unloaded (rmmod) concurrently with a read of /sys/kernel/debug/module/unloaded_tainted, or with the module list printout of an oops on another CPU.
Fix this by initializing count before the record is published.
Found during a static-analysis-assisted audit: candidate sites were surfaced by a Coccinelle rule, and the reader/writer paths were confirmed by LLM-assisted (GLM-5.3) code inspection. The issue was not observed at runtime; it is identified by code inspection only.
--- kernel/module/tracking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module/tracking.c +1 -1
@@ -40,8 +40,8 @@ int try_add_tainted_module(struct module *mod)return -ENOMEM ;strscpy (mod_taint->name, mod->name,MODULE_NAME_LEN ); mod_taint->taints = mod->taints; -list_add_rcu (&mod_taint->list, &unloaded_tainted_modules); mod_taint->count =1 ; +list_add_rcu (&mod_taint->list, &unloaded_tainted_modules); out:return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2847/3318 ipvs: fix buffer overflow when sending sync messages
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
[ Upstream commit 3e3fe49e8678c1a3d535ed02f32a9a6e80674263 ]
Sashiko reports for possible heap buffer overflow when generating sync message for the v0 and v1 message formats. We should read the cp->flags only once because another CPU can concurrently set the SEQ_MASK between the two reads.
Note that IPVS does not set the SEQ_MASK anymore for the ip_vs_ftp.c helper starting from commit 7f1c40757951 ("IPVS: make FTP work with full NAT support") (2.6.36+), so the problem should not be reproducible.
--- net/netfilter/ipvs/ip_vs_sync.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
net/netfilter/ipvs/ip_vs_sync.c +14 -9
@@ -544,13 +544,15 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp,struct ip_vs_sync_conn_v0 *s;struct ip_vs_sync_buff *buff;struct ipvs_master_sync_state *ms; -int id; +u32 flags, seq_mask;unsigned int len; +int id;if (unlikely (cp->af !=AF_INET ))return ; + flags =READ_ONCE (cp->flags);/* Do not sync ONE PACKET */ -if (cp->flags &IP_VS_CONN_F_ONE_PACKET ) +if (flags &IP_VS_CONN_F_ONE_PACKET )return ;if (!ip_vs_sync_conn_needed (ipvs, cp, pkts))
@@ -565,8 +567,8 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, id =select_master_thread_id (ipvs, cp); ms = &ipvs->ms[id]; buff = ms->sync_buff; - len = (cp->flags &IP_VS_CONN_F_SEQ_MASK ) ?FULL_CONN_SIZE : -SIMPLE_CONN_SIZE ; + seq_mask = flags &IP_VS_CONN_F_SEQ_MASK ; + len = seq_mask ?FULL_CONN_SIZE :SIMPLE_CONN_SIZE ;if (buff) { m = (struct ip_vs_sync_mesg_v0 *) buff->mesg;/* Send buffer if it is for v1 */
@@ -598,9 +600,9 @@ static void ip_vs_sync_conn_v0(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, s->caddr = cp->caddr.ip; s->vaddr = cp->vaddr.ip; s->daddr = cp->daddr.ip; - s->flags =htons (cp->flags & ~IP_VS_CONN_F_HASHED ); + s->flags =htons (flags & ~IP_VS_CONN_F_HASHED ); s->state =htons (cp->state); -if (cp->flags &IP_VS_CONN_F_SEQ_MASK ) { +if (seq_mask) {struct ip_vs_sync_conn_options *opt = (struct ip_vs_sync_conn_options *)&s[1 ];memcpy (opt, &cp->sync_conn_opt,sizeof (*opt));
@@ -636,6 +638,7 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)int id;__u8 *p;unsigned int len, pe_name_len, pad; +u32 flags, seq_mask;/* Handle old version of the protocol */ if (sysctl_sync_ver (ipvs) ==0 ) {
@@ -648,6 +651,7 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts) sloop:if (!ip_vs_sync_conn_needed (ipvs, cp, pkts)) goto control; + flags =READ_ONCE (cp->flags);/* Sanity checks */ pe_name_len =0 ;
@@ -675,7 +679,8 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)#endif len =sizeof (struct ip_vs_sync_v4 ); -if (cp->flags &IP_VS_CONN_F_SEQ_MASK ) + seq_mask = flags &IP_VS_CONN_F_SEQ_MASK ; +if (seq_mask) len +=sizeof (struct ip_vs_sync_conn_options ) +2 ;if (cp->pe_data_len)
@@ -721,7 +726,7 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts)/* Set message type & copy members */ s->v4.type = (cp->af ==AF_INET6 ?STYPE_F_INET6 :0 ); s->v4.ver_size =htons (len &SVER_MASK );/* Version 0 */ - s->v4.flags =htonl (cp->flags & ~IP_VS_CONN_F_HASHED ); + s->v4.flags =htonl (flags & ~IP_VS_CONN_F_HASHED ); s->v4.state =htons (cp->state); s->v4.protocol = cp->protocol; s->v4.cport = cp->cport;
@@ -745,7 +750,7 @@ void ip_vs_sync_conn(struct netns_ipvs *ipvs, struct ip_vs_conn *cp, int pkts) s->v4.vaddr = cp->vaddr.ip; s->v4.daddr = cp->daddr.ip; } -if (cp->flags &IP_VS_CONN_F_SEQ_MASK ) { +if (seq_mask) { *(p++) =IPVS_OPT_SEQ_DATA ; *(p++) =sizeof (struct ip_vs_sync_conn_options );hton_seq (&cp->in_seq, (struct ip_vs_seq *)p);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2848/3318 wifi: cfg80211: track SSID regardless of country data
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 577f690ce5dc641d9d8646d15bb8e99ff4a8280e ]
If the country data cannot be found, the function exits and then doesn't track the SSID. Move the SSID tracking up to fix that.
--- net/wireless/sme.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-)
net/wireless/sme.c +19 -19
@@ -887,6 +887,25 @@ void __cfg80211_connect_result(struct net_device *dev,cfg80211_upload_connect_keys (wdev); +if (!wdev->u.client.ssid_len) { +rcu_read_lock (); +for_each_valid_link (cr, link) { +u32 ssid_len; + + ssid =ieee80211_bss_get_elem (cr->links[link].bss, +WLAN_EID_SSID ); + +if (!ssid || !ssid->datalen) +continue ; + + ssid_len =min (ssid->datalen,IEEE80211_MAX_SSID_LEN ); +memcpy (wdev->u.client.ssid, ssid->data, ssid_len); + wdev->u.client.ssid_len = ssid_len; +break ; + } +rcu_read_unlock (); + } +rcu_read_lock ();for_each_valid_link (cr, link) { country_elem =
@@ -912,25 +931,6 @@ void __cfg80211_connect_result(struct net_device *dev, country_data, country_datalen);kfree (country_data); -if (!wdev->u.client.ssid_len) { -rcu_read_lock (); -for_each_valid_link (cr, link) { -u32 ssid_len; - - ssid =ieee80211_bss_get_elem (cr->links[link].bss, -WLAN_EID_SSID ); - -if (!ssid || !ssid->datalen) -continue ; - - ssid_len =min (ssid->datalen,IEEE80211_MAX_SSID_LEN ); -memcpy (wdev->u.client.ssid, ssid->data, ssid_len); - wdev->u.client.ssid_len = ssid_len; -break ; - } -rcu_read_unlock (); - } -return ; out:for_each_valid_link (cr, link)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2849/3318 ALSA: pcm: Unlink substreams before releasing them
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
[ Upstream commit d1e57f8fb7a6b6d32a4aaa31fd6fc4c77339608f ]
A closing PCM substream can remain in its linked group after the driver close callback has freed its private data. With two configured dummy capture substreams on the same PCM device, linked with LINK, PREPARE on the surviving substream can still visit the closing member:
Final close of A PREPARE on linked B
---------------- -------------------
snd_pcm_drop(): group -> SETUP
do_hw_free(A)
dummy_pcm_close(A): free dpcm
Take snd_pcm_link_rwsem for reading Walk the group, including A dummy_pcm_prepare(A)
Read freed timer_ops
pcm_release_private(A)
snd_pcm_unlink(A)
Unlink at the start of final substream release, before dropping the stream or releasing driver resources. The link write lock waits for an existing group PREPARE, and unlink removes the closing member from later group actions. Keep the existing stop synchronization in do_hw_free() before the driver resources are freed.
Make unlink independent of the pcm_release callback so OSS substreams are covered too. Remove the native-only unlink callback and its registration, while retaining the callback hook for OSS cleanup.
The existing KASAN report below records the freed timer_ops read in dummy_pcm_prepare().
KASAN report as below:
BUG: KASAN: slab-use-after-free in dummy_pcm_prepare+0xb7/0xc0
Read of size 8 at addr ffff888106b35f00 by task alsa_pcm_fixtur/491
Call Trace:
<TASK>
dump_stack_lvl+0x93/0xd0
print_report+0xce/0x630
? dummy_pcm_prepare+0xb7/0xc0
? srso_alias_return_thunk+0x5/0xfbef5
? __virt_addr_valid+0x20d/0x410
? dummy_pcm_prepare+0xb7/0xc0
kasan_report+0xe0/0x110
? dummy_pcm_prepare+0xb7/0xc0
dummy_pcm_prepare+0xb7/0xc0
snd_pcm_do_prepare+0x71/0xb0
snd_pcm_action_group+0x505/0xb30
snd_pcm_action_nonatomic+0xab/0x150
snd_pcm_common_ioctl+0x1bf5/0x3a50
? srso_alias_return_thunk+0x5/0xfbef5
? do_vfs_ioctl+0x1f5/0x1280
? __pfx_do_vfs_ioctl+0x10/0x10
? ioctl_has_perm.constprop.0.isra.0+0x34f/0x500
? __pfx_snd_pcm_common_ioctl+0x10/0x10
? __fput+0x5ba/0xa60
? srso_alias_return_thunk+0x5/0xfbef5
snd_pcm_ioctl+0x76/0xb0
? __pfx_snd_pcm_ioctl+0x10/0x10
__x64_sys_ioctl+0x163/0x1d0
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x41ee8d
Code: 04 25 28 00 00 00 48 89 45 c8 31 c0 48 8d 45 10 c7 45 b0 10 00 00 00 48 89 45 b8 48 8d 45 d0 48 89 45 c0 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1a 48 8b 45 c8 64 48 2b 04 25 28 00 00 00
RSP: 002b:00007ffcfa72fb60 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 000000000041ee8d
RDX: 0000000000000000 RSI: 0000000000004140 RDI: 0000000000000004
RBP: 00007ffcfa72fbb0 R08: 00007ffcfa72fb98 R09: 0000000000000110
R10: 0000000000000001 R11: 0000000000000246 R12: 00007ffcfa72fcd8
R13: 00007ffcfa72fcf0 R14: 00000000004a8f28 R15: 0000000000000001
</TASK>
Allocated by task 488:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0xaa/0xb0
__kmalloc_cache_noprof+0x251/0x610
dummy_hrtimer_create+0x4a/0x170
dummy_pcm_open+0xe7/0x730
snd_pcm_open_substream+0x926/0x1580
snd_pcm_open+0x28d/0x6d0
snd_pcm_capture_open+0x82/0xe0
snd_open+0x1ec/0x3e0
chrdev_open+0x21f/0x660
do_dentry_open+0x5c8/0x1300
vfs_open+0x87/0x390
path_openat+0x2460/0x3cd0
do_file_open+0x21e/0x470
do_sys_openat2+0xf4/0x1b0
__x64_sys_openat+0x136/0x1e0
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Freed by task 490:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
__kasan_slab_free+0x5f/0x80
kfree+0x307/0x580
dummy_hrtimer_free+0x72/0xe0
dummy_pcm_close+0x9f/0xd0
snd_pcm_release_substream.part.0+0x104/0x310
snd_pcm_release+0x106/0x240
__fput+0x39f/0xa60
fput_close_sync+0xff/0x200
__x64_sys_close+0x8c/0xf0
do_syscall_64+0x115/0x6a0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
==================================================================--- sound/core/pcm_native.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
sound/core/pcm_native.c +2 -8
@@ -2741,18 +2741,14 @@ static int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)return 0 ; } -static void pcm_release_private (struct snd_pcm_substream *substream) -{ -if (snd_pcm_stream_linked (substream)) -snd_pcm_unlink (substream); -} -void snd_pcm_release_substream (struct snd_pcm_substream *substream) { substream->ref_count--;if (substream->ref_count >0 )return ; +snd_pcm_unlink (substream); +snd_pcm_drop (substream);if (substream->hw_opened) {if (substream->runtime->state !=SNDRV_PCM_STATE_OPEN )
@@ -2836,8 +2832,6 @@ static int snd_pcm_open_file(struct file *file,return -ENOMEM ; } pcm_file->substream = substream; -if (substream->ref_count ==1 ) - substream->pcm_release = pcm_release_private; file->private_data = pcm_file;return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2850/3318 platform/x86: hp-bioscfg: fix off-by-one in password length check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
[ Upstream commit 0c22178524864af85ea380be4b2d36078c0edc9c ]
current_password and new_password hold MAX_PASSWD_SIZE bytes including the NUL, but validate_password_input() accepts a password of exactly MAX_PASSWD_SIZE characters when the firmware limits allow it. strscpy() then truncates it and fails with -E2BIG, which store_password_instance() ignores, so the write reports success with a truncated password stored.
For example, with a max_password_length of 64 or more, writing 64 characters succeeds but only 63 are stored.
Reject lengths of MAX_PASSWD_SIZE or more.
Compile tested only.
--- drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +1 -1
@@ -75,7 +75,7 @@ static int validate_password_input(int instance_id, const char *buf,if (is_current && !length)return 0 ; -if (length >MAX_PASSWD_SIZE ) +if (length >=MAX_PASSWD_SIZE )return -E2BIG ; if (password_data->min_password_length > length ||
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2851/3318 platform/x86: hp-bioscfg: validate SPM state returned by firmware
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
[ Upstream commit 35fb43f1576e1352077afc33a535007e0568480c ]
status_show() indexes the 3-entry spm_state_types[] with the state byte returned by firmware. update_spm_state() stores the same byte, which key_mechanism_show() uses to index the 3-entry spm_mechanism_types[]. Neither is range checked, so a state above 2 makes the world-readable status and key_mechanism files print a string from a pointer read past the array.
Return -EIO for an out of range state.
Compile tested only.
--- drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c +7 -0
@@ -6,6 +6,7 @@* Copyright (c) 2022 HP Development Company, L.P. */ +#include <linux/array_size.h> #include "bioscfg.h" static const char *const spm_state_types[] = {
@@ -115,6 +116,9 @@ static ssize_t update_spm_state(void)if (ret <0 )return ret; +if (data.state >=ARRAY_SIZE (spm_mechanism_types)) +return -EIO ; + bioscfg_drv.spm_data.mechanism = data.state;if (bioscfg_drv.spm_data.mechanism) bioscfg_drv.spm_data.is_enabled =1 ;
@@ -150,6 +154,9 @@ static ssize_t status_show(struct kobject *kobj, struct kobj_attributeif (ret <0 )return ret; +if (data.state >=ARRAY_SIZE (spm_state_types)) +return -EIO ; +/* * 'status' is a read-only file that returns ASCII text in * JSON format reporting the status information.
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2852/3318 platform/x86: hp-bioscfg: fix oops on short integer attribute buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Muhammad Bilal <[email protected]>
[ Upstream commit fd7545cd398adc09ec2f9b603d72671560ee6bf9 ]
hp_populate_integer_elements_from_buffer() ignores the return value of hp_get_string_from_buffer(). When fewer than 2 bytes are left in the buffer, dst_size is 0, kcalloc() returns ZERO_SIZE_PTR and hp_get_string_from_buffer() fails without writing to it, so kstrtoint() faults on address 0x10.
Return the error instead.
Compile tested only.
--- drivers/platform/x86/hp/hp-bioscfg/int-attributes.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/platform/x86/hp/hp-bioscfg/int-attributes.c +6 -1
@@ -334,7 +334,12 @@ static int hp_populate_integer_elements_from_buffer(u8 *buffer_ptr, u32 *buffer_// VALUE: integer_data->current_value =0 ; -hp_get_string_from_buffer (&buffer_ptr, buffer_size, dst, dst_size); + ret =hp_get_string_from_buffer (&buffer_ptr, buffer_size, dst, dst_size); +if (ret <0 ) { +kfree (dst); +return ret; + } + ret =kstrtoint (dst,10 , &integer_data->current_value);if (ret)pr_warn ("Unable to convert string to integer: %s\n" , dst);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2853/3318 serial: ma35d1: Do not force-enable an unselected console
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 171bb8a67cc1af7c88a65961adfb028430e0b783 ]
When another console is selected and there is no matching ttyNVT console argument, the core accepts the MA35D1 console without calling its setup function because it has CON_ENABLED set before registration. Its index remains -1 and printk repeatedly reports an invalid port, flooding the console and preventing boot.
Let the console core enable it after successful setup.
--- drivers/tty/serial/ma35d1_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/ma35d1_serial.c +1 -1
@@ -639,7 +639,7 @@ static struct console ma35d1serial_console = { .write = ma35d1serial_console_write, .device = uart_console_device, .setup = ma35d1serial_console_setup, - .flags = CON_PRINTBUFFER | CON_ENABLED, + .flags = CON_PRINTBUFFER, .index = -1, .data = &ma35d1serial_reg, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2854/3318 serial: pmac_zilog: report received breaks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Douglas <[email protected]>
[ Upstream commit 8db79ea07a67b126c773da6efdc00066000daeb8 ]
pmz_status_handle() sets PMACZILOG_FLAG_BREAK from RR0, and pmz_receive_chars() clears it on the null character that ends the break without marking that character, then tests BRK_ABRT in RR1, where the SCC does not set it in asynchronous mode. Breaks therefore arrive as plain NULs: brk is never counted and BRKINT, PARMRK and SysRq never see them.
Set BRK_ABRT in r1 for that character, as sunzilog does.
--- drivers/tty/serial/pmac_zilog.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/pmac_zilog.c +1 -0
@@ -233,6 +233,7 @@ static bool pmz_receive_chars(struct uart_pmac_port *uap) ch &= uap->parity_mask;if (ch ==0 && uap->flags &PMACZILOG_FLAG_BREAK ) { uap->flags &= ~PMACZILOG_FLAG_BREAK ; + r1 |=BRK_ABRT ; }#if defined(CONFIG_MAGIC_SYSRQ ) && defined(CONFIG_SERIAL_CORE_CONSOLE )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2855/3318 ASoC: codecs: wm8990: Fix definition of right input PGA controls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 5bd6d05197affaf5a2d7fae0e06e7373fd839b7c ]
The right input PGA boost (R12MNBST, R34MNBST) and routing (R12MNB, R34MNB) bits are in Input Mixer4 (R42), not in Input Mixer3 (R41), where these controls write the left channel bits.
--- sound/soc/codecs/wm8990.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8990.c +4 -4
@@ -97,8 +97,8 @@ static const struct snd_kcontrol_new wm8990_snd_controls[] = {SOC_SINGLE ("LIN12 PGA Boost" ,WM8990_INPUT_MIXER3 ,WM8990_L12MNBST_BIT ,1 ,0 ),SOC_SINGLE ("LIN34 PGA Boost" ,WM8990_INPUT_MIXER3 ,WM8990_L34MNBST_BIT ,1 ,0 ),/* INMIXR */ -SOC_SINGLE ("RIN12 PGA Boost" ,WM8990_INPUT_MIXER3 ,WM8990_R12MNBST_BIT ,1 ,0 ), -SOC_SINGLE ("RIN34 PGA Boost" ,WM8990_INPUT_MIXER3 ,WM8990_R34MNBST_BIT ,1 ,0 ), +SOC_SINGLE ("RIN12 PGA Boost" ,WM8990_INPUT_MIXER4 ,WM8990_R12MNBST_BIT ,1 ,0 ), +SOC_SINGLE ("RIN34 PGA Boost" ,WM8990_INPUT_MIXER4 ,WM8990_R34MNBST_BIT ,1 ,0 ),/* LOMIX */ SOC_SINGLE_TLV("LOMIX LIN3 Bypass Volume", WM8990_OUTPUT_MIXER3,
@@ -377,9 +377,9 @@ SOC_DAPM_SINGLE_TLV("Record Right Volume", WM8990_INPUT_MIXER4, WM8990_RDBVOL_SHIFT, WM8990_RDBVOL_MASK, 0, in_mix_tlv),SOC_DAPM_SINGLE_TLV ("RIN2 Volume" ,WM8990_INPUT_MIXER6 ,WM8990_RI2BVOL_SHIFT ,7 ,0 , in_mix_tlv), -SOC_DAPM_SINGLE ("RINPGA12 Switch" ,WM8990_INPUT_MIXER3 ,WM8990_L12MNB_BIT , +SOC_DAPM_SINGLE ("RINPGA12 Switch" ,WM8990_INPUT_MIXER4 ,WM8990_R12MNB_BIT ,1 ,0 ), -SOC_DAPM_SINGLE ("RINPGA34 Switch" ,WM8990_INPUT_MIXER3 ,WM8990_L34MNB_BIT , +SOC_DAPM_SINGLE ("RINPGA34 Switch" ,WM8990_INPUT_MIXER4 ,WM8990_R34MNB_BIT , 1, 0), };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2856/3318 ASoC: codecs: wm8990: Fix definition of LOMIX AINLMUX Bypass Volume control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 75e0b607e3456c9eb15dfb783984f814a89cbcaf ]
The LOMIX AINLMUX bypass volume (LLBLOVOL) is at bits 2:0 of Output Mixer5, not at bits 5:3, which hold the AINRMUX bypass volume (LRBLOVOL).
--- sound/soc/codecs/wm8990.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8990.c +1 -1
@@ -112,7 +112,7 @@ SOC_SINGLE_TLV("LOMIX RIN3 Bypass Volume", WM8990_OUTPUT_MIXER5,SOC_SINGLE_TLV ("LOMIX AINRMUX Bypass Volume" ,WM8990_OUTPUT_MIXER5 ,WM8990_LRBLOVOL_SHIFT ,WM8990_LRBLOVOL_MASK ,1 , out_mix_tlv),SOC_SINGLE_TLV ("LOMIX AINLMUX Bypass Volume" ,WM8990_OUTPUT_MIXER5 , -WM8990_LRBLOVOL_SHIFT ,WM8990_LRBLOVOL_MASK ,1 , out_mix_tlv), +WM8990_LLBLOVOL_SHIFT ,WM8990_LLBLOVOL_MASK ,1 , out_mix_tlv),/* ROMIX */ SOC_SINGLE_TLV("ROMIX RIN3 Bypass Volume", WM8990_OUTPUT_MIXER4,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2857/3318 ASoC: codecs: wm8991: Fix definition of right input PGA controls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 2dfecdc25d4937a36675c0c36ee0addc99e1e7f9 ]
The right input PGA boost (R12MNBST, R34MNBST) and routing (R12MNB, R34MNB) bits are in Input Mixer4 (R42), not in Input Mixer3 (R41), where these controls write the left channel bits.
--- sound/soc/codecs/wm8991.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8991.c +4 -4
@@ -169,8 +169,8 @@ static const struct snd_kcontrol_new wm8991_snd_controls[] = {SOC_SINGLE ("LIN12 PGA Boost" ,WM8991_INPUT_MIXER3 ,WM8991_L12MNBST_BIT ,1 ,0 ),SOC_SINGLE ("LIN34 PGA Boost" ,WM8991_INPUT_MIXER3 ,WM8991_L34MNBST_BIT ,1 ,0 ),/* INMIXR */ -SOC_SINGLE ("RIN12 PGA Boost" ,WM8991_INPUT_MIXER3 ,WM8991_R12MNBST_BIT ,1 ,0 ), -SOC_SINGLE ("RIN34 PGA Boost" ,WM8991_INPUT_MIXER3 ,WM8991_R34MNBST_BIT ,1 ,0 ), +SOC_SINGLE ("RIN12 PGA Boost" ,WM8991_INPUT_MIXER4 ,WM8991_R12MNBST_BIT ,1 ,0 ), +SOC_SINGLE ("RIN34 PGA Boost" ,WM8991_INPUT_MIXER4 ,WM8991_R34MNBST_BIT ,1 ,0 ),/* LOMIX */ SOC_SINGLE_TLV("LOMIX LIN3 Bypass Volume", WM8991_OUTPUT_MIXER3,
@@ -446,9 +446,9 @@ static const struct snd_kcontrol_new wm8991_dapm_inmixr_controls[] = { WM8991_RDBVOL_SHIFT, WM8991_RDBVOL_MASK, 0, in_mix_tlv),SOC_DAPM_SINGLE_TLV ("RIN2 Volume" ,WM8991_INPUT_MIXER6 ,WM8991_RI2BVOL_SHIFT ,7 ,0 , in_mix_tlv), -SOC_DAPM_SINGLE ("RINPGA12 Switch" ,WM8991_INPUT_MIXER3 ,WM8991_L12MNB_BIT , +SOC_DAPM_SINGLE ("RINPGA12 Switch" ,WM8991_INPUT_MIXER4 ,WM8991_R12MNB_BIT ,1 ,0 ), -SOC_DAPM_SINGLE ("RINPGA34 Switch" ,WM8991_INPUT_MIXER3 ,WM8991_L34MNB_BIT , +SOC_DAPM_SINGLE ("RINPGA34 Switch" ,WM8991_INPUT_MIXER4 ,WM8991_R34MNB_BIT , 1, 0), };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2858/3318 ASoC: codecs: wm8991: Fix definition of LOMIX AINLMUX Bypass Volume control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit fee722db39c2a1f18c944f747271fd1e131910a6 ]
The LOMIX AINLMUX bypass volume (LLBLOVOL) is at bits 2:0 of Output Mixer5, not at bits 5:3, which hold the AINRMUX bypass volume (LRBLOVOL).
--- sound/soc/codecs/wm8991.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8991.c +1 -1
@@ -184,7 +184,7 @@ static const struct snd_kcontrol_new wm8991_snd_controls[] = {SOC_SINGLE_TLV ("LOMIX AINRMUX Bypass Volume" ,WM8991_OUTPUT_MIXER5 ,WM8991_LRBLOVOL_SHIFT ,WM8991_LRBLOVOL_MASK ,1 , out_mix_tlv),SOC_SINGLE_TLV ("LOMIX AINLMUX Bypass Volume" ,WM8991_OUTPUT_MIXER5 , -WM8991_LRBLOVOL_SHIFT ,WM8991_LRBLOVOL_MASK ,1 , out_mix_tlv), +WM8991_LLBLOVOL_SHIFT ,WM8991_LLBLOVOL_MASK ,1 , out_mix_tlv),/* ROMIX */ SOC_SINGLE_TLV("ROMIX RIN3 Bypass Volume", WM8991_OUTPUT_MIXER4,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2859/3318 ASoC: codecs: wm8983: Fix definition of ADC 128x Oversampling control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit c1af9e2272f025ff75be76e03413074d5e7801c9 ]
ADC 128x oversampling (ADCOSR128) is at bit 3 of ADC Control, not at bit 8, which is the high pass filter enable (HPFEN).
--- sound/soc/codecs/wm8983.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8983.c +1 -1
@@ -234,7 +234,7 @@ static const struct snd_kcontrol_new wm8983_snd_controls[] = { 8, 1, 0, pga_boost_tlv),SOC_DOUBLE ("ADC Inversion Switch" ,WM8983_ADC_CONTROL ,0 ,1 ,1 ,0 ), -SOC_SINGLE ("ADC 128x Oversampling Switch" ,WM8983_ADC_CONTROL ,8 ,1 ,0 ), +SOC_SINGLE ("ADC 128x Oversampling Switch" ,WM8983_ADC_CONTROL ,3 ,1 ,0 ),SOC_DOUBLE_R_TLV ("Playback Volume" ,WM8983_LEFT_DAC_DIGITAL_VOL , WM8983_RIGHT_DAC_DIGITAL_VOL, 0, 255, 0, dac_tlv),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2860/3318 ASoC: codecs: wm8985: Fix definition of ADC 128x Oversampling control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit a747ec6e12cf7a71e42567a479af18b930890d9d ]
ADC 128x oversampling (ADCOSR128) is at bit 3 of ADC Control, not at bit 8, which is the high pass filter enable (HPFEN).
--- sound/soc/codecs/wm8985.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8985.c +1 -1
@@ -327,7 +327,7 @@ static const struct snd_kcontrol_new wm8985_common_snd_controls[] = { 8, 1, 0, pga_boost_tlv),SOC_DOUBLE ("ADC Inversion Switch" ,WM8985_ADC_CONTROL ,0 ,1 ,1 ,0 ), -SOC_SINGLE ("ADC 128x Oversampling Switch" ,WM8985_ADC_CONTROL ,8 ,1 ,0 ), +SOC_SINGLE ("ADC 128x Oversampling Switch" ,WM8985_ADC_CONTROL ,3 ,1 ,0 ),SOC_DOUBLE_R_TLV ("Playback Volume" ,WM8985_LEFT_DAC_DIGITAL_VOL , WM8985_RIGHT_DAC_DIGITAL_VOL, 0, 255, 0, dac_tlv),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2861/3318 ASoC: codecs: wm8994: Fix definition of WM8958 noise gate hold time controls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 291d81d628f3453026b029507a26b856056e4fdc ]
The noise gate hold time (NG_HLD) is at bits 6:5 of each WM8958 DAC noise gate register, not at bits 3:1, which hold the threshold (NG_THR).
--- sound/soc/codecs/wm8994.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8994.c +3 -3
@@ -700,17 +700,17 @@ static const char *wm8958_ng_text[] = { static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac1_ng_hold, WM8958_AIF1_DAC1_NOISE_GATE, - WM8958_AIF1DAC1_NG_THR_SHIFT, + WM8958_AIF1DAC1_NG_HLD_SHIFT, wm8958_ng_text); static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac2_ng_hold, WM8958_AIF1_DAC2_NOISE_GATE, - WM8958_AIF1DAC2_NG_THR_SHIFT, + WM8958_AIF1DAC2_NG_HLD_SHIFT, wm8958_ng_text); static SOC_ENUM_SINGLE_DECL(wm8958_aif2dac_ng_hold, WM8958_AIF2_DAC_NOISE_GATE, - WM8958_AIF2DAC_NG_THR_SHIFT, + WM8958_AIF2DAC_NG_HLD_SHIFT, wm8958_ng_text);static const struct snd_kcontrol_new wm8958_snd_controls[] = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2862/3318 ASoC: codecs: wm8955: Fix definition of Treble Cutoff control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 71911bf5bb3fe97da2124d17fc1dd3dbb9379e03 ]
Treble cutoff (TC) is at bit 6 of Treble Control, not at bit 2, which is part of the treble volume (TRBL[3:0]).
--- sound/soc/codecs/wm8955.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8955.c +1 -1
@@ -426,7 +426,7 @@ static const char *treble_cutoff_text[] = {"High" ,"Low" }; -static SOC_ENUM_SINGLE_DECL(treble_cutoff, WM8955_TREBLE_CONTROL, 2, +static SOC_ENUM_SINGLE_DECL(treble_cutoff, WM8955_TREBLE_CONTROL, 6, treble_cutoff_text); static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2863/3318 ASoC: codecs: wm_hubs: Fix definition of MIXINR to MIXOUTR volume control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 22bfcedd3febd6acc63ecf8bfd9638210e4b9a5e ]
The Right Output Mixer Right Input Volume (MIXINR_MIXOUTR_VOL) is at bits 2:0 of Output Mixer6, not at bits 8:6, which hold the IN2LN volume (IN2LN_MIXOUTR_VOL).
--- sound/soc/codecs/wm_hubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm_hubs.c +1 -1
@@ -426,7 +426,7 @@ SOC_SINGLE_TLV("Right Output Mixer IN2RP Volume",SOC_SINGLE_TLV ("Right Output Mixer Left Input Volume" ,WM8993_OUTPUT_MIXER6 ,3 ,7 ,1 , outmix_tlv),SOC_SINGLE_TLV ("Right Output Mixer Right Input Volume" , -WM8993_OUTPUT_MIXER6 ,6 ,7 ,1 , outmix_tlv), +WM8993_OUTPUT_MIXER6 ,0 ,7 ,1 , outmix_tlv),SOC_SINGLE_TLV ("Right Output Mixer DAC Volume" , WM8993_OUTPUT_MIXER6, 9, 7, 1, outmix_tlv),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2864/3318 ASoC: codecs: wm8737: Fix definition of zero cross switches
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 121963197200ca89050f05a704f53c281702ec16 ]
The mic (xMZC) and PGA (xPZC) zero cross bits are bits 3 and 2 of each channel's Audio Path register. SOC_DOUBLE takes one register and two shifts, so both controls only write the left register. Use SOC_DOUBLE_R, as the Mic Boost Switch next to them does.
--- sound/soc/codecs/wm8737.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8737.c +4 -4
@@ -149,13 +149,13 @@ SOC_DOUBLE_R_TLV("Mic Boost Volume", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R, 6, 3, 0, micboost_tlv),SOC_DOUBLE_R ("Mic Boost Switch" ,WM8737_AUDIO_PATH_L ,WM8737_AUDIO_PATH_R ,4 ,1 ,0 ), -SOC_DOUBLE ("Mic ZC Switch" ,WM8737_AUDIO_PATH_L ,WM8737_AUDIO_PATH_R , -3 ,1 ,0 ), +SOC_DOUBLE_R ("Mic ZC Switch" ,WM8737_AUDIO_PATH_L ,WM8737_AUDIO_PATH_R , +3 ,1 ,0 ),SOC_DOUBLE_R_TLV ("Capture Volume" ,WM8737_LEFT_PGA_VOLUME ,WM8737_RIGHT_PGA_VOLUME ,0 ,255 ,0 , pga_tlv), -SOC_DOUBLE ("Capture ZC Switch" ,WM8737_AUDIO_PATH_L ,WM8737_AUDIO_PATH_R , -2 ,1 ,0 ), +SOC_DOUBLE_R ("Capture ZC Switch" ,WM8737_AUDIO_PATH_L ,WM8737_AUDIO_PATH_R , +2 ,1 ,0 ), SOC_DOUBLE("INPUT1 DC Bias Switch", WM8737_MISC_BIAS_CONTROL, 0, 1, 1, 0),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2865/3318 ASoC: codecs: wm5100: Fix definition of EQ3 Band 1 Volume control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 96d30816a9a4fa6b3cc470f82d0f53e8a6425ab9 ]
The EQ3 band 1 gain is in WM5100_EQ3_1, not in WM5100_EQ1_1, which holds the EQ1 band 1 gain.
--- sound/soc/codecs/wm5100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm5100.c +1 -1
@@ -655,7 +655,7 @@ SOC_SINGLE_TLV("EQ2 Band 4 Volume", WM5100_EQ2_2, WM5100_EQ2_B4_GAIN_SHIFT,SOC_SINGLE_TLV ("EQ2 Band 5 Volume" ,WM5100_EQ2_2 ,WM5100_EQ2_B5_GAIN_SHIFT ,24 ,0 , eq_tlv), -SOC_SINGLE_TLV ("EQ3 Band 1 Volume" ,WM5100_EQ1_1 ,WM5100_EQ3_B1_GAIN_SHIFT , +SOC_SINGLE_TLV ("EQ3 Band 1 Volume" ,WM5100_EQ3_1 ,WM5100_EQ3_B1_GAIN_SHIFT ,24 ,0 , eq_tlv),SOC_SINGLE_TLV ("EQ3 Band 2 Volume" ,WM5100_EQ3_1 ,WM5100_EQ3_B2_GAIN_SHIFT , 24, 0, eq_tlv),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2866/3318 ASoC: codecs: wm8750: Fix definition of ALC Capture NG Type control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 8c299077c787c151c5c88928467d8e8d85cebdb7 ]
The noise gate type is wm8750_enum[7], bit 1 of WM8750_NGATE, not wm8750_enum[4], which is the 3D upper cut-off.
--- sound/soc/codecs/wm8750.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8750.c +1 -1
@@ -171,7 +171,7 @@ SOC_SINGLE("ALC Capture Hold Time", WM8750_ALC2, 0, 15, 0),SOC_SINGLE ("ALC Capture Decay Time" ,WM8750_ALC3 ,4 ,15 ,0 ),SOC_SINGLE ("ALC Capture Attack Time" ,WM8750_ALC3 ,0 ,15 ,0 ),SOC_SINGLE ("ALC Capture NG Threshold" ,WM8750_NGATE ,3 ,31 ,0 ), -SOC_ENUM ("ALC Capture NG Type" , wm8750_enum[4 ]), +SOC_ENUM ("ALC Capture NG Type" , wm8750_enum[7 ]),SOC_SINGLE ("ALC Capture NG Switch" ,WM8750_NGATE ,0 ,1 ,0 ), SOC_SINGLE("Left ADC Capture Volume", WM8750_LADC, 0, 255, 0),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2867/3318 ASoC: codecs: wm8510: Fix definition of ADC Inversion Switch control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: HyeongJun An <[email protected]>
[ Upstream commit 22d50113078dfbeff0d005d64fd9cc680249831c ]
ADC polarity is bit 0 of WM8510_ADC, not bit 0 of WM8510_COMP, which is the loopback enable. wm8974, which has the same register layout, already uses WM8974_ADC for this control.
--- sound/soc/codecs/wm8510.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8510.c +1 -1
@@ -135,7 +135,7 @@ SOC_SINGLE("Master Playback Volume", WM8510_DACVOL, 0, 127, 0),SOC_SINGLE ("High Pass Filter Switch" ,WM8510_ADC ,8 ,1 ,0 ),SOC_SINGLE ("High Pass Cut Off" ,WM8510_ADC ,4 ,7 ,0 ), -SOC_SINGLE ("ADC Inversion Switch" ,WM8510_COMP ,0 ,1 ,0 ), +SOC_SINGLE ("ADC Inversion Switch" ,WM8510_ADC ,0 ,1 ,0 ), SOC_SINGLE("Capture Volume", WM8510_ADCVOL, 0, 127, 0),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2868/3318 rpmsg: mtk: release channel OF node on device teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avi Weiss <[email protected]>
[ Upstream commit 00e100cfbf7bc159e462df16832cddeaf2cab770 ]
mtk_rpmsg_match_device_subnode() returns a referenced OF child node, which is stored in rpdev->dev.of_node.
mtk_rpmsg_release_device() later frees the containing allocation without dropping that ref.
Release the OF node when the RPMsg device is destroyed.
--- drivers/rpmsg/mtk_rpmsg.c | 1 + 1 file changed, 1 insertion(+)
drivers/rpmsg/mtk_rpmsg.c +1 -0
@@ -168,6 +168,7 @@ static void mtk_rpmsg_release_device(struct device *dev)struct rpmsg_device *rpdev =to_rpmsg_device (dev);struct mtk_rpmsg_device *mdev =to_mtk_rpmsg_device (rpdev); +of_node_put (dev->of_node);kfree (mdev); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2869/3318 rpmsg: virtio: Remove uncallable offchannel functions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dr. David Alan Gilbert <[email protected]>
[ Upstream commit 68decaf24d4d24f4f8708a248e65e9d77ea19b85 ]
The virtio_rpmsg_send_offchannel() and virtio_rpmsg_trysend_offchannel() are wired up to the send_offchannel and trysend_offchannel members of rpmsg_endpoint_ops, the only dereference of those was by the unused, and now removed rpmsg_send_offchannel() and rpmsg_trysend_offchannel() functions.
Remove them.
Stable-dep-of: 7dd4cffdf4c2 ("rpmsg: virtio: fix error handling in TX buffer wait")
--- drivers/rpmsg/virtio_rpmsg_bus.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +1 -23
@@ -141,13 +141,9 @@ static void virtio_rpmsg_destroy_ept(struct rpmsg_endpoint *ept);static int virtio_rpmsg_send (struct rpmsg_endpoint *ept,void *data,int len);static int virtio_rpmsg_sendto (struct rpmsg_endpoint *ept,void *data,int len,u32 dst); -static int virtio_rpmsg_send_offchannel (struct rpmsg_endpoint *ept,u32 src, -u32 dst,void *data,int len);static int virtio_rpmsg_trysend (struct rpmsg_endpoint *ept,void *data,int len);static int virtio_rpmsg_trysendto (struct rpmsg_endpoint *ept,void *data,int len,u32 dst); -static int virtio_rpmsg_trysend_offchannel (struct rpmsg_endpoint *ept,u32 src, -u32 dst,void *data,int len);static ssize_t virtio_rpmsg_get_mtu (struct rpmsg_endpoint *ept);static struct rpmsg_device *__rpmsg_create_channel (struct virtproc_info *vrp,struct rpmsg_channel_info *chinfo);
@@ -156,10 +152,8 @@ static const struct rpmsg_endpoint_ops virtio_endpoint_ops = { .destroy_ept = virtio_rpmsg_destroy_ept, .send = virtio_rpmsg_send, .sendto = virtio_rpmsg_sendto, - .send_offchannel = virtio_rpmsg_send_offchannel, .trysend = virtio_rpmsg_trysend, .trysendto = virtio_rpmsg_trysendto, - .trysend_offchannel = virtio_rpmsg_trysend_offchannel, .get_mtu = virtio_rpmsg_get_mtu, };
@@ -544,7 +538,7 @@ static void rpmsg_downref_sleepers(struct virtproc_info *vrp)* the function will immediately fail, and -ENOMEM will be returned. * * Normally drivers shouldn't use this function directly; instead, drivers -* should use the appropriate rpmsg_{try}send{to, _offchannel} API +* should use the appropriate rpmsg_{try}send{to} API * (see include/linux/rpmsg.h). * * Return: 0 on success and an appropriate error value on failure.
@@ -664,14 +658,6 @@ static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len,return rpmsg_send_offchannel_raw (rpdev, src, dst, data, len, true); } -static int virtio_rpmsg_send_offchannel (struct rpmsg_endpoint *ept,u32 src, -u32 dst,void *data,int len) -{ -struct rpmsg_device *rpdev = ept->rpdev; - -return rpmsg_send_offchannel_raw (rpdev, src, dst, data, len, true); -} -static int virtio_rpmsg_trysend (struct rpmsg_endpoint *ept,void *data,int len) {struct rpmsg_device *rpdev = ept->rpdev;
@@ -689,14 +675,6 @@ static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data,return rpmsg_send_offchannel_raw (rpdev, src, dst, data, len, false); } -static int virtio_rpmsg_trysend_offchannel (struct rpmsg_endpoint *ept,u32 src, -u32 dst,void *data,int len) -{ -struct rpmsg_device *rpdev = ept->rpdev; - -return rpmsg_send_offchannel_raw (rpdev, src, dst, data, len, false); -} -static ssize_t virtio_rpmsg_get_mtu (struct rpmsg_endpoint *ept) {struct rpmsg_device *rpdev = ept->rpdev;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2870/3318 rpmsg: virtio: EPOLLOUT support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Oppenlander <[email protected]>
[ Upstream commit c38d8b66c82c585199e2ad67282295f21cfa489f ]
Previously, polling an rpmsg endpoint (e.g. /dev/ttyRPMSGx) would generate EPOLLIN events but no EPOLLOUT events.
Unfortunately, poll support means that we can no longer disable tx-complete interrupts as there is no way to know whether a poller is waiting in sendq, so we always need notifications.
Stable-dep-of: 7dd4cffdf4c2 ("rpmsg: virtio: fix error handling in TX buffer wait")
--- drivers/rpmsg/virtio_rpmsg_bus.c | 101 ++++++++++--------------------- 1 file changed, 32 insertions(+), 69 deletions(-)
drivers/rpmsg/virtio_rpmsg_bus.c +32 -69
@@ -41,13 +41,12 @@* @buf_size: size of one rx or tx buffer * @last_sbuf: index of last tx buffer used * @bufs_dma: dma base addr of the buffers -* @tx_lock: protects svq, sbufs and sleepers, to allow concurrent senders. +* @tx_lock: protects svq and sbufs, to allow concurrent senders. * sending a message might require waking up a dozing remote * processor, which involves sleeping, hence the mutex. * @endpoints: idr of local endpoints, allows fast retrieval * @endpoints_lock: lock of the endpoints set * @sendq: wait queue of sending contexts waiting for a tx buffers -* @sleepers: number of senders that are waiting for a tx buffer * * This structure stores the rpmsg state of a given virtio remote processor * device (there might be several virtio proc devices for each physical
@@ -65,7 +64,6 @@ struct virtproc_info {struct idr endpoints;struct mutex endpoints_lock;wait_queue_head_t sendq; -atomic_t sleepers; };/* The feature bitmap for virtio rpmsg */
@@ -144,6 +142,8 @@ static int virtio_rpmsg_sendto(struct rpmsg_endpoint *ept, void *data, int len,static int virtio_rpmsg_trysend (struct rpmsg_endpoint *ept,void *data,int len);static int virtio_rpmsg_trysendto (struct rpmsg_endpoint *ept,void *data,int len,u32 dst); +static __poll_t virtio_rpmsg_poll (struct rpmsg_endpoint *ept,struct file *filp, +poll_table *wait);static ssize_t virtio_rpmsg_get_mtu (struct rpmsg_endpoint *ept);static struct rpmsg_device *__rpmsg_create_channel (struct virtproc_info *vrp,struct rpmsg_channel_info *chinfo);
@@ -154,6 +154,7 @@ static const struct rpmsg_endpoint_ops virtio_endpoint_ops = { .sendto = virtio_rpmsg_sendto, .trysend = virtio_rpmsg_trysend, .trysendto = virtio_rpmsg_trysendto, + .poll = virtio_rpmsg_poll, .get_mtu = virtio_rpmsg_get_mtu, };
@@ -435,7 +436,6 @@ static void *get_a_tx_buf(struct virtproc_info *vrp)unsigned int len;void *ret; -/* support multiple concurrent senders */ mutex_lock (&vrp->tx_lock);/*
@@ -453,62 +453,6 @@ static void *get_a_tx_buf(struct virtproc_info *vrp)return ret; } -/** -* rpmsg_upref_sleepers() - enable "tx-complete" interrupts, if needed -* @vrp: virtual remote processor state -* -* This function is called before a sender is blocked, waiting for -* a tx buffer to become available. -* -* If we already have blocking senders, this function merely increases -* the "sleepers" reference count, and exits. -* -* Otherwise, if this is the first sender to block, we also enable -* virtio's tx callbacks, so we'd be immediately notified when a tx -* buffer is consumed (we rely on virtio's tx callback in order -* to wake up sleeping senders as soon as a tx buffer is used by the -* remote processor). -*/ -static void rpmsg_upref_sleepers (struct virtproc_info *vrp) -{ -/* support multiple concurrent senders */ -mutex_lock (&vrp->tx_lock); - -/* are we the first sleeping context waiting for tx buffers ? */ -if (atomic_inc_return (&vrp->sleepers) ==1 ) -/* enable "tx-complete" interrupts before dozing off */ -virtqueue_enable_cb (vrp->svq); - -mutex_unlock (&vrp->tx_lock); -} - -/** -* rpmsg_downref_sleepers() - disable "tx-complete" interrupts, if needed -* @vrp: virtual remote processor state -* -* This function is called after a sender, that waited for a tx buffer -* to become available, is unblocked. -* -* If we still have blocking senders, this function merely decreases -* the "sleepers" reference count, and exits. -* -* Otherwise, if there are no more blocking senders, we also disable -* virtio's tx callbacks, to avoid the overhead incurred with handling -* those (now redundant) interrupts. -*/ -static void rpmsg_downref_sleepers (struct virtproc_info *vrp) -{ -/* support multiple concurrent senders */ -mutex_lock (&vrp->tx_lock); - -/* are we the last sleeping context waiting for tx buffers ? */ -if (atomic_dec_and_test (&vrp->sleepers)) -/* disable "tx-complete" interrupts */ -virtqueue_disable_cb (vrp->svq); - -mutex_unlock (&vrp->tx_lock); -} -/** * rpmsg_send_offchannel_raw() - send a message across to the remote processor * @rpdev: the rpmsg channel
@@ -581,9 +525,6 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev,/* no free buffer ? wait for one (but bail after 15 seconds) */ while (!msg) { -/* enable "tx-complete" interrupts, if not already enabled */ -rpmsg_upref_sleepers (vrp); -/* * sleep until a free buffer is available or 15 secs elapse. * the timeout period is not configurable because there's
@@ -594,9 +535,6 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev, (msg =get_a_tx_buf (vrp)), msecs_to_jiffies(15000)); -/* disable "tx-complete" interrupts if we're the last sleeper */ -rpmsg_downref_sleepers (vrp); -/* timeout ? */ if (!err) {dev_err (dev,"timeout waiting for a tx buffer\n" );
@@ -675,6 +613,34 @@ static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data,return rpmsg_send_offchannel_raw (rpdev, src, dst, data, len, false); } +static __poll_t virtio_rpmsg_poll (struct rpmsg_endpoint *ept,struct file *filp, +poll_table *wait) +{ +struct rpmsg_device *rpdev = ept->rpdev; +struct virtio_rpmsg_channel *vch =to_virtio_rpmsg_channel (rpdev); +struct virtproc_info *vrp = vch->vrp; +__poll_t mask =0 ; + +poll_wait (filp, &vrp->sendq, wait); + +/* support multiple concurrent senders */ +mutex_lock (&vrp->tx_lock); + +/* +* check for a free buffer, either: +* - we haven't used all of the available transmit buffers (half of the +* allocated buffers are used for transmit, hence num_bufs / 2), or, +* - we ask the virtqueue if there's a buffer available +*/ +if (vrp->last_sbuf < vrp->num_bufs /2 || + !virtqueue_enable_cb (vrp->svq)) + mask |=EPOLLOUT ; + +mutex_unlock (&vrp->tx_lock); + +return mask; +} +static ssize_t virtio_rpmsg_get_mtu (struct rpmsg_endpoint *ept) {struct rpmsg_device *rpdev = ept->rpdev;
@@ -919,9 +885,6 @@ static int rpmsg_probe(struct virtio_device *vdev)WARN_ON (err);/* sanity check; this can't really happen */ } -/* suppress "tx-complete" interrupts */ -virtqueue_disable_cb (vrp->svq); - vdev->priv = vrp; rpdev_ctrl =rpmsg_virtio_add_ctrl_dev (vdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2871/3318 rpmsg: virtio: fix error handling in TX buffer wait
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Atul Akella <[email protected]>
[ Upstream commit 7dd4cffdf4c2a496ccf783303a03d687a2127baf ]
The TX buffer wait loop in rpmsg_send_offchannel_raw() ignores the possibility of wait_event_interruptible_timeout() returning a negative value, which happens when the wait is interrupted by a signal. In that case the loop spins back around and re-arms the wait instead of propagating the signal, which can stall a task that is trying to be killed.
Separately, on a genuine timeout (return value 0) the function returns -ERESTARTSYS, which is reserved for signal-interrupted syscalls that the kernel may restart. A timeout is not a signal and should not be treated as restartable; return -ETIMEDOUT instead.
Handle both cases explicitly: return err directly when negative, and return -ETIMEDOUT on timeout.
--- drivers/rpmsg/virtio_rpmsg_bus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rpmsg/virtio_rpmsg_bus.c +4 -1
@@ -535,10 +535,13 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev, (msg =get_a_tx_buf (vrp)), msecs_to_jiffies(15000)); +if (err <0 ) +return err; +/* timeout ? */ if (!err) {dev_err (dev,"timeout waiting for a tx buffer\n" ); -return -ERESTARTSYS ; +return -ETIMEDOUT ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2872/3318 ARM: 9486/1: set !LPAE MAX_PHYSMEM_BITS to 32 and remove supersection mappings
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 787a3446cafee59e31deaec662d74f86bff38999 ]
An ARM randconfig with CONFIG_GET_FREE_REGION=y and CONFIG_WERROR=y fails to build:
include/linux/minmax.h:86:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '68719476735' to '4294967295' [-Werror=overflow]
Commit 14b80582c43e ("resource: Introduce alloc_free_mem_region()") made kernel/resource.c clamp against
(1ULL << MAX_PHYSMEM_BITS) - 1. resource_size_t is 32-bit without LPAE, but ARM's default MAX_PHYSMEM_BITS is 36.
That default was added by commit db57f88e4ccb ("ARM: 8411/1: Add default SPARSEMEM settings") because several platforms needed at least 36 physical address bits. !LPAE could map addresses above 32 bits only through supersections.
CONFIG_IO_36, added by commit 23bdf86aa06e ("[ARM] 3377/2: add support for intel xsc3 core"), enabled these for XSC3 I/O. IXP23xx placed static I/O mappings above 4GiB until its removal in 2012, and IOP13xx ioremap()ed its PCIe windows there until its removal in 2019. The only remaining XSC3 platform, PXA3xx, has nothing above 4GiB.
Supersection address bits overlap the descriptor domain field, so IO_36 also renumbered the domains to make DOMAIN_IO zero. Remove IO_36, the alternate domain numbering, and ioremap()'s supersection path. Reject !LPAE ioremap ranges extending past 4GiB before phys_addr_t truncation, drop the now-unneeded high static-mapping exclusion, and reduce ioremap alignment from 16MiB to the 2MiB covered by a PMD's pair of sections.
The other supersection user, create_36bit_mapping(), was added by commit 0b7cd62ecdc1 ("[ARM] 3017/1: Add support for 36-bit addresses to create_mapping()") for IXP2350 and carried IXP23xx's high static mappings. Before this change, its only remaining call path was efi_create_mapping() -> create_mapping_late(), for an EFI runtime region above 4GiB.
No real-world user of this !LPAE path is known. AArch32 UEFI requires RAM described by its memory map to be identity-mapped during boot services, which a 32-bit virtual address space cannot provide above 4GiB. Systems needing wider physical addressing are expected to use LPAE.
Remove create_36bit_mapping() and the supersection definitions. If firmware nevertheless advertises such a region on !LPAE, efi_create_mapping() rejects it before __pfn_to_phys() truncates its address to a low alias. EFI runtime services remain disabled, but the kernel continues to boot. LPAE kernels are unaffected.
With no remaining !LPAE mappings above 4GiB, set MAX_PHYSMEM_BITS to 32 for !LPAE and retain 36 for LPAE, where phys_addr_t is 64-bit.
--- arch/arm/include/asm/domain.h | 17 ----- arch/arm/include/asm/memory.h | 4 +- arch/arm/include/asm/pgtable-2level-hwdef.h | 1 - arch/arm/include/asm/pgtable-2level.h | 7 -- arch/arm/include/asm/sparsemem.h | 4 ++ arch/arm/kernel/efi.c | 13 ++++ arch/arm/mm/Kconfig | 7 -- arch/arm/mm/ioremap.c | 53 ++------------ arch/arm/mm/mmu.c | 76 +-------------------- 9 files changed, 27 insertions(+), 155 deletions(-)
arch/arm/include/asm/domain.h +0 -17
@@ -18,27 +18,10 @@* DOMAIN_IO - domain 2 includes all IO only * DOMAIN_USER - domain 1 includes all user memory only * DOMAIN_KERNEL - domain 0 includes all kernel memory only -* -* The domain numbering depends on whether we support 36 physical -* address for I/O or not. Addresses above the 32 bit boundary can -* only be mapped using supersections and supersections can only -* be set for domain 0. We could just default to DOMAIN_IO as zero, -* but there may be systems with supersection support and no 36-bit -* addressing. In such cases, we want to map system memory with -* supersections to reduce TLB misses and footprint. -* -* 36-bit addressing and supersections are only available on -* CPUs based on ARMv6+ or the Intel XSC3 core. */ -#ifndef CONFIG_IO_36 #define DOMAIN_KERNEL 0#define DOMAIN_USER 1#define DOMAIN_IO 2 -#else -#define DOMAIN_KERNEL 2 -#define DOMAIN_USER 1 -#define DOMAIN_IO 0 -#endif #define DOMAIN_VECTORS 3/*
arch/arm/include/asm/memory.h +2 -2
@@ -89,9 +89,9 @@#if !defined(CONFIG_SMP ) && !defined(CONFIG_ARM_LPAE )/* -* Allow 16MB-aligned ioremap pages +* Allow 2MB-aligned ioremap pages */ -#define IOREMAP_MAX_ORDER 24 +#define IOREMAP_MAX_ORDER 21#endif #define VECTORS_BASE UL(0xffff0000)
arch/arm/include/asm/pgtable-2level-hwdef.h +0 -1
@@ -35,7 +35,6 @@#define PMD_SECT_APX (_AT(pmdval_t, 1) << 15)/* v6 */ #define PMD_SECT_S (_AT(pmdval_t, 1) << 16)/* v6 */ #define PMD_SECT_nG (_AT(pmdval_t, 1) << 17)/* v6 */ -#define PMD_SECT_SUPER (_AT(pmdval_t, 1) << 18)/* v6 */ #define PMD_SECT_AF (_AT(pmdval_t, 0))#define PMD_SECT_UNCACHED (_AT(pmdval_t, 0))
arch/arm/include/asm/pgtable-2level.h +0 -7
@@ -96,13 +96,6 @@#define SECTION_SIZE (1UL << SECTION_SHIFT)#define SECTION_MASK (~(SECTION_SIZE-1)) -/* -* ARMv6 supersection address mask and size definitions. -*/ -#define SUPERSECTION_SHIFT 24 -#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT) -#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1)) -#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)/*
arch/arm/include/asm/sparsemem.h +4 -0
@@ -19,7 +19,11 @@* These can be overridden in your mach/memory.h. */ #if !defined(MAX_PHYSMEM_BITS ) || !defined(SECTION_SIZE_BITS ) +#ifdef CONFIG_ARM_LPAE #define MAX_PHYSMEM_BITS 36 +#else +#define MAX_PHYSMEM_BITS 32 +#endif #define SECTION_SIZE_BITS 28#endif
arch/arm/kernel/efi.c +13 -0
@@ -6,6 +6,7 @@#include <linux/efi.h> #include <linux/memblock.h> #include <linux/screen_info.h> +#include <linux/sizes.h> #include <asm/efi.h> #include <asm/mach/map.h>
@@ -54,6 +55,18 @@ int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) .length = md->num_pages * EFI_PAGE_SIZE, }; +/* +* Non-LPAE page tables cannot map EFI runtime regions extending +* beyond the 32-bit physical address space. +*/ +if (!IS_ENABLED (CONFIG_ARM_LPAE ) && + (md->phys_addr >=SZ_4G || + md->num_pages > (SZ_4G - md->phys_addr) /EFI_PAGE_SIZE )) { +pr_warn ("EFI runtime region at 0x%llx exceeds 32-bit physical address space\n" , + md->phys_addr); +return -ERANGE ; + } +/* * Order is important here: memory regions may have all of the * bits below set (and usually do), so we check them in order of
arch/arm/mm/Kconfig +0 -7
@@ -328,7 +328,6 @@ config CPU_XSC3 select CPU_PABRT_LEGACY select CPU_THUMB_CAPABLE select CPU_TLB_V4WBI if MMU - select IO_36 # Marvell PJ1 (Mohawk) config CPU_MOHAWK
@@ -652,12 +651,6 @@ config CPU_V7M_NUM_IRQ If unsure, keep default value. -# -# CPU supports 36-bit I/O -# -config IO_36 - bool - comment "Processor Features" config ARM_LPAE
arch/arm/mm/ioremap.c +7 -46
89 lines not on this page · raw message
arch/arm/mm/mmu.c +1 -75
94 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2873/3318 ARM: 9492/1: alignment: fix LSR #32 and ASR #32 offset decoding
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karl Mehltretter <[email protected]>
[ Upstream commit 9f878a6c2207f0c12f34a715a6a05cfc95f47460 ]
The register-offset form of LDR/STR may apply a shift to Rm. Per DecodeImmShift() (ARM ARM DDI0406C section A8.4.3, "Pseudocode details of instruction-specified shifts and rotates"), an imm5 of 0 encodes a shift of 32 for LSR and ASR; only LSL treats 0 as "no shift", and ROR with 0 encodes RRX.
do_alignment() special-cases RRX but not LSR or ASR, and IS_SHIFT() does not filter these encodings out, so the block is entered with shiftval == 0 and the offset becomes Rm instead of 0 (LSR #32) or the replicated sign of Rm (ASR #32).
do_alignment_finish_ldst() applies the offset to the base-register writeback of the post-indexed form, so the emulated access itself uses the correct faulting address but Rn is left holding the wrong value.
Reproduced on ARM926EJ-S (versatile_defconfig, CONFIG_ALIGNMENT_TRAP=y, gcc 13.3.0) with a misaligned base and Rm = 0x1000:
ldr r0, [r1], r2, lsr #32 Rn advanced by 0x1000, must be unchanged ldr r0, [r1], r2, asr #32 Rn advanced by 0x1000, must be unchanged ldr r0, [r1], r2, asr #32 with Rm negative, Rn must decrease by 1
All three are correct with the patch applied, while a lsr #1 control case is emulated correctly both before and after.
--- arch/arm/mm/alignment.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/arm/mm/alignment.c +8 -2
@@ -915,11 +915,17 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)break ;case SHIFT_LSR : - offset.un >>= shiftval; +if (shiftval ==0 ) + offset.un =0 ; +else + offset.un >>= shiftval;break ;case SHIFT_ASR : - offset.sn >>= shiftval; +if (shiftval ==0 ) + offset.sn >>=31 ; +else + offset.sn >>= shiftval;break ;case SHIFT_RORRRX :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2874/3318 ARM: 9519/1: dma-mapping: Fix wrong free function in __iommu_alloc_simple() error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
[ Upstream commit 74f79365839720bdb0c6bb4fe85c5b2a929ff5d1 ]
In __iommu_alloc_simple(), when IOMMU mapping creation fails, the error path unconditionally called __free_from_pool() regardless of the allocation path taken.
For the COHERENT case, memory is allocated via __alloc_simple_buffer(), which does not use the atomic pool. Calling __free_from_pool() on such memory silently returns without freeing, causing a page memory leak.
Fix this by matching the free function to the allocation path:
- COHERENT: use __dma_free_buffer(virt_to_page(addr), size)
- non-COHERENT: use __free_from_pool(addr, size)
--- arch/arm/mm/dma-mapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mm/dma-mapping.c +4 -1
@@ -1061,7 +1061,10 @@ static void *__iommu_alloc_simple(struct device *dev, size_t size, gfp_t gfp,return addr; err_mapping: -__free_from_pool (addr, size); +if (coherent_flag ==COHERENT ) +__dma_free_buffer (virt_to_page (addr), size); +else +__free_from_pool (addr, size);return NULL ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2875/3318 PCI: Fix out-of-bounds MMIO read in nvme_disable_and_flr()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamad Raizudeen <[email protected]>
[ Upstream commit 6aaa3f42e3410ea8e26c857477260159f724cb1d ]
In nvme_disable_and_flr(), the PCI bar is mapped using NVME_REG_CC + sizeof(cfg) which is (0x14 + 4 = 0x18 bytes)
However, the function later reads the controller status from NVME_REG_CSTS - offset 0x1C, which is outside the mapped 0x18 byte boundary. This violates the API contract.
Fix this by increasing the mapping size to include NVME_REG_CSTS. Also change sizeof(cfg) to sizeof(u32) to make the intent clearer.
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
@@ -4089,7 +4089,7 @@ static int nvme_disable_and_flr(struct pci_dev *dev, bool probe)if (probe)return 0 ; - bar =pci_iomap (dev,0 ,NVME_REG_CC +sizeof (cfg)); + bar =pci_iomap (dev,0 ,NVME_REG_CSTS +sizeof (u32));if (!bar)return -ENOTTY ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2876/3318 Bluetooth: L2CAP: take chan->lock for l2cap_chan_add/ready/del
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 385c0829e09e7a6380ae67998ac6ef6f4dfd5303 ]
chan->lock must be held for __l2cap_chan_add as eg. calls to l2cap_chan_close assume chan->conn writes are guarded by it.
It must be held for l2cap_chan_del() due to l2cap_sock.c:l2cap_chan_conn, l2cap_monitor_timeout, etc.
Similarly it should be held for l2cap_ops::ready (assumed in 6lowpan.c). Also teardown usually has chan->lock held, it should always have it held to have the same locking context.
The lock is not correctly held by l2cap_core in several places.
Add the missing locks for l2cap_chan_del/add/ready(), except in l2cap_ecred_rsp_defer() which needs separate fix as it needs lock nesting.
--- include/net/bluetooth/l2cap.h | 3 ++- net/bluetooth/l2cap_core.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
include/net/bluetooth/l2cap.h +2 -1
@@ -967,7 +967,8 @@ int l2cap_chan_check_security(struct l2cap_chan *chan, bool initiator);void l2cap_chan_set_defaults (struct l2cap_chan *chan,struct l2cap_chan *pchan);int l2cap_ertm_init (struct l2cap_chan *chan);void l2cap_chan_add (struct l2cap_conn *conn,struct l2cap_chan *chan); -void __l2cap_chan_add (struct l2cap_conn *conn,struct l2cap_chan *chan); +void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan) + __must_hold(&chan->lock);typedef void (*l2cap_chan_func_t )(struct l2cap_chan *chan,void *data);void l2cap_chan_list (struct l2cap_conn *conn,l2cap_chan_func_t func,void *data);
net/bluetooth/l2cap_core.c +15 -0
@@ -706,7 +706,9 @@ void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)void l2cap_chan_add (struct l2cap_conn *conn,struct l2cap_chan *chan) {mutex_lock (&conn->lock); +l2cap_chan_lock (chan);__l2cap_chan_add (conn, chan); +l2cap_chan_unlock (chan);mutex_unlock (&conn->lock); }
@@ -4086,6 +4088,8 @@ static struct l2cap_chan *l2cap_new_connection(struct l2cap_conn *conn,if (!chan)return NULL ; +l2cap_chan_lock (chan); +l2cap_chan_set_defaults (chan, pchan); chan->ops = pchan->ops;
@@ -4094,10 +4098,13 @@ static struct l2cap_chan *l2cap_new_connection(struct l2cap_conn *conn,if (pchan->ops->new_connection && pchan->ops->new_connection (pchan, chan) <0 ) {l2cap_chan_del (chan,0 ); +l2cap_chan_unlock (chan);l2cap_chan_put (chan);return NULL ; } +l2cap_chan_unlock (chan); +return chan; }
@@ -5065,6 +5072,8 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, goto response_unlock; } +l2cap_chan_lock (chan); +bacpy (&chan->src, &conn->hcon->src);bacpy (&chan->dst, &conn->hcon->dst); chan->src_type =bdaddr_src_type (conn->hcon);
@@ -5098,6 +5107,8 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn, result =L2CAP_CR_LE_SUCCESS ; } +l2cap_chan_unlock (chan); + response_unlock:l2cap_chan_unlock (pchan);l2cap_chan_put (pchan);
@@ -5289,6 +5300,8 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn,continue ; } +l2cap_chan_lock (chan); +bacpy (&chan->src, &conn->hcon->src);bacpy (&chan->dst, &conn->hcon->dst); chan->src_type =bdaddr_src_type (conn->hcon);
@@ -5321,6 +5334,8 @@ static inline int l2cap_ecred_conn_req(struct l2cap_conn *conn, }else {l2cap_chan_ready (chan); } + +l2cap_chan_unlock (chan); } unlock:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2877/3318 Bluetooth: L2CAP: hold l2cap_conn::lock in l2cap_connect_cfm()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit 115e6a21c88a5f708b2b025f7567ab78a782a74f ]
l2cap_new_connection() -> __l2cap_chan_add() modifies l2cap_conn::chan_l, which is guarded by l2cap_conn::lock. The lock is not held in l2cap_connect_cfm().
Fix by holding conn->lock in l2cap_connect_cfm() to make the locking systematic.
--- net/bluetooth/l2cap_core.c | 4 ++++ 1 file changed, 4 insertions(+)
net/bluetooth/l2cap_core.c +4 -0
@@ -7595,6 +7595,8 @@ static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status)* we left off, because the list lock would prevent calling the * potentially sleeping l2cap_chan_lock() function. */ +mutex_lock (&conn->lock); + pchan =l2cap_global_fixed_chan (NULL , hcon);while (pchan) {struct l2cap_chan *chan, *next;
@@ -7619,6 +7621,8 @@ static void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) pchan = next; } +mutex_unlock (&conn->lock); +l2cap_conn_ready (conn); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2878/3318 Bluetooth: L2CAP: hold chan in l2cap_ecred_conn_rsp()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pauli Virtanen <[email protected]>
[ Upstream commit b508a2a2d846ccc4c8f691e4e3dfca6f97dfe85a ]
l2cap_chan_del() calls l2cap_chan_put() to drop the conn->chan_l reference. If this was the last reference, UAF follows.
l2cap_ecred_conn_rsp() iterates chan_l list and calls l2cap_chan_del() on some members, without holding chan reference.
Fix by holding refcount while using chan after l2cap_chan_del().
Since orig is looked up by dcid provided by remote, it's also possible orig == chan, so reference needs to be held also after orig use.
--- net/bluetooth/l2cap_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/l2cap_core.c +5 -0
@@ -5387,12 +5387,14 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn, chan->state == BT_CONNECTED)continue ; +l2cap_chan_hold (chan);l2cap_chan_lock (chan);/* Check that there is a dcid for each pending channel */ if (cmd_len <sizeof (dcid)) {l2cap_chan_del (chan,ECONNREFUSED );l2cap_chan_unlock (chan); +l2cap_chan_put (chan);continue ; }
@@ -5431,6 +5433,8 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn,__set_chan_timer (orig,0 );l2cap_chan_unlock (orig); } + +l2cap_chan_put (chan);continue ; }
@@ -5476,6 +5480,7 @@ static inline int l2cap_ecred_conn_rsp(struct l2cap_conn *conn, }l2cap_chan_unlock (chan); +l2cap_chan_put (chan); }return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2879/3318 Bluetooth: btusb: Make btusb_recv_{event,acl}() take struct hci_dev *
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
[ Upstream commit d6d15018c8e1527841e39a6a80c60997e594ca70 ]
Both helpers currently take struct btusb_data *, which is private to btusb.c, as parameter type as below:
int btusb_recv_event(struct btusb_data *data, struct sk_buff *skb) int btusb_recv_acl(struct btusb_data *data, struct sk_buff *skb)
To allow vendor USB-transport-specific source files to share them as well, change the type to struct hci_dev *.
Stable-dep-of: fa96916cfd05 ("Bluetooth: btusb: Preserve event and ACL packet ordering")
--- drivers/bluetooth/btusb.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/bluetooth/btusb.c +10 -6
@@ -1159,14 +1159,16 @@ static inline void btusb_free_frags(struct btusb_data *data)spin_unlock_irqrestore (&data->rxlock, flags); } -static int btusb_recv_event (struct btusb_data *data,struct sk_buff *skb) +static int btusb_recv_event (struct hci_dev *hdev,struct sk_buff *skb) { +struct btusb_data *data =hci_get_drvdata (hdev); +if (data->intr_interval) {/* Trigger dequeue immediatelly if an event is received */ schedule_delayed_work (&data->rx_work,0 ); } -return data->recv_event (data->hdev, skb); +return data->recv_event (hdev, skb); }static int btusb_recv_intr (struct btusb_data *data,void *buffer,int count)
@@ -1226,7 +1228,7 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count) }/* Complete frame */ -btusb_recv_event (data, skb); +btusb_recv_event (data->hdev, skb); skb =NULL ; } }
@@ -1237,13 +1239,15 @@ static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)return err; } -static int btusb_recv_acl (struct btusb_data *data,struct sk_buff *skb) +static int btusb_recv_acl (struct hci_dev *hdev,struct sk_buff *skb) { +struct btusb_data *data =hci_get_drvdata (hdev); +/* Only queue ACL packet if intr_interval is set as it means * force_poll_sync has been enabled. */ if (!data->intr_interval) -return data->recv_acl (data->hdev, skb); +return data->recv_acl (hdev, skb);skb_queue_tail (&data->acl_q, skb);schedule_delayed_work (&data->rx_work, data->intr_interval);
@@ -1298,7 +1302,7 @@ static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)if (!hci_skb_expect (skb)) {/* Complete frame */ -btusb_recv_acl (data, skb); +btusb_recv_acl (data->hdev, skb); skb =NULL ; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2880/3318 Bluetooth: btusb: Preserve event and ACL packet ordering
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kiran K <[email protected]>
[ Upstream commit fa96916cfd05ceb1c26af0b2ea73daf5481cad2d ]
When force_poll_sync is enabled, commit 800fe5ec302e ("Bluetooth:
btusb: Add support for queuing during polling interval") defers ACL delivery to the RX worker. The event path currently wakes that worker before delivering the event, so queued ACL data can reach HCI first.
Deliver the event before waking the worker. This preserves the intended event-first ordering and the event callback's return value.
--- drivers/bluetooth/btusb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/btusb.c +4 -1
@@ -1162,13 +1162,16 @@ static inline void btusb_free_frags(struct btusb_data *data)static int btusb_recv_event (struct hci_dev *hdev,struct sk_buff *skb) {struct btusb_data *data =hci_get_drvdata (hdev); +int err; + + err = data->recv_event (hdev, skb);if (data->intr_interval) {/* Trigger dequeue immediatelly if an event is received */ schedule_delayed_work (&data->rx_work,0 ); } -return data->recv_event (hdev, skb); +return err; }static int btusb_recv_intr (struct btusb_data *data,void *buffer,int count)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2881/3318 Bluetooth: MGMT: Fix pending state of instances added without HCI traffic
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 5548fb51aa3cc24545029a286882d261a8e77d8a ]
When Add Advertising completes without HCI communication, e.g. when the device is not powered or the instance is overridden by Global Advertising, the instance is left marked as pending, so a subsequent failure in add_adv_complete would remove it despite it having been successfully added.
Fix this by clearing the pending state before completing the command.
--- net/bluetooth/mgmt.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/bluetooth/mgmt.c +6 -0
@@ -8988,6 +8988,12 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,if (!hdev_is_powered (hdev) ||hci_dev_test_flag (hdev,HCI_ADVERTISING ) || !schedule_instance) { +/* Instance has been accepted so it shall no longer be +* considered pending, otherwise a later failure in +* add_adv_complete would remove it. +*/ + adv->pending = false; + rp.instance = cp->instance; err =mgmt_cmd_complete (sk, hdev->id,MGMT_OP_ADD_ADVERTISING ,MGMT_STATUS_SUCCESS , &rp,sizeof (rp));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2882/3318 Bluetooth: MGMT: Fix leaking instance on Add Extended Advertising Parameters
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit f7f0d0a9eb6e4616c0b3a2a95498b5204c5543c9 ]
If queueing the command fails the instance is never removed, despite it having already been added or modified by hci_add_adv_instance, so remove it as it is done by add_ext_adv_params_complete on failure, signaling it has been removed if it was previously added.
--- net/bluetooth/mgmt.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
net/bluetooth/mgmt.c +16 -3
@@ -9174,14 +9174,15 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev, data, data_len);if (!cmd) { err = -ENOMEM ; -hci_remove_adv_instance (hdev, cp->instance); - goto unlock; + goto remove; } err =hci_cmd_sync_queue (hdev, add_ext_adv_params_sync, cmd, add_ext_adv_params_complete); -if (err <0 ) +if (err <0 ) {mgmt_pending_free (cmd); + goto remove; + } }else { rp.instance = cp->instance; rp.tx_power =HCI_ADV_TX_POWER_NO_PREFERENCE ;
@@ -9192,6 +9193,18 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev, MGMT_STATUS_SUCCESS, &rp, sizeof(rp)); } + goto unlock; + +remove: +/* The instance may have been modified already so remove it, like it +* is done in add_ext_adv_params_complete, signaling it has been +* removed if it was previously added. +*/ +if (!adv->pending) +mgmt_advertising_removed (sk, hdev, cp->instance); + +hci_remove_adv_instance (hdev, cp->instance); + unlock:hci_dev_unlock (hdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 2883/3318 Bluetooth: 6LoWPAN: Use RCU-safe device list removal
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cen Zhang <[email protected]>
[ Upstream commit 8c27d7d06e21ba9455ddae4e14f364c57f095cba ]
RCU readers of bt_6lowpan_devices must be able to follow an adapter's forward link until their read-side critical section ends. The entries are published with list_add_rcu(), but device_event() removes an entry on NETDEV_UNREGISTER with list_del(), poisoning that link.
When an adapter is being unregistered and 6LoWPAN is enabled, a 6lowpan_control debugfs write with an existing LE L2CAP connection can enter lookup_peer() after unregister's first synchronize_net(). If the connection has no peer on that adapter, the reader must advance to the next list entry. Neither RTNL nor devices_lock excludes this RCU reader.
The last peer's chan_close_cb() schedules delete_netdev(), which reaches unregister_netdevice_many_notify() through unregister_dev() and lowpan_unregister_netdev(). The following ordering is possible:
Unregister worker Control writer
----------------- --------------
synchronize_net() returns
lowpan_control_write() lookup_peer(): rcu_read_lock() reach adapter; no matching peer
device_event(): devices_lock
list_del(&entry->list)
spin_unlock(&devices_lock)
follow poisoned next link read invalid adapter address
post-notifier synchronize_net()
waits for the reader
This invalid pointer access can fault in lookup_peer(). The first grace period drains existing readers but permits new ones to start, and the later grace period cannot prevent the intervening poisoned-link access.
Use list_del_rcu() under the existing devices_lock to preserve the forward link for readers that already reached the adapter. The existing post-notifier synchronize_net() waits for those readers before netdevice teardown frees the private storage containing lowpan_btle_dev.
KASAN report as below:
[...]
[ 45.867526] Oops: general protection fault, probably for non-canonical address 0xfbd59c0000000023: 0000 [#1] SMP KASAN NOPTI
[ 45.869489] KASAN: maybe wild-memory-access in range [0xdead000000000118-0xdead00000000011f]
[ 45.870981] CPU: 1 UID: 0 PID: 646 Comm: sh Not tainted 7.2.0-rc6-pmb-bt-functional-v1+ #4 PREEMPT(lazy)
[ 45.872609] Hardware name: QEMU Ubuntu 24.04 PC v2 (i440FX + PIIX, arch_caps fix, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 45.874380] RIP: 0010:lookup_peer+0x1ba/0x320
[ 45.875067] Code: 48 89 d9 ba 04 00 00 00 4c 89 fe bf a0 06 00 00 e8 2b e8 ad fb e9 56 ff ff ff e8 01 1e c3 fb 49 8d 7f 18 48 89 f8 48 c1 e8 03 <80> 3c 28 00 0f 85 4a 01 00 00 4d 8b 47 18 4c 89 f1 ba 04 00 00 00
[ 45.878206] RSP: 0018:ffff888114d67b90 EFLAGS: 00010212
[ 45.879106] RAX: 1bd5a00000000023 RBX: 0000000000000000 RCX: ffffffff85c1d19f
[ 45.880334] RDX: ffff88810dc35700 RSI: 0000000000000000 RDI: dead000000000118
[ 45.881455] RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000001
[ 45.882546] R10: ffffffff893d3057 R11: ffff88810dc35700 R12: ffff88810a690000
[ 45.883839] R13: ffff888115451038 R14: ffff88810a690000 R15: dead000000000100
[ 45.885186] FS: 00007fa889bac780(0000) GS:ffff8881fd852000(0000) knlGS:0000000000000000
[ 45.886539] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 45.887527] CR2: 00007ffe304f2f80 CR3: 0000000104f64005 CR4: 0000000000770ef0
[ 45.888687] PKRU: 55555554
[ 45.889183] Call Trace:
[ 45.889666] <TASK>
[ 45.890061] lowpan_control_write+0x445/0x9e0
[ 45.890854] ? __pfx_lowpan_control_write+0x10/0x10
[ 45.891738] ? srso_alias_return_thunk+0x5/0xfbef5
[ 45.892603] ? srso_alias_return_thunk+0x5/0xfbef5
[ 45.893383] ? __debugfs_file_get+0x1bd/0x7f0
[ 45.894057] ? srso_alias_return_thunk+0x5/0xfbef5
[ 45.894902] ? lock_acquire+0x17b/0x2f0
[ 45.895593] ? ksys_write+0x111/0x200
[ 45.896290] full_proxy_write+0x11f/0x180
[ 45.896991] vfs_write+0x25a/0x1010
[ 45.897642] ? __pfx_full_proxy_write+0x10/0x10
[ 45.898440] ? __pfx_vfs_write+0x10/0x10
[ 45.899178] ? lock_release+0x11f/0x280
[ 45.899855] ksys_write+0x111/0x200
[ 45.900435] ? __pfx_ksys_write+0x10/0x10
[ 45.901074] ? irqentry_exit+0xbe/0x820
[ 45.901722] ? srso_alias_return_thunk+0x5/0xfbef5
[ 45.902489] do_syscall_64+0x115/0x6a0
[ 45.903064] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 45.903813] RIP: 0033:0x7fa889c3e687
[ 45.904359] Code: 48 89 fa 4c 89 df e8 58 b3 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 45.906981] RSP: 002b:00007ffd7651b960 EFLAGS: 00000202 ORIG_RAX: 0000000000000001
[ 45.908070] RAX: ffffffffffffffda RBX: 00007fa889bac780 RCX: 00007fa889c3e687
[ 45.909102] RDX: 000000000000001c RSI: 00005570f25e8d10 RDI: 0000000000000001
[ 45.910133] RBP: 00005570f25e8d10 R08: 0000000000000000 R09: 0000000000000000
[ 45.911162] R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001
[ 45.912190] R13: 000000000000001c R14: 0000000000000000 R15: 00005570f25e8a78
[ 45.913208] </TASK>
[ 45.913530] Modules linked in:
[ 45.914022] ---[ end trace 0000000000000000 ]---
[ 45.914709] RIP: 0010:lookup_peer+0x1ba/0x320
[ 45.915436] Code: 48 89 d9 ba 04 00 00 00 4c 89 fe bf a0 06 00 00 e8 2b e8 ad fb e9 56 ff ff ff e8 01 1e c3 fb 49 8d 7f 18 48 89 f8 48 c1 e8 03 <80> 3c 28 00 0f 85 4a 01 00 00 4d 8b 47 18 4c 89 f1 ba 04 00 00 00
[ 45.919191] RSP: 0018:ffff888114d67b90 EFLAGS: 00010212
[ 45.920046] RAX: 1bd5a00000000023 RBX: 0000000000000000 RCX: ffffffff85c1d19f
[ 45.921129] RDX: ffff88810dc35700 RSI: 0000000000000000 RDI: dead000000000118
[ 45.922553] RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000001
[ 45.923653] R10: ffffffff893d3057 R11: ffff88810dc35700 R12: ffff88810a690000
[ 45.925119] R13: ffff888115451038 R14: ffff88810a690000 R15: dead000000000100
[ 45.926180] FS: 00007fa889bac780(0000) GS:ffff8881fd852000(0000) knlGS:0000000000000000
[ 45.927817] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 45.928726] CR2: 00007ffe304f2f80 CR3: 0000000104f64005 CR4: 0000000000770ef0
[ 45.930069] PKRU: 55555554
[ 45.930456] Kernel panic - not syncing: Fatal exception
[ 45.931542] Kernel Offset: disabled
[ 45.932040] Rebooting in 1 seconds..--- net/bluetooth/6lowpan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/6lowpan.c +1 -1
@@ -1261,7 +1261,7 @@ static int device_event(struct notifier_block *unused,if (entry->netdev == netdev) {BT_DBG ("Unregistered netdev %s %p" , netdev->name, netdev); -list_del (&entry->list); +list_del_rcu (&entry->list);break ; } }
Signature · 1 line
2.53.0