iio: accel: fxls8962af: Fix wakeup source leaks on device unbind
Subsystems (11)
Sasha Levin
maintainerPATCH 1/15 iio: accel: fxls8962af: Fix wakeup source leaks on device unbind
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 0cd34d98dfd4f2b596415b8f12faf7b946613458 ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/iio/accel/fxls8962af-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iio/accel/fxls8962af-core.c +5 -2
@@ -1229,8 +1229,11 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq)if (ret)return ret; -if (device_property_read_bool (dev,"wakeup-source" )) -device_init_wakeup (dev, true); +if (device_property_read_bool (dev,"wakeup-source" )) { + ret =devm_device_init_wakeup (dev); +if (ret) +return dev_err_probe (dev, ret,"Failed to init wakeup\n" ); + }return devm_iio_device_register (dev, indio_dev); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/15 iio: adc: qcom-spmi-iadc: Fix wakeup source leaks on device unbind
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ad3764b45c1524872b621d5667a56f6a574501bd ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/iio/adc/qcom-spmi-iadc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/adc/qcom-spmi-iadc.c +3 -1
@@ -543,7 +543,9 @@ static int iadc_probe(struct platform_device *pdev)else return ret; }else { -device_init_wakeup (iadc->dev,1 ); + ret =devm_device_init_wakeup (iadc->dev); +if (ret) +return dev_err_probe (iadc->dev, ret,"Failed to init wakeup\n" ); } ret =iadc_update_offset (iadc);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/15 iio: imu: st_lsm6dsx: Fix wakeup source leaks on device unbind
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 4551383e78d59b34eea3f4ed28ad22df99e25d59 ]
Device can be unbound, so driver must also release memory for the wakeup source.
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +5 -2
@@ -2719,8 +2719,11 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, }if (device_property_read_bool (dev,"wakeup-source" ) || - (pdata && pdata->wakeup_source)) -device_init_wakeup (dev, true); + (pdata && pdata->wakeup_source)) { + err =devm_device_init_wakeup (dev); +if (err) +return dev_err_probe (dev, err,"Failed to init wakeup\n" ); + }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/15 btrfs: compression: adjust cb->compressed_folios allocation type
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 6f9a8ab796c6528d22de3c504c81fce7dde63d8a ]
In preparation for making the kmalloc() family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.)
The assigned type is "struct folio **" but the returned type will be "struct page **". These are the same allocation size (pointer size), but the types don't match. Adjust the allocation type to match the assignment.
--- fs/btrfs/compression.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/compression.c +1 -1
@@ -606,7 +606,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio)free_extent_map (em); cb->nr_folios =DIV_ROUND_UP (compressed_len,PAGE_SIZE ); - cb->compressed_folios =kcalloc (cb->nr_folios,sizeof (struct page *),GFP_NOFS ); + cb->compressed_folios =kcalloc (cb->nr_folios,sizeof (struct folio *),GFP_NOFS );if (!cb->compressed_folios) { ret =BLK_STS_RESOURCE ; goto out_free_bio;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/15 btrfs: correct the order of prelim_ref arguments in btrfs__prelim_ref
In reply to Sasha LevinFrom: Goldwyn Rodrigues <[email protected]>
[ Upstream commit bc7e0975093567f51be8e1bdf4aa5900a3cf0b1e ]
btrfs_prelim_ref() calls the old and new reference variables in the incorrect order. This causes a NULL pointer dereference because oldref is passed as NULL to trace_btrfs_prelim_ref_insert().
Note, trace_btrfs_prelim_ref_insert() is being called with newref as oldref (and oldref as NULL) on purpose in order to print out the values of newref.
To reproduce:
echo 1 > /sys/kernel/debug/tracing/events/btrfs/btrfs_prelim_ref_insert/enable
Perform some writeback operations.
Backtrace: BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 115949067 P4D 115949067 PUD 11594a067 PMD 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 1 UID: 0 PID: 1188 Comm: fsstress Not tainted 6.15.0-rc2-tester+ #47 PREEMPT(voluntary) 7ca2cef72d5e9c600f0c7718adb6462de8149622 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-2-gc13ff2cd-prebuilt.qemu.org 04/01/2014 RIP: 0010:trace_event_raw_event_btrfs__prelim_ref+0x72/0x130 Code: e8 43 81 9f ff 48 85 c0 74 78 4d 85 e4 0f 84 8f 00 00 00 49 8b 94 24 c0 06 00 00 48 8b 0a 48 89 48 08 48 8b 52 08 48 89 50 10 <49> 8b 55 18 48 89 50 18 49 8b 55 20 48 89 50 20 41 0f b6 55 28 88 RSP: 0018:ffffce44820077a0 EFLAGS: 00010286 RAX: ffff8c6b403f9014 RBX: ffff8c6b55825730 RCX: 304994edf9cf506b RDX: d8b11eb7f0fdb699 RSI: ffff8c6b403f9010 RDI: ffff8c6b403f9010 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000010 R10: 00000000ffffffff R11: 0000000000000000 R12: ffff8c6b4e8fb000 R13: 0000000000000000 R14: ffffce44820077a8 R15: ffff8c6b4abd1540 FS: 00007f4dc6813740(0000) GS:ffff8c6c1d378000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000018 CR3: 000000010eb42000 CR4: 0000000000750ef0 PKRU: 55555554 Call Trace: <TASK> prelim_ref_insert+0x1c1/0x270 find_parent_nodes+0x12a6/0x1ee0 ? __entry_text_end+0x101f06/0x101f09 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 ? srso_alias_return_thunk+0x5/0xfbef5 btrfs_is_data_extent_shared+0x167/0x640 ? fiemap_process_hole+0xd0/0x2c0 extent_fiemap+0xa5c/0xbc0 ? __entry_text_end+0x101f05/0x101f09 btrfs_fiemap+0x7e/0xd0 do_vfs_ioctl+0x425/0x9d0 __x64_sys_ioctl+0x75/0xc0
--- include/trace/events/btrfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/btrfs.h +1 -1
@@ -1928,7 +1928,7 @@ DECLARE_EVENT_CLASS(btrfs__prelim_ref, TP_PROTO(const struct btrfs_fs_info *fs_info, const struct prelim_ref *oldref, const struct prelim_ref *newref, u64 tree_size), -TP_ARGS (fs_info, newref, oldref, tree_size), +TP_ARGS (fs_info, oldref, newref, tree_size),TP_STRUCT__entry_btrfs ( __field( u64, root_id )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/15 btrfs: handle empty eb->folios in num_extent_folios()
In reply to Sasha LevinFrom: Boris Burkov <[email protected]>
[ Upstream commit d6fe0c69b3aa5c985380b794bdf8e6e9b1811e60 ]
num_extent_folios() unconditionally calls folio_order() on eb->folios[0]. If that is NULL this will be a segfault. It is reasonable for it to return 0 as the number of folios in the eb when the first entry is NULL, so do that instead.
--- fs/btrfs/extent_io.h | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/extent_io.h +2 -0
@@ -297,6 +297,8 @@ static inline int num_extent_pages(const struct extent_buffer *eb)*/ static inline int num_extent_folios (const struct extent_buffer *eb) { +if (!eb->folios[0 ]) +return 0 ;if (folio_order (eb->folios[0 ]))return 1 ;return num_extent_pages (eb);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/15 btrfs: avoid NULL pointer dereference if no valid csum tree
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit f95d186255b319c48a365d47b69bd997fecb674e ]
[BUG]
When trying read-only scrub on a btrfs with rescue=idatacsums mount option, it will crash with the following call trace:
BUG: kernel NULL pointer dereference, address: 0000000000000208 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page CPU: 1 UID: 0 PID: 835 Comm: btrfs Tainted: G O 6.15.0-rc3-custom+ #236 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022 RIP: 0010:btrfs_lookup_csums_bitmap+0x49/0x480 [btrfs] Call Trace: <TASK> scrub_find_fill_first_stripe+0x35b/0x3d0 [btrfs] scrub_simple_mirror+0x175/0x290 [btrfs] scrub_stripe+0x5f7/0x6f0 [btrfs] scrub_chunk+0x9a/0x150 [btrfs] scrub_enumerate_chunks+0x333/0x660 [btrfs] btrfs_scrub_dev+0x23e/0x600 [btrfs] btrfs_ioctl+0x1dcf/0x2f80 [btrfs] __x64_sys_ioctl+0x97/0xc0 do_syscall_64+0x4f/0x120 entry_SYSCALL_64_after_hwframe+0x76/0x7e
[CAUSE]
Mount option "rescue=idatacsums" will completely skip loading the csum tree, so that any data read will not find any data csum thus we will ignore data checksum verification.
Normally call sites utilizing csum tree will check the fs state flag NO_DATA_CSUMS bit, but unfortunately scrub does not check that bit at all.
This results in scrub to call btrfs_search_slot() on a NULL pointer and triggered above crash.
[FIX]
Check both extent and csum tree root before doing any tree search.
--- fs/btrfs/scrub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/scrub.c +2 -2
@@ -1541,8 +1541,8 @@ static int scrub_find_fill_first_stripe(struct btrfs_block_group *bg,u64 extent_gen;int ret; -if (unlikely (!extent_root)) { -btrfs_err (fs_info,"no valid extent root for scrub" ); +if (unlikely (!extent_root || !csum_root)) { +btrfs_err (fs_info,"no valid extent or csum root for scrub" );return -EUCLEAN ; } memset(stripe->sectors, 0, sizeof(struct scrub_sector_verification) *
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/15 usb: xhci: Don't trust the EP Context cycle bit when moving HW dequeue
In reply to Sasha LevinFrom: Michal Pecio <[email protected]>
[ Upstream commit 6328bdc988d23201c700e1e7e04eb05a1149ac1e ]
VIA VL805 doesn't bother updating the EP Context cycle bit when the endpoint halts. This is seen by patching xhci_move_dequeue_past_td() to print the cycle bits of the EP Context and the TRB at hw_dequeue and then disconnecting a flash drive while reading it. Actual cycle state is random as expected, but the EP Context bit is always 1.
This means that the cycle state produced by this function is wrong half the time, and then the endpoint stops working.
Work around it by looking at the cycle bit of TD's end_trb instead of believing the Endpoint or Stream Context. Specifically:
- rename cycle_found to hw_dequeue_found to avoid confusion
- initialize new_cycle from td->end_trb instead of hw_dequeue
- switch new_cycle toggling to happen after end_trb is found
Now a workload which regularly stalls the device works normally for a few hours and clearly demonstrates the HW bug - the EP Context bit is not updated in a new cycle until Set TR Dequeue overwrites it:
[ +0,000298] sd 10:0:0:0: [sdc] Attached SCSI disk [ +0,011758] cycle bits: TRB 1 EP Ctx 1 [ +5,947138] cycle bits: TRB 1 EP Ctx 1 [ +0,065731] cycle bits: TRB 0 EP Ctx 1 [ +0,064022] cycle bits: TRB 0 EP Ctx 0 [ +0,063297] cycle bits: TRB 0 EP Ctx 0 [ +0,069823] cycle bits: TRB 0 EP Ctx 0 [ +0,063390] cycle bits: TRB 1 EP Ctx 0 [ +0,063064] cycle bits: TRB 1 EP Ctx 1 [ +0,062293] cycle bits: TRB 1 EP Ctx 1 [ +0,066087] cycle bits: TRB 0 EP Ctx 1 [ +0,063636] cycle bits: TRB 0 EP Ctx 0 [ +0,066360] cycle bits: TRB 0 EP Ctx 0
Also tested on the buggy ASM1042 which moves EP Context dequeue to the next TRB after errors, one problem case addressed by the rework that implemented this loop. In this case hw_dequeue can be enqueue, so simply picking the cycle bit of TRB at hw_dequeue wouldn't work.
Commit 5255660b208a ("xhci: add quirk for host controllers that don't update endpoint DCS") tried to solve the stale cycle problem, but it was more complex and got reverted due to a reported issue.
--- drivers/usb/host/xhci-ring.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/usb/host/xhci-ring.c +9 -10
@@ -643,7 +643,7 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci,int new_cycle;dma_addr_t addr;u64 hw_dequeue; -bool cycle_found = false; +bool hw_dequeue_found = false;bool td_last_trb_found = false;u32 trb_sct =0 ;int ret;
@@ -659,25 +659,24 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci, hw_dequeue =xhci_get_hw_deq (xhci, dev, ep_index, stream_id); new_seg = ep_ring->deq_seg; new_deq = ep_ring->dequeue; - new_cycle = hw_dequeue &0x1 ; + new_cycle =le32_to_cpu (td->end_trb->generic.field[3 ]) &TRB_CYCLE ;/* -* We want to find the pointer, segment and cycle state of the new trb -* (the one after current TD's end_trb). We know the cycle state at -* hw_dequeue, so walk the ring until both hw_dequeue and end_trb are -* found. +* Walk the ring until both the next TRB and hw_dequeue are found (don't +* move hw_dequeue back if it went forward due to a HW bug). Cycle state +* is loaded from a known good TRB, track later toggles to maintain it. */ do { - if (!cycle_found && xhci_trb_virt_to_dma(new_seg, new_deq) + if (!hw_dequeue_found && xhci_trb_virt_to_dma(new_seg, new_deq) == (dma_addr_t)(hw_dequeue & ~0xf)) { - cycle_found = true; + hw_dequeue_found = true; if (td_last_trb_found) break; } if (new_deq == td->end_trb) td_last_trb_found = true; - if (cycle_found && trb_is_link(new_deq) && + if (td_last_trb_found && trb_is_link(new_deq) && link_trb_toggles_cycle(new_deq)) new_cycle ^= 0x1;
@@ -689,7 +688,7 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci,return -EINVAL ; } - }while (!cycle_found || !td_last_trb_found); + }while (!hw_dequeue_found || !td_last_trb_found);/* Don't update the ring cycle state for the producer (us). */ addr =xhci_trb_virt_to_dma (new_seg, new_deq);
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.14 08/15] usb: xhci: Don't trust the EP Context cycle bit when moving HW dequeue
Quoted 47 lines · Sasha Levin
From: Michal Pecio <[email protected]>
[ Upstream commit
6328bdc988d23201c700e1e7e04eb05a1149ac1e]VIA VL805 doesn't bother updating the EP Context cycle bit when the endpoint halts. This is seen by patching
xhci_move_dequeue_past_td()to print the cycle bits of the EP Context and the TRB athw_dequeueand then disconnecting a flash drive while reading it. Actual cycle state is random as expected, but the EP Context bit is always 1.This means that the cycle state produced by this function is wrong half the time, and then the endpoint stops working.
Work around it by looking at the cycle bit of TD's
end_trbinstead of believing the Endpoint or Stream Context. Specifically:- rename
cycle_foundtohw_dequeue_foundto avoid confusion
- initializenew_cyclefromtd->end_trbinstead ofhw_dequeue
- switchnew_cycletoggling to happen afterend_trbis foundNow a workload which regularly stalls the device works normally for a few hours and clearly demonstrates the HW bug - the EP Context bit is not updated in a new cycle until Set TR Dequeue overwrites it:
[ +0,000298] sd 10:0:0:0: [sdc] Attached SCSI disk [ +0,011758] cycle bits: TRB 1 EP Ctx 1 [ +5,947138] cycle bits: TRB 1 EP Ctx 1 [ +0,065731] cycle bits: TRB 0 EP Ctx 1 [ +0,064022] cycle bits: TRB 0 EP Ctx 0 [ +0,063297] cycle bits: TRB 0 EP Ctx 0 [ +0,069823] cycle bits: TRB 0 EP Ctx 0 [ +0,063390] cycle bits: TRB 1 EP Ctx 0 [ +0,063064] cycle bits: TRB 1 EP Ctx 1 [ +0,062293] cycle bits: TRB 1 EP Ctx 1 [ +0,066087] cycle bits: TRB 0 EP Ctx 1 [ +0,063636] cycle bits: TRB 0 EP Ctx 0 [ +0,066360] cycle bits: TRB 0 EP Ctx 0Also tested on the buggy ASM1042 which moves EP Context dequeue to the next TRB after errors, one problem case addressed by the rework that implemented this loop. In this case
hw_dequeuecan be enqueue, so simply picking the cycle bit of TRB athw_dequeuewouldn't work.Commit
5255660b208a("xhci: add quirk for host controllers that don't update endpoint DCS") tried to solve the stale cycle problem, but it was more complex and got reverted due to a reported issue.
Quoted 7 lines
Cc Jonathan Bell <[email protected]>Cc Oliver Neukum <[email protected]>Signed-off-by Michal Pecio <[email protected]>Signed-off-by Mathias Nyman <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Hi,
This wasn't tagged for stable because the function may potentially still be affected by some unforeseen HW bugs, and previous attempt at fixing the issue ran into trouble and nobody truly knows why.
The problem is very old and not critically severe, so I think this can wait till 6.15. People don't like minor release regressions.
Regards,
Michal
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 08/15] usb: xhci: Don't trust the EP Context cycle bit when moving HW dequeue
Quoted 56 lines · Michał Pecio
Quoted 47 lines · Sasha Levin
From: Michal Pecio <[email protected]>
[ Upstream commit
6328bdc988d23201c700e1e7e04eb05a1149ac1e]VIA VL805 doesn't bother updating the EP Context cycle bit when the endpoint halts. This is seen by patching
xhci_move_dequeue_past_td()to print the cycle bits of the EP Context and the TRB athw_dequeueand then disconnecting a flash drive while reading it. Actual cycle state is random as expected, but the EP Context bit is always 1.This means that the cycle state produced by this function is wrong half the time, and then the endpoint stops working.
Work around it by looking at the cycle bit of TD's
end_trbinstead of believing the Endpoint or Stream Context. Specifically:- rename
cycle_foundtohw_dequeue_foundto avoid confusion
- initializenew_cyclefromtd->end_trbinstead ofhw_dequeue
- switchnew_cycletoggling to happen afterend_trbis foundNow a workload which regularly stalls the device works normally for a few hours and clearly demonstrates the HW bug - the EP Context bit is not updated in a new cycle until Set TR Dequeue overwrites it:
[ +0,000298] sd 10:0:0:0: [sdc] Attached SCSI disk [ +0,011758] cycle bits: TRB 1 EP Ctx 1 [ +5,947138] cycle bits: TRB 1 EP Ctx 1 [ +0,065731] cycle bits: TRB 0 EP Ctx 1 [ +0,064022] cycle bits: TRB 0 EP Ctx 0 [ +0,063297] cycle bits: TRB 0 EP Ctx 0 [ +0,069823] cycle bits: TRB 0 EP Ctx 0 [ +0,063390] cycle bits: TRB 1 EP Ctx 0 [ +0,063064] cycle bits: TRB 1 EP Ctx 1 [ +0,062293] cycle bits: TRB 1 EP Ctx 1 [ +0,066087] cycle bits: TRB 0 EP Ctx 1 [ +0,063636] cycle bits: TRB 0 EP Ctx 0 [ +0,066360] cycle bits: TRB 0 EP Ctx 0Also tested on the buggy ASM1042 which moves EP Context dequeue to the next TRB after errors, one problem case addressed by the rework that implemented this loop. In this case
hw_dequeuecan be enqueue, so simply picking the cycle bit of TRB athw_dequeuewouldn't work.Commit
5255660b208a("xhci: add quirk for host controllers that don't update endpoint DCS") tried to solve the stale cycle problem, but it was more complex and got reverted due to a reported issue.Quoted 7 lines
Cc Jonathan Bell <[email protected]>Cc Oliver Neukum <[email protected]>Signed-off-by Michal Pecio <[email protected]>Signed-off-by Mathias Nyman <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 8 lines
Hi,
This wasn't tagged for stable because the function may potentially still be affected by some unforeseen HW bugs, and previous attempt at fixing the issue ran into trouble and nobody truly knows why.
The problem is very old and not critically severe, so I think this can wait till 6.15. People don't like minor release regressions.
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 9/15 tools: ynl-gen: validate 0 len strings from kernel
In reply to Sasha LevinFrom: David Wei <[email protected]>
[ Upstream commit 4720f9707c783f642332dee3d56dccaefa850e42 ]
Strings from the kernel are guaranteed to be null terminated and ynl_attr_validate() checks for this. But it doesn't check if the string has a len of 0, which would cause problems when trying to access data[len - 1]. Fix this by checking that len is positive.
--- tools/net/ynl/lib/ynl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/net/ynl/lib/ynl.c +1 -1
@@ -364,7 +364,7 @@ int ynl_attr_validate(struct ynl_parse_arg *yarg, const struct nlattr *attr) "Invalid attribute (binary %s)", policy->name);return -1 ;case YNL_PT_NUL_STR : -if ((!policy->len || len <= policy->len) && !data[len -1 ]) +if (len && (!policy->len || len <= policy->len) && !data[len -1 ])break ;yerr (yarg->ys,YNL_ERROR_ATTR_INVALID ,"Invalid attribute (string %s)" , policy->name);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/15 block: only update request sector if needed
In reply to Sasha LevinFrom: Johannes Thumshirn <[email protected]>
[ Upstream commit db492e24f9b05547ba12b4783f09c9d943cf42fe ]
In case of a ZONE APPEND write, regardless of native ZONE APPEND or the emulation layer in the zone write plugging code, the sector the data got written to by the device needs to be updated in the bio.
At the moment, this is done for every native ZONE APPEND write and every request that is flagged with 'BIO_ZONE_WRITE_PLUGGING'. But thus superfluously updates the sector for regular writes to a zoned block device.
Check if a bio is a native ZONE APPEND write or if the bio is flagged as 'BIO_EMULATES_ZONE_APPEND', meaning the block layer's zone write plugging code handles the ZONE APPEND and translates it into a regular write and back. Only if one of these two criterion is met, update the sector in the bio upon completion.
--- block/blk.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk.h +2 -1
@@ -480,7 +480,8 @@ static inline void blk_zone_update_request_bio(struct request *rq,* the original BIO sector so that blk_zone_write_plug_bio_endio() can * lookup the zone write plug. */ -if (req_op (rq) ==REQ_OP_ZONE_APPEND ||bio_zone_write_plugging (bio)) +if (req_op (rq) ==REQ_OP_ZONE_APPEND || +bio_flagged (bio,BIO_EMULATES_ZONE_APPEND )) bio->bi_iter.bi_sector = rq->__sector; }void blk_zone_write_plug_bio_endio (struct bio *bio);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/15 wifi: iwlwifi: add support for Killer on MTL
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit ebedf8b7f05b9c886d68d63025db8d1b12343157 ]
For now, we need another entry for these devices, this will be changed completely for 6.16.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +2 -0
@@ -587,6 +587,8 @@ VISIBLE_IF_IWLWIFI_KUNIT const struct iwl_dev_info iwl_dev_info_table[] = {IWL_DEV_INFO (0x7A70 ,0x1692 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690i_name),IWL_DEV_INFO (0x7AF0 ,0x1691 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690s_name),IWL_DEV_INFO (0x7AF0 ,0x1692 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690i_name), +IWL_DEV_INFO (0x7F70 ,0x1691 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690s_name), +IWL_DEV_INFO (0x7F70 ,0x1692 , iwlax411_2ax_cfg_so_gf4_a0, iwl_ax411_killer_1690i_name),IWL_DEV_INFO (0x271C ,0x0214 , iwl9260_2ac_cfg, iwl9260_1_name), IWL_DEV_INFO(0x7E40, 0x1691, iwl_cfg_ma, iwl_ax411_killer_1690s_name),
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/15 x86/Kconfig: make CFI_AUTO_DEFAULT depend on !RUST or Rust >= 1.88
In reply to Sasha LevinFrom: Paweł Anikiel <[email protected]>
[ Upstream commit 5595c31c370957aabe739ac3996aedba8267603f ]
Calling core::fmt::write() from rust code while FineIBT is enabled results in a kernel panic:
[ 4614.199779] kernel BUG at arch/x86/kernel/cet.c:132! [ 4614.205343] Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 4614.211781] CPU: 2 UID: 0 PID: 6057 Comm: dmabuf_dump Tainted: G U O 6.12.17-android16-0-g6ab38c534a43 #1 9da040f27673ec3945e23b998a0f8bd64c846599 [ 4614.227832] Tainted: [U]=USER, [O]=OOT_MODULE [ 4614.241247] RIP: 0010:do_kernel_cp_fault+0xea/0xf0 ... [ 4614.398144] RIP: 0010:_RNvXs5_NtNtNtCs3o2tGsuHyou_4core3fmt3num3impyNtB9_7Display3fmt+0x0/0x20 [ 4614.407792] Code: 48 f7 df 48 0f 48 f9 48 89 f2 89 c6 5d e9 18 fd ff ff 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 41 81 ea 14 61 af 2c 74 03 0f 0b 90 <66> 0f 1f 00 55 48 89 e5 48 89 f2 48 8b 3f be 01 00 00 00 5d e9 e7 [ 4614.428775] RSP: 0018:ffffb95acfa4ba68 EFLAGS: 00010246 [ 4614.434609] RAX: 0000000000000000 RBX: 0000000000000010 RCX: 0000000000000000 [ 4614.442587] RDX: 0000000000000007 RSI: ffffb95acfa4ba70 RDI: ffffb95acfa4bc88 [ 4614.450557] RBP: ffffb95acfa4bae0 R08: ffff0a00ffffff05 R09: 0000000000000070 [ 4614.458527] R10: 0000000000000000 R11: ffffffffab67eaf0 R12: ffffb95acfa4bcc8 [ 4614.466493] R13: ffffffffac5d50f0 R14: 0000000000000000 R15: 0000000000000000 [ 4614.474473] ? __cfi__RNvXs5_NtNtNtCs3o2tGsuHyou_4core3fmt3num3impyNtB9_7Display3fmt+0x10/0x10 [ 4614.484118] ? _RNvNtCs3o2tGsuHyou_4core3fmt5write+0x1d2/0x250
This happens because core::fmt::write() calls core::fmt::rt::Argument::fmt(), which currently has CFI disabled:
library/core/src/fmt/rt.rs:
171 // FIXME: Transmuting formatter in new and indirectly branching to/calling
172 // it here is an explicit CFI violation.
173 #[allow(inline_no_sanitize)]
174 #[no_sanitize(cfi, kcfi)]
175 #[inline]
176 pub(super) unsafe fn fmt(&self, f: &mut Formatter<'_>) -> Result {This causes a Control Protection exception, because FineIBT has sealed off the original function's endbr64.
This makes rust currently incompatible with FineIBT. Add a Kconfig dependency that prevents FineIBT from getting turned on by default if rust is enabled.
[ Rust 1.88.0 (scheduled for 2025-06-26) should have this fixed [1],
and thus we relaxed the condition with Rust >= 1.88.
When objtool lands checking for this with e.g. [2], the plan is to ideally run that in upstream Rust's CI to prevent regressions early [3], since we do not control core's source code.
Alice tested the Rust PR backported to an older compiler.
Peter would like that Rust provides a stable core which can be pulled into the kernel: "Relying on that much out of tree code is 'unfortunate'".
- Miguel ]
--- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -2430,6 +2430,7 @@ config STRICT_SIGALTSTACK_SIZE config CFI_AUTO_DEFAULT bool "Attempt to use FineIBT by default at boot time" depends on FINEIBT + depends on !RUST || RUSTC_VERSION >= 108800 default y help Attempt to use FineIBT by default at boot time. If enabled,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/15 xenbus: Allow PVH dom0 a non-local xenstore
In reply to Sasha LevinFrom: Jason Andryuk <[email protected]>
[ Upstream commit 90989869baae47ee2aa3bcb6f6eb9fbbe4287958 ]
Make xenbus_init() allow a non-local xenstore for a PVH dom0 - it is currently forced to XS_LOCAL. With Hyperlaunch booting dom0 and a xenstore stubdom, dom0 can be handled as a regular XS_HVM following the late init path.
Ideally we'd drop the use of xen_initial_domain() and just check for the event channel instead. However, ARM has a xen,enhanced no-xenstore mode, where the event channel and PFN would both be 0. Retain the xen_initial_domain() check, and use that for an additional check when the event channel is 0.
Check the full 64bit HVM_PARAM_STORE_EVTCHN value to catch the off chance that high bits are set for the 32bit event channel.
Message-ID: <[email protected]>
--- drivers/xen/xenbus/xenbus_probe.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/xen/xenbus/xenbus_probe.c +8 -6
@@ -966,9 +966,15 @@ static int __init xenbus_init(void)if (xen_pv_domain ()) xen_store_domain_type =XS_PV ;if (xen_hvm_domain ()) + { xen_store_domain_type =XS_HVM ; -if (xen_hvm_domain () &&xen_initial_domain ()) - xen_store_domain_type =XS_LOCAL ; + err =hvm_get_parameter (HVM_PARAM_STORE_EVTCHN , &v); +if (err) + goto out_error; + xen_store_evtchn = (int )v; +if (!v &&xen_initial_domain ()) + xen_store_domain_type =XS_LOCAL ; + }if (xen_pv_domain () && !xen_start_info->store_evtchn) xen_store_domain_type =XS_LOCAL ;if (xen_pv_domain () && xen_start_info->store_evtchn)
@@ -987,10 +993,6 @@ static int __init xenbus_init(void) xen_store_interface =gfn_to_virt (xen_store_gfn);break ;case XS_HVM : - err =hvm_get_parameter (HVM_PARAM_STORE_EVTCHN , &v); -if (err) - goto out_error; - xen_store_evtchn = (int )v; err =hvm_get_parameter (HVM_PARAM_STORE_PFN , &v);if (err) goto out_error;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/15 drm/amd/display: Call FP Protect Before Mode Programming/Mode Support
In reply to Sasha LevinFrom: Austin Zheng <[email protected]>
[ Upstream commit eba692ca3abca258b3214a6e4126afefad1822f0 ]
[Why]
Memory allocation occurs within dml21_validate() for adding phantom planes. May cause kernel to be tainted due to usage of FP Start.
[How]
Move FP start from dml21_validate to before mode programming/mode support. Calculations requiring floating point are all done within mode programming or mode support.
--- drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c +4 -4
@@ -220,7 +220,9 @@ static bool dml21_mode_check_and_programming(const struct dc *in_dc, struct dc_sif (!result)return false; +DC_FP_START (); result =dml2_build_mode_programming (mode_programming); +DC_FP_END ();if (!result)return false;
@@ -263,7 +265,9 @@ static bool dml21_check_mode_support(const struct dc *in_dc, struct dc_state *co mode_support->dml2_instance = dml_init->dml2_instance;dml21_map_dc_state_into_dml_display_cfg (in_dc, context, dml_ctx); dml_ctx->v21.mode_programming.dml2_instance->scratch.build_mode_programming_locals.mode_programming_params.programming = dml_ctx->v21.mode_programming.programming; +DC_FP_START (); is_supported =dml2_check_mode_supported (mode_support); +DC_FP_END ();if (!is_supported)return false;
@@ -274,16 +278,12 @@ bool dml21_validate(const struct dc *in_dc, struct dc_state *context, struct dml {bool out = false; -DC_FP_START (); -/* Use dml_validate_only for fast_validate path */ if (fast_validate) out =dml21_check_mode_support (in_dc, context, dml_ctx);else out =dml21_mode_check_and_programming (in_dc, context, dml_ctx); -DC_FP_END (); -return out; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/15 __legitimize_mnt(): check for MNT_SYNC_UMOUNT should be under mount_lock
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 250cf3693060a5f803c5f1ddc082bb06b16112a9 ]
... or we risk stealing final mntput from sync umount - raising mnt_count after umount(2) has verified that victim is not busy, but before it has set MNT_SYNC_UMOUNT; in that case __legitimize_mnt() doesn't see that it's safe to quietly undo mnt_count increment and leaves dropping the reference to caller, where it'll be a full-blown mntput().
Check under mount_lock is needed; leaving the current one done before taking that makes no sense - it's nowhere near common enough to bother with.
--- fs/namespace.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
fs/namespace.c +1 -5
@@ -781,12 +781,8 @@ int __legitimize_mnt(struct vfsmount *bastard, unsigned seq)smp_mb ();// see mntput_no_expire() if (likely (!read_seqretry (&mount_lock, seq)))return 0 ; -if (bastard->mnt_flags &MNT_SYNC_UMOUNT ) { -mnt_add_count (mnt,-1 ); -return 1 ; - }lock_mount_hash (); -if (unlikely (bastard->mnt_flags &MNT_DOOMED )) { +if (unlikely (bastard->mnt_flags & (MNT_SYNC_UMOUNT |MNT_DOOMED ))) {mnt_add_count (mnt,-1 );unlock_mount_hash ();return 1 ;
Signature · 1 line
2.39.5