6.6.158-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 111/1193 irqchip/gic-v4: Dont advertise VLPIs if no ITS is probed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mostafa Saleh <[email protected]>
[ Upstream commit e61654fbc3bc5d07ec9fafe29f33e19b2b5d0fd5 ]
When accidentally setting “kvm-arm.vgic_v4_enable=1” on a system that has no MSI controller device tree node and GICv4, it results a panic as “gic_domain” is NULL and the kernel attempts to access it.
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000028
Mem abort info:
ESR = 0x0000000096000006
CPU: 1 UID: 0 PID: 295 Comm: lkvm-static Not tainted 7.1.0-rc4-ge3f15ad3970e #5 PREEMPT
Hardware name: linux,dummy-virt (DT)
pstate: 81402005 (Nzcv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
pc : __irq_domain_instantiate+0x1d4/0x578
lr : __irq_domain_instantiate+0x1cc/0x578Set vLPI support to false at init time if the host has no ITS, so it propagates properly to kvm_vgic_global_state.has_gicv4.
--- drivers/irqchip/irq-gic-v3-its.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-gic-v3-its.c +1 -0
@@ -5686,6 +5686,7 @@ int __init its_init(struct fwnode_handle *handle, struct rdists *rdists,its_acpi_probe ();if (list_empty (&its_nodes)) { + rdists->has_vlpis = false;pr_warn ("ITS: No ITS available, not enabling LPIs\n" );return -ENXIO ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 112/1193 ALSA: usb-audio: Add quirk for Novation Mininova
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Küchler <[email protected]>
[ Upstream commit b2e9d2cbbb71b00faf3e27fb741a27b9ad455edd ]
Add a device-specific quirk for the Novation Mininova synthesizer (USB ID 1235:001e) to enable proper recognition and functionality as a MIDI device.
--- sound/usb/quirks-table.h | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/usb/quirks-table.h +8 -0
@@ -2131,6 +2131,14 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +{ +USB_DEVICE (0x1235 ,0x001e ), + QUIRK_DRIVER_INFO { +/* .vendor_name = "Novation", */ +/* .product_name = "Mininova", */ + QUIRK_DATA_RAW_BYTES(0) + } +}, {USB_DEVICE_VENDOR_SPEC (0x1235 ,0x4661 ), QUIRK_DRIVER_INFO {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 113/1193 net: hsr: require valid EOT supervision TLV
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luka Gejak <[email protected]>
[ Upstream commit 46d111a3ef3b5972804dcdce0833767143a12192 ]
Supervision frames are only valid if terminated with a zero-length EOT TLV. The current check fails to reject non-EOT entries as the terminal TLV, potentially allowing malformed supervision traffic.
Fix this by strictly requiring the terminal TLV to be HSR_TLV_EOT with a length of zero.
--- net/hsr/hsr_forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/hsr/hsr_forward.c +1 -1
@@ -110,7 +110,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, struct sk_buff *skb) }/* end of tlvs must follow at the end */ -if (hsr_sup_tlv->HSR_TLV_type ==HSR_TLV_EOT && +if (hsr_sup_tlv->HSR_TLV_type !=HSR_TLV_EOT || hsr_sup_tlv->HSR_TLV_length !=0 )return false;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 114/1193 ipv6: addrconf: fix temp address generation after prefix deprecation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fernando Fernandez Mancera <[email protected]>
[ Upstream commit e20d8922aa8fe441d291364c96c2179a005b79ea ]
When a router temporarily deprecates an IPv6 prefix (either by sending a Router Advertisement with Preferred Lifetime = 0 or by letting the lifetime expire) and later restores it, the kernel permanently loses its ability to generate temporary privacy addresses (RFC 8981) for that prefix.
This happens because the address worker attempts to generate a replacement temporary address when the current one nears expiration. As the base prefix is deprecated already, the generation fails after marking the temporary address as already having spawned a replacement (ifp->regen_count++).
When the router eventually restores the prefix, the temporary address becomes active again. However, once it naturally expires, the address worker sees this temporary address already tried to generate one and skips the regeneration.
Fix the issue by resetting the regen_count check of the latest temp address generated for the prefix updated by the incoming RA.
--- net/ipv6/addrconf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +9 -1
@@ -1177,6 +1177,7 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,ipv6_link_dev_addr (idev, ifa);if (ifa->flags&IFA_F_TEMPORARY ) { +/* manage_tempaddrs() relies on addresses being added to the head */ list_add (&ifa->tmp_list, &idev->tempaddr_list);in6_ifa_hold (ifa); }
@@ -2577,8 +2578,10 @@ static void manage_tempaddrs(struct inet6_dev *idev, __u32 valid_lft, __u32 prefered_lft, bool create, unsigned long now) { - u32 flags; + u32 orig_prefered_lft = prefered_lft;struct inet6_ifaddr *ift; +bool reset_done = false; +u32 flags;read_lock_bh (&idev->lock);/* update all temporary addresses in the list */
@@ -2613,6 +2616,11 @@ static void manage_tempaddrs(struct inet6_dev *idev, prefered_lft = max_prefered;spin_lock (&ift->lock); +/* the first match is the most recent temp address */ +if (!reset_done && orig_prefered_lft >0 ) { + ift->regen_count =0 ; + reset_done = true; + } flags = ift->flags; ift->valid_lft = valid_lft; ift->prefered_lft = prefered_lft;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 115/1193 net: thunderx: fix PTP device ref leak in nicvf_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 2bcf59eefb9f00a2b1d426b639ee49c305a80695 ]
cavium_ptp_get() acquires a reference to the PTP PCI device through pci_get_device(). If any initialization step fails after cavium_ptp_get(), the PTP PCI device reference is leaked. Add a common error path to release the PTP reference before returning from probe failures.
--- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/cavium/thunder/nicvf_main.c +6 -2
@@ -2110,8 +2110,10 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } err =pci_enable_device (pdev); -if (err) -return dev_err_probe (dev, err,"Failed to enable PCI device\n" ); +if (err) { + err =dev_err_probe (dev, err,"Failed to enable PCI device\n" ); + goto err_put_ptp; + } err =pci_request_regions (pdev,DRV_NAME );if (err) {
@@ -2265,6 +2267,8 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_release_regions (pdev); err_disable_device:pci_disable_device (pdev); +err_put_ptp: +cavium_ptp_put (ptp_clock);return err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 116/1193 drm/amd/pm/si: Fix updating clock limits from power states
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Klarenbeek <[email protected]>
[ Upstream commit e6c5d36756e7d4d260e2365fc4d01226f1973152 ]
VBIOS can contain conflicting values between:
- the maximum allowed clocks and voltages on AC or DC
- the clocks and voltages in power states on AC or DC
Update maximum clock (and voltage) limits for both AC/DC and take the highest value from the VBIOS limits and the performance/battery power states. Previously this was only done for AC, but is also needed for DC.
This commit fixes the behaviour on some laptop GPUs, where the VBIOS limit was set to the lowest possible clock frequency, so the GPU was stuck on the lowest possible power level on battery.
Some affected GPUs are:
FirePro W4170M (Dell Precision M2800)
Radeon HD 8790M (Dell Latitude E6540)
and possibly other laptop GPUs.
--- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c | 29 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c +24 -5
@@ -7218,6 +7218,7 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev,struct evergreen_power_info *eg_pi =evergreen_get_pi (adev);struct si_power_info *si_pi =si_get_pi (adev);struct si_ps *ps =si_get_ps (rps); +struct amdgpu_clock_and_voltage_limits *limits;u16 leakage_voltage;struct rv7xx_pl *pl = &ps->performance_levels[index];int ret;
@@ -7277,12 +7278,30 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev, si_pi->mvdd_bootup_value = mvdd; } +/* +* Update maximum allowed clock limits. +* VBIOS can contain conflicting values between: +* - the maximum allowed clocks and voltages on AC or DC +* - the clocks and voltages in power states on AC or DC +*/ if ((rps->class &ATOM_PPLIB_CLASSIFICATION_UI_MASK ) == -ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) { - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.sclk = pl->sclk; - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.mclk = pl->mclk; - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddc = pl->vddc; - adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddci = pl->vddci; +ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) + limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_ac; +else if ((rps->class &ATOM_PPLIB_CLASSIFICATION_UI_MASK ) == +ATOM_PPLIB_CLASSIFICATION_UI_BATTERY ) + limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_dc; +else + limits =NULL ; + +if (limits) { +if (pl->sclk > limits->sclk) + limits->sclk = pl->sclk; +if (pl->mclk > limits->mclk) + limits->mclk = pl->mclk; +if (pl->vddc > limits->vddc) + limits->vddc = pl->vddc; +if (pl->vddci > limits->vddci) + limits->vddci = pl->vddci; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 117/1193 ACPICA: Fix condition check in acpi_ps_parse_loop()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 8de27e2d83c0d07ae9443c6304575b0609394bfd ]
Fix condition check for AML_ELSE_OP in acpi_ps_parse_loop() to prevent out-of-bounds access.
--- drivers/acpi/acpica/psloop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/acpi/acpica/psloop.c +4 -1
@@ -425,7 +425,10 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)ACPI_ERROR ((AE_INFO ,"Skipping While/If block" )); -if (*walk_state->aml ==AML_ELSE_OP ) { +if ((walk_state->aml < + parser_state->aml_end) + && (*walk_state->aml == +AML_ELSE_OP )) {ACPI_ERROR ((AE_INFO ,"Skipping Else block" )); walk_state->parser_state.aml =
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 118/1193 ACPICA: Fix use-after-free in acpi_ds_terminate_control_method()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 945e87267cfd90937b3c637f87324cbb56998b72 ]
Fix use-after-free issue in acpi_ds_terminate_control_method() by clearing references to method locals and arguments.
--- drivers/acpi/acpica/dsmethod.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/acpi/acpica/dsmethod.c +43 -0
@@ -698,6 +698,8 @@ void acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, struct acpi_walk_state *walk_state) { + u32 i; +struct acpi_namespace_node *ref_node;ACPI_FUNCTION_TRACE_PTR (ds_terminate_control_method, walk_state);
@@ -708,6 +710,47 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, }if (walk_state) { +/* +* Check if the return value is a ref_of reference to a method local +* or argument. If so, clear the reference to avoid use-after-free +* when the walk state is deleted. +*/ +if (walk_state->return_desc && + (walk_state->return_desc->common.type == +ACPI_TYPE_LOCAL_REFERENCE ) + && (walk_state->return_desc->reference.class == +ACPI_REFCLASS_REFOF )) { + ref_node = walk_state->return_desc->reference.object; +if (ref_node) { + +/* Check against method locals */ +for (i =0 ; i <ACPI_METHOD_NUM_LOCALS ; i++) { +if (ref_node == + &walk_state->local_variables[i]) { +acpi_ut_remove_reference + (walk_state->return_desc); + walk_state->return_desc =NULL ; +break ; + } + } + +/* Check against method arguments if not already cleared */ +if (walk_state->return_desc) { +for (i =0 ; i <ACPI_METHOD_NUM_ARGS ; + i++) { +if (ref_node == + &walk_state->arguments[i]) { +acpi_ut_remove_reference + (walk_state-> + return_desc); + walk_state-> + return_desc =NULL ; +break ; + } + } + } + } + }/* Delete all arguments and locals */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 119/1193 ACPICA: add boundary checks in acpi_ps_get_next_field()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit e15aa60de0256d63df2331bf5a4bc4dd287504cd ]
Add boundary checks in acpi_ps_get_next_field() to prevent out-of-bounds access.
--- drivers/acpi/acpica/psargs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/acpi/acpica/psargs.c +17 -0
@@ -474,6 +474,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_stateASL_CV_CAPTURE_COMMENTS_ONLY (parser_state); aml = parser_state->aml; +if (aml >= parser_state->aml_end) { +return_PTR (NULL ); + } +/* Determine field type */ switch (ACPI_GET8 (parser_state->aml)) {
@@ -522,6 +526,11 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Get the 4-character name */ +if ((parser_state->aml +ACPI_NAMESEG_SIZE ) > + parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + }ACPI_MOVE_32_TO_32 (&name, parser_state->aml);acpi_ps_set_name (field, name); parser_state->aml +=ACPI_NAMESEG_SIZE ;
@@ -567,6 +576,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* Get the two bytes (Type/Attribute) */ +if ((parser_state->aml +2 ) > parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + } access_type =ACPI_GET8 (parser_state->aml); parser_state->aml++; access_attribute =ACPI_GET8 (parser_state->aml);
@@ -578,6 +591,10 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state/* This opcode has a third byte, access_length */ if (opcode ==AML_INT_EXTACCESSFIELD_OP ) { +if (parser_state->aml >= parser_state->aml_end) { +acpi_ps_free_op (field); +return_PTR (NULL ); + } access_length =ACPI_GET8 (parser_state->aml); parser_state->aml++;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 120/1193 ACPICA: validate byte_count in acpi_ps_get_next_package_length()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit d49c6ee08365a8596f639da46eb7e71752b0cd42 ]
Validate package length reading in acpi_ps_get_next_package_length().
--- drivers/acpi/acpica/psargs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/acpi/acpica/psargs.c +17 -0
@@ -48,6 +48,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)u32 package_length =0 ;u32 byte_count;u8 byte_zero_mask =0x3F ;/* Default [0:5] */ +u32 remaining;ACPI_FUNCTION_TRACE (ps_get_next_package_length);
@@ -55,7 +56,23 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)* Byte 0 bits [6:7] contain the number of additional bytes * used to encode the package length, either 0,1,2, or 3 */ + +/* Check if we have at least one byte to read */ + remaining = (u32 )ACPI_PTR_DIFF (parser_state->aml_end, aml); +if (remaining ==0 ) { +return_UINT32 (0 ); + } + byte_count = (aml[0 ] >>6 ); + +/* Validate byte_count and ensure we have enough bytes to read */ +if (byte_count >= remaining) { + +/* Clamp to available bytes and advance to end */ + parser_state->aml = parser_state->aml_end; +return_UINT32 (0 ); + } + parser_state->aml += ((acpi_size )byte_count +1 );/* Get bytes 3, 2, 1 as needed */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 121/1193 ACPICA: Prevent adding invalid references
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 6e8c55e13a5e3a9f38921d62924f18ceba3330eb ]
Prevent adding references for local, argument, and debug objects in acpi_ut_copy_simple_object().
--- drivers/acpi/acpica/utcopy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/acpica/utcopy.c +9 -1
@@ -731,7 +731,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,break ; } -acpi_ut_add_reference (source_desc->reference.object); +/* +* Local/Arg/Debug references do not have a valid Object pointer +* that can be referenced +*/ +if ((source_desc->reference.class !=ACPI_REFCLASS_LOCAL ) && + (source_desc->reference.class !=ACPI_REFCLASS_ARG ) && + (source_desc->reference.class !=ACPI_REFCLASS_DEBUG )) { +acpi_ut_add_reference (source_desc->reference.object); + }break ;case ACPI_TYPE_REGION :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 122/1193 ACPICA: Fix integer overflow in acpi_ex_opcode_3A_1T_1R() (mid_op)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 0e2021f49e64b3c8a9aa880d0c62a218bfe147ce ]
Add overflow check for Index + Length to prevent integer overflow when calculating the truncation length. This prevents negative size parameter being passed to memcpy().
--- drivers/acpi/acpica/exoparg3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/exoparg3.c +1 -1
@@ -152,7 +152,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)/* Truncate request if larger than the actual String/Buffer */ - else if ((index + length) > operand[0]->string.length) { + else if ((index + length) > operand[0]->string.length || (index + length) < index) { /* Check for overflow */ length = (acpi_size )operand[0 ]->string.length - (acpi_size )index;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 123/1193 ACPICA: Improve argument parsing in acpi_ps_get_next_simple_arg()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 27d27e75ecb752a0b4da848c440bb3a88396ecba ]
Improve argument parsing in acpi_ps_get_next_simple_arg() to handle remaining AML data safely.
--- drivers/acpi/acpica/psargs.c | 78 +++++++++++++++++++++++++++++++----- 1 file changed, 68 insertions(+), 10 deletions(-)
drivers/acpi/acpica/psargs.c +68 -10
@@ -384,6 +384,8 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,u32 length;u16 opcode;u8 *aml = parser_state->aml; +u32 remaining = (u32 )ACPI_PTR_DIFF (parser_state->aml_end, aml); +u64 partial_value;ACPI_FUNCTION_TRACE_U32 (ps_get_next_simple_arg, arg_type);
@@ -393,8 +395,13 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 1 byte from the AML stream */ opcode =AML_BYTE_OP ; - arg->common.value.integer = (u64) *aml; - length =1 ; +if (remaining >=1 ) { + arg->common.value.integer = (u64)*aml; + length =1 ; + }else { + arg->common.value.integer =0 ; + length =0 ; + }break ;case ARGP_WORDDATA :
@@ -402,8 +409,19 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 2 bytes from the AML stream */ opcode =AML_WORD_OP ; -ACPI_MOVE_16_TO_64 (&arg->common.value.integer, aml); - length =2 ; +if (remaining >=2 ) { +ACPI_MOVE_16_TO_64 (&arg->common.value.integer, aml); + length =2 ; + }else { + arg->common.value.integer =0 ; + length =0 ; +if (remaining >0 ) { + partial_value =0 ; +memcpy (&partial_value, aml, remaining); + arg->common.value.integer = partial_value; + length = remaining; + } + }break ;case ARGP_DWORDDATA :
@@ -411,8 +429,19 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 4 bytes from the AML stream */ opcode =AML_DWORD_OP ; -ACPI_MOVE_32_TO_64 (&arg->common.value.integer, aml); - length =4 ; +if (remaining >=4 ) { +ACPI_MOVE_32_TO_64 (&arg->common.value.integer, aml); + length =4 ; + }else { + arg->common.value.integer =0 ; + length =0 ; +if (remaining >0 ) { + partial_value =0 ; +memcpy (&partial_value, aml, remaining); + arg->common.value.integer = partial_value; + length = remaining; + } + }break ;case ARGP_QWORDDATA :
@@ -420,8 +449,19 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Get 8 bytes from the AML stream */ opcode =AML_QWORD_OP ; -ACPI_MOVE_64_TO_64 (&arg->common.value.integer, aml); - length =8 ; +if (remaining >=8 ) { +ACPI_MOVE_64_TO_64 (&arg->common.value.integer, aml); + length =8 ; + }else { + arg->common.value.integer =0 ; + length =0 ; +if (remaining >0 ) { + partial_value =0 ; +memcpy (&partial_value, aml, remaining); + arg->common.value.integer = partial_value; + length = remaining; + } + }break ;case ARGP_CHARLIST :
@@ -434,10 +474,28 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,/* Find the null terminator */ length =0 ; -while (aml[length]) { +while ((length < remaining) && aml[length]) { + length++; + } +if (length < remaining) { + +/* Account for the terminating null */ length++; + }else { +/* +* No terminator found - add null at buffer boundary +* and report a warning +*/ +ACPI_WARNING ((AE_INFO , +"Invalid AML string: no null terminator, truncating at offset %u" , + (u32)(aml - parser_state->aml))); + +/* Add null terminator at the boundary */ +if (remaining >0 ) { + aml[remaining -1 ] =0 ; + length = remaining; + } } - length++;break ;case ARGP_NAME :
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 124/1193 ACPICA: validate handler object type in two places
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit c5296da2d516707862f8a2dbb4b515f777e5294f ]
ACPICA: validate handler object type in acpi_ev_has_default_handler() and acpi_ev_find_region_handler().
--- drivers/acpi/acpica/evhandler.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/acpi/acpica/evhandler.c +11 -0
@@ -130,6 +130,14 @@ acpi_ev_has_default_handler(struct acpi_namespace_node *node,/* Walk the linked list of handlers for this object */ while (handler_obj) { + +/* Validate handler object type before accessing fields */ + +if (handler_obj->common.type != +ACPI_TYPE_LOCAL_ADDRESS_HANDLER ) { +break ; + } +if (handler_obj->address_space.space_id == space_id) {if (handler_obj->address_space.handler_flags &ACPI_ADDR_HANDLER_DEFAULT_INSTALLED ) {
@@ -292,6 +300,9 @@ union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type/* Walk the handler list for this device */ while (handler_obj) { +if (handler_obj->common.type !=ACPI_TYPE_LOCAL_ADDRESS_HANDLER ) { +break ; + }/* Same space_id indicates a handler is installed */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 125/1193 ACPICA: Add package limit checks in parser functions
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit d27d48a528e437aed690f977e69a6fe73fe82ab5 ]
Add package limit checks in parser functions to prevent out-of-bounds access.
--- drivers/acpi/acpica/nsxfname.c | 4 ++++ drivers/acpi/acpica/psargs.c | 4 ++++ drivers/acpi/acpica/psloop.c | 25 +++++++++++++++++++++++++ drivers/acpi/acpica/psparse.c | 8 ++++++++ 4 files changed, 41 insertions(+)
drivers/acpi/acpica/nsxfname.c +4 -0
@@ -512,6 +512,10 @@ acpi_status acpi_install_method(u8 *buffer) parser_state.aml +=acpi_ps_get_opcode_size (opcode); parser_state.pkg_end =acpi_ps_get_next_package_end (&parser_state); +if ((parser_state.pkg_end > parser_state.aml_end) || + (parser_state.pkg_end < parser_state.aml)) { +return (AE_AML_PACKAGE_LIMIT ); + } path =acpi_ps_get_next_namestring (&parser_state); method_flags = *parser_state.aml++;
drivers/acpi/acpica/psargs.c +4 -0
@@ -867,6 +867,10 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, parser_state->pkg_end =acpi_ps_get_next_package_end (parser_state); +if ((parser_state->pkg_end > parser_state->aml_end) + || (parser_state->pkg_end < parser_state->aml)) { +return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT ); + }break ;case ARGP_FIELDLIST :
drivers/acpi/acpica/psloop.c +25 -0
@@ -361,6 +361,13 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->parser_state.aml =acpi_ps_get_next_package_end (&walk_state->parser_state); +if ((walk_state->parser_state.aml > + walk_state->parser_state.aml_end) + || (walk_state->parser_state.aml < + walk_state->aml)) { +return_ACPI_STATUS + (AE_AML_PACKAGE_LIMIT ); + } walk_state->aml = walk_state->parser_state.aml; }
@@ -421,6 +428,14 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) parser_state->aml =acpi_ps_get_next_package_end (parser_state); +if ((parser_state->aml > + parser_state->aml_end) + || (parser_state->aml < + walk_state->control_state-> + control.aml_predicate_start)) { +return_ACPI_STATUS + (AE_AML_PACKAGE_LIMIT ); + } walk_state->aml = parser_state->aml; ACPI_ERROR((AE_INFO,
@@ -436,6 +451,16 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) walk_state->parser_state.aml =acpi_ps_get_next_package_end (parser_state); +if ((walk_state->parser_state. + aml > + walk_state->parser_state. + aml_end) + || (walk_state-> + parser_state.aml < + walk_state->aml)) { +return_ACPI_STATUS + (AE_AML_PACKAGE_LIMIT ); + } walk_state->aml = parser_state->aml; }
drivers/acpi/acpica/psparse.c +8 -0
@@ -300,6 +300,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, {struct acpi_parse_state *parser_state = &walk_state->parser_state;acpi_status status =AE_CTRL_PENDING ; +u8 *aml;ACPI_FUNCTION_TRACE_PTR (ps_next_parse_state, op);
@@ -344,7 +345,14 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,* Predicate of an IF was true, and we are at the matching ELSE. * Just close out this package */ + aml = parser_state->aml; + parser_state->aml =acpi_ps_get_next_package_end (parser_state); +if ((parser_state->aml > parser_state->aml_end) || + (parser_state->aml < aml)) { + status =AE_AML_PACKAGE_LIMIT ; +break ; + } status =AE_CTRL_PENDING ;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 126/1193 ACPICA: Add validation for node in acpi_ns_build_normalized_path()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 96b2b616870e46e2bc04efec03879683a0036e66 ]
Add validation for node in acpi_ns_build_normalized_path() to prevent use-after-free vulnerabilities.
--- drivers/acpi/acpica/nsnames.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/acpica/nsnames.c +6 -0
@@ -222,6 +222,12 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, goto build_trailing_null; } +/* Validate the Node to avoid use-after-free vulnerabilities */ + +if (ACPI_GET_DESCRIPTOR_TYPE (node) !=ACPI_DESC_TYPE_NAMED ) { + goto build_trailing_null; + } + next_node = node;while (next_node && next_node != acpi_gbl_root_node) {if (next_node != node) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 127/1193 ACPICA: Enhance OEM ID and Table ID validation in acpi_ex_load_table_op()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit 485829e6999b7909f50761a1c708660304edc945 ]
Enhance OEM ID and Table ID validation in acpi_ex_load_table_op() to prevent buffer overflows.
--- drivers/acpi/acpica/exconfig.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/acpi/acpica/exconfig.c +24 -2
@@ -90,6 +90,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state,union acpi_operand_object *return_obj;union acpi_operand_object *ddb_handle;u32 table_index; +char oem_id[ACPI_OEM_ID_SIZE +1 ]; +char oem_table_id[ACPI_OEM_TABLE_ID_SIZE +1 ];ACPI_FUNCTION_TRACE (ex_load_table_op);
@@ -102,12 +104,32 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, *return_desc = return_obj; +/* +* Validate OEM ID and OEM Table ID string lengths. +* acpi_tb_find_table expects strings that can safely read +* ACPI_OEM_ID_SIZE and ACPI_OEM_TABLE_ID_SIZE bytes. +*/ +if ((operand[1 ]->string.length >ACPI_OEM_ID_SIZE ) || + (operand[2 ]->string.length >ACPI_OEM_TABLE_ID_SIZE )) { +return_ACPI_STATUS (AE_AML_STRING_LIMIT ); + } + +/* +* Copy OEM strings to local buffers with guaranteed null-termination. +* This prevents heap-buffer-overflow when acpi_tb_find_table reads +* ACPI_OEM_ID_SIZE/ACPI_OEM_TABLE_ID_SIZE bytes. +*/ +memcpy (oem_id, operand[1 ]->string.pointer, operand[1 ]->string.length); + oem_id[operand[1 ]->string.length] =0 ; +memcpy (oem_table_id, operand[2 ]->string.pointer, + operand[2 ]->string.length); + oem_table_id[operand[2 ]->string.length] =0 ; +/* Find the ACPI table in the RSDT/XSDT */ acpi_ex_exit_interpreter (); status =acpi_tb_find_table (operand[0 ]->string.pointer, - operand[1 ]->string.pointer, - operand[2 ]->string.pointer, &table_index); + oem_id, oem_table_id, &table_index);acpi_ex_enter_interpreter ();if (ACPI_FAILURE (status)) {if (status !=AE_NOT_FOUND ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 128/1193 ACPICA: Fix NULL pointer dereference in acpi_ns_custom_package()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiming Shi <[email protected]>
[ Upstream commit f8d14b7bb0063bbbd86c0e4d73edb8cea7b362bc ]
acpi_ns_custom_package() unconditionally dereferences the first element of the package to read the _BIX version number, without checking for NULL:
if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)
When firmware returns a _BIX package whose first element is an unresolvable reference, ACPICA evaluates that entry to NULL. acpi_ns_remove_null_elements() does not strip NULL entries for ACPI_PTYPE_CUSTOM packages (fixed-position format would break if elements were shifted), so acpi_ns_custom_package() sees the NULL and causes a crash.
Add a NULL check for the first element (version field) before dereferencing it. The caller then receives AE_AML_OPERAND_TYPE instead of crashing.
--- drivers/acpi/acpica/nsprepkg.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/acpica/nsprepkg.c +7 -0
@@ -631,6 +631,13 @@ acpi_ns_custom_package(struct acpi_evaluate_info *info,/* Get version number, must be Integer */ +if (!(*elements)) { +ACPI_WARN_PREDEFINED ((AE_INFO , info->full_pathname, + info->node_flags, +"Return Package has a NULL version element" )); +return_ACPI_STATUS (AE_AML_OPERAND_TYPE ); + } +if ((*elements)->common.type !=ACPI_TYPE_INTEGER ) { ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 129/1193 ACPICA: Enhance buffer validation in acpi_ut_walk_aml_resources()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit b2e21fe8c3361c3d0d57ee56d359bea9b51fda3d ]
Enhance buffer validation in acpi_ut_walk_aml_resources() to prevent buffer overflows.
--- drivers/acpi/acpica/utresrc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/acpi/acpica/utresrc.c +30 -0
@@ -165,6 +165,28 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,/* Walk the byte list, abort on any invalid descriptor type or length */ while (aml < end_aml) { +/* +* Validate that the remaining buffer space can hold enough +* bytes to safely access fields during validation. +* For large resource descriptors (bit 7 set), we need enough +* bytes to access the Type field in serial_bus resources. +* Small resource descriptors only need sizeof(struct aml_resource_end_tag). +*/ +if ((acpi_size)(end_aml - aml) < +sizeof (struct aml_resource_end_tag )) { +return_ACPI_STATUS (AE_AML_BUFFER_LENGTH ); + } + +/* +* For large resource descriptors, ensure enough space for +* the header plus serial_bus Type field access. +*/ +if ((ACPI_GET8 (aml) &ACPI_RESOURCE_NAME_LARGE ) && + ((acpi_size)(end_aml - aml) < + ACPI_OFFSET(struct aml_resource_common_serialbus, + type) +1 )) { +return_ACPI_STATUS (AE_AML_BUFFER_LENGTH ); + }/* Validate the Resource Type and Resource Length */
@@ -182,6 +204,14 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, length =acpi_ut_get_descriptor_length (aml); +/* +* Validate that the descriptor length doesn't exceed the +* remaining buffer size to prevent reading beyond the end. +*/ +if (length > (acpi_size)(end_aml - aml)) { +return_ACPI_STATUS (AE_AML_BUFFER_LENGTH ); + } +/* Invoke the user function */ if (user_function) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 130/1193 ACPICA: add boundary checks in two places
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ikaros <[email protected]>
[ Upstream commit bdc35754012906dbf094be104b103ca3adfef6f7 ]
Add boundary checks in acpi_ps_get_next_namestring() and acpi_ps_peek_opcode() to prevent out-of-bounds access.
--- drivers/acpi/acpica/psargs.c | 18 +++++++++++++++++- drivers/acpi/acpica/psparse.c | 6 ++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
drivers/acpi/acpica/psargs.c +17 -1
@@ -148,10 +148,16 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)/* Point past any namestring prefix characters (backslash or carat) */ -while (ACPI_IS_ROOT_PREFIX (*end) ||ACPI_IS_PARENT_PREFIX (*end)) { +while (end < parser_state->aml_end && + (ACPI_IS_ROOT_PREFIX (*end) ||ACPI_IS_PARENT_PREFIX (*end))) { end++; } +if (end >= parser_state->aml_end) { + parser_state->aml = parser_state->aml_end; +return_PTR (NULL ); + } +/* Decode the path prefix character */ switch (*end) {
@@ -176,6 +182,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)/* Multiple name segments, 4 chars each, count in next byte */ +if ((end +1 ) >= parser_state->aml_end) { + parser_state->aml = parser_state->aml_end; +return_PTR (NULL ); + } + end +=2 + (*(end +1 ) *ACPI_NAMESEG_SIZE );break ;
@@ -187,6 +198,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)break ; } +if (end > parser_state->aml_end) { + parser_state->aml = parser_state->aml_end; +return_PTR (NULL ); + } + parser_state->aml = end;return_PTR ((char *)start); }
drivers/acpi/acpica/psparse.c +6 -0
@@ -70,6 +70,9 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)u16 opcode; aml = parser_state->aml; +if (aml >= parser_state->aml_end) { +return (0xFFFF ); + } opcode = (u16 )ACPI_GET8 (aml);if (opcode ==AML_EXTENDED_PREFIX ) {
@@ -77,6 +80,9 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)/* Extended opcode, get the second opcode byte */ aml++; +if (aml >= parser_state->aml_end) { +return (0xFFFF ); + } opcode = (u16) ((opcode <<8 ) |ACPI_GET8 (aml)); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 131/1193 hfs: rework hfsplus_readdir() logic
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 7fde7e806657fbe0d33f489521b488eed94f9b39 ]
The xfstests' test-case generic/637 fails with error:
FSTYP -- hfs
PLATFORM -- Linux/x86_64 kvm-xfstests 6.15.0-rc4-xfstests-g00b827f0cffa #1 SMP PREEMPT_DYNAMIC Fri May 25 MKFS_OPTIONS -- /dev/vdcMOUNT_OPTIONS -- /dev/vdc /vdc
QA output created by 637
entries 7 and 8 have duplicate d_off 8
Found unlinked files in open dir (see xfstests-dev/results//generic/637.full for details)
Likewise HFS+, currently, HFS has very complicated and fragile logic of rd->file->f_pos correction in hfs_delete_cat(). This patch removes this logic and it stores the current pos into hfs_readdir_data. Finally, if rd->pos == ctx->pos then hfs_readdir() tries to find the position in b-tree's node by means of hfs_cat_key. This position is used to re-start the folder's content traversal.
sudo ./check generic/637
FSTYP -- hfs PLATFORM -- Linux/x86_64 hfsplus-testing-0001 7.1.0-rc1+ #55 SMP PREEMPT_DYNAMIC Tue May 19 15:18:02 PDT 2026 MKFS_OPTIONS -- /dev/loop51
MOUNT_OPTIONS -- /dev/loop51 /mnt/scratch
generic/637 32s ... 31s
Ran: generic/637
Passed all 1 tests
--- fs/hfs/catalog.c | 9 --------- fs/hfs/dir.c | 28 +++++++++++----------------- fs/hfs/hfs.h | 3 +-- fs/hfs/hfs_fs.h | 2 -- fs/hfs/inode.c | 4 ---- 5 files changed, 12 insertions(+), 34 deletions(-)
fs/hfs/catalog.c +0 -9
@@ -222,7 +222,6 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str) {struct super_block *sb;struct hfs_find_data fd; -struct hfs_readdir_data *rd;int res, type;hfs_dbg (CAT_MOD ,"delete_cat: %s,%u\n" , str ? str->name :NULL , cnid);
@@ -248,14 +247,6 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str) } } -/* we only need to take spinlock for exclusion with ->release() */ -spin_lock (&HFS_I (dir)->open_dir_lock); -list_for_each_entry (rd, &HFS_I (dir)->open_dir_list, list) { -if (fd.tree->keycmp (fd.search_key, (void *)&rd->key) <0 ) - rd->file->f_pos--; - } -spin_unlock (&HFS_I (dir)->open_dir_lock); - res =hfs_brec_remove (&fd);if (res) goto out;
fs/hfs/dir.c +11 -17
@@ -97,7 +97,15 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx) }if (ctx->pos >= inode->i_size) goto out; - err =hfs_brec_goto (&fd, ctx->pos -1 ); + rd = file->private_data; +if (rd && rd->pos == ctx->pos) { +memcpy (fd.search_key, &rd->key,sizeof (struct hfs_cat_key )); + err =hfs_brec_find (&fd); +if (err == -ENOENT ) + err =hfs_brec_goto (&fd,1 ); + }else { + err =hfs_brec_goto (&fd, ctx->pos -1 ); + }if (err) goto out;
@@ -146,7 +154,6 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)if (err) goto out; } - rd = file->private_data;if (!rd) { rd =kmalloc (sizeof (struct hfs_readdir_data ),GFP_KERNEL );if (!rd) {
@@ -154,15 +161,8 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx) goto out; } file->private_data = rd; - rd->file = file; -spin_lock (&HFS_I (inode)->open_dir_lock); -list_add (&rd->list, &HFS_I (inode)->open_dir_list); -spin_unlock (&HFS_I (inode)->open_dir_lock); } -/* -* Can be done after the list insertion; exclusion with -* hfs_delete_cat() is provided by directory lock. -*/ + rd->pos = ctx->pos;memcpy (&rd->key, &fd.key->cat,sizeof (struct hfs_cat_key )); out:hfs_find_exit (&fd);
@@ -171,13 +171,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)static int hfs_dir_release (struct inode *inode,struct file *file) { -struct hfs_readdir_data *rd = file->private_data; -if (rd) { -spin_lock (&HFS_I (inode)->open_dir_lock); -list_del (&rd->list); -spin_unlock (&HFS_I (inode)->open_dir_lock); -kfree (rd); - } +kfree (file->private_data);return 0 ; }
fs/hfs/hfs.h +1 -2
@@ -281,8 +281,7 @@ struct hfs_mdb {/*======== Data structures kept in memory ========*/ struct hfs_readdir_data { -struct list_head list; -struct file *file; +loff_t pos;struct hfs_cat_key key; };
fs/hfs/hfs_fs.h +0 -2
@@ -68,8 +68,6 @@ struct hfs_inode_info {struct hfs_cat_key cat_key; -struct list_head open_dir_list; -spinlock_t open_dir_lock;struct inode *rsrc_inode;struct mutex extents_lock;
fs/hfs/inode.c +0 -4
@@ -193,8 +193,6 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_treturn NULL ;mutex_init (&HFS_I (inode)->extents_lock); -INIT_LIST_HEAD (&HFS_I (inode)->open_dir_list); -spin_lock_init (&HFS_I (inode)->open_dir_lock);hfs_cat_build_key (sb, (btree_key *)&HFS_I (inode)->cat_key, dir->i_ino, name); inode->i_ino =HFS_SB (sb)->next_id++; inode->i_mode = mode;
@@ -328,8 +326,6 @@ static int hfs_read_inode(struct inode *inode, void *data)HFS_I (inode)->flags =0 ;HFS_I (inode)->rsrc_inode =NULL ;mutex_init (&HFS_I (inode)->extents_lock); -INIT_LIST_HEAD (&HFS_I (inode)->open_dir_list); -spin_lock_init (&HFS_I (inode)->open_dir_lock);/* Initialize the inode */ inode->i_uid = hsb->s_uid;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 132/1193 pinctrl: renesas: rzv2m: Use -ENOTSUPP instead of -EOPNOTSUPP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 01f94d53947df35ba77cdb3992a4e3ef9d9dc1ad ]
The pinctrl and GPIO core code make exceptions for the -ENOTSUPP error code. One such example is gpio_set_config_with_argument_optional(), which returns success when gpio_set_config_with_argument() returns -ENOTSUPP, but reports failure for all other error codes.
Returning -EOPNOTSUPP from the pinctrl driver on the unsupported pinctrl operation may lead to boot failures when pinctrl drivers implements struct gpio_chip::set_config, the system uses GPIO hogs, and the struct gpio_chip::set_config implementation returns -EOPNOTSUPP for the unsupported operations.
Currently, the driver does not implement struct gpio_chip::set_config(). To avoid future failures, return -ENOTSUPP from rzv2m_pinctrl_pinconf_set().
rzv2m_pinctrl_pinconf_group_get() is used when dumping pinctrl configuration. pinconf_generic_dump_one(), which calls it, makes exceptions for the -EINVAL and -ENOTSUPP error codes. The documentation for struct pinconf_ops::pin_config_group_get states that it "should return -ENOTSUPP and -EINVAL using the same rules as pin_config_get()". The documentation for struct pinconf_ops::pin_config_get states:
"get the config of a certain pin, if the requested config is not available on this controller this should return -ENOTSUPP and if it is available but disabled it should return -EINVAL".
Return -ENOTSUPP for the unsupported pinctrl operation.
--- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/pinctrl-rzv2m.c +2 -2
@@ -665,7 +665,7 @@ static int rzv2m_pinctrl_pinconf_set(struct pinctrl_dev *pctldev, }default : -return -EOPNOTSUPP ; +return -ENOTSUPP ; } }
@@ -714,7 +714,7 @@ static int rzv2m_pinctrl_pinconf_group_get(struct pinctrl_dev *pctldev,/* Check config matches previous pins */ if (i && prev_config != *config) -return -EOPNOTSUPP ; +return -ENOTSUPP ; prev_config = *config; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 133/1193 host1x: bus: Fix missing ops null check in error teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: shayderrr <[email protected]>
[ Upstream commit 71d25f668bc5c0f36ea843462e12307dea45aaa3 ]
In host1x_device_init(), the error teardown paths do not check client->ops before dereferencing it, unlike the forward init paths which correctly guard with 'client->ops &&'. This can result in a NULL pointer dereference if client->ops is NULL.
Fix by adding the missing client->ops check in both the teardown and teardown_late labels.
--- drivers/gpu/host1x/bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/host1x/bus.c +2 -2
@@ -226,7 +226,7 @@ int host1x_device_init(struct host1x_device *device) teardown:list_for_each_entry_continue_reverse (client, &device->clients, list) -if (client->ops->exit) +if (client->ops && client->ops->exit) client->ops->exit (client);/* reset client to end of list for late teardown */
@@ -234,7 +234,7 @@ int host1x_device_init(struct host1x_device *device) teardown_late:list_for_each_entry_continue_reverse (client, &device->clients, list) -if (client->ops->late_exit) +if (client->ops && client->ops->late_exit) client->ops->late_exit (client);mutex_unlock (&device->clients_lock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 134/1193 scripts: modpost: detect and report truncated buf_printf() output
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Courbot <[email protected]>
[ Upstream commit d7231d8cb262b1e350c00271bf53d54414b4f3b1 ]
buf_printf() uses a fixed-size stack buffer. vsnprintf() returns the number of bytes that *would* have been written to that buffer, which can be larger than the size of said buffer if the formatted string is too long.
The problem is that whenever this happens buf_printf() currently passes this length, unchecked, to buf_write(), which silently reads past the stack buffer and copies invalid data into the output buffer.
Fix this by detecting vsnprintf() failures and truncations before appending to the output buffer, and report a fatal error instead of producing corrupt symbol names.
--- scripts/mod/modpost.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
scripts/mod/modpost.c +10 -1
@@ -1730,8 +1730,17 @@ void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf,va_start (ap, fmt); len =vsnprintf (tmp,SZ , fmt, ap); -buf_write (buf, tmp, len);va_end (ap); + +if (len <0 ) { +perror ("vsnprintf failed" ); +exit (1 ); + } +if (len >=SZ ) +fatal ("buf_printf output truncated for string %s: %d bytes needed, %d available\n" , + tmp, len +1 ,SZ ); + +buf_write (buf, tmp, len); }void buf_write (struct buffer *buf,const char *s,int len)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 135/1193 drm/nouveau/gsp: add SEC2 to GA100 chip table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
[ Upstream commit 604d0efb17cc0dd197e089134736ac2698d5fca7 ]
The booter-load and booter-unload firmware run on the SEC2 falcon. During tu102_gsp_oneinit(), the booter constructor needs device->sec2 to access the SEC2 falcon.
Without the .sec2 entry, device->sec2 is NULL and this dereference crashes during GSP-RM boot.
--- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +1 -0
@@ -2591,6 +2591,7 @@ nv170_chipset = { .vfn = { 0x00000001, ga100_vfn_new }, .ce = { 0x000003ff, ga100_ce_new }, .fifo = { 0x00000001, ga100_fifo_new }, + .sec2 = { 0x00000001, tu102_sec2_new }, }; static const struct nvkm_device_chip
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 136/1193 ASoC: Intel: catpt: Complete coredump handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 7e5d59f407bc39d43b350cc45f7880647429eb5d ]
An exception may occur during the firmware booting procedure. In such case the firmware sends COREDUMP_REQUESTS and expects the driver to dump relevant information and finish with the COREDUMP_RELEASE write.
To distinguish such situation from generic timeout, always signal fw_ready completion when a coredump request is received and translate it to -EREMOTEIO in catpt_boot_firmware().
The "FW READY" print makes the success clearly visible even when the event-traces are not enabled.
--- sound/soc/intel/catpt/ipc.c | 8 ++++++++ sound/soc/intel/catpt/loader.c | 3 +++ sound/soc/intel/catpt/registers.h | 12 ++++++++++++ 3 files changed, 23 insertions(+)
sound/soc/intel/catpt/ipc.c +8 -0
@@ -205,6 +205,7 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)memcpy_fromio (&config, cdev->lpe_ba + off,sizeof (config));trace_catpt_ipc_payload ((u8 *)&config,sizeof (config)); +dev_dbg (cdev->dev,"FW READY 0x%08x\n" , header);catpt_ipc_arm (ipc, &config);complete (&cdev->fw_ready);return ;
@@ -215,6 +216,13 @@ static void catpt_dsp_process_response(struct catpt_dev *cdev, u32 header)dev_err (cdev->dev,"ADSP device coredump received\n" ); ipc->ready = false;catpt_coredump (cdev); + +if (catpt_readl_dram (cdev,COREDUMP ) ==CATPT_COREDUMP_REQUEST ) { +dev_dbg (cdev->dev,"releasing firmware from the coredump state\n" ); +catpt_writel_dram (cdev,COREDUMP ,CATPT_COREDUMP_RELEASE ); + } + +complete (&cdev->fw_ready);/* TODO: attempt recovery */ break ;
sound/soc/intel/catpt/loader.c +3 -0
@@ -626,6 +626,9 @@ int catpt_boot_firmware(struct catpt_dev *cdev, bool restore)if (!ret) {dev_err (cdev->dev,"firmware ready timeout\n" );return -ETIMEDOUT ; +/* Wake up does not mean FW is ready, an exception could occur. */ + }else if (!cdev->ipc.ready) { +return -EREMOTEIO ; }/* update sram pg & clock once done booting */
sound/soc/intel/catpt/registers.h +12 -0
@@ -124,6 +124,11 @@#define CATPT_SSCR2_DEFAULT 0x0#define CATPT_SSPSP2_DEFAULT 0x0 +/* Coredump register and its states */ +#define CATPT_DRAM_COREDUMP 0x1F4 +#define CATPT_COREDUMP_REQUEST UINT_MAX +#define CATPT_COREDUMP_RELEASE 0 +/* Physically the same block, access address differs between host and dsp */ #define CATPT_DSP_DRAM_OFFSET 0x400000#define catpt_to_host_offset (offset) ((offset) & ~(CATPT_DSP_DRAM_OFFSET))
@@ -137,6 +142,8 @@/* registry I/O helpers */ +#define catpt_dram_addr (cdev) \ + ((cdev)->lpe_ba + (cdev)->spec->host_dram_offset)#define catpt_shim_addr (cdev) \ ((cdev)->lpe_ba + (cdev)->spec->host_shim_offset)#define catpt_dma_addr (cdev, dma) \
@@ -151,6 +158,11 @@#define catpt_writel_ssp (cdev, ssp, reg, val) \ writel(val, catpt_ssp_addr(cdev, ssp) + (reg)) +#define catpt_readl_dram (cdev, reg) \ + readl(catpt_dram_addr(cdev) + CATPT_DRAM_##reg) +#define catpt_writel_dram (cdev, reg, val) \ + writel(val, catpt_dram_addr(cdev) + CATPT_DRAM_##reg) +#define catpt_readl_shim (cdev, reg) \ readl(catpt_shim_addr(cdev) + CATPT_SHIM_##reg)#define catpt_writel_shim (cdev, reg, val) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 137/1193 libbpf: Add __NR_bpf definition for LoongArch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
[ Upstream commit a4a5d4ee061240a1d39053db0a87f841d43277c0 ]
LoongArch uses the generic syscall table, where __NR_bpf is defined as 280 in include/uapi/asm-generic/unistd.h.
To align with other architectures, add the __NR_bpf definition for LoongArch to avoid a potential compilation failure: "error __NR_bpf not defined. libbpf does not support your arch."
This is a follow up patch of:
commit b0c47807d31d ("bpf: Add sparc support to tools and samples.") commit bad1926dd2f6 ("bpf, s390: fix build for libbpf and selftest suite") commit ca31ca8247e2 ("tools/bpf: fix perf build error with uClibc (seen on ARC)") commit e32cb12ff52a ("bpf, mips: Fix build errors about __NR_bpf undeclared")
--- tools/build/feature/test-bpf.c | 2 ++ tools/lib/bpf/bpf.c | 2 ++ 2 files changed, 4 insertions(+)
tools/build/feature/test-bpf.c +2 -0
@@ -20,6 +20,8 @@# define __NR_bpf 6319# elif defined(__mips__) && defined(_ABI64)# define __NR_bpf 5315 +# elif defined(__loongarch__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
tools/lib/bpf/bpf.c +2 -0
@@ -59,6 +59,8 @@# define __NR_bpf 6319# elif defined(__mips__) && defined(_ABI64)# define __NR_bpf 5315 +# elif defined(__loongarch__) +# define __NR_bpf 280# else # error __NR_bpf not defined. libbpf does not support your arch.# endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 138/1193 soundwire: dmi-quirks: Disable ghost Realtek devices
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 4dab2b904414fac53535c4e4cdad808132f4cdc2 ]
Many systems ship with a Realtek audio codec in the ACPI that doesn't physically exist in the system. This confuses the newer function topology system that creates the soundcard, as it builds the card based on the ACPI information.
Whilst we are working with the laptop vendors to try and stop this happening there are quite a few systems where this has shipped. Add a quirk to disable this "ghost" device.
Currently this patch should cover:
- Asus UX5406AA
- Lenovo Yoga Pro 9i (83SF)
- Lenovo Yoga Slim 7 Ultra (83QK)
--- drivers/soundwire/dmi-quirks.c | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
drivers/soundwire/dmi-quirks.c +35 -0
@@ -90,6 +90,19 @@ static const struct adr_remap intel_rooks_county[] = { {} }; +/* +* Many platforms have ghost realtek devices in the ACPI that don't physically +* exist, remove those devices. +*/ +static const struct adr_remap ghost_realtek[] = { +/* rt722 on link3 */ + { +0x000330025d072201ull , +0x0000000000000000ull + }, + {} +}; +static const struct dmi_system_id adr_remap_quirk_table[] = {/* TGL devices */ {
@@ -164,6 +177,28 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { }, .driver_data = (void *)hp_omen_16, }, +/* PTL devices */ + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), + DMI_MATCH(DMI_BOARD_NAME, "UX5406AA"), + }, + .driver_data = (void *)ghost_realtek, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83QK"), + }, + .driver_data = (void *)ghost_realtek, + }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "83SF"), + }, + .driver_data = (void *)ghost_realtek, + }, {} };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 139/1193 gfs2: page poisoning fix
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 4982e58669b11c43644efb5fb7435975848b716e ]
Processes can write to the last page of a file using mmap, and when the file size is not a multiple of the page size, this can be used to write beyond the end of the file. This is sometimes referred to as page poisoning, and it is not a problem in itself because the data beyond eof will be ignored. However, we currently fail to clear out any space beyond the end of the file that we skip over when the file size is increased, so that "poison" can end up getting exposed. Fix that.
Fixes xfstest generic/363.
--- fs/gfs2/bmap.c | 19 +++++++++++++++++++ fs/gfs2/bmap.h | 1 + fs/gfs2/file.c | 10 ++++++++++ 3 files changed, 30 insertions(+)
fs/gfs2/bmap.c +19 -0
@@ -1317,6 +1317,19 @@ static int gfs2_block_zero_range(struct inode *inode, loff_t from,return iomap_zero_range (inode, from, length,NULL , &gfs2_iomap_ops); } +int gfs2_clear_beyond_eof (struct inode *inode,loff_t end) +{ +loff_t isize =i_size_read (inode); +unsigned int len = isize & ~PAGE_MASK ; + +if (!len || isize >= end) +return 0 ; + len =PAGE_SIZE - len; +if (end - isize < len) + len = end - isize; +return gfs2_block_zero_range (inode, isize, len); +} +#define GFS2_JTRUNC_REVOKES 8192/**
@@ -2092,6 +2105,12 @@ static int do_grow(struct inode *inode, u64 size) unstuff =1 ; } +if (!unstuff) { + error =gfs2_clear_beyond_eof (inode, size); +if (error) + goto do_grow_qunlock; + } + error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT + (unstuff && gfs2_is_jdata(ip) ? RES_JDATA : 0) +
fs/gfs2/bmap.h +1 -0
@@ -57,6 +57,7 @@ int gfs2_get_extent(struct inode *inode, u64 lblock, u64 *dblock, unsigned int *extlen);int gfs2_alloc_extent (struct inode *inode,u64 lblock,u64 *dblock,unsigned *extlen,bool *new); +int gfs2_clear_beyond_eof (struct inode *inode,loff_t end);int gfs2_setattr_size (struct inode *inode,u64 size);int gfs2_truncatei_resume (struct gfs2_inode *ip);int gfs2_file_dealloc (struct gfs2_inode *ip);
fs/gfs2/file.c +10 -0
@@ -1056,6 +1056,10 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb, goto out_unlock; } + ret =gfs2_clear_beyond_eof (inode, iocb->ki_pos); +if (ret) + goto out_unlock; +pagefault_disable (); ret =iomap_file_buffered_write (iocb, from, &gfs2_iomap_ops);pagefault_enable ();
@@ -1258,6 +1262,12 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t next = (next +1 ) << sdp->sd_sb.sb_bsize_shift; +if (!(mode &FALLOC_FL_KEEP_SIZE )) { + error =gfs2_clear_beyond_eof (inode, offset + len); +if (error) +return error; + } + offset &= bsize_mask; len = next - offset;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 140/1193 soundwire: only handle alert events when the peripheral is attached
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 38cd651ebce7065a81c7e950d9e2ea1572304605 ]
It doesn't make sense to handle an alert event when the peripheral is not attached. The slave->status could be SDW_SLAVE_ATTACHED or SDW_SLAVE_ALERT when it is attached on the bus.
--- drivers/soundwire/bus.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soundwire/bus.c +4 -0
@@ -1923,6 +1923,10 @@ int sdw_handle_slave_status(struct sdw_bus *bus,break ;case SDW_SLAVE_ALERT : +if (slave->status !=SDW_SLAVE_ATTACHED && + slave->status !=SDW_SLAVE_ALERT ) +continue ; + ret =sdw_handle_slave_alerts (slave);if (ret <0 ) dev_err(&slave->dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 141/1193 mmc: davinci: fix mmc_add_host order in probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Osama Abdelkader <[email protected]>
[ Upstream commit d04e0151d316edbdb4f0397a9b92a1936e4a1421 ]
mmc_add_host() makes the host visible to the MMC core. Register the interrupt handlers and advertise MMC_CAP_SDIO_IRQ before that, so the core cannot start using the host before IRQ handling is set up.
--- drivers/mmc/host/davinci_mmc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/mmc/host/davinci_mmc.c +5 -7
@@ -1302,14 +1302,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) goto cpu_freq_fail; } - ret =mmc_add_host (mmc); -if (ret <0 ) - goto mmc_add_host_fail; - ret =devm_request_irq (&pdev->dev, irq, mmc_davinci_irq,0 ,mmc_hostname (mmc), host);if (ret) - goto request_irq_fail; + goto mmc_add_host_fail;if (host->sdio_irq >=0 ) { ret = devm_request_irq(&pdev->dev, host->sdio_irq,
@@ -1319,6 +1315,10 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) mmc->caps |=MMC_CAP_SDIO_IRQ ; } + ret =mmc_add_host (mmc); +if (ret <0 ) + goto mmc_add_host_fail; +rename_region (mem,mmc_hostname (mmc)); dev_info(mmc_dev(host->mmc), "Using %s, %d-bit mode\n",
@@ -1327,8 +1327,6 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)return 0 ; -request_irq_fail: -mmc_remove_host (mmc); mmc_add_host_fail:mmc_davinci_cpufreq_deregister (host); cpu_freq_fail:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 142/1193 mmc: renesas_sdhi: Add OF entry for RZ/G2N SoC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 5ce500d31a1625d8fe7ede950201b8df076bdd48 ]
The RZ/G2N (R8A774B1) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2N is identical with the R-Car M3-N (R8A77965), it requires the specific quirks and configuration defined in of_r8a77965_compatible rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774b1" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -277,6 +277,7 @@ static const struct renesas_sdhi_of_data_with_quirks of_rza2_compatible = {static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = { { .compatible ="renesas,sdhi-r7s9210" , .data = &of_rza2_compatible, }, { .compatible ="renesas,sdhi-mmc-r8a77470" , .data = &of_rcar_gen3_compatible, }, + { .compatible ="renesas,sdhi-r8a774b1" , .data = &of_r8a77965_compatible, }, { .compatible ="renesas,sdhi-r8a774e1" , .data = &of_r8a7795_compatible, }, { .compatible ="renesas,sdhi-r8a7795" , .data = &of_r8a7795_compatible, }, { .compatible ="renesas,sdhi-r8a77961" , .data = &of_r8a77961_compatible, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 143/1193 tracing: Disable KCOV instrumentation for trace_irqsoff.o
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 01046072880b654dbadf71be2f645aad4a7b5d87 ]
When KCOV runs its boot selftest with whole-kernel instrumentation enabled, it sets current->kcov_mode to KCOV_MODE_TRACE_PC without installing a coverage area. Any instrumented code accepted as task-context coverage in that window dereferences current->kcov_area and crashes.
On ARMv5 Versatile PB with CONFIG_KCOV_SELFTEST=y, CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_IRQSOFF_TRACER=y, boot hits a NULL pointer fault during the selftest:
kcov: running self test
Internal error: Oops: 5 [#1] ARM PC is at __sanitizer_cov_trace_pc+0x4c/0x90 Kernel panic - not syncing: Fatal exception
A diagnostic run showed the unwanted coverage comes from the IRQs-off tracer callbacks reached from ARM IRQ entry before hardirq context is visible to KCOV:
__sanitizer_cov_trace_pc from tracer_hardirqs_off+0x18/0x1cc tracer_hardirqs_off from trace_hardirqs_off+0x34/0x54 trace_hardirqs_off from __irq_svc+0x58/0xb0 __irq_svc from kcov_init+0x7c/0xdc
and similarly through tracer_hardirqs_on().
trace_preemptirq.o is already excluded because this tracing path can run from early interrupt code and produce coverage unrelated to syscall inputs. Exclude trace_irqsoff.o as well, instead of requiring users to turn off CONFIG_KCOV_INSTRUMENT_ALL=y, which is the default whole-kernel KCOV mode.
With the exclusion in place, the same ARMv5 Versatile PB QEMU test boots through the KCOV selftest and reaches userspace.
Tested on ARMv5 Versatile PB QEMU with CONFIG_KCOV_SELFTEST=y, CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_IRQSOFF_TRACER=y.
--- kernel/trace/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/trace/Makefile +3 -2
@@ -31,9 +31,10 @@ ifdef CONFIG_GCOV_PROFILE_FTRACE GCOV_PROFILE := y endif -# Functions in this file could be invoked from early interrupt -# code and produce random code coverage. +# Functions in these files can run from IRQ entry before hardirq context +# is visible to KCOV, and produce coverage unrelated to syscall inputs. KCOV_INSTRUMENT_trace_preemptirq.o := n +KCOV_INSTRUMENT_trace_irqsoff.o := n CFLAGS_bpf_trace.o := -I$(src)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 144/1193 mmc: renesas_sdhi: Add OF entry for RZ/G2E SoC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ebf7f2198ac4817bd2929cf83c697cefa8bf36a9 ]
The RZ/G2E (R8A774C0) SoC was previously handled via the generic "renesas,rcar-gen3-sdhi" fallback compatible string. However, because the SDHI IP on RZ/G2E is identical with the R-Car E3 (R8A77990), it requires the specific quirks and configuration defined in of_r8a77990_compatible rather than the generic Gen3 data.
Add the explicit "renesas,sdhi-r8a774c0" match entry to map it correctly. Note that the DT binding file renesas,sdhi.yaml does not need an update as the entry for this SoC is already present.
--- drivers/mmc/host/renesas_sdhi_internal_dmac.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/renesas_sdhi_internal_dmac.c +1 -0
@@ -278,6 +278,7 @@ static const struct of_device_id renesas_sdhi_internal_dmac_of_match[] = { { .compatible = "renesas,sdhi-r7s9210", .data = &of_rza2_compatible, }, { .compatible = "renesas,sdhi-mmc-r8a77470", .data = &of_rcar_gen3_compatible, }, { .compatible = "renesas,sdhi-r8a774b1", .data = &of_r8a77965_compatible, }, + { .compatible = "renesas,sdhi-r8a774c0", .data = &of_r8a77990_compatible, }, { .compatible = "renesas,sdhi-r8a774e1", .data = &of_r8a7795_compatible, }, { .compatible = "renesas,sdhi-r8a7795", .data = &of_r8a7795_compatible, }, { .compatible = "renesas,sdhi-r8a77961", .data = &of_r8a77961_compatible, },
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 145/1193 iio: light: stk3310: Deal with the ps interrupt issue in PM
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miao Li <[email protected]>
[ Upstream commit 9c1d639e90cf42f5c1401f91f38ffd89af6dd970 ]
On the Inspur HS326 laptop(which integrated with HiSilicon M900 processor), if the STK3311-X chip's PS interrupt is configured in "Recommended interrupt mode", the interrupt cannot be triggered normally after waking from suspend or hibernation.
In this case, neither disabling and re-enabling the interrupt nor resetting the PS threshold register can restore the interrupt to normal operation.
If the interrupt is disabled in suspend() then reset the PS threshold register and enable the interrupt in resume(). This resolves the issue.
--- drivers/iio/light/stk3310.c | 76 +++++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 7 deletions(-)
drivers/iio/light/stk3310.c +69 -7
@@ -106,6 +106,9 @@ struct stk3310_data {struct mutex lock;bool als_enabled;bool ps_enabled; +bool ps_int_enabled; +uint32_t ps_thdl; +uint32_t ps_thdh;uint32_t ps_near_level;u64 timestamp;struct regmap *regmap;
@@ -275,10 +278,17 @@ static int stk3310_write_event(struct iio_dev *indio_dev, buf =cpu_to_be16 (val); ret =regmap_bulk_write (data->regmap, reg, &buf,2 ); -if (ret <0 ) +if (ret <0 ) {dev_err (&client->dev,"failed to set PS threshold!\n" ); +return ret; + } -return ret; +if (reg ==STK3310_REG_THDH_PS ) + data->ps_thdh = val; +else + data->ps_thdl = val; + +return 0 ; } static int stk3310_read_event_config(struct iio_dev *indio_dev,
@@ -313,11 +323,17 @@ static int stk3310_write_event_config(struct iio_dev *indio_dev,/* Set INT_PS value */ mutex_lock (&data->lock); ret =regmap_field_write (data->reg_int_ps, state); -if (ret <0 ) +if (ret <0 ) {dev_err (&client->dev,"failed to set interrupt mode\n" ); +mutex_unlock (&data->lock); +return ret; + } + + data->ps_int_enabled = state; +mutex_unlock (&data->lock); -return ret; +return 0 ; } static int stk3310_read_raw(struct iio_dev *indio_dev,
@@ -490,10 +506,15 @@ static int stk3310_init(struct iio_dev *indio_dev)/* Enable PS interrupts */ ret =regmap_field_write (data->reg_int_ps,STK3310_PSINT_EN ); -if (ret <0 ) +if (ret <0 ) {dev_err (&client->dev,"failed to enable interrupts!\n" ); +return ret; + } -return ret; + data->ps_int_enabled = true; + data->ps_thdh =STK3310_PS_MAX_VAL ; + +return 0 ; }static bool stk3310_is_volatile_reg (struct device *dev,unsigned int reg)
@@ -659,9 +680,18 @@ static void stk3310_remove(struct i2c_client *client)static int stk3310_suspend (struct device *dev) {struct stk3310_data *data; +int ret; data =iio_priv (i2c_get_clientdata (to_i2c_client (dev))); +if (data->ps_int_enabled) { + ret =regmap_field_write (data->reg_int_ps,0x0 ); +if (ret <0 ) { +dev_err (dev,"failed to disable ps int at suspend.\n" ); +return ret; + } + } +return stk3310_set_state (data,STK3310_STATE_STANDBY ); }
@@ -669,6 +699,8 @@ static int stk3310_resume(struct device *dev) {u8 state =0 ;struct stk3310_data *data; +__be16 buf; +int ret; data =iio_priv (i2c_get_clientdata (to_i2c_client (dev)));if (data->ps_enabled)
@@ -676,7 +708,37 @@ static int stk3310_resume(struct device *dev)if (data->als_enabled) state |=STK3310_STATE_EN_ALS ; -return stk3310_set_state (data, state); + ret =stk3310_set_state (data, state); +if (ret <0 ) +return ret; + +if (data->ps_thdl !=0x0 ) { + buf =cpu_to_be16 (data->ps_thdl); + ret =regmap_bulk_write (data->regmap,STK3310_REG_THDL_PS , &buf,2 ); +if (ret <0 ) { +dev_err (dev,"failed to set reg THDL_PS at resume.\n" ); +return ret; + } + } + +if (data->ps_thdh !=STK3310_PS_MAX_VAL ) { + buf =cpu_to_be16 (data->ps_thdh); + ret =regmap_bulk_write (data->regmap,STK3310_REG_THDH_PS , &buf,2 ); +if (ret <0 ) { +dev_err (dev,"failed to set reg THDH_PS at resume.\n" ); +return ret; + } + } + +if (data->ps_int_enabled) { + ret =regmap_field_write (data->reg_int_ps,STK3310_PSINT_EN ); +if (ret <0 ) { +dev_err (dev,"failed to enable ps int at resume.\n" ); +return ret; + } + } + +return 0 ; } static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 146/1193 perf/ftrace: Fix WARNING in __unregister_ftrace_function
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <[email protected]>
[ Upstream commit 9581123304b23049437324038698af9fb56ee663 ]
perf_ftrace_function_unregister() unconditionally calls unregister_ftrace_function() without checking whether the ftrace_ops was ever successfully registered. This triggers a WARN_ON in __unregister_ftrace_function() when the ops doesn't have FTRACE_OPS_FL_ENABLED set.
This can happen during perf_event_alloc() error cleanup when perf_trace_destroy() is called via __free_event() on an event whose ftrace_ops registration failed or was already torn down by perf_try_init_event()'s err_destroy path.
The call path is:
perf_event_alloc() error cleanup
-> __free_event()
-> event->destroy() [tp_perf_event_destroy]
-> perf_trace_destroy()
-> perf_trace_event_close()
-> TRACE_REG_PERF_CLOSE
-> perf_ftrace_function_unregister()
-> unregister_ftrace_function()
-> __unregister_ftrace_function()
-> WARN_ON(!(ops->flags & FTRACE_OPS_FL_ENABLED))Fix this by checking FTRACE_OPS_FL_ENABLED before attempting to unregister. If the ops is not enabled, just free the filter and return success.
--- kernel/trace/trace_event_perf.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
kernel/trace/trace_event_perf.c +11 -1
@@ -497,7 +497,17 @@ static int perf_ftrace_function_register(struct perf_event *event)static int perf_ftrace_function_unregister (struct perf_event *event) {struct ftrace_ops *ops = &event->ftrace_ops; -int ret =unregister_ftrace_function (ops); +int ret =0 ; + +/* +* Perf will call this unconditionally even if the ops is not +* enabled. The unregister_ftrace_function() will warn if called +* when not enabled. Just bypass the unregistering if ops isn't +* enabled here. +*/ +if (ops->flags &FTRACE_OPS_FL_ENABLED ) + ret =unregister_ftrace_function (ops); +ftrace_free_filter (ops);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 147/1193 iio: accel: mma8452: switch to non-devm request_threaded_irq()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanjay Chitroda <[email protected]>
[ Upstream commit 0a6726ec20cd4c0101f2de0ca485a11676224dea ]
Avoid using devm_request_threaded_irq() as the driver requires explicit error-handling path(s). Using devm_* API together with goto-based unwinding breaks the expected LIFO resource release model.
Add explicit IRQ cleanup in the driver teardown paths to follow kernel resource management conventions.
--- drivers/iio/accel/mma8452.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/iio/accel/mma8452.c +12 -7
@@ -1695,18 +1695,16 @@ static int mma8452_probe(struct i2c_client *client) goto trigger_cleanup;if (client->irq) { - ret =devm_request_threaded_irq (&client->dev, - client->irq, -NULL , mma8452_interrupt, -IRQF_TRIGGER_LOW |IRQF_ONESHOT , - client->name, indio_dev); + ret =request_threaded_irq (client->irq,NULL , mma8452_interrupt, +IRQF_TRIGGER_LOW |IRQF_ONESHOT , + client->name, indio_dev);if (ret) goto buffer_cleanup; } ret =pm_runtime_set_active (&client->dev);if (ret <0 ) - goto buffer_cleanup; + goto free_irq;pm_runtime_enable (&client->dev); pm_runtime_set_autosuspend_delay(&client->dev,
@@ -1715,7 +1713,7 @@ static int mma8452_probe(struct i2c_client *client) ret =iio_device_register (indio_dev);if (ret <0 ) - goto buffer_cleanup; + goto free_irq; ret =mma8452_set_freefall_mode (data, false);if (ret <0 )
@@ -1726,6 +1724,10 @@ static int mma8452_probe(struct i2c_client *client) unregister_device:iio_device_unregister (indio_dev); +free_irq: +if (client->irq) +free_irq (client->irq, indio_dev); + buffer_cleanup:iio_triggered_buffer_cleanup (indio_dev);
@@ -1751,6 +1753,9 @@ static void mma8452_remove(struct i2c_client *client)pm_runtime_disable (&client->dev);pm_runtime_set_suspended (&client->dev); +if (client->irq) +free_irq (client->irq, indio_dev); +iio_triggered_buffer_cleanup (indio_dev);mma8452_trigger_cleanup (indio_dev);mma8452_standby (iio_priv (indio_dev));
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 148/1193 libbpf: Also reset {insn,data}_cur on realloc failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit d2f7bd066ed492aeaf82864fbf1f06770f9d9f9d ]
realloc_insn_buf() as well as realloc_data_buf() free and NULL gen->insn_start / gen->data_start on -ENOMEM but leave gen->insn_cur / gen->data_cur pointing into the old, freed buffer. Just reset the cursors to NULL alongside the base pointers so the freed state is coherent.
--- tools/lib/bpf/gen_loader.c | 2 ++ 1 file changed, 2 insertions(+)
tools/lib/bpf/gen_loader.c +2 -0
@@ -63,6 +63,7 @@ static int realloc_insn_buf(struct bpf_gen *gen, __u32 size) gen->error = -ENOMEM ;free (gen->insn_start); gen->insn_start =NULL ; + gen->insn_cur =NULL ;return -ENOMEM ; } gen->insn_start = insn_start;
@@ -86,6 +87,7 @@ static int realloc_data_buf(struct bpf_gen *gen, __u32 size) gen->error = -ENOMEM ;free (gen->data_start); gen->data_start =NULL ; + gen->data_cur =NULL ;return -ENOMEM ; } gen->data_start = data_start;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 149/1193 net: ibm: emac: Reserve VLAN header in MJS limit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 0906c117f81c2ae6e6dbfa82719f79c75e1c9325 ]
The IBM EMAC programs its Maximum Jumbo Size (MJS) drop threshold from ndev->mtu directly. The hardware sizes the threshold against the L2 frame minus the ethernet header, but does not discount the 802.1Q tag, so a frame carrying a VLAN tag and a full 1500-byte payload exceeds MJS by exactly 4 bytes and is dropped.
This is normally hidden because JPSM (and therefore the MJS check) only engages when the MTU is raised above ETH_DATA_LEN. With the qca8k DSA tagger the conduit MTU is bumped by QCA_HDR_LEN to 1502 during dsa_conduit_setup(), which is enough to enable JPSM and expose the off-by-VLAN-tag in the limit.
Pad MJS by VLAN_HLEN so a VLAN-tagged full-MTU frame passes.
Reported on Meraki MX60 (qca8k switch): tagged VLAN traffic drops at 1500-byte payload, while 1496 bytes works and untagged 1500 bytes works.
--- drivers/net/ethernet/ibm/emac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ibm/emac/core.c +2 -1
@@ -30,6 +30,7 @@#include <linux/skbuff.h> #include <linux/crc32.h> #include <linux/ethtool.h> +#include <linux/if_vlan.h> #include <linux/mii.h> #include <linux/bitops.h> #include <linux/workqueue.h>
@@ -466,7 +467,7 @@ static inline u32 emac_iff2rmr(struct net_device *ndev)if (emac_has_feature (dev,EMAC_APM821XX_REQ_JUMBO_FRAME_SIZE )) { r &= ~EMAC4_RMR_MJS_MASK ; - r |=EMAC4_RMR_MJS (ndev->mtu); + r |=EMAC4_RMR_MJS (ndev->mtu +VLAN_HLEN ); }return r;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 150/1193 wifi: ath11k: fix invalid data access in ath11k_dp_rx_h_undecap_nwifi
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqing Pan <[email protected]>
[ Upstream commit 6b471e9aefee9ed73278eb1141e0d8530a56fae9 ]
In certain cases, hardware might provide packets with a length greater than the maximum native Wi-Fi header length. This can lead to accessing and modifying fields in the header within the ath11k_dp_rx_h_undecap_nwifi() function for the DP_RX_DECAP_TYPE_NATIVE_WIFI decap type and potentially result in invalid data access and memory corruption.
Kernel stack is corrupted in: ath11k_dp_rx_h_undecap+0x6b0/0x6b0 [ath11k]
Call trace: ath11k_dp_rx_h_mpdu+0x0/0x2e8 [ath11k] ath11k_dp_rx_h_mpdu+0x1e0/0x2e8 [ath11k] ath11k_dp_rx_wbm_err+0x1e0/0x450 [ath11k] ath11k_dp_rx_process_wbm_err+0x2fc/0x460 [ath11k] ath11k_dp_service_srng+0x2e0/0x348 [ath11k]
Add a sanity check before processing the SKB to prevent invalid data access in the undecap native Wi-Fi function for the DP_RX_DECAP_TYPE_NATIVE_WIFI decap type.
This adapted from the discussion/patch of the ath12k driver [1].
Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04685-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 50 +++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +47 -3
@@ -2504,6 +2504,29 @@ static void ath11k_dp_rx_deliver_msdu(struct ath11k *ar, struct napi_struct *napieee80211_rx_napi (ar->hw, pubsta, msdu, napi); } +static bool ath11k_dp_rx_check_nwifi_hdr_len_valid (struct ath11k_base *ab, +struct hal_rx_desc *rx_desc, +struct sk_buff *msdu) +{ +struct ieee80211_hdr *hdr; +u8 decap_type; +u32 hdr_len; + + decap_type =ath11k_dp_rx_h_msdu_start_decap_type (ab, rx_desc); +if (decap_type !=DP_RX_DECAP_TYPE_NATIVE_WIFI ) +return true; + + hdr = (struct ieee80211_hdr *)msdu->data; + hdr_len =ieee80211_hdrlen (hdr->frame_control); + +if (likely (hdr_len <=DP_MAX_NWIFI_HDR_LEN )) +return true; + + ab->soc_stats.invalid_rbm++; +WARN_ON_ONCE (1 ); +return false; +} + static int ath11k_dp_rx_process_msdu(struct ath11k *ar, struct sk_buff *msdu, struct sk_buff_head *msdu_list,
@@ -2574,6 +2597,11 @@ static int ath11k_dp_rx_process_msdu(struct ath11k *ar, } } +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ab, rx_desc, msdu))) { + ret = -EINVAL ; + goto free_out; + } +ath11k_dp_rx_h_ppdu (ar, rx_desc, rx_status);ath11k_dp_rx_h_mpdu (ar, msdu, rx_desc, rx_status);
@@ -3314,6 +3342,12 @@ static int ath11k_dp_rx_h_verify_tkip_mic(struct ath11k *ar, struct ath11k_peerRX_FLAG_IV_STRIPPED |RX_FLAG_DECRYPTED ;skb_pull (msdu, hal_rx_desc_sz); +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ar->ab, rx_desc, + msdu))) { +dev_kfree_skb_any (msdu); +return -EINVAL ; + } +ath11k_dp_rx_h_ppdu (ar, rx_desc, rxs);ath11k_dp_rx_h_undecap (ar, msdu, rx_desc,HAL_ENCRYPT_TYPE_TKIP_MIC , rxs, true);
@@ -4006,6 +4040,10 @@ static int ath11k_dp_rx_h_null_q_desc(struct ath11k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); } + +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ar->ab, desc, msdu))) +return -EINVAL ; +ath11k_dp_rx_h_ppdu (ar, desc, status);ath11k_dp_rx_h_mpdu (ar, msdu, desc, status);
@@ -4050,7 +4088,7 @@ static bool ath11k_dp_rx_h_reo_err(struct ath11k *ar, struct sk_buff *msdu,return drop; } -static void ath11k_dp_rx_h_tkip_mic_err (struct ath11k *ar,struct sk_buff *msdu, +static bool ath11k_dp_rx_h_tkip_mic_err (struct ath11k *ar,struct sk_buff *msdu,struct ieee80211_rx_status *status) {u16 msdu_len;
@@ -4058,6 +4096,7 @@ static void ath11k_dp_rx_h_tkip_mic_err(struct ath11k *ar, struct sk_buff *msdu,u8 l3pad_bytes;struct ath11k_skb_rxcb *rxcb =ATH11K_SKB_RXCB (msdu);u32 hal_rx_desc_sz = ar->ab->hw_params.hal_desc_sz; +struct ath11k_base *ab = ar->ab; rxcb->is_first_msdu =ath11k_dp_rx_h_msdu_end_first_msdu (ar->ab, desc); rxcb->is_last_msdu =ath11k_dp_rx_h_msdu_end_last_msdu (ar->ab, desc);
@@ -4067,6 +4106,9 @@ static void ath11k_dp_rx_h_tkip_mic_err(struct ath11k *ar, struct sk_buff *msdu,skb_put (msdu, hal_rx_desc_sz + l3pad_bytes + msdu_len);skb_pull (msdu, hal_rx_desc_sz + l3pad_bytes); +if (unlikely (!ath11k_dp_rx_check_nwifi_hdr_len_valid (ab, desc, msdu))) +return true; +ath11k_dp_rx_h_ppdu (ar, desc, status); status->flag |= (RX_FLAG_MMIC_STRIPPED | RX_FLAG_MMIC_ERROR |
@@ -4074,19 +4116,21 @@ static void ath11k_dp_rx_h_tkip_mic_err(struct ath11k *ar, struct sk_buff *msdu,ath11k_dp_rx_h_undecap (ar, msdu, desc,HAL_ENCRYPT_TYPE_TKIP_MIC , status, false); + +return false; }static bool ath11k_dp_rx_h_rxdma_err (struct ath11k *ar,struct sk_buff *msdu,struct ieee80211_rx_status *status) {struct ath11k_skb_rxcb *rxcb =ATH11K_SKB_RXCB (msdu); -bool drop = false; +bool drop; ar->ab->soc_stats.rxdma_error[rxcb->err_code]++;switch (rxcb->err_code) {case HAL_REO_ENTR_RING_RXDMA_ECODE_TKIP_MIC_ERR : -ath11k_dp_rx_h_tkip_mic_err (ar, msdu, status); + drop =ath11k_dp_rx_h_tkip_mic_err (ar, msdu, status);break ;default :/* TODO: Review other rxdma error code to check if anything is
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 151/1193 ASoC: qcom: q6apm: return error code to consumers on failures
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
[ Upstream commit 3075ae5abbc370d2a9a01bd6d554a412d406f5bd ]
Return errors from audioreach_set_media_format() to ensure callers are notified when media format setup fails.
This could hide failures while programming media format parameters for individual modules and allow graph setup to continue with incomplete configuration.
--- sound/soc/qcom/qdsp6/q6apm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/qcom/qdsp6/q6apm.c +5 -5
@@ -203,10 +203,7 @@ int q6apm_graph_media_format_shmem(struct q6apm_graph *graph,if (!module)return -ENODEV ; -audioreach_set_media_format (graph, module, cfg); - -return 0 ; - +return audioreach_set_media_format (graph, module, cfg); }EXPORT_SYMBOL_GPL (q6apm_graph_media_format_shmem);
@@ -371,6 +368,7 @@ int q6apm_graph_media_format_pcm(struct q6apm_graph *graph, struct audioreach_mostruct audioreach_sub_graph *sgs;struct audioreach_container *container;struct audioreach_module *module; +int ret;list_for_each_entry (sgs, &info->sg_list, node) {list_for_each_entry (container, &sgs->container_list, node) {
@@ -379,7 +377,9 @@ int q6apm_graph_media_format_pcm(struct q6apm_graph *graph, struct audioreach_mo (module->module_id == MODULE_ID_RD_SHARED_MEM_EP)) continue; -audioreach_set_media_format (graph, module, cfg); + ret =audioreach_set_media_format (graph, module, cfg); +if (ret) +return ret; } } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 152/1193 ASoC: codecs: pcm3168a: Drop CONFIG_PM-conditional preproc directive
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit eb7107264da8545ba7381a76818bae553e1fd1e4 ]
Revert changes done in commit 489db5d94150 ("ASoC: pcm3168a:
Don't disable pcm3168a when CONFIG_PM defined") and add pm_runtime_status_suspended() check.
The suspended-check addresses regulator's "unbalanced disables" warning during driver removal even when CONFIG_PM is enabled.
--- sound/soc/codecs/pcm3168a.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-)
sound/soc/codecs/pcm3168a.c +7 -13
@@ -820,15 +820,6 @@ int pcm3168a_probe(struct device *dev, struct regmap *regmap) }EXPORT_SYMBOL_GPL (pcm3168a_probe); -static void pcm3168a_disable (struct device *dev) -{ -struct pcm3168a_priv *pcm3168a =dev_get_drvdata (dev); - -regulator_bulk_disable (ARRAY_SIZE (pcm3168a->supplies), - pcm3168a->supplies); -clk_disable_unprepare (pcm3168a->scki); -} -void pcm3168a_remove (struct device *dev) {struct pcm3168a_priv *pcm3168a =dev_get_drvdata (dev);
@@ -840,10 +831,12 @@ void pcm3168a_remove(struct device *dev)* The asserted level of GPIO_ACTIVE_LOW is LOW. */ gpiod_set_value_cansleep (pcm3168a->gpio_rst,1 ); +pm_runtime_disable (dev); -#ifndef CONFIG_PM -pcm3168a_disable (dev); -#endif +if (!pm_runtime_status_suspended (dev)) { +regulator_bulk_disable (ARRAY_SIZE (pcm3168a->supplies), pcm3168a->supplies); +clk_disable_unprepare (pcm3168a->scki); + } }EXPORT_SYMBOL_GPL (pcm3168a_remove);
@@ -899,7 +892,8 @@ static int pcm3168a_rt_suspend(struct device *dev)regcache_cache_only (pcm3168a->regmap, true); -pcm3168a_disable (dev); +regulator_bulk_disable (ARRAY_SIZE (pcm3168a->supplies), pcm3168a->supplies); +clk_disable_unprepare (pcm3168a->scki);return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 153/1193 ata: ahci: fail probe if BAR too small for claimed ports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: liyouhong <[email protected]>
[ Upstream commit c4086c6e1af757e1ff26fa2d2926b3ec0195de79 ]
When an AHCI controller is disabled in BIOS, its HOST_CAP register may contain a bogus value, e.g. 0xFFFFFFFF.
Since CAP.NP (Number of Ports) is a zeroes based 5-bit register field, a value of 0x1f means 32 ports. If CAP.NP claims more ports than can physically fit within the mapped BAR region, accessing port registers beyond the BAR boundary causes a kernel panic.
Add validation in ahci_init_one() to check that the BAR size is sufficient for the number of ports claimed in CAP.NP. The check calculates the required MMIO size as:
required_size = 0x100 (global registers) + max_ports * 0x80
If required_size exceeds the actual BAR size, the probe fails with -ENODEV, preventing the panic and providing a clear error message.
--- drivers/ata/ahci.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/ata/ahci.c +22 -0
@@ -1852,6 +1852,24 @@ static ssize_t remapped_nvme_show(struct device *dev,static DEVICE_ATTR_RO (remapped_nvme); +static int ahci_validate_bar_size (struct pci_dev *pdev,int bar, +struct ahci_host_priv *hpriv) +{ +u32 cap =readl (hpriv->mmio +HOST_CAP ); +unsigned int max_ports =ahci_nr_ports (cap); +u32 last_port_end =0x100 + (max_ports *0x80 ); +resource_size_t bar_size =pci_resource_len (pdev, bar); + +if (last_port_end > bar_size) { +dev_warn (&pdev->dev, +"BAR%d too small for %u ports (last port ends at %#x, BAR %pa)\n" , + bar, max_ports, last_port_end, &bar_size); +return -ENODEV ; + } + +return 0 ; +} +static int ahci_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) {unsigned int board_id = ent->driver_data;
@@ -1954,6 +1972,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) hpriv->mmio =pcim_iomap_table (pdev)[ahci_pci_bar]; + rc =ahci_validate_bar_size (pdev, ahci_pci_bar, hpriv); +if (rc) +return rc; +/* detect remapped nvme devices */ ahci_remap_check (pdev, ahci_pci_bar, hpriv);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 154/1193 ACPI: PCI: Clear _DEP dependencies after PCI root bridge attach
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Pei <[email protected]>
[ Upstream commit 3a59c3b772e5dc0cedecce8e7fbf7c2d6245b643 ]
PCI root bridges enumerated by acpi_pci_root_add() can be the _DEP supplier for other ACPI consumers, most notably ACPI0017 CXL root devices whose probe path depends on acpi_pci_find_root() succeeding. Once the root bus has been added, those consumers can safely be enumerated, so notify them by clearing the dependency.
Call acpi_dev_clear_dependencies() at the end of acpi_pci_root_add(), after pci_bus_add_devices(), following the same pattern used by other ACPI suppliers such as the EC (drivers/acpi/ec.c) and the ACPI PCI Link device (drivers/acpi/pci_link.c). The clear is intentionally done only on the success path; on the error paths the supplier did not attach and consumers must keep dep_unmet set.
This is a prerequisite for honoring _DEP on ACPI0016 host bridges, which matters on architectures where the probe order of acpi_pci_root relative to cxl_acpi is not guaranteed (e.g. RISC-V).
--- drivers/acpi/pci_root.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/pci_root.c +4 -0
@@ -764,6 +764,10 @@ static int acpi_pci_root_add(struct acpi_device *device,pci_lock_rescan_remove ();pci_bus_add_devices (root->bus);pci_unlock_rescan_remove (); + +/* Clear _DEP dependencies to allow consumers to enumerate */ +acpi_dev_clear_dependencies (device); +return 1 ; remove_dmar:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 155/1193 net: qrtr: fix node refcount leak on ctrl packet alloc failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
[ Upstream commit 3b09ff54114566864eea59020f6b69c5bb325b9d ]
qrtr_send_resume_tx() calls qrtr_node_lookup() which takes a reference on the returned node. If the subsequent call to qrtr_alloc_ctrl_packet() fails due to memory allocation failure, the function returns -ENOMEM without calling qrtr_node_release() to release the node reference.
Add qrtr_node_release(node) before returning on the allocation failure path to properly release the reference.
--- net/qrtr/af_qrtr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/qrtr/af_qrtr.c +3 -1
@@ -1009,8 +1009,10 @@ static int qrtr_send_resume_tx(struct qrtr_cb *cb)return -EINVAL ; skb =qrtr_alloc_ctrl_packet (&pkt,GFP_KERNEL ); -if (!skb) +if (!skb) { +qrtr_node_release (node);return -ENOMEM ; + } pkt->cmd =cpu_to_le32 (QRTR_TYPE_RESUME_TX ); pkt->client.node =cpu_to_le32 (cb->dst_node);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 156/1193 net: wwan: t7xx: Add delay between MD and SAP suspend
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
[ Upstream commit ae733795e593272f67d607c09d2a00637ac13ed0 ]
SAP (Service Access Point) suspend occasionally times out with error -110 (ETIMEDOUT), followed by modem port errors and complete modem failure requiring a system reboot to recover.
Error symptoms:
mtk_t7xx 0000:72:00.0: [PM] SAP suspend error: -110 mtk_t7xx 0000:72:00.0: can't suspend (...returned -110) mtk_t7xx 0000:07:00.0: Failed to send skb: -22 mtk_t7xx 0000:07:00.0: Write error on MBIM port, -22
The modem firmware needs time after receiving the MD (modem) suspend request to complete internal operations before it is ready to accept the SAP suspend request. Without this delay, if runtime PM attempts to suspend while the firmware is busy, the SAP suspend command times out, leaving the modem in an unrecoverable state.
Root cause and userspace interaction:
ModemManager 1.24+ includes changes that reduce the likelihood of this issue by ensuring the modem is in a low-power state before the kernel attempts runtime suspend. However, the kernel driver should not depend on specific userspace behavior or ModemManager versions. Older versions (1.20-1.22) are still widely deployed, and the kernel should be robust regardless of userspace implementation details.
There appears to be no hardware status register or other mechanism available to query whether the firmware is ready for SAP suspend. A delay between the two suspend requests is the most reliable solution found through testing.
Add a 50ms delay between MD suspend and SAP suspend. This gives the firmware adequate time to complete internal operations without adding significant latency to the suspend path. This makes the driver robust across all ModemManager versions and system conditions.
Testing: 96+ hours of continuous operation with ModemManager 1.20.2 and Fibocom FM350-GL modem. Zero SAP suspend timeouts observed across 2000+ successful suspend/resume cycles. Previously failed within 24 hours with 100% reproducibility.
--- drivers/net/wwan/t7xx/t7xx_pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wwan/t7xx/t7xx_pci.c +3 -0
@@ -313,6 +313,9 @@ static int __t7xx_pci_pm_suspend(struct pci_dev *pdev) goto abort_suspend; } +/* Delay to prevent SAP suspend timeout */ +msleep (50 ); + ret =t7xx_send_pm_request (t7xx_dev,H2D_CH_SUSPEND_REQ_AP );if (ret) {t7xx_send_pm_request (t7xx_dev,H2D_CH_RESUME_REQ );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 157/1193 iommu/rockchip: disable fetch dte time limit
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Xue <[email protected]>
[ Upstream commit 8d4346ecd4950ae08cc76a6de327c264e846758c ]
Disable the Bit 31 of the AUTO_GATING iommu register, as it causes hangups with the RGA3 (Raster Graphics Acceleration 3) peripheral. The RGA3 register description of the TRM already states that the bit must be set to 1. The vendor kernel sets the bit unconditionally to 1 to fix VOP (Video Output Processor) screen black issues. This patch squashes the 2 vendor kernel commits with the following commit messages:
Master fetch data and cpu update page table may work in parallel, may have the following procedure:
master cpu
fetch dte update page tabl
| |
(make dte invalid) <- zap iotlb entry
| |
fetch dte again
(make dte invalid) <- zap iotlb entry
| |
fetch dte again
(make dte invalid) <- zap iotlb entry
| |
fetch dte again
(make iommu block) <- zap iotlb entry
New iommu version has the above bug, if fetch dte consecutively four times, then it will be blocked. Fortunately, we can set bit 31 of register MMU_AUTO_GATING to 1 to make it work as old version which does not have this issue.
This issue only appears on RV1126 so far, so make a workaround dedicated to "rockchip,rv1126" machine type.
iommu/rockchip: fix vop blocked and screen black on RK356X and RK3588
RK3568 and RK3588 has the same issue as RV1126/RV1109 that caused by dte fetch time limit, So we can set BIT(31) of register 0x24 default to 1 as a workaround.
--- drivers/iommu/rockchip-iommu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iommu/rockchip-iommu.c +8 -0
@@ -73,6 +73,8 @@#define SPAGE_ORDER 12#define SPAGE_SIZE (1 << SPAGE_ORDER) +#define DISABLE_FETCH_DTE_TIME_LIMIT BIT(31) +/* * Support mapping any size that fits in one page table: * 4 KiB to 4 MiB
@@ -924,6 +926,7 @@ static int rk_iommu_enable(struct rk_iommu *iommu)struct iommu_domain *domain = iommu->domain;struct rk_iommu_domain *rk_domain =to_rk_domain (domain);int ret, i; +u32 auto_gate; ret =clk_bulk_enable (iommu->num_clocks, iommu->clocks);if (ret)
@@ -942,6 +945,11 @@ static int rk_iommu_enable(struct rk_iommu *iommu) rk_ops->mk_dtentries(rk_domain->dt_dma));rk_iommu_base_command (iommu->bases[i],RK_MMU_CMD_ZAP_CACHE );rk_iommu_write (iommu->bases[i],RK_MMU_INT_MASK ,RK_MMU_IRQ_MASK ); + +/* Workaround for iommu blocked, BIT(31) default to 1 */ + auto_gate =rk_iommu_read (iommu->bases[i],RK_MMU_AUTO_GATING ); + auto_gate |=DISABLE_FETCH_DTE_TIME_LIMIT ; +rk_iommu_write (iommu->bases[i],RK_MMU_AUTO_GATING , auto_gate); } ret =rk_iommu_enable_paging (iommu);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 158/1193 fs/ntfs3: preserve non-DOS attribute bits in system.dos_attrib
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit b1c1101067d9536bcb0fe023b96ee2dde5535959 ]
[BUG]
A corrupted ntfs3 image can hit a NULL function pointer call in generic_perform_write() after toggling system.ntfs_attrib and then overwriting system.dos_attrib on the same file.
BUG: kernel NULL pointer dereference, address: 0000000000000000 \#PF: supervisor instruction fetch in kernel mode \#PF: error_code(0x0010) - not-present page PGD bed5067 P4D bed5067 PUD 0 Oops: Oops: 0010 [#1] SMP KASAN NOPTI RIP: 0010:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0018:ffff88801025f988 EFLAGS: 00010246 Call Trace: generic_perform_write+0x409/0x8c0 mm/filemap.c:4255 __generic_file_write_iter+0x1bb/0x200 mm/filemap.c:4372 ntfs_file_write_iter+0xcd9/0x1c20 fs/ntfs3/file.c:1253 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x63b/0xf70 fs/read_write.c:686 ksys_write+0x133/0x250 fs/read_write.c:738 __do_sys_write fs/read_write.c:749 [inline] __se_sys_write fs/read_write.c:746 [inline] __x64_sys_write+0x77/0xc0 fs/read_write.c:746 ...
[CAUSE]
system.ntfs_attrib updates ATTR_DATA flags via ni_new_attr_flags() and switches i_mapping->a_ops to ntfs_aops_cmpr when FILE_ATTRIBUTE_COMPRESSED is set. system.dos_attrib then overwrites ni->std_fa from a one-byte DOS attribute value, clearing the compression bit without updating ATTR_DATA or the mapping operations.
Old buffered writes use is_compressed(ni) to choose __generic_file_write_iter(). That leaves generic_perform_write() calling a NULL write_begin callback from ntfs_aops_cmpr.
[FIX]
Treat system.dos_attrib as a low-byte DOS attribute update and preserve the existing non-DOS attribute bits in ni->std_fa. This keeps compressed and sparse state consistent with ATTR_DATA and the mapping operations while keeping the existing DOS attribute semantics intact.
--- fs/ntfs3/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ntfs3/xattr.c +3 -1
@@ -853,7 +853,9 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,if (!strcmp (name,SYSTEM_DOS_ATTRIB )) {if (sizeof (u8) != size) goto out; - new_fa =cpu_to_le32 (*(u8 *)value); +/* system.dos_attrib only covers the low DOS attribute byte. */ + new_fa = (ni->std_fa & ~cpu_to_le32 (0xff )) | +cpu_to_le32 (*(u8 *)value); goto set_new_fa; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 159/1193 fs/ntfs3: validate index entry key bounds
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 98d6e5d9dc1d34dcffc61549617581a5fe1ef807 ]
[BUG]
A malformed NTFS directory index entry can advertise a key_size larger than the bytes actually present in its NTFS_DE payload. Directory lookup then passes that malformed key to cmp_fnames(), which can read past the end of the kmalloc'ed index buffer.
BUG: KASAN: slab-out-of-bounds in fname_full_size fs/ntfs3/ntfs.h:590 [inline] BUG: KASAN: slab-out-of-bounds in cmp_fnames+0x1ea/0x230 fs/ntfs3/index.c:46 Read of size 1 at addr ffff88801c313018 by task syz.6.3365/9279 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xbe/0x130 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xd1/0x650 mm/kasan/report.c:482 kasan_report+0xfb/0x140 mm/kasan/report.c:595 __asan_report_load1_noabort+0x14/0x30 mm/kasan/report_generic.c:378 fname_full_size fs/ntfs3/ntfs.h:590 [inline] cmp_fnames+0x1ea/0x230 fs/ntfs3/index.c:46 hdr_find_e.isra.0+0x3ed/0x670 fs/ntfs3/index.c:762 indx_find+0x4b5/0x900 fs/ntfs3/index.c:1186 dir_search_u+0x2c0/0x460 fs/ntfs3/dir.c:254 ntfs_lookup+0x1cc/0x2a0 fs/ntfs3/namei.c:85 __lookup_slow+0x241/0x450 fs/namei.c:1816 lookup_slow fs/namei.c:1833 [inline] walk_component+0x31c/0x570 fs/namei.c:2151 link_path_walk+0x592/0xd60 fs/namei.c:2519 path_lookupat+0x138/0x660 fs/namei.c:2675 filename_lookup+0x1f3/0x560 fs/namei.c:2705 filename_setxattr+0xad/0x1c0 fs/xattr.c:660 path_setxattrat+0x1d8/0x280 fs/xattr.c:713 __do_sys_lsetxattr fs/xattr.c:754 [inline] __se_sys_lsetxattr fs/xattr.c:750 [inline] __x64_sys_lsetxattr+0xd0/0x150 fs/xattr.c:750 ... Allocated by task 9279: kasan_save_stack+0x39/0x70 mm/kasan/common.c:56 kasan_save_track+0x14/0x40 mm/kasan/common.c:77 kasan_save_alloc_info+0x37/0x60 mm/kasan/generic.c:573 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0xc3/0xd0 mm/kasan/common.c:417 kasan_kmalloc include/linux/kasan.h:262 [inline] __do_kmalloc_node mm/slub.c:5650 [inline] __kmalloc_noprof+0x2bd/0x900 mm/slub.c:5662 kmalloc_noprof include/linux/slab.h:961 [inline] indx_read+0x41d/0xad0 fs/ntfs3/index.c:1059 indx_find+0x447/0x900 fs/ntfs3/index.c:1179 dir_search_u+0x2c0/0x460 fs/ntfs3/dir.c:254 ntfs_lookup+0x1cc/0x2a0 fs/ntfs3/namei.c:85 __lookup_slow+0x241/0x450 fs/namei.c:1816 lookup_slow fs/namei.c:1833 [inline] walk_component+0x31c/0x570 fs/namei.c:2151 link_path_walk+0x592/0xd60 fs/namei.c:2519 path_lookupat+0x138/0x660 fs/namei.c:2675 filename_lookup+0x1f3/0x560 fs/namei.c:2705 filename_setxattr+0xad/0x1c0 fs/xattr.c:660 path_setxattrat+0x1d8/0x280 fs/xattr.c:713 __do_sys_lsetxattr fs/xattr.c:754 [inline] __se_sys_lsetxattr fs/xattr.c:750 [inline] __x64_sys_lsetxattr+0xd0/0x150 fs/xattr.c:750 ...
[CAUSE]
The index-header validators only validated INDEX_HDR-level geometry. They did not walk each NTFS_DE to verify entry alignment, subnode layout, or that key_size fit inside the entry payload. They also allowed a last sentinel entry to carry a non-zero key_size.
[FIX]
Walk every NTFS_DE in ntfs3's index-header validators and reject entries with invalid layout, mismatched subnode state, oversized key_size, or non-zero sentinel keys before lookup or log replay can consume them.
--- fs/ntfs3/fslog.c | 26 ++++++++++++++++++++------ fs/ntfs3/index.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 7 deletions(-)
fs/ntfs3/fslog.c +20 -6
@@ -2641,11 +2641,12 @@ static int read_next_log_rec(struct ntfs_log *log, struct lcb *lcb, u64 *lsn)bool check_index_header (const struct INDEX_HDR *hdr,size_t bytes) { +const bool has_subnode =hdr_has_subnode (hdr);__le16 mask;u32 min_de, de_off, used, total;const struct NTFS_DE *e; -if (hdr_has_subnode (hdr)) { +if (has_subnode) { min_de =sizeof (struct NTFS_DE ) +sizeof (u64); mask =NTFS_IE_HAS_SUBNODES ; }else {
@@ -2662,20 +2663,33 @@ bool check_index_header(const struct INDEX_HDR *hdr, size_t bytes)return false; } - e =Add2Ptr (hdr, de_off); + e = (const struct NTFS_DE *)((const u8 *)hdr + de_off);for (;;) {u16 esize =le16_to_cpu (e->size); -struct NTFS_DE *next =Add2Ptr (e, esize); +u16 key_size =le16_to_cpu (e->key_size); +u16 data_size; -if (esize < min_de ||PtrOffset (hdr, next) > used || +if (!IS_ALIGNED (esize,8 ) || esize < min_de || (e->flags &NTFS_IE_HAS_SUBNODES ) != mask) {return false; } -if (de_is_last (e)) +if (size_add (de_off, esize) > used) +return false; + +if (de_is_last (e)) { +if (key_size) +return false; +break ; + } + + data_size = esize - min_de; +if (key_size > data_size) +return false; - e = next; + de_off += esize; + e = (const struct NTFS_DE *)((const u8 *)hdr + de_off); }return true;
fs/ntfs3/index.c +36 -1
@@ -613,16 +613,51 @@ static const struct NTFS_DE *hdr_insert_head(struct INDEX_HDR *hdr,*/ static bool index_hdr_check (const struct INDEX_HDR *hdr,u32 bytes) { +const bool has_subnode =hdr_has_subnode (hdr); +const u16 min_size =sizeof (struct NTFS_DE ) + + (has_subnode ?sizeof (u64) :0 );u32 end =le32_to_cpu (hdr->used);u32 tot =le32_to_cpu (hdr->total);u32 off =le32_to_cpu (hdr->de_off); +const struct NTFS_DE *e;if (!IS_ALIGNED (off,8 ) || tot > bytes || end > tot || -size_add (off,sizeof (struct NTFS_DE )) > end) { +size_add (off, min_size) > end) {/* incorrect index buffer. */ return false; } +/* Ensure every key stays inside its entry before lookup walks it. */ + e = (const struct NTFS_DE *)((const u8 *)hdr + off); +for (;;) { +u16 e_size =le16_to_cpu (e->size); +u16 key_size =le16_to_cpu (e->key_size); +u16 data_size; + +if (!IS_ALIGNED (e_size,8 ) || e_size < min_size || +de_has_vcn (e) != has_subnode) { +/* incorrect index entry. */ +return false; + } + +if (size_add (off, e_size) > end) +return false; + +if (de_is_last (e)) { +if (key_size) +return false; + +break ; + } + + data_size = e_size - min_size; +if (key_size > data_size) +return false; + + off += e_size; + e = (const struct NTFS_DE *)((const u8 *)hdr + off); + } +return true; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 160/1193 ntfs3: fix out-of-bounds read in ntfs_dir_emit() and hdr_find_e()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alessandro Schino <[email protected]>
[ Upstream commit aa1bdbb39f49c5bc9779316891c40005517842a5 ]
The bounds check in ntfs_dir_emit() compares fname->name_len (a character count) against e->size (a byte count) without accounting for the 2-byte-per-character UTF-16LE encoding or the ATTR_FILE_NAME header size:
if (fname->name_len + sizeof(struct NTFS_DE) > le16_to_cpu(e->size))
This computes: name_len + 16 > e_size
The correct check must account for the ATTR_FILE_NAME header (66 bytes before the name) and the UTF-16LE character size (2 bytes each):
sizeof(NTFS_DE) + offsetof(ATTR_FILE_NAME, name) + name_len * sizeof(short) > e_size
Which computes: 16 + 66 + name_len * 2 > e_size
The correct calculation already exists as fname_full_size() in ntfs.h and is used in cmp_fnames(), namei.c, and fslog.c, but was not used in the readdir path.
A crafted NTFS image with an index entry containing a small e->size but large fname->name_len bypasses the current check, causing ntfs_utf16_to_nls() to read past the entry boundary.
Additionally, add a key_size validation in hdr_find_e() to ensure the declared key_size does not exceed the available entry data, preventing comparison functions from reading past entry boundaries on the lookup path.
--- fs/ntfs3/dir.c | 4 +++- fs/ntfs3/index.c | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-)
fs/ntfs3/dir.c +3 -1
@@ -304,7 +304,9 @@ static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,if (sbi->options->nohidden && (fname->dup.fa &FILE_ATTRIBUTE_HIDDEN ))return true; -if (fname->name_len +sizeof (struct NTFS_DE ) >le16_to_cpu (e->size)) +if (sizeof (struct NTFS_DE ) + + offsetof(struct ATTR_FILE_NAME , name) + + fname->name_len *sizeof (short ) >le16_to_cpu (e->size))return true; name_len = ntfs_utf16_to_nls(sbi, fname->name, fname->name_len, name,
fs/ntfs3/index.c +4 -0
@@ -794,6 +794,10 @@ static struct NTFS_DE *hdr_find_e(const struct ntfs_index *indx, binary_search: e_key_len =le16_to_cpu (e->key_size); +/* Validate key_size fits within the entry data area. */ +if (e_key_len >le16_to_cpu (e->size) -sizeof (struct NTFS_DE )) +return NULL ; + diff2 = (*cmp)(key, key_len, e +1 , e_key_len, ctx);if (diff2 >0 ) {if (found) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 161/1193 ASoC: codecs: rk3328: Use managed GPIO and clock helpers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 0cf3489bba9ad13aae052232e223e19a620fe7a7 ]
rk3328_platform_probe() acquires the mute GPIO with gpiod_get_optional() but never releases it. It also enables mclk and pclk manually while relying on probe error labels for unwind, and the driver has no platform remove callback to disable those clocks after a successful unbind.
This path has already needed fixes for missing clock unwinds on probe errors. Use devm_gpiod_get_optional() and devm_clk_get_enabled() so the GPIO and enabled clock lifetimes are tied to the device. This removes the manual error labels and makes both probe failure and driver unbind follow the normal devres cleanup path.
--- sound/soc/codecs/rk3328_codec.c | 54 ++++++++------------------------- 1 file changed, 13 insertions(+), 41 deletions(-)
sound/soc/codecs/rk3328_codec.c +13 -41
@@ -425,7 +425,6 @@ static int rk3328_platform_probe(struct platform_device *pdev)struct rk3328_codec_priv *rk3328;struct regmap *grf;void __iomem *base; -int ret =0 ; rk3328 =devm_kzalloc (&pdev->dev,sizeof (*rk3328),GFP_KERNEL );if (!rk3328)
@@ -441,14 +440,13 @@ static int rk3328_platform_probe(struct platform_device *pdev)regmap_write (grf,RK3328_GRF_SOC_CON2 , (BIT (14 ) <<16 |BIT (14 ))); - ret =of_property_read_u32 (rk3328_np,"spk-depop-time-ms" , - &rk3328->spk_depop_time); -if (ret <0 ) { +if (of_property_read_u32 (rk3328_np,"spk-depop-time-ms" , + &rk3328->spk_depop_time)) {dev_info (&pdev->dev,"spk_depop_time use default value.\n" ); rk3328->spk_depop_time =200 ; } - rk3328->mute =gpiod_get_optional (&pdev->dev,"mute" ,GPIOD_OUT_HIGH ); + rk3328->mute =devm_gpiod_get_optional (&pdev->dev,"mute" ,GPIOD_OUT_HIGH );if (IS_ERR (rk3328->mute))return PTR_ERR (rk3328->mute);/*
@@ -461,57 +459,31 @@ static int rk3328_platform_probe(struct platform_device *pdev)regmap_write (grf,RK3328_GRF_SOC_CON10 ,BIT (17 ) |BIT (1 )); } - rk3328->mclk =devm_clk_get (&pdev->dev,"mclk" ); + rk3328->mclk =devm_clk_get_enabled (&pdev->dev,"mclk" );if (IS_ERR (rk3328->mclk))return PTR_ERR (rk3328->mclk); - ret =clk_prepare_enable (rk3328->mclk); -if (ret) -return ret;clk_set_rate (rk3328->mclk,INITIAL_FREQ ); - rk3328->pclk =devm_clk_get (&pdev->dev,"pclk" ); -if (IS_ERR (rk3328->pclk)) { -dev_err (&pdev->dev,"can't get acodec pclk\n" ); - ret =PTR_ERR (rk3328->pclk); - goto err_unprepare_mclk; - } - - ret =clk_prepare_enable (rk3328->pclk); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to enable acodec pclk\n" ); - goto err_unprepare_mclk; - } + rk3328->pclk =devm_clk_get_enabled (&pdev->dev,"pclk" ); +if (IS_ERR (rk3328->pclk)) +return dev_err_probe (&pdev->dev,PTR_ERR (rk3328->pclk), +"failed to get or enable acodec pclk\n" ); base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (base)) { - ret =PTR_ERR (base); - goto err_unprepare_pclk; - } +if (IS_ERR (base)) +return PTR_ERR (base); rk3328->regmap =devm_regmap_init_mmio (&pdev->dev, base, &rk3328_codec_regmap_config); -if (IS_ERR (rk3328->regmap)) { - ret =PTR_ERR (rk3328->regmap); - goto err_unprepare_pclk; - } +if (IS_ERR (rk3328->regmap)) +return PTR_ERR (rk3328->regmap);platform_set_drvdata (pdev, rk3328); - ret =devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, +return devm_snd_soc_register_component (&pdev->dev, &soc_codec_rk3328, rk3328_dai,ARRAY_SIZE (rk3328_dai)); -if (ret) - goto err_unprepare_pclk; - -return 0 ; - -err_unprepare_pclk: -clk_disable_unprepare (rk3328->pclk); - -err_unprepare_mclk: -clk_disable_unprepare (rk3328->mclk); -return ret; }static const struct of_device_id rk3328_codec_of_match[]__maybe_unused = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 162/1193 ALSA: seq: oss: Reject reads that cannot fit the next event
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 611f538253d970f4d152003841544e875828d015 ]
snd_seq_oss_read() checks whether the next queued OSS sequencer event fits in the remaining userspace buffer before removing it from the read queue.
The check is inverted. It currently stops when the event is smaller than the remaining buffer, so a normal 4-byte event is not copied for an 8-byte read buffer. Conversely, an 8-byte event can be copied for a smaller read count.
Break only when the remaining userspace buffer is smaller than the next event, and report -EINVAL if no complete event has been copied. This prevents an undersized read from looking like end-of-file while leaving the event queued for a later read with a large enough buffer.
--- sound/core/seq/oss/seq_oss_rw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/seq/oss/seq_oss_rw.c +2 -1
@@ -57,7 +57,8 @@ snd_seq_oss_read(struct seq_oss_devinfo *dp, char __user *buf, int count)break ; } ev_len =ev_length (&rec); -if (ev_len < count) { +if (count < ev_len) { + err = -EINVAL ;snd_seq_oss_readq_unlock (readq, flags);break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 163/1193 dpaa2-switch: rework FDB management on the bridge leave path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit efc1d92eacf03afa6f4d53bf7120e059b6f961f2 ]
On bridge leave, the dpaa2_switch_port_set_fdb() function always allocates a new FDB for the port which is becoming standalone. In case no FDB is found, then the port leaving a bridge will continue to use the current one.
The above logic does not cover the case in which there are multiple bridges which have ports from the same DPSW instance. In this case, when the last port leaves bridge #1, it finds an unused FDB to switch to, but the old FDB is not marked as unused. Since the number of FDBs is equal to the number of DPSW interfaces, this will eventually lead to multiple ports sharing the same FDB.
Fix this by changing how we are managing the FDBs on the leave path. Instead of directly allocating a new FDB, first verify if the current port is the last one to leave a bridge. If this is the case, then continue to use the current FDB and only allocate another FDB if there are other ports remaining in the bridge.
--- .../ethernet/freescale/dpaa2/dpaa2-switch.c | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +24 -7
@@ -54,27 +54,44 @@ dpaa2_switch_filter_block_get_unused(struct ethsw_core *ethsw)static u16 dpaa2_switch_port_set_fdb (struct ethsw_port_priv *port_priv,struct net_device *bridge_dev) { +struct ethsw_core *ethsw = port_priv->ethsw_data;struct ethsw_port_priv *other_port_priv =NULL ;struct dpaa2_switch_fdb *fdb;struct net_device *other_dev; +bool last_fdb_user = true;struct list_head *iter; +int i;/* If we leave a bridge (bridge_dev is NULL), find an unused * FDB and use that. */ if (!bridge_dev) { - fdb =dpaa2_switch_fdb_get_unused (port_priv->ethsw_data); - -/* If there is no unused FDB, we must be the last port that -* leaves the last bridge, all the others are standalone. We -* can just keep the FDB that we already have. -*/ +/* First verify if this is the last port to leave this bridge */ +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) { +if (!ethsw->ports[i] || ethsw->ports[i] == port_priv) +continue ; +if (ethsw->ports[i]->fdb == port_priv->fdb) { + last_fdb_user = false; +break ; + } + } -if (!fdb) { +/* If this is the last user of the FDB, just keep using it. */ +if (last_fdb_user) { port_priv->fdb->bridge_dev =NULL ;return 0 ; } +/* Since we are not the last port which leaves a bridge, +* acquire a new FDB and use it. The number of FDBs is sized to +* accommodate all switch ports as standalone, each with its +* private FDB, which means that dpaa2_switch_fdb_get_unused() +* must succeed here. WARN if not. +*/ + fdb =dpaa2_switch_fdb_get_unused (port_priv->ethsw_data); +if (WARN_ON (!fdb)) +return 0 ; + port_priv->fdb = fdb; port_priv->fdb->in_use = true; port_priv->fdb->bridge_dev =NULL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 164/1193 dpaa2-switch: fix the error path in dpaa2_switch_rx()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit 74c1c9f5c0c30bbd0c2cf87b6e3507e7ea46c13d ]
In case of an error in dpaa2_switch_rx(), the dpaa2_switch_free_fd() function is called in order to free the FD. This is incorrect since the dpaa2_switch_free_fd() is intended to be used on Tx frame descriptors, meaning that it expects in the software annotation area of the FD data to find a valid skb pointer on which to call dev_kfree_skb().
Fix this by extracting the dma_unmap_page() from dpaa2_switch_build_linear_skb() directly into the dpaa2_switch_rx() function. This allows us to directly use free_pages() in case of an error before an SKB was created and kfree_skb() afterwards.
--- .../ethernet/freescale/dpaa2/dpaa2-switch.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +12 -11
@@ -2394,18 +2394,13 @@ static int dpaa2_switch_port_blocking_event(struct notifier_block *nb,/* Build a linear skb based on a single-buffer frame descriptor */ static struct sk_buff *dpaa2_switch_build_linear_skb (struct ethsw_core *ethsw, -const struct dpaa2_fd *fd) +const struct dpaa2_fd *fd, +void *fd_vaddr) {u16 fd_offset =dpaa2_fd_get_offset (fd); -dma_addr_t addr =dpaa2_fd_get_addr (fd);u32 fd_length =dpaa2_fd_get_len (fd);struct device *dev = ethsw->dev;struct sk_buff *skb =NULL ; -void *fd_vaddr; - - fd_vaddr =dpaa2_iova_to_virt (ethsw->iommu_domain, addr); -dma_unmap_page (dev, addr,DPAA2_SWITCH_RX_BUF_SIZE , -DMA_FROM_DEVICE ); skb =build_skb (fd_vaddr,DPAA2_SWITCH_RX_BUF_SIZE +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )));
@@ -2431,6 +2426,7 @@ static void dpaa2_switch_tx_conf(struct dpaa2_switch_fq *fq,static void dpaa2_switch_rx (struct dpaa2_switch_fq *fq,const struct dpaa2_fd *fd) { +dma_addr_t addr =dpaa2_fd_get_addr (fd);struct ethsw_core *ethsw = fq->ethsw;struct ethsw_port_priv *port_priv;struct net_device *netdev;
@@ -2438,10 +2434,14 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq,struct sk_buff *skb;u16 vlan_tci, vid;int if_id, err; +void *vaddr; + + vaddr =dpaa2_iova_to_virt (ethsw->iommu_domain, addr); +dma_unmap_page (ethsw->dev, addr,DPAA2_SWITCH_RX_BUF_SIZE , +DMA_FROM_DEVICE );/* get switch ingress interface ID */ if_id =upper_32_bits (dpaa2_fd_get_flc (fd)) &0x0000FFFF ; -if (if_id >= ethsw->sw_attr.num_ifs) {dev_err (ethsw->dev,"Frame received from unknown interface!\n" ); goto err_free_fd;
@@ -2457,7 +2457,7 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq, } } - skb =dpaa2_switch_build_linear_skb (ethsw, fd); + skb =dpaa2_switch_build_linear_skb (ethsw, fd, vaddr);if (unlikely (!skb)) goto err_free_fd;
@@ -2475,7 +2475,8 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq, err =__skb_vlan_pop (skb, &vlan_tci);if (err) {dev_info (ethsw->dev,"__skb_vlan_pop() returned %d" , err); - goto err_free_fd; +kfree_skb (skb); +return ; } }
@@ -2490,7 +2491,7 @@ static void dpaa2_switch_rx(struct dpaa2_switch_fq *fq,return ; err_free_fd: -dpaa2_switch_free_fd (ethsw, fd); +free_pages ((unsigned long )vaddr,0 ); }static void dpaa2_switch_detect_features (struct ethsw_core *ethsw)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 165/1193 net: dsa: sja1105: flower: reject cross-chip redirect
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Yang <[email protected]>
[ Upstream commit cfa5274a5dc2a23b957da5dc806d2ac0c7a66af0 ]
dsa_port_from_netdev() may return a valid port from a different switch chip. Programming another chip's port index into the local hardware causes redirection to the wrong port, or an out-of-bounds access if the index exceeds the local chip's port count.
Apply a minimal fix that adds a check to catch this case and adjusts the extack message. When cls->common.skip_sw is not set, the operation could instead redirect to the upstream port and let the software or upstream switch(es) handle the forward, but that is not addressed here.
--- drivers/net/dsa/sja1105/sja1105_flower.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/dsa/sja1105/sja1105_flower.c +2 -2
@@ -388,9 +388,9 @@ int sja1105_cls_flower_add(struct dsa_switch *ds, int port,struct dsa_port *to_dp; to_dp =dsa_port_from_netdev (act->dev); -if (IS_ERR (to_dp)) { +if (IS_ERR (to_dp) || to_dp->ds != ds) {NL_SET_ERR_MSG_MOD (extack, -"Destination not a switch port" ); +"Destination not a local switch port" );return -EOPNOTSUPP ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 166/1193 dpaa2-switch: fix handling of NAPI on the remove path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ioana Ciornei <[email protected]>
[ Upstream commit e23d7c8c1d4ba435c457d7ffb2669175ec819b07 ]
All the NAPI instances for a DPSW device are attached to the first switch port's net_device but shared by all ports. The NAPI instances get disabled only once the last port goes down.
This causes an issue on the .remove() path where each port is unregistered and freed one at a time, causing the NAPI instances to be deleted even though they are not disabled.
In order to avoid this, split up the unregister_netdev() calls from the free_netdev() so that we make sure all ports go down before we attempt a deletion of NAPI instances. Also, make the netif_napi_del() explicit as it is on the .probe() path.
--- .../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +10 -5
@@ -3263,7 +3263,6 @@ static void dpaa2_switch_teardown(struct fsl_mc_device *sw_dev)static void dpaa2_switch_remove (struct fsl_mc_device *sw_dev) { -struct ethsw_port_priv *port_priv;struct ethsw_core *ethsw;struct device *dev;int i;
@@ -3275,11 +3274,17 @@ static void dpaa2_switch_remove(struct fsl_mc_device *sw_dev)dpsw_disable (ethsw->mc_io,0 , ethsw->dpsw_handle); -for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) { - port_priv = ethsw->ports[i]; -unregister_netdev (port_priv->netdev); +/* Unregister all the netdevs so that they are brought down and the +* shared NAPI instances gets disabled. +*/ +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++) +unregister_netdev (ethsw->ports[i]->netdev); + +for (i =0 ; i <DPAA2_SWITCH_RX_NUM_FQS ; i++) +netif_napi_del (ðsw->fq[i].napi); + +for (i =0 ; i < ethsw->sw_attr.num_ifs; i++)dpaa2_switch_remove_port (ethsw, i); - }kfree (ethsw->fdbs);kfree (ethsw->filter_blocks);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 167/1193 thermal/drivers/qcom/tsens: Atomic temperature read with hardware-guided retries
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Priyansh Jain <[email protected]>
[ Upstream commit e28ef2f3ccea276436bd0f30c93f99e764ba492b ]
The existing TSENS temperature read logic polls the valid bit and then reads the temperature register. When temperature reads are triggered at very short intervals, this can race with hardware updates and allow the temperature field to be read while it is still being updated.
In this case, the valid bit may already be asserted even though the temperature value is transitioning, resulting in an incorrect reading.
Hardware programming guidelines require the temperature value and the valid bit to be sampled atomically in the same read transaction. A reading is considered valid only if the valid bit is observed set in that same sample.
The guidelines further specify that software should attempt the temperature read up to three times to account for transient update windows. If none of the attempts yields a valid sample, a stable fallback value must be returned: if the first and second samples match, the second value is returned;otherwise, if the second and third samples match, the third value is returned;if neither pair matches, -EAGAIN is returned.
Update the TSENS sensor read logic to implement atomic sampling along with the recommended retry-and-compare fallback behavior. This removes the race window and ensures deterministic temperature values in accordance with hardware requirements.
--- drivers/thermal/qcom/tsens.c | 111 ++++++++++++++++++++++++----------- drivers/thermal/qcom/tsens.h | 1 + 2 files changed, 78 insertions(+), 34 deletions(-)
drivers/thermal/qcom/tsens.c +77 -34
@@ -315,9 +315,66 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s) }/** -* tsens_hw_to_mC - Return sign-extended temperature in mCelsius. +* tsens_read_temp - Retrieve temperature readings from the hardware. * @s: Pointer to sensor struct * @field: Index into regmap_field array pointing to temperature data +* @temp: temperature in deciCelsius to be read from hardware +* +* This function handles temperature returned in ADC code or deciCelsius +* depending on IP version. +* +* Return: 0 on success, a negative errno will be returned in error cases +*/ +static int tsens_read_temp (const struct tsens_sensor *s,int field,int *temp) +{ +struct tsens_priv *priv = s->priv; +int temp_val[MAX_READ_RETRY ] = {0 }; +u32 status; +int ret; +u32 last_temp_mask =GENMASK (priv->fields[LAST_TEMP_0 ].msb, + priv->fields[LAST_TEMP_0 ].lsb); +u32 valid_bit = priv->rf[VALID_0 ] ?BIT (priv->fields[VALID_0 ].lsb) :0 ; + +for (int i =0 ; i <MAX_READ_RETRY ; i++) { + ret =regmap_read (priv->tm_map, priv->fields[field].reg, &status); +if (ret) +return ret; + +/* VER_0 doesn't have a VALID bit */ +if (!valid_bit) { + *temp = status & last_temp_mask; +return 0 ; + } + + temp_val[i] = status & last_temp_mask; + +if (status & valid_bit) { + *temp = temp_val[i]; +return 0 ; + } + } + +/* +* As per the HW guidelines, if none of the attempts observe a +* valid sample, a stable fallback value must be returned. If the +* first and second samples match, the second value is returned; +* otherwise, if the second and third samples match, the third +* value is returned. +*/ +if (temp_val[0 ] == temp_val[1 ]) + *temp = temp_val[1 ]; +else if (temp_val[1 ] == temp_val[2 ]) + *temp = temp_val[2 ]; +else +return -EAGAIN ; + +return 0 ; +} + +/** +* tsens_hw_to_mC - Return sign-extended temperature in mCelsius. +* @s: Pointer to sensor struct +* @temp: temperature in milliCelsius to be read from hardware * * This function handles temperature returned in ADC code or deciCelsius * depending on IP version.
@@ -325,20 +382,14 @@ static inline int code_to_degc(u32 adc_code, const struct tsens_sensor *s)* Return: Temperature in milliCelsius on success, a negative errno will * be returned in error cases */ -static int tsens_hw_to_mC (const struct tsens_sensor *s,int field) +static int tsens_hw_to_mC (const struct tsens_sensor *s,int temp) {struct tsens_priv *priv = s->priv;u32 resolution; -u32 temp =0 ; -int ret; resolution = priv->fields[LAST_TEMP_0 ].msb - priv->fields[LAST_TEMP_0 ].lsb; - ret =regmap_field_read (priv->rf[field], &temp); -if (ret) -return ret; -/* Convert temperature from ADC code to milliCelsius */ if (priv->feat->adc)return code_to_degc (temp, s) *1000 ;
@@ -513,8 +564,10 @@ static int tsens_read_irq_state(struct tsens_priv *priv, u32 hw_id, &d->crit_irq_mask);if (ret)return ret; - - d->crit_thresh =tsens_hw_to_mC (s,CRIT_THRESH_0 + hw_id); + ret =regmap_field_read (priv->rf[CRIT_THRESH_0 + hw_id], &d->crit_thresh); +if (ret) +return ret; + d->crit_thresh =tsens_hw_to_mC (s, d->crit_thresh); }else {/* No mask register on older TSENS */ d->up_irq_mask =0 ;
@@ -524,8 +577,16 @@ static int tsens_read_irq_state(struct tsens_priv *priv, u32 hw_id, d->crit_thresh =0 ; } - d->up_thresh =tsens_hw_to_mC (s,UP_THRESH_0 + hw_id); - d->low_thresh =tsens_hw_to_mC (s,LOW_THRESH_0 + hw_id); + ret =regmap_field_read (priv->rf[UP_THRESH_0 + hw_id], &d->up_thresh); +if (ret) +return ret; + + d->up_thresh =tsens_hw_to_mC (s, d->up_thresh); + ret =regmap_field_read (priv->rf[LOW_THRESH_0 + hw_id], &d->low_thresh); +if (ret) +return ret; + + d->low_thresh =tsens_hw_to_mC (s, d->low_thresh); dev_dbg(priv->dev, "[%u] %s%s: status(%u|%u|%u) | clr(%u|%u|%u) | mask(%u|%u|%u)\n", hw_id, __func__,
@@ -749,33 +810,15 @@ static void tsens_disable_irq(struct tsens_priv *priv)int get_temp_tsens_valid (const struct tsens_sensor *s,int *temp) { -struct tsens_priv *priv = s->priv;int hw_id = s->hw_id;u32 temp_idx =LAST_TEMP_0 + hw_id; -u32 valid_idx =VALID_0 + hw_id; -u32 valid;int ret; -/* VER_0 doesn't have VALID bit */ -if (tsens_version (priv) ==VER_0 ) - goto get_temp; - -/* Valid bit is 0 for 6 AHB clock cycles. -* At 19.2MHz, 1 AHB clock is ~60ns. -* We should enter this loop very, very rarely. -* Wait 1 us since it's the min of poll_timeout macro. -* Old value was 400 ns. -*/ - ret =regmap_field_read_poll_timeout (priv->rf[valid_idx], valid, - valid,1 ,20 *USEC_PER_MSEC ); -if (ret) -return ret; - -get_temp: -/* Valid bit is set, OK to read the temperature */ - *temp =tsens_hw_to_mC (s, temp_idx); + ret =tsens_read_temp (s, temp_idx, temp); +if (!ret) + *temp =tsens_hw_to_mC (s, *temp); -return 0 ; +return ret; }int get_temp_common (const struct tsens_sensor *s,int *temp)
drivers/thermal/qcom/tsens.h +1 -0
@@ -21,6 +21,7 @@#define THRESHOLD_MIN_ADC_CODE 0x0#define MAX_SENSORS 16 +#define MAX_READ_RETRY 3#include <linux/interrupt.h> #include <linux/thermal.h>
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 168/1193 xhci: Prevent queuing new commands if xhci is inaccessible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit 82b70c799281cc24506085be978b829149ba0ca4 ]
Refuse to queue a new command on the command ring if xHC is marked inaccessible with the HCD_FLAG_HW_ACCESSIBLE.
HCD_FLAG_HW_ACCESSIBLE is set and cleared in suspend and resume.
Also print a warning if xhci is being suspended with commands still pending on the command ring.
--- drivers/usb/host/xhci-ring.c | 6 ++++++ drivers/usb/host/xhci.c | 4 ++++ 2 files changed, 10 insertions(+)
drivers/usb/host/xhci-ring.c +6 -0
@@ -4468,6 +4468,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd, u32 field3, u32 field4, bool command_must_succeed) { int reserved_trbs = xhci->cmd_ring_reserved_trbs; +struct usb_hcd *hcd =xhci_to_hcd (xhci);int ret; if ((xhci->xhc_state & XHCI_STATE_DYING) ||
@@ -4477,6 +4478,11 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,return -ESHUTDOWN ; } +if (!HCD_HW_ACCESSIBLE (hcd)) { +xhci_warn (xhci,"Can't queue command, xHC not accessible\n" ); +return -ESHUTDOWN ; + } +if (!command_must_succeed) reserved_trbs++;
drivers/usb/host/xhci.c +4 -0
@@ -919,6 +919,10 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)/* step 1: stop endpoint */ /* skipped assuming that port suspend has done */ +/* Check if command ring is empty */ +if (!list_empty (&xhci->cmd_list)) +xhci_warn (xhci,"Suspending and stopping xHC with pending command!\n" ); +/* step 2: clear Run/Stop bit */ command =readl (&xhci->op_regs->command); command &= ~CMD_RUN ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 169/1193 drm/amdkfd: fix UAF race in destroy_queue_cpsch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alysa Liu <[email protected]>
[ Upstream commit ac081deaf16a639ea7dff2f285fe421a33c1ade0 ]
wait_on_destroy_queue() drops locks to wait for queue resume, allowing a concurrent destroy to free the queue. Use is_being_destroyed flag to serialize destruction.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +7 -1
@@ -2048,6 +2048,9 @@ static int wait_on_destroy_queue(struct device_queue_manager *dqm,if (pdd->qpd.is_debug)return ret; +if (q->properties.is_being_destroyed) +return -EBUSY ; + q->properties.is_being_destroyed = true;if (pdd->process->debug_trap_enabled && q->properties.is_suspended) {
@@ -2060,6 +2063,9 @@ static int wait_on_destroy_queue(struct device_queue_manager *dqm,dqm_lock (dqm); } +if (ret) + q->properties.is_being_destroyed = false; +return ret; }
@@ -2151,7 +2157,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,return retval; failed_try_destroy_debugged_queue: - + q->properties.is_being_destroyed = false;dqm_unlock (dqm);return retval; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 170/1193 drm/amd/pm: bound pp_dpm_set_pp_table() memcpy
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asad Kamal <[email protected]>
[ Upstream commit f193e71fa9fab2e68ef85201b106e8f580d3a25b ]
The powerplay path allocates hardcode_pp_table once with kmemdup(..., soft_pp_table_size). memcpy(..., size) used the sysfs store count (up to PAGE_SIZE) with no upper bound, causing heap overflow. Reject writes where size exceeds soft_pp_table_size.
--- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +3 -0
@@ -680,6 +680,9 @@ static int pp_dpm_set_pp_table(void *handle, const char *buf, size_t size)if (!hwmgr || !hwmgr->pm_en)return -EINVAL ; +if (size > hwmgr->soft_pp_table_size) +return -EINVAL ; +if (!hwmgr->hardcode_pp_table) { hwmgr->hardcode_pp_table = kmemdup(hwmgr->soft_pp_table, hwmgr->soft_pp_table_size,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 171/1193 drm/amdgpu: fix buffer overflow during vBIOS update
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiwu Zhang <[email protected]>
[ Upstream commit 6229898d46c0cbc238a6fe9f11c1ea12cf8bb9c5 ]
Clamp the buffer postion to write by setting the bin attribute to the maximum buffer size so that VFS layer will block the out-of-bounds accessing.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
@@ -3694,7 +3694,7 @@ static ssize_t amdgpu_psp_vbflash_read(struct file *filp, struct kobject *kobj,*/ static struct bin_attribute psp_vbflash_bin_attr = { .attr = {.name ="psp_vbflash" , .mode =0660 }, - .size =0 , + .size =AMD_VBIOS_FILE_MAX_SIZE_B , .write = amdgpu_psp_vbflash_write, .read = amdgpu_psp_vbflash_read, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 172/1193 RDMA/irdma: Fix typo in SQ completions generation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cyrill Gorcunov <[email protected]>
[ Upstream commit b548a6c4eee5c428663f3944e173e6c92e2e8d6f ]
When we generate completion for SQ the opcode while being properly read from ring buffer is ignored when written back to completion. Seems to be a simple typo.
--- drivers/infiniband/hw/irdma/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/irdma/utils.c +1 -1
@@ -2478,7 +2478,7 @@ void irdma_generate_flush_completions(struct irdma_qp *iwqp) cmpl->cpi.wr_id = qp->sq_wrtrk_array[wqe_idx].wrid; sw_wqe = qp->sq_base[wqe_idx].elem;get_64bit_val (sw_wqe,24 , &wqe_qword); - cmpl->cpi.op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE ,IRDMAQPSQ_OPCODE ); + cmpl->cpi.op_type = (u8 )FIELD_GET (IRDMAQPSQ_OPCODE , wqe_qword); cmpl->cpi.q_type =IRDMA_CQE_QTYPE_SQ ;/* remove the SQ WR by moving SQ tail*/ IRDMA_RING_SET_TAIL(*sq_ring,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 173/1193 net/mlx5: E-Switch, align disable sequence with switchdev-to-legacy transition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shay Drory <[email protected]>
[ Upstream commit b48b6308dfaeae49fcda61b4066773cb5e8a9ce8 ]
This patch align the eswitch disable sequence with the switchdev-to-legacy mode transition, where eswitch must be disabled before device detachment. The consistent ordering is required for proper SD LAG cleanup which depends on eswitch state during teardown.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -0
@@ -1524,6 +1524,7 @@ void mlx5_uninit_one(struct mlx5_core_dev *dev)mlx5_hwmon_dev_unregister (dev);mlx5_crdump_disable (dev); +mlx5_eswitch_disable (dev->priv.eswitch);mlx5_unregister_device (dev);if (!test_bit (MLX5_INTERFACE_STATE_UP , &dev->intf_state)) {
@@ -1608,6 +1609,7 @@ void mlx5_unload_one_devl_locked(struct mlx5_core_dev *dev, bool suspend)devl_assert_locked (priv_to_devlink (dev));mutex_lock (&dev->intf_state_mutex); +mlx5_eswitch_disable (dev->priv.eswitch);mlx5_detach_device (dev, suspend);if (!test_bit (MLX5_INTERFACE_STATE_UP , &dev->intf_state)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 174/1193 clk: keystone: dont cache clock rate
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Walle <[email protected]>
[ Upstream commit a80b32a140c8612bbaed27009c383d43304db6d5 ]
The TISCI firmware will return 0 if the clock or consumer is not enabled although there is a stored value in the firmware. IOW a call to set rate will work but at get rate will always return 0 if the clock is disabled.
The clk framework will try to cache the clock rate when it's requested by a consumer. If the clock or consumer is not enabled at that point, the cached value is 0, which is wrong. Thus, disable the cache altogether.
--- drivers/clk/keystone/sci-clk.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/keystone/sci-clk.c +8 -0
@@ -333,6 +333,14 @@ static int _sci_clk_build(struct sci_clk_provider *provider, init.ops = &sci_clk_ops; init.num_parents = sci_clk->num_parents; + +/* +* A clock rate query to the SCI firmware will return 0 if either the +* clock itself is disabled or the attached device/consumer is disabled. +* This makes it inherently unsuitable for the caching of the clk +* framework. +*/ + init.flags =CLK_GET_RATE_NOCACHE ; sci_clk->hw.init = &init; ret =devm_clk_hw_register (provider->dev, &sci_clk->hw);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 175/1193 ALSA: hda/realtek: Add quirk for ASUS VivoBook X509DAP
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Faleichyk <[email protected]>
[ Upstream commit 3580bc53520ce4efc94ece5886ad3670b93667ba ]
The internal microphone on ASUS VivoBook X509DAP (subsystem ID 0x1043:0x197e) is not detected without a quirk entry. Add ALC256_FIXUP_ASUS_MIC_NO_PRESENCE to fix the issue.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10310,6 +10310,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x18f1 ,"Asus FX505DT" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x194e ,"ASUS UX563FD" ,ALC294_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x1970 ,"ASUS UX550VE" ,ALC289_FIXUP_ASUS_GA401 ), +SND_PCI_QUIRK (0x1043 ,0x197e ,"ASUS VivoBook X509DAP" ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1982 ,"ASUS B1400CEPE" ,ALC256_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ), SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 176/1193 ipmi: si: Use platform_get_irq_optional() to retrieve interrupt
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 39851b7e580a65bee732e5364f0efb974b242370 ]
Use platform_get_irq_optional() to retrieve the interrupt resource instead of directly parsing and mapping the OF node via irq_of_parse_and_map(). This is the standard pattern for platform devices. irq_of_parse_and_map() requires ire_dispose_mapping(), which is missing.
Message-ID: <[email protected]> [Handle a negative return from platform_get_irq_optional() to mean
no interrupt is assigned.]
--- drivers/char/ipmi/ipmi_si_platform.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_si_platform.c +4 -1
@@ -279,7 +279,10 @@ static int of_ipmi_probe(struct platform_device *pdev) io.regspacing = regspacing ?be32_to_cpup (regspacing) :DEFAULT_REGSPACING ; io.regshift = regshift ?be32_to_cpup (regshift) :0 ; - io.irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); + io.irq =platform_get_irq_optional (pdev,0 ); +if (io.irq <0 ) + io.irq =0 ; + io.dev = &pdev->dev; dev_dbg(&pdev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 177/1193 drm/amdkfd: Unwind debug trap enable on copy_to_user failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongqiang Sun <[email protected]>
[ Upstream commit 01112e241e37f9ac98b6f418d93ce2e0b87b7ee0 ]
If kfd_dbg_trap_enable() fails while copying runtime_info to userspace, it had already activated the trap, set debug_trap_enabled, taken an extra process reference, and opened the debug event file. Return -EFAULT without unwinding that state, leaving inconsistent trap state and a refcount imbalance that could break later DISABLE/ENABLE.
On copy_to_user failure, deactivate the trap and undo the rest of the enable setup before returning.
--- drivers/gpu/drm/amd/amdkfd/kfd_debug.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_debug.c +6 -0
@@ -805,6 +805,12 @@ int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd,if (copy_to_user (runtime_info, (void *)&target->runtime_info, copy_size)) {kfd_dbg_trap_deactivate (target, false,0 ); +fput (target->dbg_ev_file); + target->dbg_ev_file =NULL ; +if (target->debugger_process) +atomic_dec (&target->debugger_process->debugged_process_count); + target->debug_trap_enabled = false; +kfd_unref_process (target); r = -EFAULT ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 178/1193 wifi: nl80211: Increase ie_len size to prevent truncated IEs in new peer notifications
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thiyagarajan Pandiyan <[email protected]>
[ Upstream commit dfb67ae569bf0726187725b1ef8d89377778861e ]
Currently, ie_len in cfg80211_notify_new_peer_candidate is defined as 1-byte field, capping the maximum IE list size at 255 bytes. When a large beacon is received, the IE list is truncated, passing incomplete data to wpa_supplicant. This causes supplicant to fail parsing the IEs.
Increasing the size of ie_len to allow the full length of the IE list to be forwarded properly.
--- include/net/cfg80211.h | 2 +- net/wireless/nl80211.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/cfg80211.h +1 -1
@@ -7383,7 +7383,7 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,* cfg80211 then sends a notification to userspace. */ void cfg80211_notify_new_peer_candidate (struct net_device *dev, -const u8 *macaddr,const u8 *ie,u8 ie_len, +const u8 *macaddr,const u8 *ie,size_t ie_len,int sig_dbm,gfp_t gfp);/**
net/wireless/nl80211.c +1 -1
@@ -18502,7 +18502,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, }void cfg80211_notify_new_peer_candidate (struct net_device *dev,const u8 *addr, -const u8 *ie,u8 ie_len, +const u8 *ie,size_t ie_len,int sig_dbm,gfp_t gfp) {struct wireless_dev *wdev = dev->ieee80211_ptr;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 179/1193 RDMA/umem: Be careful about boundary conditions in ib_umem_find_best_pgsz()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 09ea6837a0434fb4db99528a5055b6d822135dcf ]
Several corner cases, especially important on 32 bits:
- umem->iova is u64, the function argument should pass in u64 or iova will be truncated
- Check that the length is not too large for the iova
- Check that lengths > 4G don't overflow the GENMASK
--- drivers/infiniband/core/umem.c | 18 ++++++++++++------ include/rdma/ib_umem.h | 4 ++-- 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/infiniband/core/umem.c +12 -6
@@ -78,14 +78,17 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int d*/ unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem,unsigned long pgsz_bitmap, -unsigned long virt) +u64 virt) {unsigned long curr_len =0 ;dma_addr_t curr_base = ~0 ; -unsigned long va, pgoff; +unsigned long pgoff;struct scatterlist *sg; -dma_addr_t mask; +unsigned long mask =0 ; +unsigned int bits;dma_addr_t end; +u64 last_va; +u64 va;int i; umem->iova = va = virt;
@@ -103,9 +106,12 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,* number of required pages. Compute the largest page size that could * work based on VA address bits that don't change. */ - mask = pgsz_bitmap & -GENMASK (BITS_PER_LONG -1 , -bits_per ((umem->length -1 + virt) ^ virt)); +if (check_add_overflow (umem->length -1 , virt, &last_va)) +return 0 ; + bits =bits_per (virt ^ last_va); +if (bits <BITS_PER_LONG ) + mask = pgsz_bitmap &GENMASK (BITS_PER_LONG -1 , bits); +/* offset into first SGL */ pgoff = umem->address & ~PAGE_MASK ;
include/rdma/ib_umem.h +2 -2
@@ -81,7 +81,7 @@ int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset, size_t length);unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem,unsigned long pgsz_bitmap, -unsigned long virt); +u64 virt);/** * ib_umem_find_best_pgoff - Find best HW page size
@@ -161,7 +161,7 @@ static inline int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offs }static inline unsigned long ib_umem_find_best_pgsz (struct ib_umem *umem,unsigned long pgsz_bitmap, -unsigned long virt) +u64 virt) {return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 180/1193 RDMA/mlx5: Fix state and counter desync on loopback enable failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 0d32eabccbe4b2f8d45be3192c5f3c76c8af703d ]
In mlx5_ib_enable_lb(), dev->lb.enabled was unconditionally set to true even if mlx5_nic_vport_update_local_lb() failed.
Fix this by only setting dev->lb.enabled on success. On failure, roll back the reference counters and return the error.
--- drivers/infiniband/hw/mlx5/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/infiniband/hw/mlx5/main.c +11 -0
@@ -1739,6 +1739,9 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp) dev->lb.qps == 1) {if (!dev->lb.enabled) { err =mlx5_nic_vport_update_local_lb (dev->mdev, true); +if (err) + goto err_rollback; + dev->lb.enabled = true; } }
@@ -1746,6 +1749,14 @@ int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp)mutex_unlock (&dev->lb.mutex);return err; + +err_rollback: +if (td) + dev->lb.user_td--; +if (qp) + dev->lb.qps--; +mutex_unlock (&dev->lb.mutex); +return err; }void mlx5_ib_disable_lb (struct mlx5_ib_dev *dev,bool td,bool qp)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 181/1193 bpf: NUL-terminate replaced sysctl value
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dawei Feng <[email protected]>
[ Upstream commit a66e3b5bacf38d6ab29fa05a9754f7a114485605 ]
When writing to sysctls, proc_sys_call_handler() guarantees that the buffer passed to proc handlers is NUL-terminated. If bpf_sysctl_set_new_value() replaces the pending sysctl value, it can hand a replacement buffer directly to proc handlers. However, the helper currently copies only buf_len bytes into that buffer without appending a NUL terminator, leaving downstream parsers vulnerable to out-of-bounds access.
Fix this by appending a '\0' after the replaced value to restore the expected sysctl semantics. Since the helper already rejects buf_len greater than PAGE_SIZE - 1, there is always room for the extra byte.
Reproduced in a QEMU x86_64 guest booted with KASAN while exercising the sysctl replacement path with a cgroup/sysctl BPF program. The reproducer targets /proc/sys/net/core/flow_limit_cpu_bitmap, fills the original user write buffer with non-zero bytes, and overrides the sysctl value so the replacement buffer lacks a terminating NUL. Under that setup, the pre-fix kernel reported:
BUG: KASAN: slab-out-of-bounds in strnchrnul+0x72/0x90 Read of size 1 at addr ffff88800de57000 by task repro_patch3/66 CPU: 0 UID: 0 PID: 66 Comm: repro_patch3 Not tainted 7.1.0-rc3-00269-g8370ca1f87cc #6 PREEMPT(lazy) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xa0 print_report+0xcb/0x5e0 ? __virt_addr_valid+0x21d/0x3f0 ? strnchrnul+0x72/0x90 ? strnchrnul+0x72/0x90 kasan_report+0xca/0x100 ? strnchrnul+0x72/0x90 strnchrnul+0x72/0x90 bitmap_parse+0x37/0x2e0 flow_limit_cpu_sysctl+0xc6/0x840 ? __pfx_flow_limit_cpu_sysctl+0x10/0x10 ? __kvmalloc_node_noprof+0x5ba/0x870 proc_sys_call_handler+0x31d/0x480 ? __pfx_proc_sys_call_handler+0x10/0x10 ? selinux_file_permission+0x39f/0x500 ? lock_is_held_type+0x9e/0x120 vfs_write+0x98e/0x1000 ... </TASK> The buggy address is located 0 bytes to the right of allocated 4096-byte region [ffff88800de56000, ffff88800de57000)
With this fix applied, rerunning the same sysctl-targeted path yields no corresponding KASAN reports.
--- kernel/bpf/cgroup.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/cgroup.c +1 -0
@@ -2206,6 +2206,7 @@ BPF_CALL_3(bpf_sysctl_set_new_value, struct bpf_sysctl_kern *, ctx,return -E2BIG ;memcpy (ctx->new_val, buf, buf_len); + ((char *)ctx->new_val)[buf_len] ='\0' ; ctx->new_len = buf_len; ctx->new_updated =1 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 182/1193 net: cpsw_new: unregister devlink on port registration failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangshuo Li <[email protected]>
[ Upstream commit b64f763b607426ac97e44b114f0b8844ac3b86dd ]
cpsw_probe() registers devlink before registering the CPSW ports.
If cpsw_register_ports() fails, the error path only unregisters the notifiers and then releases the lower level resources. It does not undo the successful cpsw_register_devlink() call, leaving the devlink instance and its parameters registered after probe has failed.
Add a devlink cleanup label for the path where devlink registration has already succeeded, and use it when port registration fails.
--- drivers/net/ethernet/ti/cpsw_new.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpsw_new.c +3 -1
@@ -2015,7 +2015,7 @@ static int cpsw_probe(struct platform_device *pdev) ret =cpsw_register_ports (cpsw);if (ret) - goto clean_unregister_notifiers; + goto clean_unregister_devlink; dev_notice(dev, "initialized (regs %pa, pool size %d) hw_ver:%08X %d.%d (%d)\n", &ss_res->start, descs_pool_size,
@@ -2027,6 +2027,8 @@ static int cpsw_probe(struct platform_device *pdev)return 0 ; +clean_unregister_devlink: +cpsw_unregister_devlink (cpsw); clean_unregister_notifiers:cpsw_unregister_notifiers (cpsw); clean_cpts:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 183/1193 hsr: broadcast netlink notifications in the devices net namespace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maoyi Xie <[email protected]>
[ Upstream commit a762fabd7ef9a6cc07258684138f9c3f078d0326 ]
The HSR generic netlink family sets .netnsok = true. HSR devices can live in network namespaces other than init_net.
Two async notifiers broadcast events with genlmsg_multicast(). They are hsr_nl_ringerror() and hsr_nl_nodedown(). That helper delivers only on the default genl socket in init_net. So the events always land in init_net. The network namespace of the device does not matter.
This has two effects. A listener in the device's own namespace never sees its own ring error and node down events. A privileged listener in init_net receives events from HSR devices in other namespaces. The payload carries the peer node MAC (HSR_A_NODE_ADDR) and the slave port ifindex (HSR_A_IFINDEX).
Switch both callers to genlmsg_multicast_netns(). Other families with .netnsok = true already do this. Examples are gtp, ovpn, team, batman-adv, netdev-genl, ethtool and handshake.
hsr_nl_ringerror() already has the slave port. It uses dev_net(port->dev). hsr_nl_nodedown() takes the namespace from the master port via hsr_port_get_hsr().
--- net/hsr/hsr_netlink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/hsr/hsr_netlink.c +7 -2
@@ -233,7 +233,8 @@ void hsr_nl_ringerror(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN], goto nla_put_failure;genlmsg_end (skb, msg_head); -genlmsg_multicast (&hsr_genl_family, skb,0 ,0 ,GFP_ATOMIC ); +genlmsg_multicast_netns (&hsr_genl_family,dev_net (port->dev), + skb,0 ,0 ,GFP_ATOMIC );return ;
@@ -269,8 +270,12 @@ void hsr_nl_nodedown(struct hsr_priv *hsr, unsigned char addr[ETH_ALEN])if (res <0 ) goto nla_put_failure; +rcu_read_lock (); + master =hsr_port_get_hsr (hsr,HSR_PT_MASTER );genlmsg_end (skb, msg_head); -genlmsg_multicast (&hsr_genl_family, skb,0 ,0 ,GFP_ATOMIC ); +genlmsg_multicast_netns (&hsr_genl_family,dev_net (master->dev), + skb,0 ,0 ,GFP_ATOMIC ); +rcu_read_unlock ();return ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 184/1193 net: microchip: sparx5: clean up PSFP resources on flower setup failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
[ Upstream commit 46e50367338702abe3df661df7795bdada40fef7 ]
sparx5_tc_flower_psfp_setup() allocates PSFP stream gate, flow meter and stream filter resources before adding VCAP actions. If a later step fails, the resources allocated earlier in the function are not unwound.
Add error paths to release the stream filter, flow meter and stream gate when setup fails after they have been acquired.
Also make sparx5_psfp_fm_add() return the acquired flow-meter id before the existing-flow-meter early return. When an existing flow meter is reused, sparx5_psfp_fm_get() increments its pool reference count, but the caller previously kept psfp_fmid as 0. If a later setup step failed, the error path could try to delete flow-meter id 0 instead of the reused flow meter, leaving the incremented reference behind.
--- .../ethernet/microchip/sparx5/sparx5_psfp.c | 5 +++-- .../microchip/sparx5/sparx5_tc_flower.c | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_psfp.c +3 -2
@@ -273,6 +273,9 @@ int sparx5_psfp_fm_add(struct sparx5 *sparx5, u32 uidx, ret =sparx5_psfp_fm_get (uidx, &fm->pol.idx);if (ret <0 )return ret; + + *id = fm->pol.idx; +/* Was already in use, no need to reconfigure */ if (ret >1 )return 0 ;
@@ -287,8 +290,6 @@ int sparx5_psfp_fm_add(struct sparx5 *sparx5, u32 uidx,if (ret <0 )return ret; - *id = fm->pol.idx; -return 0 ; }
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +14 -4
@@ -801,7 +801,7 @@ static int sparx5_tc_flower_psfp_setup(struct sparx5 *sparx5,/* Add new flow-meter */ ret =sparx5_psfp_fm_add (sparx5, pol_idx, fm, &psfp_fmid);if (ret <0 ) -return ret; + goto err_sg_del; }/* Map stream filter to stream gate */
@@ -810,7 +810,7 @@ static int sparx5_tc_flower_psfp_setup(struct sparx5 *sparx5,/* Add new stream-filter and map it to a steam gate */ ret =sparx5_psfp_sf_add (sparx5, sf, &psfp_sfid);if (ret <0 ) -return ret; + goto err_fm_del;/* Streams are classified by ISDX - map ISDX 1:1 to sfid for now. */ sparx5_isdx_conf_set (sparx5, psfp_sfid, psfp_sfid, psfp_fmid);
@@ -818,13 +818,23 @@ static int sparx5_tc_flower_psfp_setup(struct sparx5 *sparx5, ret =vcap_rule_add_action_bit (vrule,VCAP_AF_ISDX_ADD_REPLACE_SEL ,VCAP_BIT_1 );if (ret) -return ret; + goto err_sf_del; ret =vcap_rule_add_action_u32 (vrule,VCAP_AF_ISDX_VAL , psfp_sfid);if (ret) -return ret; + goto err_sf_del;return 0 ; + +err_sf_del: +sparx5_isdx_conf_set (sparx5, psfp_sfid,0 ,0 ); +sparx5_psfp_sf_del (sparx5, psfp_sfid); +err_fm_del: +if (pol_idx >=0 ) +sparx5_psfp_fm_del (sparx5, psfp_fmid); +err_sg_del: +sparx5_psfp_sg_del (sparx5, psfp_sgid); +return ret; }/* Handle the action trap for a VCAP rule */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 185/1193 ALSA: es18xx: check control allocation before private data setup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruoyu Wang <[email protected]>
[ Upstream commit 422e42b7c2b882ba1d16d4afc8891bcea7c4de93 ]
snd_es18xx_mixer() creates controls with snd_ctl_new1() and then stores bookkeeping pointers or sets private_free before calling snd_ctl_add(). snd_ctl_new1() can return NULL on allocation failure, so those writes can dereference a NULL control pointer.
Check the returned control pointers before using them and return -ENOMEM on allocation failure.
--- sound/isa/es18xx.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/isa/es18xx.c +4 -0
@@ -1776,6 +1776,8 @@ static int snd_es18xx_mixer(struct snd_card *card)for (idx =0 ; idx <ARRAY_SIZE (snd_es18xx_base_controls); idx++) {struct snd_kcontrol *kctl; kctl =snd_ctl_new1 (&snd_es18xx_base_controls[idx], chip); +if (!kctl) +return -ENOMEM ;if (chip->caps &ES18XX_HWV ) {switch (idx) {case 0 :
@@ -1837,6 +1839,8 @@ static int snd_es18xx_mixer(struct snd_card *card)for (idx =0 ; idx <ARRAY_SIZE (snd_es18xx_hw_volume_controls); idx++) {struct snd_kcontrol *kctl; kctl =snd_ctl_new1 (&snd_es18xx_hw_volume_controls[idx], chip); +if (!kctl) +return -ENOMEM ;if (idx ==0 ) chip->hw_volume = kctl;else
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 186/1193 netfilter: nf_conntrack: use get_unaligned_be32() in tcp_sack()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit d3bf9eae486490832bd08fd62ab0ac601f346bd4 ]
The timestamp-only fast path dereferences the option stream as *(__be32 *)ptr, which assumes 4-byte alignment that the TCP option stream does not guarantee. Use get_unaligned_be32() instead, which reads the value safely and already returns host byte order, so the htonl() on the comparison constant can be dropped.
This matches the existing get_unaligned_be32() use later in the same function.
--- net/netfilter/nf_conntrack_proto_tcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +5 -5
@@ -405,11 +405,11 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,return ;/* Fast path for timestamp-only option */ -if (length ==TCPOLEN_TSTAMP_ALIGNED - && *(__be32 *)ptr ==htonl ((TCPOPT_NOP <<24 ) - | (TCPOPT_NOP <<16 ) - | (TCPOPT_TIMESTAMP <<8 ) - |TCPOLEN_TIMESTAMP )) +if (length ==TCPOLEN_TSTAMP_ALIGNED && +get_unaligned_be32 (ptr) == ((TCPOPT_NOP <<24 ) | + (TCPOPT_NOP <<16 ) | + (TCPOPT_TIMESTAMP <<8 ) | +TCPOLEN_TIMESTAMP ))return ;while (length >0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 187/1193 btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 18d32b0013efba19f7ad3e5b08d7aee813d604a6 ]
[BUG]
Running btrfs balance can trigger a null-ptr-deref before relocating a data chunk when metadata corruption leaves a chunk in the chunk tree without a corresponding block group in the in-memory cache:
KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f]
RIP: 0010:btrfs_may_alloc_data_chunk+0x40/0x1c0 fs/btrfs/volumes.c:3601
Call Trace:
__btrfs_balance fs/btrfs/volumes.c:4217 [inline]
btrfs_balance+0x2516/0x42b0 fs/btrfs/volumes.c:4604
btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline]
btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313
...[CAUSE]__btrfs_balance() iterates the on-disk chunk tree and passes the chunk logical bytenr to btrfs_may_alloc_data_chunk() before relocating a data chunk. That helper then queries the in-memory block group cache:
cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_type = cache->flags; /* cache may be NULL */
A corrupt image can contain a chunk item whose matching block group item is missing, so no block group is ever inserted into the cache. In that case btrfs_lookup_block_group() returns NULL.
The code only guards this with ASSERT(cache), which becomes a no-op when CONFIG_BTRFS_ASSERT is disabled. The subsequent dereference of cache->flags therefore crashes the kernel.
[FIX]
Add a NULL check after btrfs_lookup_block_group() in btrfs_may_alloc_data_chunk() and print and error message for clarity.
--- fs/btrfs/volumes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/volumes.c +5 -1
@@ -3466,7 +3466,11 @@ static int btrfs_may_alloc_data_chunk(struct btrfs_fs_info *fs_info,u64 chunk_type; cache =btrfs_lookup_block_group (fs_info, chunk_offset); -ASSERT (cache); +if (unlikely (!cache)) { +btrfs_err (fs_info,"balance: chunk at bytenr %llu has no corresponding block group" , + chunk_offset); +return -EUCLEAN ; + } chunk_type = cache->flags;btrfs_put_block_group (cache);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 188/1193 btrfs: tree-checker: validate names in ROOT_REF and ROOT_BACKREF
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Cen <[email protected]>
[ Upstream commit 0af37c217edf15fa21dac1c40822086df356c6bb ]
ROOT_REF and ROOT_BACKREF items contain a struct btrfs_root_ref followed by the subvolume name. Several readers assume that this layout is already valid and then use the on-disk name length directly. A corrupted item can therefore make those readers address bytes outside the item, and BTRFS_IOC_GET_SUBVOL_INFO can copy too many bytes into its fixed-size UAPI name buffer.
Validate ROOT_REF and ROOT_BACKREF items in tree-checker before any reader uses them. Reject records that do not contain a non-empty name, whose name_len does not exactly describe the remaining item payload, or whose name exceeds BTRFS_NAME_LEN.
For BTRFS_IOC_GET_SUBVOL_INFO, copy only the validated on-disk name_len instead of deriving the copy length from the item size. The ioctl result is zeroed when allocated. That leaves the existing trailing zero byte untouched.
--- fs/btrfs/ioctl.c | 11 +++++------ fs/btrfs/tree-checker.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-)
fs/btrfs/ioctl.c +5 -6
@@ -2167,7 +2167,6 @@ static int btrfs_ioctl_get_subvol_info(struct inode *inode, void __user *argp)struct btrfs_root_ref *rref;struct extent_buffer *leaf;unsigned long item_off; -unsigned long item_len;int slot;int ret =0 ;
@@ -2242,17 +2241,17 @@ static int btrfs_ioctl_get_subvol_info(struct inode *inode, void __user *argp)btrfs_item_key_to_cpu (leaf, &key, slot);if (key.objectid == subvol_info->treeid && key.type ==BTRFS_ROOT_BACKREF_KEY ) { +u16 name_len; + subvol_info->parent_id = key.offset; rref = btrfs_item_ptr(leaf, slot, struct btrfs_root_ref); + name_len =btrfs_root_ref_name_len (leaf, rref); subvol_info->dirid =btrfs_root_ref_dirid (leaf, rref); - item_off =btrfs_item_ptr_offset (leaf, slot) - +sizeof (struct btrfs_root_ref ); - item_len =btrfs_item_size (leaf, slot) - -sizeof (struct btrfs_root_ref ); + item_off =btrfs_item_ptr_offset (leaf, slot) +sizeof (*rref);read_extent_buffer (leaf, subvol_info->name, - item_off, item_len); + item_off, name_len); }else { ret = -ENOENT ; goto out;
fs/btrfs/tree-checker.c +35 -0
@@ -1252,6 +1252,37 @@ static int check_root_item(struct extent_buffer *leaf, struct btrfs_key *key,return 0 ; } +static int check_root_ref (struct extent_buffer *leaf,struct btrfs_key *key,int slot) +{ +struct btrfs_root_ref *rref; +u32 item_size =btrfs_item_size (leaf, slot); +u32 name_len; + +if (unlikely (item_size <=sizeof (*rref))) { +generic_err (leaf, slot, +"invalid root ref item size for key type %u, have %u expect > %zu" , + key->type, item_size,sizeof (*rref)); +return -EUCLEAN ; + } + + rref = btrfs_item_ptr(leaf, slot, struct btrfs_root_ref); + name_len =btrfs_root_ref_name_len (leaf, rref); +if (unlikely (name_len >BTRFS_NAME_LEN )) { +generic_err (leaf, slot, +"root ref name too long for key type %u, have %u max %u" , + key->type, name_len,BTRFS_NAME_LEN ); +return -EUCLEAN ; + } +if (unlikely (item_size !=sizeof (*rref) + name_len)) { +generic_err (leaf, slot, +"invalid root ref item size for key type %u, have %u expect %zu" , + key->type, item_size,sizeof (*rref) + name_len); +return -EUCLEAN ; + } + +return 0 ; +} + __printf(3,4)__cold static void extent_err(const struct extent_buffer *eb, int slot,
@@ -1871,6 +1902,10 @@ static enum btrfs_tree_block_status check_leaf_item(struct extent_buffer *leaf,case BTRFS_ROOT_ITEM_KEY : ret =check_root_item (leaf, key, slot);break ; +case BTRFS_ROOT_REF_KEY : +case BTRFS_ROOT_BACKREF_KEY : + ret =check_root_ref (leaf, key, slot); +break ;case BTRFS_EXTENT_ITEM_KEY :case BTRFS_METADATA_ITEM_KEY : ret =check_extent_item (leaf, key, slot, prev_key);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 189/1193 NFS: fix eof updates after NFSv4.2 fallocate/zero-range
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dai Ngo <[email protected]>
[ Upstream commit 35168eb947f230aaa35fd8416a30563ef89f5421 ]
Generic/075 reliably exposes a regression when the client holds an NFSv4 write delegation: ZERO_RANGE/ALLOCATE extends the file on the server, but the local inode keeps the old i_size. The test then fails with 'Size error' because the post-op attribute refresh refuses to touch i_size while a delegation is outstanding, and the cached EOF was never marked stale.
Update _nfs42_proc_fallocate() so that on success it:
- bumps i_size when the operation extends the file, and
- marks NFS_INO_INVALID_BLOCKS since the block count can also change
Tested with xfstests generic/075 over NFSv4.2.
--- fs/nfs/nfs42proc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/nfs/nfs42proc.c +10 -5
@@ -79,12 +79,17 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, status =nfs4_call_sync (server->client, server, msg, &args.seq_args, &res.seq_res,0 );if (status ==0 ) { -if (nfs_should_remove_suid (inode)) { -spin_lock (&inode->i_lock); +loff_t newsize = offset + len; + +spin_lock (&inode->i_lock); +if (newsize >i_size_read (inode)) +i_size_write (inode, newsize); +nfs_set_cache_invalid (inode,NFS_INO_INVALID_BLOCKS ); +if (nfs_should_remove_suid (inode))nfs_set_cache_invalid (inode, -NFS_INO_REVAL_FORCED |NFS_INO_INVALID_MODE ); -spin_unlock (&inode->i_lock); - } +NFS_INO_REVAL_FORCED | +NFS_INO_INVALID_MODE ); +spin_unlock (&inode->i_lock); status =nfs_post_op_update_inode_force_wcc (inode, res.falloc_fattr); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 190/1193 RDMA/rtrs-srv: Fix integer underflow in process_read and process_write
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurelien DESBRIERES <[email protected]>
[ Upstream commit 54bf38b27afc08a0eb6b732f9c14eb8a4bcb66b5 ]
usr_len is read from a network-supplied message field (le16_to_cpu) and used to compute data_len = off - usr_len without validating that usr_len <= off. A malicious RDMA client can send usr_len > off causing an integer underflow, resulting in data_len wrapping to a huge size_t value which is then passed to the rdma_ev callback as a memory length, leading to out-of-bounds memory access.
Fix by reading and validating usr_len <= off before rtrs_srv_get_ops_ids() in both process_read() and process_write(), ensuring the early return path acquires no reference and has no resource leak.
--- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-srv.c +10 -2
@@ -1042,6 +1042,11 @@ static void process_read(struct rtrs_srv_con *con, "Processing read request failed, invalid message\n");return ; } + usr_len =le16_to_cpu (msg->usr_len); +if (usr_len > off) { +pr_debug ("rtrs-srv: Invalid usr_len %zu > off %u\n" , usr_len, off); +return ; + }rtrs_srv_get_ops_ids (srv_path);rtrs_srv_update_rdma_stats (srv_path->stats, off,READ ); id = srv_path->ops_ids[buf_id];
@@ -1049,7 +1054,6 @@ static void process_read(struct rtrs_srv_con *con, id->dir =READ ; id->msg_id = buf_id; id->rd_msg = msg; - usr_len =le16_to_cpu (msg->usr_len); data_len = off - usr_len; data =page_address (srv->chunks[buf_id]); ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
@@ -1095,6 +1099,11 @@ static void process_write(struct rtrs_srv_con *con, rtrs_srv_state_str(srv_path->state));return ; } + usr_len =le16_to_cpu (req->usr_len); +if (usr_len > off) { +pr_debug ("rtrs-srv: Invalid usr_len %zu > off %u\n" , usr_len, off); +return ; + }rtrs_srv_get_ops_ids (srv_path);rtrs_srv_update_rdma_stats (srv_path->stats, off,WRITE ); id = srv_path->ops_ids[buf_id];
@@ -1102,7 +1111,6 @@ static void process_write(struct rtrs_srv_con *con, id->dir =WRITE ; id->msg_id = buf_id; - usr_len =le16_to_cpu (req->usr_len); data_len = off - usr_len; data =page_address (srv->chunks[buf_id]); ret = ctx->ops.rdma_ev(srv->priv, id, data, data_len,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 191/1193 xprtrdma: Add request-pool slack for delayed recycling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 64bf6892057b746c55bcc045b9492741b72d8d27 ]
After the previous patch gates req recycling on Send completion, a completed RPC's rpcrdma_req can remain pinned by the sendctx ring until the next signaled Send completion releases it. The transmitted-RPC ceiling is unchanged: xprt_request_get_cong() gates Sends against xprt->cwnd, the RPC/RDMA credit window fed by server-granted credits and capped at re_max_requests. The req pool, however, must exceed max_reqs by enough that this recycle delay does not stall a slot allocation that the credit window would admit.
The headroom is bounded. frwr_open() sets re_send_batch to re_max_requests >> 3 -- one in every eight Sends is signaled -- so at most re_send_batch unsignaled Sends can be outstanding before the next signaled completion releases them. That equals max_reqs / 8 reqs in the worst case, with a one-slot floor for small max_reqs values where the right-shift rounds to zero.
The sendctx ring and the hardware Send Queue are not enlarged to match. Both are sized in rpcrdma_sendctxs_create() and frwr_query_device() for re_max_requests in-flight Sends, which is the ceiling the credit window enforces. The pool slack does not raise that ceiling -- it only lets allocation keep pace with the credit window during the brief interval in which earlier reqs are pinned waiting for the next signaled completion. At any moment, at most re_send_batch sendctxes are held by unswept unsignaled Sends, leaving the rest of the ring available for newly admitted Sends.
Allocate max_reqs + DIV_ROUND_UP(max_reqs, 8) request objects and name the slack calculation at the allocation site so the 1/8 bound stays tied to the Send-signaling batch size.
--- net/sunrpc/xprtrdma/verbs.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +20 -1
@@ -1110,6 +1110,22 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)spin_unlock (&buf->rb_lock); } +static unsigned int rpcrdma_req_pool_slack (unsigned int max_reqs) +{ +/* The sendctx ring can hold up to one Send-signaling batch +* (re_send_batch, set by frwr_open() to re_max_requests >> 3) +* of unfinished Sends. Each pins its req until a signaled Send +* completion releases the sendctx. Size the pool above max_reqs +* by that batch so the recycle delay does not stall a slot +* allocation that the RPC/RDMA credit window would admit. +* +* Round up: re_max_requests >> 3 is zero when max_reqs < 8, but +* a single unsignaled Send is still enough to pin one req. One +* slack slot covers that case. +*/ +return DIV_ROUND_UP (max_reqs,8 ); +} +/** * rpcrdma_buffer_create - Create initial set of req/rep objects * @r_xprt: transport instance to (re)initialize
@@ -1119,6 +1135,7 @@ static void rpcrdma_reps_destroy(struct rpcrdma_buffer *buf)int rpcrdma_buffer_create (struct rpcrdma_xprt *r_xprt) {struct rpcrdma_buffer *buf = &r_xprt->rx_buf; +unsigned int max_reqs;int i, rc; buf->rb_bc_srv_max_requests =0 ;
@@ -1132,7 +1149,9 @@ int rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt)INIT_LIST_HEAD (&buf->rb_all_reps); rc = -ENOMEM ; -for (i =0 ; i < r_xprt->rx_xprt.max_reqs; i++) { + max_reqs = r_xprt->rx_xprt.max_reqs; + max_reqs +=rpcrdma_req_pool_slack (max_reqs); +for (i =0 ; i < max_reqs; i++) {struct rpcrdma_req *req; req = rpcrdma_req_create(r_xprt,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 192/1193 configfs_depend_prep(): pass configfs_dirent instead of dentry
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 764682e0118432260191d194edbdaff208260483 ]
Again, the only thing it uses dentry for is dentry->d_fsdata; for the recursive call the situation is the same as with configfs_detach_prep() and the same observation about ->s_dentry->d_fsdata applies.
--- fs/configfs/dir.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/configfs/dir.c +4 -8
@@ -1060,15 +1060,12 @@ static int configfs_dump(struct configfs_dirent *sd, int level)* much on the stack, though, so folks that need this function - be careful * about your stack! Patches will be accepted to make it iterative. */ -static int configfs_depend_prep (struct dentry *origin, +static int configfs_depend_prep (struct configfs_dirent *sd,struct config_item *target) { -struct configfs_dirent *child_sd, *sd; +struct configfs_dirent *child_sd;int ret =0 ; -BUG_ON (!origin || !origin->d_fsdata); - sd = origin->d_fsdata; -if (sd->s_element == target)/* Boo-yah */ goto out;
@@ -1076,8 +1073,7 @@ static int configfs_depend_prep(struct dentry *origin,if ((child_sd->s_type &CONFIGFS_DIR ) && !(child_sd->s_type &CONFIGFS_USET_DROPPING ) && !(child_sd->s_type &CONFIGFS_USET_CREATING )) { - ret =configfs_depend_prep (child_sd->s_dentry, - target); + ret =configfs_depend_prep (child_sd, target);if (!ret) goto out;/* Child path boo-yah */ }
@@ -1098,7 +1094,7 @@ static int configfs_do_depend_item(struct dentry *subsys_dentry,spin_lock (&configfs_dirent_lock);/* Scan the tree, return 0 if found */ - ret =configfs_depend_prep (subsys_dentry, target); + ret =configfs_depend_prep (subsys_dentry->d_fsdata, target);if (ret) goto out_unlock_dirent_lock;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 193/1193 net: ibm: emac: mal: fix potential system hang in mal_remove()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 7c5d41f87f079990bf241359e3c1332d8d10fe87 ]
napi_disable() is not idempotent and calling it on an already-disabled or unenabled NAPI context will cause the kernel to spin indefinitely waiting for the NAPI_STATE_SCHED bit to clear.
In mal_remove(), napi_disable() is called unconditionally. If no MACs were registered, NAPI was never enabled. Also, if they were registered but subsequently unregistered, NAPI was already disabled in mal_unregister_commac(). In either case, calling napi_disable() causes the kernel to hang upon module removal.
Fix this by only calling napi_disable() in mal_remove() if the commac list is not empty (which implies NAPI is enabled).
--- drivers/net/ethernet/ibm/emac/mal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/ibm/emac/mal.c +3 -3
@@ -718,13 +718,13 @@ static int mal_remove(struct platform_device *ofdev)MAL_DBG (mal,"remove" NL );/* Synchronize with scheduled polling */ -napi_disable (&mal->napi); - -if (!list_empty (&mal->list)) +if (!list_empty (&mal->list)) { +napi_disable (&mal->napi);/* This is *very* bad */ WARN (1 ,KERN_EMERG "mal%d: commac list is not empty on remove!\n" , mal->index); + }free_irq (mal->serr_irq, mal);free_irq (mal->txde_irq, mal);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 194/1193 tls: Flush backlog before waiting for a new record
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit edcf32b8a48f5882b5b7a91b21c89d233d4aecf2 ]
While lock_sock is held, incoming TCP segments land on sk->sk_backlog rather than sk->sk_receive_queue. tls_rx_rec_wait() inspects only sk_receive_queue, so backlog data remains invisible. For non-blocking callers (read_sock, and recvmsg or splice_read with MSG_DONTWAIT) this causes a spurious -EAGAIN. For blocking callers it forces an unnecessary sleep/wakeup cycle.
Flush the backlog inside tls_rx_rec_wait() before checking sk_receive_queue so the strparser can parse newly-arrived segments immediately. On the next loop iteration tls_read_flush_backlog() may redundantly flush, but this path is cold and the cost is negligible.
Backlog processing can run tcp_reset(), which calls tcp_done_with_error() to set sk->sk_err = ECONNRESET and then tcp_done() to set sk->sk_shutdown = SHUTDOWN_MASK. The pre-existing top-of-loop sk_err check already ran before the flush, so the freshly-set error would be masked by the next-line sk_shutdown test returning 0 (EOF). Re-check sk_err immediately before the sk_shutdown test so a connection abort surfaces as -ECONNRESET rather than a clean EOF.
Commit f508262ae9f2 ("tls: Preserve sk_err across recvmsg() when data has been copied") gave the top-of-loop sk_err check a has_copied split. The recheck applies the same handling: when the caller has already copied bytes, sk_err is reported but preserved so the error surfaces on the next call; otherwise sock_error() consumes it so the error is reported exactly once.
--- net/tls/tls_sw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/tls/tls_sw.c +12 -0
@@ -1414,12 +1414,24 @@ tls_rx_rec_wait(struct sock *sk, struct sk_psock *psock, bool nonblock,if (ret <0 )return ret; +if (sk_flush_backlog (sk)) + released = true;if (!skb_queue_empty (&sk->sk_receive_queue)) {tls_strp_check_rcv (&ctx->strp);if (tls_strp_msg_ready (ctx))break ; } +/* sk_flush_backlog() can run tcp_reset(), which sets +* sk_err and then sk_shutdown via tcp_done(). Recheck +* sk_err here so a connection abort surfaces as the +* actual error rather than a clean EOF. +*/ +if (sk->sk_err) { +if (has_copied) +return -READ_ONCE (sk->sk_err); +return sock_error (sk); + }if (sk->sk_shutdown &RCV_SHUTDOWN )return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 195/1193 platform/x86: dell-laptop: add Inspiron N5110 to touchpad LED quirk table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gleb Sonichev <[email protected]>
[ Upstream commit bfe91a80b13f8068f6fa07aa8c468d284150d4ad ]
The Inspiron N5110 needs the touchpad LED quirk (Vostro V130 quirk) to properly control the touchpad LED. Add its DMI identifier to the existing quirk table, next to the similar Inspiron M5110 entry.
Tested on Dell Inspiron N5110.
The touchpad LED works correctly with this quirk enabled.
--- drivers/platform/x86/dell/dell-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/dell/dell-laptop.c +9 -0
@@ -206,6 +206,15 @@ static const struct dmi_system_id dell_quirks[] __initconst = { }, .driver_data = &quirk_dell_vostro_v130, }, + { + .callback = dmi_matched, + .ident = "Dell Inspiron N5110", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N5110"), + }, + .driver_data = &quirk_dell_vostro_v130, + }, { .callback = dmi_matched, .ident = "Dell Vostro 3360",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 196/1193 wifi: mt76: transform aspm_conf for pci_disable_link_state
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiajia Liu <[email protected]>
[ Upstream commit 2dd78856223484895306351df1f903a4b75d213f ]
commit b478e162f227 ("PCI/ASPM: Consolidate link state defines") changed PCIE_LINK_STATE_L0S (1) to (BIT(0) | BIT(1)). PCI_EXP_LNKCTL_ASPM_L0S (1) and PCI_EXP_LNKCTL_ASPM_L1 (2) are no longer matched with PCIE_LINK_STATE_L0S (3) and PCIE_LINK_STATE_L1 (4).
On the platform enabling ASPM L0s and L1, mt76_pci_disable_aspm is not able to disable L1. Fix this by transforming aspm_conf to pcie link state.
--- drivers/net/wireless/mediatek/mt76/pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/pci.c +7 -1
@@ -30,8 +30,14 @@ void mt76_pci_disable_aspm(struct pci_dev *pdev)if (IS_ENABLED (CONFIG_PCIEASPM )) {int err; +int state =0 ; - err =pci_disable_link_state (pdev, aspm_conf); +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L0S ) + state |=PCIE_LINK_STATE_L0S ; +if (aspm_conf &PCI_EXP_LNKCTL_ASPM_L1 ) + state |=PCIE_LINK_STATE_L1 ; + + err =pci_disable_link_state (pdev, state);if (!err)return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 197/1193 btrfs: protect sb_write_pointer() with invalidate lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: KangNing Liao <[email protected]>
[ Upstream commit 123b9a545f4d0348e81f558a032bf2a93ee5722f ]
sb_write_pointer() reads the super block from the block device page cache using read_cache_page_gfp(). This has the same race with BLKBSZSET as the one fixed by commit 3f29d661e568 ("btrfs: sync read disk super and set block size").
Take the mapping invalidate lock around read_cache_page_gfp() to serialize the read against block size changes.
--- fs/btrfs/zoned.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/zoned.c +2 -0
@@ -130,8 +130,10 @@ static int sb_write_pointer(struct block_device *bdev, struct blk_zone *zones,u64 bytenr =ALIGN_DOWN (zone_end,BTRFS_SUPER_INFO_SIZE ) -BTRFS_SUPER_INFO_SIZE ; +filemap_invalidate_lock (mapping); page[i] =read_cache_page_gfp (mapping, bytenr >>PAGE_SHIFT ,GFP_NOFS ); +filemap_invalidate_unlock (mapping);if (IS_ERR (page[i])) {if (i ==1 )btrfs_release_disk_super (super[0 ]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 198/1193 hwmon: (adt7462) Add of_match_table to support devicetree
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit cd1b42617aafe01810ab7d3b9948d2f5fa9fb8af ]
Add of_match_table to add support of devicetree probing.
--- drivers/hwmon/adt7462.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hwmon/adt7462.c +8 -0
@@ -12,6 +12,7 @@#include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/err.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/log2.h> #include <linux/slab.h>
@@ -1814,10 +1815,17 @@ static const struct i2c_device_id adt7462_id[] = { };MODULE_DEVICE_TABLE (i2c, adt7462_id); +static const struct of_device_id adt7462_of_match[] = { + { .compatible ="onnn,adt7462" }, + { }, +}; +MODULE_DEVICE_TABLE (of, adt7462_of_match); +static struct i2c_driver adt7462_driver = { .class =I2C_CLASS_HWMON , .driver = { .name ="adt7462" , + .of_match_table = adt7462_of_match, }, .probe = adt7462_probe, .id_table = adt7462_id,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 199/1193 net: dsa: qca8k: Add support for force mode for fixed link topology
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Moussalem <[email protected]>
[ Upstream commit e0a77b1ed9001bdd0c73b99c67abb90f4bd7d7f5 ]
A fixed link topology is commonly used to connect this switch (on port 0 or 6) to a SoC's MAC over SGMII. When inband negotiation is not used, the switch needs to be configured to operate in force mode. As such, enable support for force mode.
--- drivers/net/dsa/qca/qca8k-8xxx.c | 22 ++++++++++++++++------ drivers/net/dsa/qca/qca8k.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/net/dsa/qca/qca8k-8xxx.c +16 -6
@@ -1526,7 +1526,7 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode, {struct qca8k_priv *priv =pcs_to_qca8k_pcs (pcs)->priv;int cpu_port_index, ret, port; -u32 reg, val; +u32 mask, reg, val; port =pcs_to_qca8k_pcs (pcs)->port;switch (port) {
@@ -1599,11 +1599,21 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,if (priv->ports_config.sgmii_tx_clk_falling_edge) val |=QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE ; -if (val) - ret =qca8k_rmw (priv, reg, -QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE | -QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE , - val); + mask = (val) ? (QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE | +QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE ) :0 ; + +/* +* (Un)set force mode on QCA8337 only, don't include it in the mask for +* others. It is written to the PORT0 PAD register for both port 0 and 6. +*/ +if (priv->switch_id ==QCA8K_ID_QCA8337 ) { +if (neg_mode ==PHYLINK_PCS_NEG_OUTBAND ) + val |=QCA8K_PORT_PAD_SGMII_FORCE_MODE ; + mask |=QCA8K_PORT_PAD_SGMII_FORCE_MODE ; + } + +if (mask) + ret =qca8k_rmw (priv, reg, mask, val);return 0 ; }
drivers/net/dsa/qca/qca8k.h +1 -0
@@ -58,6 +58,7 @@#define QCA8K_PORT_PAD_RGMII_TX_DELAY_EN BIT(25)#define QCA8K_PORT_PAD_RGMII_RX_DELAY_EN BIT(24)#define QCA8K_PORT_PAD_SGMII_EN BIT(7) +#define QCA8K_PORT_PAD_SGMII_FORCE_MODE BIT(3)#define QCA8K_REG_PWS 0x010#define QCA8K_PWS_POWER_ON_SEL BIT(31)/* This reg is only valid for QCA832x and toggle the package
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 200/1193 vdpa/ifcvf: handle dev_set_name() failure in ifcvf_vdpa_dev_add()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Evgenii Burenchev <[email protected]>
[ Upstream commit 4c653e85857b41a7148917f2628fae1d04a9c251 ]
dev_set_name() may fail and return an error, but its return value is currently ignored and overwritten by _vdpa_register_device().
Abort device creation if dev_set_name() fails and release the device reference to avoid continuing with an improperly initialized struct device.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Message-ID: <[email protected]>
--- drivers/vdpa/ifcvf/ifcvf_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +9 -2
@@ -718,15 +718,22 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, ret =dev_set_name (&vdpa_dev->dev,"%s" , name); else ret =dev_set_name (&vdpa_dev->dev,"vdpa%u" , vdpa_dev->index); +if (ret) { +IFCVF_ERR (pdev,"Failed to set device name" ); + goto err; + } ret =_vdpa_register_device (&adapter->vdpa, vf->nr_vring);if (ret) { -put_device (&adapter->vdpa.dev);IFCVF_ERR (pdev,"Failed to register to vDPA bus" ); -return ret; + goto err; }return 0 ; + +err: +put_device (&adapter->vdpa.dev); +return ret; }static void ifcvf_vdpa_dev_del (struct vdpa_mgmt_dev *mdev,struct vdpa_device *dev)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 201/1193 ALSA: hda/realtek: Add quirk for HP 255 15.6 inch G9 Notebook PC
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Furst Blumier <[email protected]>
[ Upstream commit 98e157916f83c26a41448267180944048d2f1460 ]
The HP 255 15.6 inch G9 Notebook PC (PCI SSID 103c:8a1b) uses the ALC236 codec but lacks an entry in the quirk table, causing the kernel to fall back to a null SSID match (103c:0000) and skip the necessary fixup. Add a quirk entry using ALC236_FIXUP_HP_MUTE_LED_COEFBIT2, matching the HP 255 G8 which uses the same codec and fixup. This fixes the mute-button LED and fixes an issue with unplugging and replugging a headset jack not being recognized as an audio sink.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10177,6 +10177,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x89ca ,"HP" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x89d3 ,"HP EliteBook 645 G9 (MB 89D2)" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ),SND_PCI_QUIRK (0x103c ,0x8a0f ,"HP Pavilion 14-ec1xxx" ,ALC287_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x8a1b ,"HP 255 15.6 inch G9 Notebook PC" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x8a1f ,"HP Laptop 14s-dr5xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x8a20 ,"HP Laptop 15s-fq5xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 202/1193 ALSA: hda/realtek: Add quirk for Lenovo Yoga Pro 7 14IRH8
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moritz Baron <[email protected]>
[ Upstream commit 853e10ec445984e99b3c7f6375f4e185614b842a ]
The Lenovo Yoga Pro 7 14IRH8 (ALC287 codec, subsystem ID 0x17aa:0x38b1) has bass speakers on pin 0x17 that are not routed through a DAC with volume control. This causes the bass speakers to play at full volume regardless of the volume slider position.
Apply ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN which corrects the DAC routing for pin 0x17, enabling proper volume control. This is the same fix used for other Yoga Pro 7 models with identical audio topology (14APH8, 14AHP9, 14ASP10, 14IAH10).
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -10566,6 +10566,10 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3843 ,"Yoga 9i" ,ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP ),SND_PCI_QUIRK (0x17aa ,0x3847 ,"Legion 7 16ACHG6" ,ALC287_FIXUP_LEGION_16ACHG6 ),SND_PCI_QUIRK (0x17aa ,0x384a ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ), +/* Yoga Pro 7 14IRH8 shares PCI SSID 17aa:3852 with Yoga 7 14ITL5; +* use codec SSID to distinguish them +*/ +HDA_CODEC_QUIRK (0x17aa ,0x38b1 ,"Lenovo Yoga Pro 7 14IRH8" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3852 ,"Lenovo Yoga 7 14ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ),SND_PCI_QUIRK (0x17aa ,0x3853 ,"Lenovo Yoga 7 15ITL5" ,ALC287_FIXUP_YOGA7_14ITL_SPEAKERS ), SND_PCI_QUIRK(0x17aa, 0x3855, "Legion 7 16ITHG6", ALC287_FIXUP_LEGION_16ITHG6),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 203/1193 ata: libata-pmp: add JMicron JMS562 quirk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Rao <[email protected]>
[ Upstream commit c62aff1174cf88e10716c7513702443c47551fc6 ]
JMicron JMS562, as used in QNAP QDA-A2AR RAID1 adapters, may keep the exported ATA device not ready while the array is rebuilding.
In this state, libata may repeatedly try to softreset and classify the fan-out link. On the affected adapter, this can time out, make PMP/SCR access fail, and eventually disable the fan-out link before the RAID volume is exported.
A failing boot shows the fan-out link failing SRST, PMP access timing out, SCR read failing, and the link being disabled:
ata4.00: softreset failed (device not ready) ata4.15: qc timeout after 3000 msecs (cmd 0xe4) ata4.00: failed to read SCR 0 (Emask=0x4) ata4.00: failed to recover link after 3 tries, disabling
After that, the root filesystem on the exported RAID volume cannot be found.
Add JMS562 to the existing JMicron PMP quirk that disables LPM, avoids softreset on fan-out links, and assumes an ATA device. This prevents libata from dropping the exported RAID volume during rebuild recovery.
--- drivers/ata/libata-pmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ata/libata-pmp.c +6 -1
@@ -446,8 +446,13 @@ static void sata_pmp_quirks(struct ata_port *ap)* otherwise. Don't try hard to recover it. */ ap->pmp_link[ap->nr_pmp_links -1 ].flags |=ATA_LFLAG_NO_RETRY ; - }else if (vendor ==0x197b && (devid ==0x2352 || devid ==0x0325 )) { + }else if (vendor ==0x197b && + (devid ==0x0562 || devid ==0x2352 || devid ==0x0325 )) {/* +* 0x0562: JMicron JMS562, as used in QNAP QDA-A2AR RAID1 +* adapters. The exported device may stay not ready +* while the array is rebuilding, and SRST/classify can +* time out before the RAID volume is exported. * 0x2352: found in Thermaltake BlackX Duet, jmicron JMB350? * 0x0325: jmicron JMB394. */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 204/1193 platform/x86: intel-hid: Add HP ProBook x360 440 G1 to button_array_table
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Metchev <[email protected]>
[ Upstream commit c39023ca9a447f09c072080efc84d6874c2275c9 ]
The volume rocker buttons on the HP ProBook x360 440 G1 convertible emit events 0xc4-0xc7 via the intel-hid ACPI device (INT33D5). These codes are only present in intel_array_keymap, which is used when the "5 button array" input device exists. On this machine button_array_present() returns false because the firmware does not advertise the array through the HEBC method, so notify_handler() routes the events to a NULL priv->array and they are dropped as "unknown event 0xc4". As a result the side volume keys do nothing.
Add the machine to button_array_table so the array device is created and the volume rocker emits KEY_VOLUMEUP / KEY_VOLUMEDOWN. This is equivalent to booting with the enable_5_button_array=1 module parameter, which was used to confirm the fix on the affected hardware.
--- drivers/platform/x86/intel/hid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/intel/hid.c +7 -0
@@ -142,6 +142,13 @@ static const struct dmi_system_id button_array_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 4"), }, }, + { + .ident = "HP ProBook x360 440 G1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "HP"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook x360 440 G1"), + }, + }, { } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 205/1193 nvme-fc: Do not cancel requests in io target before it is initialized
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
[ Upstream commit ee38469f88492df99e1d97f03aa40ecfd218934f ]
A new nvme-fc controller in CONNECTING state sees admin request timeout schedules ctrl->ioerr_work to abort inflight requests. This ends up calling __nvme_fc_abort_outstanding_ios() which aborts requests in both admin and io tagsets. In case fc_ctrl->tag_set was not initialized we see the warning below. This is because ctrl.queue_count is initialized early in nvme_fc_alloc_ctrl().
nvme nvme0: NVME-FC{0}: starting error recovery Connectivity Loss
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe lpfc 0000:ab:00.0: queue 0 connect admin queue failed (-6). you didn't initialize this object before use?
turning off the locking correctness validator.
Workqueue: nvme-reset-wq nvme_fc_ctrl_ioerr_work [nvme_fc] Call Trace: <TASK> dump_stack_lvl+0x57/0x80 register_lock_class+0x567/0x580 __lock_acquire+0x330/0xb90 lock_acquire.part.0+0xad/0x210 blk_mq_tagset_busy_iter+0xf9/0xc00 __nvme_fc_abort_outstanding_ios+0x23f/0x320 [nvme_fc] nvme_fc_ctrl_ioerr_work+0x172/0x210 [nvme_fc] process_one_work+0x82c/0x1450 worker_thread+0x5ee/0xfd0 kthread+0x3a0/0x750 ret_from_fork+0x439/0x670 ret_from_fork_asm+0x1a/0x30 </TASK>
Update the check in __nvme_fc_abort_outstanding_ios() confirm that io tagset was created before iterating over busy requests. Also make sure to cancel ctrl->ioerr_work before removing io tagset.
--- drivers/nvme/host/fc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +6 -1
@@ -2459,7 +2459,7 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues)* io requests back to the block layer as part of normal completions * (but with error status). */ -if (ctrl->ctrl.queue_count >1 ) { +if (ctrl->ctrl.queue_count >1 && ctrl->ctrl.tagset) {nvme_quiesce_io_queues (&ctrl->ctrl);nvme_sync_io_queues (&ctrl->ctrl); blk_mq_tagset_busy_iter(&ctrl->tag_set,
@@ -2896,6 +2896,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl) out_delete_hw_queues:nvme_fc_delete_hw_io_queues (ctrl); out_cleanup_tagset: +/* +* In CONNECTING state ctrl->ioerr_work will abort both admin +* and io tagsets. Cancel it first before removing io tagset. +*/ +cancel_work_sync (&ctrl->ioerr_work);nvme_remove_io_tag_set (&ctrl->ctrl);nvme_fc_free_io_queues (ctrl);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 206/1193 sctp: Unwind address notifier registration on failure
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 c8459ee2fef502d6ef6c063751c33d9ac7943eab ]
sctp_v4_add_protocol() and sctp_v6_add_protocol() register their address notifiers before registering the SCTP protocol handlers. If protocol registration fails, the functions return without unregistering the notifiers.
Unregister the notifiers on the protocol registration failure paths. Also propagate notifier registration failures instead of ignoring them.
--- net/sctp/ipv6.c | 10 ++++++++-- net/sctp/protocol.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
net/sctp/ipv6.c +8 -2
@@ -1221,11 +1221,17 @@ void sctp_v6_protosw_exit(void)/* Register with inet6 layer. */ int sctp_v6_add_protocol (void ) { +int ret; +/* Register notifier for inet6 address additions/deletions. */ -register_inet6addr_notifier (&sctp_inet6addr_notifier); + ret =register_inet6addr_notifier (&sctp_inet6addr_notifier); +if (ret) +return ret; -if (inet6_add_protocol (&sctpv6_protocol,IPPROTO_SCTP ) <0 ) +if (inet6_add_protocol (&sctpv6_protocol,IPPROTO_SCTP ) <0 ) { +unregister_inet6addr_notifier (&sctp_inet6addr_notifier);return -EAGAIN ; + }return 0 ; }
net/sctp/protocol.c +8 -2
@@ -1276,12 +1276,18 @@ static void sctp_v4_protosw_exit(void)static int sctp_v4_add_protocol (void ) { +int ret; +/* Register notifier for inet address additions/deletions. */ -register_inetaddr_notifier (&sctp_inetaddr_notifier); + ret =register_inetaddr_notifier (&sctp_inetaddr_notifier); +if (ret) +return ret;/* Register SCTP with inet layer. */ -if (inet_add_protocol (&sctp_protocol,IPPROTO_SCTP ) <0 ) +if (inet_add_protocol (&sctp_protocol,IPPROTO_SCTP ) <0 ) { +unregister_inetaddr_notifier (&sctp_inetaddr_notifier);return -EAGAIN ; + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 207/1193 PCI: Avoid SBR for Qualcomm WCN6855/WCN7850 WiFi, SDX62/SDX65 modems
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jose Ignacio Tornos Martinez <[email protected]>
[ Upstream commit 6a4f64c3a3ada43e71ef1e06da89beb36bdaeefa ]
Some Qualcomm PCIe devices (WCN6855/WCN7850 WiFi cards, SDX62/SDX65 modems) do not properly support Secondary Bus Reset (SBR).
Testing confirms this is device-specific, not deployment-specific:
MediaTek MT7925e successfully uses bus reset through the same passive M.2-to-PCIe adapters where Qualcomm devices fail, proving PERST# is properly wired through the adapters.
Prevent use of Secondary Bus Reset for these devices.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -3770,6 +3770,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003e , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x1103 , quirk_no_bus_reset);/* WCN6855 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x1107 , quirk_no_bus_reset);/* WCN7850 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_QCOM ,0x0308 , quirk_no_bus_reset);/* SDX62/SDX65 */ /* * Root port on some Cavium CN8xxx chips do not successfully complete a bus
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 208/1193 dmaengine: dw-axi-dmac: fix PM for system sleep and channel alloc
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tze Yee Ng <[email protected]>
[ Upstream commit df0c2dc68770cf43f15df40b184df030b850ea05 ]
The driver only had runtime PM callbacks. If a channel stayed allocated across system suspend/resume, the runtime usage count could remain non-zero while hardware state (DMAC_CFG, clocks) was lost, and axi_dma_runtime_resume() would not run to restore it.
Add system-sleep PM ops that use pm_runtime_force_suspend() and pm_runtime_force_resume() so suspend/resume reuses the existing axi_dma_suspend() and axi_dma_resume() paths.
Replace pm_runtime_get() with pm_runtime_resume_and_get() in dma_chan_alloc_chan_resources() so clocks are enabled before a client can immediately submit a transfer and touch MMIO.
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +9 -2
@@ -470,11 +470,17 @@ static void dw_axi_dma_synchronize(struct dma_chan *dchan)static int dma_chan_alloc_chan_resources (struct dma_chan *dchan) {struct axi_dma_chan *chan =dchan_to_axi_dma_chan (dchan); +int ret; + + ret =pm_runtime_resume_and_get (chan->chip->dev); +if (ret <0 ) +return ret;/* ASSERT: channel is idle */ if (axi_chan_is_hw_enable (chan)) {dev_err (chan2dev (chan),"%s is non-idle!\n" ,axi_chan_name (chan)); +pm_runtime_put (chan->chip->dev);return -EBUSY ; }
@@ -485,12 +491,11 @@ static int dma_chan_alloc_chan_resources(struct dma_chan *dchan) 64, 0);if (!chan->desc_pool) {dev_err (chan2dev (chan),"No memory for descriptors\n" ); +pm_runtime_put (chan->chip->dev);return -ENOMEM ; }dev_vdbg (dchan2dev (dchan),"%s: allocating\n" ,axi_chan_name (chan)); -pm_runtime_get (chan->chip->dev); -return 0 ; }
@@ -1565,6 +1570,8 @@ static int dw_remove(struct platform_device *pdev) }static const struct dev_pm_ops dw_axi_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume)SET_RUNTIME_PM_OPS (axi_dma_runtime_suspend, axi_dma_runtime_resume,NULL ) };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 209/1193 hwmon: (pmbus/lm25066) Fix PMBus coefficients for LM5064/5066/5066i
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Potin Lai <[email protected]>
[ Upstream commit 83dda7ed185501ba1f8165aeca83ff4a8ef7c263 ]
Swap the high setting and low setting coefficients in the lm25066_coeff table for LM5064, LM5066, and LM5066i. The coefficients were previously mapped incorrectly, resulting in inverted current and power scaling.
Additionally, dynamically assign the exponent (R) registers inside the probe's LM25066_DEV_SETUP_CL check. This ensures that the proper exponent is applied (e.g., for LM25056, high setting power exponent is -4, but low setting power exponent is -3).
--- drivers/hwmon/pmbus/lm25066.c | 54 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 26 deletions(-)
drivers/hwmon/pmbus/lm25066.c +28 -26
@@ -133,23 +133,23 @@ static const struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10742, - .b = 1552, + .m = 5456, + .b = 2118, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5456, - .b = 2118, + .m = 10742, + .b = 1552, .R = -2, }, [PSC_POWER] = { - .m = 1204, - .b = 8524, + .m = 612, + .b = 11202, .R = -3, }, [PSC_POWER_L] = { - .m = 612, - .b = 11202, + .m = 1204, + .b = 8524, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -168,23 +168,23 @@ static const struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 10753, - .b = -1200, + .m = 5405, + .b = -600, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 5405, - .b = -600, + .m = 10753, + .b = -1200, .R = -2, }, [PSC_POWER] = { - .m = 1204, - .b = -6000, + .m = 605, + .b = -8000, .R = -3, }, [PSC_POWER_L] = { - .m = 605, - .b = -8000, + .m = 1204, + .b = -6000, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -203,23 +203,23 @@ static const struct __coeff lm25066_coeff[][PSC_NUM_CLASSES + 2] = { .R = -2, }, [PSC_CURRENT_IN] = { - .m = 15076, - .b = -504, + .m = 7645, + .b = 100, .R = -2, }, [PSC_CURRENT_IN_L] = { - .m = 7645, - .b = 100, + .m = 15076, + .b = -504, .R = -2, }, [PSC_POWER] = { - .m = 1701, - .b = -4000, + .m = 861, + .b = -965, .R = -3, }, [PSC_POWER_L] = { - .m = 861, - .b = -965, + .m = 1701, + .b = -4000, .R = -3, }, [PSC_TEMPERATURE] = {
@@ -520,18 +520,20 @@ static int lm25066_probe(struct i2c_client *client) info->m[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].m; info->b[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].b; info->R[PSC_VOLTAGE_OUT ] = coeff[PSC_VOLTAGE_OUT ].R; - info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].R; - info->R[PSC_POWER ] = coeff[PSC_POWER ].R;if (config &LM25066_DEV_SETUP_CL ) { info->m[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].m; info->b[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].b; + info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN_L ].R; info->m[PSC_POWER ] = coeff[PSC_POWER_L ].m; info->b[PSC_POWER ] = coeff[PSC_POWER_L ].b; + info->R[PSC_POWER ] = coeff[PSC_POWER_L ].R; }else { info->m[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].m; info->b[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].b; + info->R[PSC_CURRENT_IN ] = coeff[PSC_CURRENT_IN ].R; info->m[PSC_POWER ] = coeff[PSC_POWER ].m; info->b[PSC_POWER ] = coeff[PSC_POWER ].b; + info->R[PSC_POWER ] = coeff[PSC_POWER ].R; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 210/1193 spi: xilinx: let transfers timeout in case of no IRQ
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit 0f95264f49ace739d411fd9149e2b3545d741d06 ]
In case of failed HW the driver may not see an interrupt and will stuck in waiting forever. We can avoid such situation by timing out of transfers if the interrupt is not seen in a reasonable time.
This problem can be found on unload of ptp_ocp driver for TimeCard which uses Xilinx SPI AXI and SPI-NOR flash memory. During tear-down process spi-nor drivers send soft reset command which is not triggering an interrupt stalling the unload process completely.
--- drivers/spi/spi-xilinx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-xilinx.c +5 -1
@@ -284,7 +284,11 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)if (use_irq) { xspi->write_fn (cr, xspi->regs +XSPI_CR_OFFSET ); -wait_for_completion (&xspi->done); +if (!wait_for_completion_timeout (&xspi->done,secs_to_jiffies (1 ))) { +dev_err (&spi->dev,"SPI transfer timed out\n" ); +xspi_init_hw (xspi); +return -ETIMEDOUT ; + }/* A transmit has just completed. Process received data * and check for more data to transmit. Always inhibit * the transmitter while the Isr refills the transmit
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 211/1193 Bluetooth: btusb: Add Mercusys MA530 for Realtek RTL8761BUV
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hrvoje Nuic <[email protected]>
[ Upstream commit ce21a5cf3d1fd92b84ea9ad2b7c7240aff2162d2 ]
Add the USB ID for the Mercusys MA530 Bluetooth adapter. The device uses a Realtek RTL8761BUV controller and works with the existing Realtek setup path.
The device reports vendor ID 0x2c4e and product ID 0x0115, and loads the rtl_bt/rtl8761bu_fw.bin firmware successfully with this quirk.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -730,6 +730,8 @@ static const struct usb_device_id quirks_table[] = { { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK }, /* Additional Realtek 8761BUV Bluetooth devices */ + { USB_DEVICE(0x2c4e, 0x0115), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 212/1193 Bluetooth: btusb: Add support for TP-Link TL-UB250
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cris <[email protected]>
[ Upstream commit ea77debfe443f505a4edbb7f21340a583a8a143f ]
Add USB ID 2357:0607 for TP-Link TL-UB250.
This is a Realtek RTL8761BUV based Bluetooth adapter.
Without this entry the device is picked up by the generic Bluetooth USB class match and exposes hci0, but the Realtek setup path is not used and rtl8761bu firmware/config are not loaded.
The controller reports Realtek Semiconductor Corporation as the manufacturer and LMP subversion 0x8761. With this entry added, btusb loads rtl_bt/rtl8761bu_fw.bin and rtl_bt/rtl8761bu_config.bin successfully.
Relevant part of /sys/kernel/debug/usb/devices:
T: Bus=01 Lev=02 Prnt=06 Port=00 Cnt=01 Dev#= 9 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=2357 ProdID=0607 Rev= 2.00 S: Product=TP-Link TL-UB250 Adapter
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
Use the same flags as the existing TP-Link 2357:0604 entry.
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -734,6 +734,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2357, 0x0604), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x2357, 0x0607), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2550, 0x8761), .driver_info = BTUSB_REALTEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 213/1193 Bluetooth: L2CAP: validate connectionless PSM length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Moelius <[email protected]>
[ Upstream commit a40a5f922546b3bd7c094d882b29177db4f2abe0 ]
Connectionless L2CAP frames carry a two-byte PSM at the start of the payload. l2cap_recv_frame() currently reads that PSM unconditionally after validating only the outer L2CAP length.
A malformed connectionless frame with a zero- or one-byte payload can therefore make the parser read beyond the advertised skb payload and use tailroom bytes as part of the PSM. A VHCI-backed QEMU reproducer injected a one-byte connectionless payload and reached the unchecked read.
Reject connectionless frames that cannot contain the PSM before reading or pulling it. This preserves all valid connectionless frames while dropping only structurally incomplete packets.
--- net/bluetooth/l2cap_core.c | 5 +++++ 1 file changed, 5 insertions(+)
net/bluetooth/l2cap_core.c +5 -0
@@ -7031,6 +7031,11 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)break ;case L2CAP_CID_CONN_LESS : +if (skb->len <L2CAP_PSMLEN_SIZE ) { +kfree_skb (skb); +break ; + } + psm =get_unaligned ((__le16 *) skb->data);skb_pull (skb,L2CAP_PSMLEN_SIZE );l2cap_conless_channel (conn, psm, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 214/1193 ASoC: rockchip: rockchip_pdm: Handle runtime PM resume failures in set_fmt
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 ee7b5f7b39332febf917f9ebf212842cc9379815 ]
rockchip_pdm_set_fmt() calls pm_runtime_get_sync() before accessing hardware registers, but ignores its return value.
If the runtime resume fails, the function continues to perform register accesses while the device state is undefined.
Replace pm_runtime_get_sync() with pm_runtime_resume_and_get() and return early on failure to avoid unpowered register accesses.
--- sound/soc/rockchip/rockchip_pdm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/rockchip/rockchip_pdm.c +5 -1
@@ -322,6 +322,7 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai, {struct rk_pdm_dev *pdm =to_info (cpu_dai);unsigned int mask =0 , val =0 ; +int ret; mask =PDM_CKP_MSK ;switch (fmt &SND_SOC_DAIFMT_INV_MASK ) {
@@ -335,7 +336,10 @@ static int rockchip_pdm_set_fmt(struct snd_soc_dai *cpu_dai,return -EINVAL ; } -pm_runtime_get_sync (cpu_dai->dev); + ret =pm_runtime_resume_and_get (cpu_dai->dev); +if (ret) +return ret; +regmap_update_bits (pdm->regmap,PDM_CLK_CTRL , mask, val);pm_runtime_put (cpu_dai->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 215/1193 ASoC: rockchip: rockchip_pdm: Reorder clock enable sequence
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 3168721d6ec3b610edf6a3c22ad190722a27d276 ]
Enable the 'hclk' bus clock before the 'clk' controller clock during runtime resume.
The bus clock provides the register access interface, so enable it before the controller clock. This also makes the resume sequence the reverse of the suspend sequence, which keeps the clock ordering consistent.
--- sound/soc/rockchip/rockchip_pdm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/rockchip/rockchip_pdm.c +5 -5
@@ -427,16 +427,16 @@ static int rockchip_pdm_runtime_resume(struct device *dev)struct rk_pdm_dev *pdm =dev_get_drvdata (dev);int ret; - ret =clk_prepare_enable (pdm->clk); + ret =clk_prepare_enable (pdm->hclk);if (ret) { -dev_err (pdm->dev,"clock enable failed %d\n" , ret); +dev_err (pdm->dev,"hclock enable failed %d\n" , ret);return ret; } - ret =clk_prepare_enable (pdm->hclk); + ret =clk_prepare_enable (pdm->clk);if (ret) { -clk_disable_unprepare (pdm->clk); -dev_err (pdm->dev,"hclock enable failed %d\n" , ret); +clk_disable_unprepare (pdm->hclk); +dev_err (pdm->dev,"clock enable failed %d\n" , ret);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 216/1193 ASoC: rockchip: spdif: Restore regcache cache-only mode on sync failure
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 3546e9aa691ac981e4734fedd1646d0180784893 ]
If regcache_sync() fails during runtime resume, the driver disables the clocks and returns an error. However, the regmap cache-only mode is left disabled.
Restore cache-only mode in the error path so subsequent register accesses continue to use the cache while the device is inactive.
--- sound/soc/rockchip/rockchip_spdif.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/rockchip/rockchip_spdif.c +1 -0
@@ -98,6 +98,7 @@ static int __maybe_unused rk_spdif_runtime_resume(struct device *dev) ret =regcache_sync (spdif->regmap);if (ret) { +regcache_cache_only (spdif->regmap, true);clk_disable_unprepare (spdif->mclk);clk_disable_unprepare (spdif->hclk); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 217/1193 Bluetooth: btusb: Add TP-Link UB600 for Realtek 8761BUV
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nils Helmig <[email protected]>
[ Upstream commit bc597f0cc44f0b173c50ee986a047219cd559ee9 ]
Add the vendor/product ID (0x37ad, 0x0600) to usb_device_id table for Realtek 8761BUV.
The device info from /sys/kernel/debug/usb/devices as below.
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 4 Spd=12 MxCh= 0 D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=37ad ProdID=0600 Rev= 2.00 S: Manufacturer= S: Product=TP-Link Bluetooth USB Adapter S: SerialNumber=ACA7F14FD2A5 C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
--- drivers/bluetooth/btusb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btusb.c +2 -0
@@ -750,6 +750,8 @@ static const struct usb_device_id quirks_table[] = { BTUSB_WIDEBAND_SPEECH }, { USB_DEVICE(0x2b89, 0x6275), .driver_info = BTUSB_REALTEK | BTUSB_WIDEBAND_SPEECH }, + { USB_DEVICE(0x37ad, 0x0600), .driver_info = BTUSB_REALTEK | + BTUSB_WIDEBAND_SPEECH }, /* Additional Realtek 8761CU Bluetooth devices */ { USB_DEVICE(0x0b05, 0x1bef), .driver_info = BTUSB_REALTEK |
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 218/1193 sparc64: uprobes: add missing break
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 5b0eee4cd812bd6547eea393cb9b5c0322f26c88 ]
Missing fallthrough causes failure with newer compilers:
arch/sparc/kernel/uprobes.c:284:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
284 | default:
| ^
arch/sparc/kernel/uprobes.c:284:2: note: insert 'break;' to avoid fall-through
284 | default:
| ^
| break;--- arch/sparc/kernel/uprobes.c | 1 + 1 file changed, 1 insertion(+)
arch/sparc/kernel/uprobes.c +1 -0
@@ -278,6 +278,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,case DIE_SSTEP :if (uprobe_post_sstep_notifier (args->regs)) ret =NOTIFY_STOP ; +break ;default :break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 219/1193 net: stmmac: xgmac2: disable RBUE in default RX interrupt mask
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nazim Amirul <[email protected]>
[ Upstream commit d3265c19b35d036bba327b36b5366bee76b0157c ]
Enabling the RX Buffer Unavailable (RBUE) interrupt is counterproductive and can trigger a MAC interrupt storm under heavy RX pressure. When the DMA runs out of RX descriptors it fires RBUE continuously until software refills the ring.
However, RBUE is redundant: the normal RX completion interrupt (RIE) already triggers NAPI, which processes completed descriptors and refills the ring, causing the DMA to resume. The RBUE handler itself only sets handle_rx - the same outcome as RIE.
On Agilex5 under heavy RX pressure, the MAC interrupt (which includes RBUE) was observed firing 1,821,811,555 times against only 2,618,627 actual RX completions - a ~695x ratio - confirming the severity of the storm.
RBUE does not provide OOM recovery. If page_pool is exhausted, stmmac_rx_refill() cannot advance the DMA tail pointer, the DMA stays suspended, and RBUE fires again on the next NAPI completion - a storm with no forward progress. This patch trades that storm for a clean stall with the same RX outcome. Proper OOM recovery is a pre-existing gap outside the scope of this fix.
Note: as a consequence of disabling RBUE, the rx_buf_unav_irq ethtool counter will always read 0 on XGMAC2 devices. This behaviour is already inconsistent across DWMAC core versions.
Remove RBUE from XGMAC_DMA_INT_DEFAULT_EN and XGMAC_DMA_INT_DEFAULT_RX to prevent the interrupt storm while keeping normal RX handling intact.
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 -2
@@ -435,9 +435,9 @@#define XGMAC_RIE BIT(6)#define XGMAC_TBUE BIT(2)#define XGMAC_TIE BIT(0) -#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | XGMAC_RBUE | \ +#define XGMAC_DMA_INT_DEFAULT_EN (XGMAC_NIE | XGMAC_AIE | \ XGMAC_RIE | XGMAC_TIE) -#define XGMAC_DMA_INT_DEFAULT_RX (XGMAC_RBUE | XGMAC_RIE) +#define XGMAC_DMA_INT_DEFAULT_RX (XGMAC_RIE)#define XGMAC_DMA_INT_DEFAULT_TX (XGMAC_TIE)#define XGMAC_DMA_CH_Rx_WATCHDOG (x) (0x0000313c + (0x80 * (x)))#define XGMAC_RWT GENMASK(7, 0)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 220/1193 ptp: ocp: add shutdown callback
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit f6f955cbf9d4e02deebe54ca91c118b53be9ffe6 ]
The shutdown callback was never implemented for this driver, but it's needed because .remove() callback is never called during kexec/reboot process. That leaves HW with some interrupts enabled and may cause spurious interrupt while booting into a new kernel during with kexec. If it happens that I2C interrupt fires during kexec, the whole I2C bus is disabled leaving TimeCard with no devlink communication. The same happens if timestampers were enabled, leaving the card without timestamper interrupts until full reboot cycle.
Implement .shutdown() callback with the same function as remove callback.
--- drivers/ptp/ptp_ocp.c | 1 + 1 file changed, 1 insertion(+)
drivers/ptp/ptp_ocp.c +1 -0
@@ -4264,6 +4264,7 @@ static struct pci_driver ptp_ocp_driver = { .id_table = ptp_ocp_pcidev_id, .probe = ptp_ocp_probe, .remove = ptp_ocp_remove, + .shutdown = ptp_ocp_remove, }; static int
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 221/1193 vsock: use sk_acceptq_is_full() helper in all transports
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raf Dickson <[email protected]>
[ Upstream commit 4ff2e84ff1b33d79fa0e3ae355ce4a334908ef9a ]
Replace the open-coded backlog check with sk_acceptq_is_full(). The helper uses > instead of >=, which is the correct comparison per commit 64a146513f8f ("[NET]: Revert incorrect accept queue backlog changes."), and adds READ_ONCE() for proper memory ordering.
--- net/vmw_vsock/hyperv_transport.c | 2 +- net/vmw_vsock/vmci_transport.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/hyperv_transport.c +1 -1
@@ -323,7 +323,7 @@ static void hvs_open_connection(struct vmbus_channel *chan) goto out;if (conn_from_host) { -if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) +if (sk_acceptq_is_full (sk)) goto out; new =vsock_create_connected (sk);
net/vmw_vsock/vmci_transport.c +1 -1
@@ -1002,7 +1002,7 @@ static int vmci_transport_recv_listen(struct sock *sk,* reset. Otherwise we create and initialize a child socket and reply * with a connection negotiation. */ -if (sk->sk_ack_backlog >= sk->sk_max_ack_backlog) { +if (sk_acceptq_is_full (sk)) {vmci_transport_reply_reset (pkt);return -ECONNREFUSED ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 222/1193 e1000e: limit endianness conversion to boundary words
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Agalakov Daniil <[email protected]>
[ Upstream commit a5ecafcfb27baf2dba766c4fd99dbb947f4e85d8 ]
[Why]
In e1000_set_eeprom(), the eeprom_buff is allocated to hold a range of words. However, only the boundary words (the first and the last) are populated from the EEPROM if the write request is not word-aligned. The words in the middle of the buffer remain uninitialized because they are intended to be completely overwritten by the new data via memcpy().
The previous implementation had a loop that performed le16_to_cpus() on the entire buffer. This resulted in endianness conversion being performed on uninitialized memory for all interior words.
Fix this by converting the endianness only for the boundary words immediately after they are successfully read from the EEPROM.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/ethernet/intel/e1000e/ethtool.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/e1000e/ethtool.c +12 -7
@@ -605,20 +605,25 @@ static int e1000_set_eeprom(struct net_device *netdev,/* need read/modify/write of first changed EEPROM word */ /* only the second byte of the word is being modified */ ret_val =e1000_read_nvm (hw, first_word,1 , &eeprom_buff[0 ]); +if (ret_val) + goto out; + +/* Device's eeprom is always little-endian, word addressable */ +le16_to_cpus (&eeprom_buff[0 ]); + ptr++; } -if (((eeprom->offset + eeprom->len) &1 ) && (!ret_val)) +if ((eeprom->offset + eeprom->len) &1 ) {/* need read/modify/write of last changed EEPROM word */ /* only the first byte of the word is being modified */ ret_val =e1000_read_nvm (hw, last_word,1 , &eeprom_buff[last_word - first_word]); +if (ret_val) + goto out; -if (ret_val) - goto out; - -/* Device's eeprom is always little-endian, word addressable */ -for (i =0 ; i < last_word - first_word +1 ; i++) -le16_to_cpus (&eeprom_buff[i]); +/* Device's eeprom is always little-endian, word addressable */ +le16_to_cpus (&eeprom_buff[last_word - first_word]); + }memcpy (ptr, bytes, eeprom->len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 223/1193 net/sched: act_csum: dont mangle UDP tunnel GSO packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Mikityanska <[email protected]>
[ Upstream commit 9bcb30b389ec5888590cb6ec58c7a3b80fe49a11 ]
Similar to commit add641e7dee3 ("sched: act_csum: don't mangle TCP and UDP GSO packets"), UDP tunnel GSO packets going through act_csum shouldn't have their checksum calculated at this point, because it will be done after segmentation. Setting the checksum in act_csum modifies skb->ip_summed and prevents inner IP csum offload from kicking in, resulting in a packet with a bad checksum.
Add UDP tunnel GSO packets to the exceptions, and also add UDP GSO (SKB_GSO_UDP_L4), as the same logic as in the commit mentioned above applies to UDP GSO too.
--- net/sched/act_csum.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sched/act_csum.c +6 -2
@@ -258,7 +258,9 @@ static int tcf_csum_ipv4_udp(struct sk_buff *skb, unsigned int ihl,const struct iphdr *iph;u16 ul; -if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type &SKB_GSO_UDP ) +if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type & + (SKB_GSO_UDP |SKB_GSO_UDP_L4 | +SKB_GSO_UDP_TUNNEL |SKB_GSO_UDP_TUNNEL_CSUM ))return 1 ;/*
@@ -314,7 +316,9 @@ static int tcf_csum_ipv6_udp(struct sk_buff *skb, unsigned int ihl,const struct ipv6hdr *ip6h;u16 ul; -if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type &SKB_GSO_UDP ) +if (skb_is_gso (skb) &&skb_shinfo (skb)->gso_type & + (SKB_GSO_UDP |SKB_GSO_UDP_L4 | +SKB_GSO_UDP_TUNNEL |SKB_GSO_UDP_TUNNEL_CSUM ))return 1 ;/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 224/1193 smb: client: fix races in cifsd thread creation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fredric Cover <[email protected]>
[ Upstream commit e8a5cf2ff5a13fefb228f2069e29dd7d8e37185d ]
The cifsd demultiplex thread can run and access tcp_ses before the parent thread has finished populating tcp_ses, which the worker thread accesses locklessly.
Also, the kthread_run macro may start the thread before returning the thread pointer. Because the pointer is part of the structure that the thread can access, if the kernel is preempted after the thread is spawned, but before the thread pointer is populated and the thread attempts to exit, it will sleep, waiting for a SIGKILL signal.
Fix this by moving creation of the thread to after all of tcp_ses'es fields are populated, and spawning the thread last, using a split kthread_create/wake_up_process logic.
--- fs/smb/client/connect.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
fs/smb/client/connect.c +16 -11
@@ -1839,14 +1839,6 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,* this will succeed. No need for try_module_get(). */ __module_get (THIS_MODULE ); - tcp_ses->tsk =kthread_run (cifs_demultiplex_thread, - tcp_ses,"cifsd" ); -if (IS_ERR (tcp_ses->tsk)) { - rc =PTR_ERR (tcp_ses->tsk); -cifs_dbg (VFS ,"error %d create cifsd thread\n" , rc); -module_put (THIS_MODULE ); - goto out_err_crypto_release; - } tcp_ses->min_offload = ctx->min_offload; tcp_ses->retrans = ctx->retrans;/*
@@ -1854,9 +1846,7 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,* to the struct since the kernel thread not created yet * no need to spinlock this update of tcpStatus */ -spin_lock (&tcp_ses->srv_lock); tcp_ses->tcpStatus = CifsNeedNegotiate; -spin_unlock (&tcp_ses->srv_lock);if ((ctx->max_credits <20 ) || (ctx->max_credits >60000 )) tcp_ses->max_credits =SMB2_MAX_CREDITS_AVAILABLE ;
@@ -1865,7 +1855,16 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, tcp_ses->nr_targets =1 ; tcp_ses->ignore_signature = ctx->ignore_signature; -/* thread spawned, put it on the list */ + + tcp_ses->tsk =kthread_create (cifs_demultiplex_thread, + tcp_ses,"cifsd" ); +if (IS_ERR (tcp_ses->tsk)) { + rc =PTR_ERR (tcp_ses->tsk); +cifs_dbg (VFS ,"error %d create cifsd thread\n" , rc); +module_put (THIS_MODULE ); + goto out_err_crypto_release; + } +/* thread created, put it on the list */ spin_lock (&cifs_tcp_ses_lock);list_add (&tcp_ses->tcp_ses_list, &cifs_tcp_ses_list);spin_unlock (&cifs_tcp_ses_lock);
@@ -1873,6 +1872,12 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx,/* queue echo request delayed work */ queue_delayed_work (cifsiod_wq, &tcp_ses->echo, tcp_ses->echo_interval); +/* +* Use split create/wake logic to ensure that tcp_ses is fully populated +* and tcp_ses->tsk is valid +*/ +wake_up_process (tcp_ses->tsk); +return tcp_ses; out_err_crypto_release:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 225/1193 i3c: mipi-i3c-hci: Tolerate i3c_master_add_i3c_dev_locked() failures in DAA
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit c236563c8a84239d31a1e6ec4444887a7b5ed98f ]
i3c_master_add_i3c_dev_locked() no longer leaves the address marked as free on failure, so aborting the DAA sequence on its error is unnecessary.
Failure to register a discovered device does not invalidate the entire Dynamic Address Assignment (DAA) procedure. Align with the behavior of other I3C master drivers by ignoring errors from i3c_master_add_i3c_dev_locked() and continuing enumeration.
--- drivers/i3c/master/mipi-i3c-hci/cmd_v1.c | 4 +--- drivers/i3c/master/mipi-i3c-hci/cmd_v2.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/i3c/master/mipi-i3c-hci/cmd_v1.c +1 -3
@@ -359,9 +359,7 @@ static int hci_cmd_v1_daa(struct i3c_hci *hci)* TODO: Extend the subsystem layer to allow for registering * new device and provide BCR/DCR/PID at the same time. */ - ret =i3c_master_add_i3c_dev_locked (&hci->master, next_addr); -if (ret) -break ; +i3c_master_add_i3c_dev_locked (&hci->master, next_addr); }if (dat_idx >=0 )
drivers/i3c/master/mipi-i3c-hci/cmd_v2.c +1 -3
@@ -299,9 +299,7 @@ static int hci_cmd_v2_daa(struct i3c_hci *hci)* TODO: Extend the subsystem layer to allow for registering * new device and provide BCR/DCR/PID at the same time. */ - ret =i3c_master_add_i3c_dev_locked (&hci->master, next_addr); -if (ret) -break ; +i3c_master_add_i3c_dev_locked (&hci->master, next_addr); }hci_free_xfer (xfer,2 );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 226/1193 sparc: Disable compat support with LLD
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rosen Penev <[email protected]>
[ Upstream commit 852fed2e8bfe195351fb0078ba7245d41154e7a5 ]
An LLVM=1 sparc64 allmodconfig enables COMPAT and then tries to build the 32-bit vDSO. That path cannot be linked with ld.lld:
ld.lld: error: unknown emulation: elf32_sparc
ld.lld does not support the 32-bit SPARC ELF emulation used for the compat vDSO, so keep COMPAT disabled when LLD is the linker. This avoids selecting an unsupported build path while leaving the existing GNU ld configuration unchanged.
--- arch/sparc/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/sparc/Kconfig +1 -0
@@ -487,6 +487,7 @@ endmenu config COMPAT bool depends on SPARC64 + depends on !LD_IS_LLD default y select HAVE_UID16 select ARCH_WANT_OLD_COMPAT_IPC
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 227/1193 ALSA: hda/realtek: Add quirk for Lenovo Xiaoxin 14 GT
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viktor Menshin <[email protected]>
[ Upstream commit 3a3e810e91080a5121170ee11554a55ed89a1c8b ]
The Lenovo Xiaoxin 14 GT (Chinese market model, AMD Ryzen AI 9 365) produces constant electrical hissing and crackling noise from both internal speakers and 3.5mm headphone jack during audio playback. Audio works correctly on Windows.
The PCI SSID 17aa:3912 is not present in the quirk list. The device shares the same AMD platform and ALC287 codec as neighboring Lenovo 14" AMD models (17aa:3911, 17aa:390d), so apply the same fixup.
Note: the fixup selection is based on similarity with neighboring models and has not been verified by testing a compiled kernel. Guidance from maintainers on the correct fixup is welcome.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10600,6 +10600,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x3902 ,"Lenovo E50-80" ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ),SND_PCI_QUIRK (0x17aa ,0x390d ,"Lenovo Yoga Pro 7 14ASP10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3911 ,"Lenovo Yoga Pro 7 14IAH10" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ), +SND_PCI_QUIRK (0x17aa ,0x3912 ,"Lenovo Xiaoxin 14 GT" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),SND_PCI_QUIRK (0x17aa ,0x3913 ,"Lenovo 145" ,ALC236_FIXUP_LENOVO_INV_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"IdeaPad S210" ,ALC283_FIXUP_INT_MIC ), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 228/1193 HID: hidpp: fix potential UAF in hidpp_connect_event()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
[ Upstream commit 6df6b1f2c49678211f65647c300bc51dda02893b ]
If input_register_device() fails, we call input_free_device(), but keep stale pointer to the old device in hidpp->input, which could potentially lead to UAF. Fix that by resetting it to NULL before returning from hidpp_connect_event().
--- drivers/hid/hid-logitech-hidpp.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-logitech-hidpp.c +1 -0
@@ -4313,6 +4313,7 @@ static void hidpp_connect_event(struct hidpp_device *hidpp) ret =input_register_device (input);if (ret) { + hidpp->input =NULL ;input_free_device (input);return ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 229/1193 fuse: set ff->flock only on success
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Tianci <[email protected]>
[ Upstream commit 71947173cef279be5eed209ec28f8c11f9d73159 ]
If FUSE_SETLK fails (e.g., due to EWOULDBLOCK), we shall not set FUSE_RELEASE_FLOCK_UNLOCK in fuse_file_release().
--- fs/fuse/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/file.c +2 -1
@@ -2680,8 +2680,9 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)struct fuse_file *ff = file->private_data;/* emulate flock with POSIX locks */ - ff->flock = true; err =fuse_setlk (file, fl,1 ); +if (!err) + ff->flock = true; }return err;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 230/1193 scsi: bfa: Reduce kernel stack usage in bfa_fcs_lport_fdmi_build_portattr_block()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 57a6ed0b41677ccc5e28cc0976e495c1dfa33747 ]
bfa_fcs_fdmi_get_portattr() gets inlined into multiple places and has two fairly large variables on the stack, to the point of causing a warning in some randconfig builds:
drivers/scsi/bfa/bfa_fcs_lport.c:2198:1: error: stack frame size (1560) exceeds limit (1280) in 'bfa_fcs_lport_fdmi_build_portattr_block' [-Werror,-Wframe-larger-than]
2198 | bfa_fcs_lport_fdmi_build_portattr_block(struct bfa_fcs_lport_fdmi_s *fdmi,
| ^
drivers/scsi/bfa/bfa_fcs_lport.c:1856:1: error: stack frame size (1600) exceeds limit (1280) in 'bfa_fcs_lport_fdmi_build_rhba_pyld' [-Werror,-Wframe-larger-than]
1856 | bfa_fcs_lport_fdmi_build_rhba_pyld(struct bfa_fcs_lport_fdmi_s *fdmi, u8 *pyld)
| ^Mark the inner function as noinline_for_stack to keep it separate from the other variables and prevent multiple copies of the same variable to get inlined here.
--- drivers/scsi/bfa/bfa_fcs_lport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/bfa/bfa_fcs_lport.c +1 -1
@@ -2673,7 +2673,7 @@ bfa_fcs_fdmi_get_hbaattr(struct bfa_fcs_lport_fdmi_s *fdmi, } -static void +static noinline_for_stack voidbfa_fcs_fdmi_get_portattr (struct bfa_fcs_lport_fdmi_s *fdmi,struct bfa_fcs_fdmi_port_attr_s *port_attr) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 231/1193 gpio: pisosr: Read "ngpios" as u32
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <[email protected]>
[ Upstream commit 4910aa198d25e5d1067236560ba34ab12bccc677 ]
The generic "ngpios" property is encoded as a normal uint32 cell. The pisosr driver stores it in the gpio_chip field, but reading it with a u16 helper does not match the DT property encoding.
Read "ngpios" as u32 and keep the existing assignment to the chip field.
--- drivers/gpio/gpio-pisosr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pisosr.c +3 -1
@@ -125,6 +125,7 @@ static int pisosr_gpio_probe(struct spi_device *spi) {struct device *dev = &spi->dev;struct pisosr_gpio *gpio; +u32 ngpios;int ret; gpio =devm_kzalloc (dev,sizeof (*gpio),GFP_KERNEL );
@@ -133,7 +134,8 @@ static int pisosr_gpio_probe(struct spi_device *spi) gpio->chip = template_chip; gpio->chip.parent = dev; -of_property_read_u16 (dev->of_node,"ngpios" , &gpio->chip.ngpio); +if (!of_property_read_u32 (dev->of_node,"ngpios" , &ngpios)) + gpio->chip.ngpio = ngpios; gpio->spi = spi;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 232/1193 spi: Add NULL check for spi_get_device_id() in spi_get_device_match_data()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: guoqi0226 <[email protected]>
[ Upstream commit f1b061b4d4c6cbf861319ba954caa80145cf018f ]
Prevent NULL pointer dereference when spi_get_device_id() returns NULL, which can happen when using driver_override without matching SPI ID entry.
--- drivers/spi/spi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi.c +5 -1
@@ -366,12 +366,16 @@ EXPORT_SYMBOL_GPL(spi_get_device_id);const void *spi_get_device_match_data (const struct spi_device *sdev) {const void *match; +const struct spi_device_id *id; match =device_get_match_data (&sdev->dev);if (match)return match; -return (const void *)spi_get_device_id (sdev)->driver_data; + id =spi_get_device_id (sdev); +if (!id) +return NULL ; +return (const void *)id->driver_data; }EXPORT_SYMBOL_GPL (spi_get_device_match_data);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 233/1193 ALSA: usb-audio: Add quirk flags for SC13A
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ai Chao <[email protected]>
[ Upstream commit 8956950dab22fbaefe92ca1980728165c5da793d ]
The SC13A ( VID 0x1ff7, PID 0x0f81) not support reading the current sample rate and results in an error message printed to kmsg. Set QUIRK_FLAG_GET_SAMPLE_RATE to skip the sample rate check.
Quirky device sample:
usb 3-5.2.4.1: new high-speed USB device number 11 using xhci_hcd usb 3-5.2.4.1: New USB device found, idVendor=1ff7, idProduct=0f81 usb 3-5.2.4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 3-5.2.4.1: Product: SC13A
usb 3-5.2.4.1: Manufacturer: Linux Foundation
usb 3-5.2.4.1: SerialNumber: 000002
usb 3-5.2.4.1: Found UVC 1.50 device SC13A (1ff7:0f81)
usb 3-5.2.4.1: 3:1: cannot get freq at ep 0x86
usb 3-5.2.4.1: Warning! Unlikely big volume range (=4096),
cval->res is probably wrong.
usb 3-5.2.4.1: [5] FU [Mic Capture Volume] ch = 1, val = 0/4096/1
usbcore: registered new interface driver snd-usb-audio usb 3-5.2.4.1: 3:1: cannot get freq at ep 0x86
usb 3-5.2.4.1: 3:1: cannot get freq at ep 0x86
--- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/quirks.c +2 -0
@@ -2225,6 +2225,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_MIC_RES_16),DEVICE_FLG (0x1bcf ,0x2283 ,/* NexiGo N930AF FHD Webcam */ QUIRK_FLAG_GET_SAMPLE_RATE |QUIRK_FLAG_MIC_RES_16 ), +DEVICE_FLG (0x1ff7 ,0x0f81 ,/* SC13A Webcam */ +QUIRK_FLAG_GET_SAMPLE_RATE ),DEVICE_FLG (0x2040 ,0x7200 ,/* Hauppauge HVR-950Q */ QUIRK_FLAG_SHARE_MEDIA_DEVICE |QUIRK_FLAG_ALIGN_TRANSFER ), DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 234/1193 tls: reject the combination of TLS and sockmap
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 460e6486617c17dd19abe8f3fc67d9a6fa25f8ca ]
TLS and sockmap (BPF psock) integration hides a lot of latent bugs. Bugs which may be more or less relevant for real users but they are definitely exploitable.
We could not find anyone actively using this integration so let's reject this config. Adding a TLS socket to a sockmap was already rejected by sk_psock_init() through the inet_csk_has_ulp() check. We need to reject the attempts to configure the TLS keys (rather than adding the ULP itself) because checking prior to the ULP installation is tricky without risking a race with sockmap getting added in parallel (sockmap does not hold the socket lock).
This patch is a minimal rejection of the feature. Subsequent patch in the series will do a light dead code removal. Full cleanup would require a major rewrite of the Tx path, we don't need skmsg any more.
--- net/tls/tls_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/tls/tls_main.c +11 -0
@@ -592,6 +592,17 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,int rc =0 ;int conf; +/* TLS and sockmap are mutually exclusive. A socket already in a +* sockmap (i.e. with a psock attached) cannot be upgraded to TLS. +* sockmap rejects TLS sockets already (see sk_psock_init()). +*/ +rcu_read_lock (); +if (sk_psock (sk)) { +rcu_read_unlock (); +return -EINVAL ; + } +rcu_read_unlock (); +if (sockptr_is_null (optval) || (optlen <sizeof (*crypto_info)))return -EINVAL ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 235/1193 ALSA: hda/conexant: Add pin config quirk for Lenovo IdeaPad Slim 5 16AKP10
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Galen Hassen <[email protected]>
[ Upstream commit f7c4968ae3af3e819428da5416c2dfd361473f5c ]
The Lenovo IdeaPad Slim 5 16AKP10 (PCI SSID 17aa:38b6) uses the Conexant SN6140 codec. The internal microphone is on pin 0x1a but the BIOS configures it with pin default 0x95a60120, which includes a jack detection bit that causes the kernel to treat it as an unplugged external mic rather than a fixed internal mic.
Add a pin config quirk that overrides pin 0x1a to 0x95a60130, setting the connectivity bits to indicate a fixed/always-connected device. This allows the internal microphone to be correctly identified and used.
--- sound/pci/hda/patch_conexant.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_conexant.c +12 -0
@@ -307,6 +307,7 @@ enum {CXT_FIXUP_HEADSET_MIC ,CXT_FIXUP_HP_MIC_NO_PRESENCE ,CXT_PINCFG_SWS_JS201D , +CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10 ,CXT_PINCFG_TOP_SPEAKER ,CXT_FIXUP_HP_A_U , CXT_FIXUP_ACER_SWIFT_HP,
@@ -841,6 +842,12 @@ static const struct hda_pintbl cxt_pincfg_lemote[] = { {} }; +/* Lenovo IdeaPad Slim 5 16AKP10 with SN6140 */ +static const struct hda_pintbl cxt_pincfg_lenovo_ideapad_slim5_16akp10[] = { + {0x1a ,0x95a60130 },/* Internal mic, fixed/always-connected */ + {} +}; +/* SuoWoSi/South-holding JS201D with sn6140 */ static const struct hda_pintbl cxt_pincfg_sws_js201d[] = { {0x16 ,0x03211040 },/* hp out */
@@ -1015,6 +1022,10 @@ static const struct hda_fixup cxt_fixups[] = { .type = HDA_FIXUP_PINS, .v.pins = cxt_pincfg_sws_js201d, }, + [CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10] = { + .type = HDA_FIXUP_PINS, + .v.pins = cxt_pincfg_lenovo_ideapad_slim5_16akp10, + }, [CXT_PINCFG_TOP_SPEAKER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -1123,6 +1134,7 @@ static const struct hda_quirk cxt5066_fixups[] = {SND_PCI_QUIRK (0x17aa ,0x21da ,"Lenovo X220" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21db ,"Lenovo X220-tablet" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x38af ,"Lenovo IdeaPad Z560" ,CXT_FIXUP_MUTE_LED_EAPD ), +SND_PCI_QUIRK (0x17aa ,0x38b6 ,"Lenovo IdeaPad Slim 5 16AKP10" ,CXT_PINCFG_LENOVO_IDEAPAD_SLIM5_16AKP10 ),SND_PCI_QUIRK (0x17aa ,0x3905 ,"Lenovo G50-30" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 236/1193 leds: uleds: Return -EFAULT on copy_to_user() failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yousef Alhouseen <[email protected]>
[ Upstream commit 61ed78f55a46e12afd4b464c4ba736f55ff33c5e ]
uleds_read() copies the current brightness value to userspace but ignores copy_to_user() failures. It then clears the pending update and reports a successful full read even when no data was copied.
Return -EFAULT when the copy fails and leave the update pending so a later read can retry.
--- drivers/leds/uleds.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/leds/uleds.c +7 -4
@@ -148,10 +148,13 @@ static ssize_t uleds_read(struct file *file, char __user *buffer, size_t count, }else if (!udev->new_data && (file->f_flags &O_NONBLOCK )) { retval = -EAGAIN ; }else if (udev->new_data) { - retval =copy_to_user (buffer, &udev->brightness, -sizeof (udev->brightness)); - udev->new_data = false; - retval =sizeof (udev->brightness); +if (copy_to_user (buffer, &udev->brightness, +sizeof (udev->brightness))) { + retval = -EFAULT ; + }else { + udev->new_data = false; + retval =sizeof (udev->brightness); + } }mutex_unlock (&udev->mutex);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 237/1193 leds: pca9532: Dont stop blinking for non-zero brightness
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Deiminger <[email protected]>
[ Upstream commit 0261683a4d31783d680e74b3ae5f22f6a62128cc ]
pca9532 unexpectedly stopped blinking when changing brightness to a non-zero value. To reproduce:
echo timer > /sys/class/leds/led-1/trigger # blinks echo 255 > /sys/class/leds/led-1/brightness # blinking stops, light on cat /sys/class/leds/led-1/trigger # still claims [timer]
According to Documentation/leds/leds-class.rst, only brightness = 0 shall be a stop condition:
Quoted 3 lines
You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to
LED_OFFit will also disable the timer trigger.
Therefore add a guard to continue blinking when brightness != LED_OFF, similar to how pca955x does it since 575f10dc64a2 ("leds: pca955x: Add HW blink support").
--- drivers/leds/leds-pca9532.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/leds-pca9532.c +5 -3
@@ -175,11 +175,13 @@ static int pca9532_set_brightness(struct led_classdev *led_cdev,int err =0 ;struct pca9532_led *led =ldev_to_led (led_cdev); -if (value ==LED_OFF ) +if (value ==LED_OFF ) { led->state =PCA9532_OFF ; -else if (value ==LED_FULL ) + }else if (led->state ==PCA9532_PWM1 ) { +return 0 ;/* Non-zero brightness shall not stop HW blinking */ + }else if (value ==LED_FULL ) { led->state =PCA9532_ON ; -else { + }else { led->state =PCA9532_PWM0 ;/* Thecus: hardcode one pwm */ err =pca9532_calcpwm (led->client,0 ,0 , value);if (err)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 238/1193 mfd: tps65219: Make poweroff handler conditional on system-power-controller
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akashdeep Kaur <[email protected]>
[ Upstream commit 104cd764a031bfe2ffe253adce9581384a78c16e ]
Currently, the TPS65219 driver unconditionally registers a poweroff handler. This causes issues on systems where a different component (such as TF-A firmware) should handle system poweroff instead.
Make the poweroff handler registration conditional based on the "system-power-controller" device tree property. This follows the standard kernel pattern where only the designated power controller registers for system poweroff operations.
On systems where the property is absent, the PMIC will not register a poweroff handler, allowing other poweroff mechanisms to function.
--- drivers/mfd/tps65219.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/tps65219.c +8 -6
@@ -280,13 +280,15 @@ static int tps65219_probe(struct i2c_client *client)return ret; } - ret =devm_register_power_off_handler (tps->dev, - tps65219_power_off_handler, - tps); -if (ret) { -dev_err (tps->dev,"failed to register power-off handler: %d\n" , ret); -return ret; +if (of_device_is_system_power_controller (tps->dev->of_node)) { + ret =devm_register_power_off_handler (tps->dev, + tps65219_power_off_handler, + tps); +if (ret) +return dev_err_probe (tps->dev, ret, +"Failed to register power-off handler\n" ); } +return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 239/1193 mfd: rsmu: Add 8a34002 support
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Bystrin <[email protected]>
[ Upstream commit d18fd55c780c2bae3d353024cab7f8746d3d9e91 ]
Add compatible string, i2c_devcie_id and spi_devcie_id to support 8a34002.
--- drivers/mfd/rsmu_i2c.c | 2 ++ drivers/mfd/rsmu_spi.c | 2 ++ 2 files changed, 4 insertions(+)
drivers/mfd/rsmu_i2c.c +2 -0
@@ -255,6 +255,7 @@ static void rsmu_i2c_remove(struct i2c_client *client)static const struct i2c_device_id rsmu_i2c_id[] = { {"8a34000" ,RSMU_CM }, {"8a34001" ,RSMU_CM }, + {"8a34002" ,RSMU_CM }, {"82p33810" ,RSMU_SABRE }, {"82p33811" ,RSMU_SABRE }, {"8v19n850" ,RSMU_SL },
@@ -266,6 +267,7 @@ MODULE_DEVICE_TABLE(i2c, rsmu_i2c_id);static const struct of_device_id rsmu_i2c_of_match[] = { { .compatible ="idt,8a34000" , .data = (void *)RSMU_CM }, { .compatible ="idt,8a34001" , .data = (void *)RSMU_CM }, + { .compatible ="idt,8a34002" , .data = (void *)RSMU_CM }, { .compatible ="idt,82p33810" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,82p33811" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,8v19n850" , .data = (void *)RSMU_SL },
drivers/mfd/rsmu_spi.c +2 -0
@@ -244,6 +244,7 @@ static void rsmu_spi_remove(struct spi_device *client)static const struct spi_device_id rsmu_spi_id[] = { {"8a34000" ,RSMU_CM }, {"8a34001" ,RSMU_CM }, + {"8a34002" ,RSMU_CM }, {"82p33810" ,RSMU_SABRE }, {"82p33811" ,RSMU_SABRE }, {}
@@ -253,6 +254,7 @@ MODULE_DEVICE_TABLE(spi, rsmu_spi_id);static const struct of_device_id rsmu_spi_of_match[] = { { .compatible ="idt,8a34000" , .data = (void *)RSMU_CM }, { .compatible ="idt,8a34001" , .data = (void *)RSMU_CM }, + { .compatible ="idt,8a34002" , .data = (void *)RSMU_CM }, { .compatible ="idt,82p33810" , .data = (void *)RSMU_SABRE }, { .compatible ="idt,82p33811" , .data = (void *)RSMU_SABRE }, {}
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 240/1193 drm/amdkfd: Let driver decide buffer size at AMDKFD_IOC_GET_DMABUF_INFO ioctl
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaogang Chen <[email protected]>
[ Upstream commit 8242a8d9d7194d5ef8a8b38a5621ca0966a3ec15 ]
amdkfd driver needs allocate buffer to return bo metadata to user space. The buffer size is controlled by user currently. It is a potential security issue that hostile value (e.g. 2 GiB) lets any render-group user trigger order-MAX allocation/OOM in kernel context.
This patch first finds bo metadata size. If the size is smaller than user provided value drive can safely allocate buffer in kernel space and copy to user space buffer. If not, driver will let user know, not allocate and copy. User will redo with new buffer in user space.
This patch lets driver decide buffer allocation size to avoid potential hostile size from user space.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 23 ++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++-------- 3 files changed, 22 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +19 -4
@@ -469,7 +469,7 @@ uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz(struct amdgpu_device *adev)int amdgpu_amdkfd_get_dmabuf_info (struct amdgpu_device *adev,int dma_buf_fd,struct amdgpu_device **dmabuf_adev, -uint64_t *bo_size,void *metadata_buffer, +uint64_t *bo_size,void **metadata_buffer,size_t buffer_size,uint32_t *metadata_size,uint32_t *flags,int8_t *xcp_id) {
@@ -504,9 +504,24 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd, *dmabuf_adev = adev;if (bo_size) *bo_size =amdgpu_bo_size (bo); -if (metadata_buffer) - r =amdgpu_bo_get_metadata (bo, metadata_buffer, buffer_size, - metadata_size, &metadata_flags); +if (metadata_buffer) { +/* first get metadata_size by buffer = NULL */ + r =amdgpu_bo_get_metadata (bo,NULL ,0 , + metadata_size,NULL ); + +/* user buf_size is bigger than bo metadata_size +* allocate a buf at kernel space and copy */ +if (*metadata_size <= buffer_size) { + *metadata_buffer =kzalloc (*metadata_size,GFP_KERNEL ); + +if (!*metadata_buffer) +return -ENOMEM ; + + r =amdgpu_bo_get_metadata (bo, *metadata_buffer, *metadata_size, +NULL , &metadata_flags); + }else + r = -EINVAL ; + }if (flags) { *flags = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ? KFD_IOC_ALLOC_MEM_FLAGS_VRAM
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +1 -1
@@ -237,7 +237,7 @@ uint64_t amdgpu_amdkfd_get_gpu_clock_counter(struct amdgpu_device *adev);uint32_t amdgpu_amdkfd_get_max_engine_clock_in_mhz (struct amdgpu_device *adev);int amdgpu_amdkfd_get_dmabuf_info (struct amdgpu_device *adev,int dma_buf_fd,struct amdgpu_device **dmabuf_adev, -uint64_t *bo_size,void *metadata_buffer, +uint64_t *bo_size,void **metadata_buffer,size_t buffer_size,uint32_t *metadata_size,uint32_t *flags,int8_t *xcp_id); uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct amdgpu_device *dst,
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -8
@@ -1547,16 +1547,10 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep,if (!dev)return -EINVAL ; -if (args->metadata_ptr) { - metadata_buffer =kzalloc (args->metadata_size,GFP_KERNEL ); -if (!metadata_buffer) -return -ENOMEM ; - } -/* Get dmabuf info from KGD */ r =amdgpu_amdkfd_get_dmabuf_info (dev->adev, args->dmabuf_fd, &dmabuf_adev, &args->size, - metadata_buffer, args->metadata_size, + &metadata_buffer, args->metadata_size, &args->metadata_size, &flags, &xcp_id);if (r) goto exit;
@@ -1568,7 +1562,7 @@ static int kfd_ioctl_get_dmabuf_info(struct file *filep, args->flags = flags;/* Copy metadata buffer to user mode */ -if (metadata_buffer) { +if (metadata_buffer && args->metadata_ptr) { r =copy_to_user ((void __user *)args->metadata_ptr, metadata_buffer, args->metadata_size);if (r !=0 )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 241/1193 drm/amdkfd: check find_first_zero_bit before __set_bit on kfd->doorbell_bitmap
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaogang Chen <[email protected]>
[ Upstream commit 516bf737a5602875f6c28d1028967837c8edf2c0 ]
If inx from find_first_zero_bit is beyond range not need set doorbell_bitmap.
--- drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +5 -3
@@ -153,14 +153,16 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd,u32 inx;mutex_lock (&kfd->doorbell_mutex); + inx =find_first_zero_bit (kfd->doorbell_bitmap,PAGE_SIZE /sizeof (u32)); +if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) { +mutex_unlock (&kfd->doorbell_mutex); +return NULL ; + }__set_bit (inx, kfd->doorbell_bitmap);mutex_unlock (&kfd->doorbell_mutex); -if (inx >=KFD_MAX_NUM_OF_QUEUES_PER_PROCESS ) -return NULL ; - *doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev, kfd->doorbells, inx,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 242/1193 drm/amdgpu: Use system unbound workqueue for soft IH ring
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Kristóf <[email protected]>
[ Upstream commit ba2977dcce72127986fbad76c4c67f134e2f69ae ]
Allow the kernel to dispatch the soft IH work on other CPUs.
Otherwise it can happen that the soft IH ring fills up before it actually starts processing anything, which can easily happen with retry page faults, in which case the CP repeatedly spams the CPU with a lot of interrupts.
This significantly improves retry page fault handling on GPUs that don't have the filter CAM and must rely on software based filtering.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
@@ -500,7 +500,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev, unsigned int num_dw) {amdgpu_ih_ring_write (adev, &adev->irq.ih_soft, entry->iv_entry, num_dw); -schedule_work (&adev->irq.ih_soft_work); +queue_work (system_unbound_wq, &adev->irq.ih_soft_work); }/**
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 243/1193 ALSA: usb-audio: Add quirk for YAMAHA CDS3000
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Louis Colaco <[email protected]>
[ Upstream commit 348f69320e4db6ebec6940c81154bec4b9eb275a ]
This quirk is identical to the one for the Yamaha Steinberg UR22, here applied to a CD player that also uses the Steinberg USB interface. This quirk is necessary to avoid sporadic "clic" noise when using the DAC of the player.
--- sound/usb/quirks-table.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/usb/quirks-table.h +14 -0
@@ -390,6 +390,20 @@ YAMAHA_DEVICE(0x105d, NULL), } } }, +{ +USB_DEVICE (0x0499 ,0x150d ), + QUIRK_DRIVER_INFO { +/* .vendor_name = "Yamaha", */ +/* .product_name = "CDS3000", */ + QUIRK_DATA_COMPOSITE { + { QUIRK_DATA_STANDARD_AUDIO(1) }, + { QUIRK_DATA_STANDARD_AUDIO(2) }, + { QUIRK_DATA_MIDI_YAMAHA(3) }, + { QUIRK_DATA_IGNORE(4) }, + QUIRK_COMPOSITE_END + } + } +}, {USB_DEVICE (0x0499 ,0x1718 ), QUIRK_DRIVER_INFO {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 244/1193 PCI: iproc: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a6a64e150f12ad5391e0a0d60f6a3d119b06ce50 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-iproc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-iproc.c +2 -0
@@ -1540,8 +1540,10 @@ void iproc_pcie_remove(struct iproc_pcie *pcie) {struct pci_host_bridge *host =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (host->bus);pci_remove_root_bus (host->bus); +pci_unlock_rescan_remove ();iproc_pcie_msi_disable (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 245/1193 PCI: altera: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a8759c8ac48c0419f5899e95a6ffc611b07c965b ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-altera.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-altera.c +2 -0
@@ -832,8 +832,10 @@ static void altera_pcie_remove(struct platform_device *pdev)struct altera_pcie *pcie =platform_get_drvdata (pdev);struct pci_host_bridge *bridge =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (bridge->bus);pci_remove_root_bus (bridge->bus); +pci_unlock_rescan_remove ();altera_pcie_irq_teardown (pcie); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 246/1193 PCI: rockchip: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit 0bd9611587bb494c33566d825fe34b2705e4b167 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-rockchip-host.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-rockchip-host.c +2 -0
@@ -1018,8 +1018,10 @@ static void rockchip_pcie_remove(struct platform_device *pdev)struct rockchip_pcie *rockchip =dev_get_drvdata (dev);struct pci_host_bridge *bridge =pci_host_bridge_from_priv (rockchip); +pci_lock_rescan_remove ();pci_stop_root_bus (bridge->bus);pci_remove_root_bus (bridge->bus); +pci_unlock_rescan_remove ();irq_domain_remove (rockchip->irq_domain);rockchip_pcie_deinit_phys (rockchip);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 247/1193 PCI: mediatek: Protect root bus removal with rescan lock
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Zhang <[email protected]>
[ Upstream commit a29812a55da8d0dbeb071b26ac428c338e3fc389 ]
Hold the pci_rescan_remove_lock lock while stopping and removing a root bus to avoid racing with concurrent rescan or hotplug operations triggered via sysfs. Such races may lead to use-after-free issues or system crashes.
--- drivers/pci/controller/pcie-mediatek.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/controller/pcie-mediatek.c +2 -0
@@ -1174,8 +1174,10 @@ static void mtk_pcie_remove(struct platform_device *pdev)struct mtk_pcie *pcie =platform_get_drvdata (pdev);struct pci_host_bridge *host =pci_host_bridge_from_priv (pcie); +pci_lock_rescan_remove ();pci_stop_root_bus (host->bus);pci_remove_root_bus (host->bus); +pci_unlock_rescan_remove ();mtk_pcie_free_resources (pcie);mtk_pcie_irq_teardown (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 248/1193 md/raid5: account discard IO
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 74ddbf98e2db646ec58f7e7731c936b7a4a470fe ]
Raid5 handles discard bios internally through make_discard_request() and never passes them through md_account_bio(). As a result, discard IO is missing the md-device iostat accounting that normal raid5 IO and discard IO in other raid levels get from md_account_bio().
Before accounting the bio, trim the request to the full data stripes that raid5 will actually discard. The first full stripe is the ceiling of the bio start divided by data-stripe sectors, and the last full stripe is the floor of the bio end divided by data-stripe sectors. Account that exact MD logical full-stripe range, then restore the original iterator so bio completion and iostat still cover the original request.
--- drivers/md/raid5.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/md/raid5.c +23 -10
@@ -5741,7 +5741,10 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi) {struct r5conf *conf = mddev->private;sector_t logical_sector, last_sector; +sector_t first_stripe, last_stripe;struct stripe_head *sh; +struct bvec_iter bi_iter; +struct bio *orig_bi = bi;int stripe_sectors;/* We need to handle this when io_uring supports discard/trim */
@@ -5752,19 +5755,29 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi)/* Skip discard while reshape is happening */ return ; - logical_sector = bi->bi_iter.bi_sector & ~((sector_t )RAID5_STRIPE_SECTORS (conf)-1 ); - last_sector =bio_end_sector (bi); - - bi->bi_next =NULL ; - stripe_sectors = conf->chunk_sectors * (conf->raid_disks - conf->max_degraded); - logical_sector =DIV_ROUND_UP_SECTOR_T (logical_sector, - stripe_sectors); -sector_div (last_sector, stripe_sectors); + first_stripe =DIV_ROUND_UP_SECTOR_T (bi->bi_iter.bi_sector, + stripe_sectors); + last_stripe =bio_end_sector (bi); +sector_div (last_stripe, stripe_sectors); + +if (first_stripe >= last_stripe) { +bio_endio (bi); +return ; + } + + bi_iter = bi->bi_iter; + bi->bi_iter.bi_sector = first_stripe * stripe_sectors; + bi->bi_iter.bi_size = ((last_stripe - first_stripe) * + stripe_sectors) <<9 ; +md_account_bio (mddev, &bi); + orig_bi->bi_iter = bi_iter; + bi->bi_iter = bi_iter; + bi->bi_next =NULL ; - logical_sector *= conf->chunk_sectors; - last_sector *= conf->chunk_sectors; + logical_sector = first_stripe * conf->chunk_sectors; + last_sector = last_stripe * conf->chunk_sectors;for (; logical_sector < last_sector; logical_sector +=RAID5_STRIPE_SECTORS (conf)) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 249/1193 md/raid5: let stripe batch bm_seq comparison wrap-safe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Cheng <[email protected]>
[ Upstream commit 00e93faf4cea9e8802ac5dfee0952d84fc95c40f ]
Once the 32-bit seq wraps, a newer bm_seq can look smaller than old, so .. covert to wrap-safe calculate way.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -991,7 +991,7 @@ static void stripe_add_to_batch_list(struct r5conf *conf,if (test_and_clear_bit (STRIPE_BIT_DELAY , &sh->state)) {int seq = sh->bm_seq;if (test_bit (STRIPE_BIT_DELAY , &sh->batch_head->state) && - sh->batch_head->bm_seq > seq) + sh->batch_head->bm_seq - seq >0 ) seq = sh->batch_head->bm_seq;set_bit (STRIPE_BIT_DELAY , &sh->batch_head->state); sh->batch_head->bm_seq = seq;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 250/1193 f2fs: validate inline dentry name lengths before conversion
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Moelius <[email protected]>
[ Upstream commit cfcd0e49a178b3dac2c0ece656079081dbf5da74 ]
Inline dentry conversion copies names out of the inline dentry area before checking that each recorded name length fits in the available filename slots.
A corrupted image can therefore make the conversion path read past the inline filename storage while building the regular dentry block.
Validate each inline dentry name length against the inline filename area before copying it.
--- fs/f2fs/inline.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/f2fs/inline.c +7 -0
@@ -507,6 +507,12 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) bit_pos++;continue ; } +if (unlikely (le16_to_cpu (de->name_len) >F2FS_NAME_LEN || + bit_pos +GET_DENTRY_SLOTS (le16_to_cpu (de->name_len)) > + d.max)) { + err = -EFSCORRUPTED ; + goto punch_dentry_pages; + }/* * We only need the disk_name and hash to move the dentry.
@@ -527,6 +533,7 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) bit_pos +=GET_DENTRY_SLOTS (le16_to_cpu (de->name_len)); }return 0 ; + punch_dentry_pages:truncate_inode_pages (&dir->i_data,0 );f2fs_truncate_blocks (dir,0 , false);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 251/1193 rtc: aspeed: add AST2700 compatible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tommy Huang <[email protected]>
[ Upstream commit 3319cfeeb8c4047026f84df045c438f7bbd338a6 ]
Add support for matching the RTC controller on ASPEED AST2700 SoCs.
The AST2700 RTC controller is compatible with the existing ASPEED RTC driver implementation.
--- drivers/rtc/rtc-aspeed.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-aspeed.c +1 -0
@@ -111,6 +111,7 @@ static const struct of_device_id aspeed_rtc_match[] = { { .compatible = "aspeed,ast2400-rtc", }, { .compatible = "aspeed,ast2500-rtc", }, { .compatible = "aspeed,ast2600-rtc", }, + { .compatible = "aspeed,ast2700-rtc", }, {} }; MODULE_DEVICE_TABLE(of, aspeed_rtc_match);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 252/1193 ksmbd: fix lease break and ack state handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 5015191096db311759fef98769270336cd8b1324 ]
Do not skip valid lease states containing WRITE_CACHING when breaking level-II/read leases for writes and truncates.
Handle lease break acknowledgments according to the SMB2 rule that the acknowledged state must be a subset of the server's break target. Apply the acknowledged state directly and keep the break pending on failed ACKs.
--- fs/smb/server/oplock.c | 24 +++------ fs/smb/server/smb2pdu.c | 106 ++++++++++------------------------------ 2 files changed, 34 insertions(+), 96 deletions(-)
fs/smb/server/oplock.c +8 -16
@@ -1485,14 +1485,8 @@ void smb_break_all_levII_oplock(struct ksmbd_work *work, struct ksmbd_file *fp,continue ; } -if (brk_op->is_lease && (brk_op->o_lease->state & - (~(SMB2_LEASE_READ_CACHING_LE | -SMB2_LEASE_HANDLE_CACHING_LE )))) { -ksmbd_debug (OPLOCK ,"unexpected lease state(0x%x)\n" , - brk_op->o_lease->state); - goto next; - }else if (brk_op->level != -SMB2_OPLOCK_LEVEL_II ) { +if (!brk_op->is_lease && + brk_op->level !=SMB2_OPLOCK_LEVEL_II ) {ksmbd_debug (OPLOCK ,"unexpected oplock(0x%x)\n" , brk_op->level); goto next;
@@ -1553,15 +1547,13 @@ void smb_break_all_oplock(struct ksmbd_work *work, struct ksmbd_file *fp)*/ __u8 smb2_map_lease_to_oplock (__le32 lease_state) { -if (lease_state == (SMB2_LEASE_HANDLE_CACHING_LE | -SMB2_LEASE_READ_CACHING_LE | -SMB2_LEASE_WRITE_CACHING_LE )) { +if ((lease_state &SMB2_LEASE_WRITE_CACHING_LE ) && + (lease_state &SMB2_LEASE_HANDLE_CACHING_LE )) {return SMB2_OPLOCK_LEVEL_BATCH ; - }else if (lease_state !=SMB2_LEASE_WRITE_CACHING_LE && - lease_state &SMB2_LEASE_WRITE_CACHING_LE ) { -if (!(lease_state &SMB2_LEASE_HANDLE_CACHING_LE )) -return SMB2_OPLOCK_LEVEL_EXCLUSIVE ; - }else if (lease_state &SMB2_LEASE_READ_CACHING_LE ) { + }else if (lease_state &SMB2_LEASE_WRITE_CACHING_LE ) { +return SMB2_OPLOCK_LEVEL_EXCLUSIVE ; + }else if (lease_state & (SMB2_LEASE_READ_CACHING_LE | +SMB2_LEASE_HANDLE_CACHING_LE )) {return SMB2_OPLOCK_LEVEL_II ; }return 0 ;
fs/smb/server/smb2pdu.c +26 -80
147 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 253/1193 ksmbd: validate SMB2 lease create contexts
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit b69be2c58615950ee7353b61a21acdf8508c0cbb ]
Validate SMB2 lease context lengths, requested lease state bits, and v2 flags before using the context. Return errors via ERR_PTR so CREATE can distinguish a missing lease context from a malformed one.
Also ignore lease v2 contexts for SMB 2.1, where they are not valid.
--- fs/smb/server/oplock.c | 33 ++++++++++++++++++++++++++++----- fs/smb/server/smb2pdu.c | 24 +++++++++++++++++++++++- 2 files changed, 51 insertions(+), 6 deletions(-)
fs/smb/server/oplock.c +28 -5
@@ -5,6 +5,7 @@*/ #include <linux/moduleparam.h> +#include <linux/err.h> #include "glob.h" #include "oplock.h"
@@ -19,6 +20,20 @@static LIST_HEAD (lease_table_list);static DEFINE_RWLOCK (lease_list_lock); +#define SMB2_LEASE_STATE_MASK_LE (SMB2_LEASE_READ_CACHING_LE | \ + SMB2_LEASE_HANDLE_CACHING_LE | \ + SMB2_LEASE_WRITE_CACHING_LE) + +static bool lease_state_valid (__le32 state) +{ +return !(state & ~SMB2_LEASE_STATE_MASK_LE ); +} + +static bool lease_v2_flags_valid (__le32 flags) +{ +return !(flags & ~SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE ); +} +/** * alloc_opinfo() - allocate a new opinfo object for oplock info * @work: smb work
@@ -1621,12 +1636,14 @@ struct lease_ctx_info *parse_lease_state(void *open_req)struct lease_ctx_info *lreq; cc =smb2_find_context_vals (req,SMB2_CREATE_REQUEST_LEASE ,4 ); -if (IS_ERR_OR_NULL (cc)) +if (IS_ERR (cc)) +return ERR_CAST (cc); +if (!cc)return NULL ; lreq =kzalloc (sizeof (struct lease_ctx_info ),GFP_KERNEL );if (!lreq) -return NULL ; +return ERR_PTR (-ENOMEM );if (sizeof (struct lease_context_v2 ) ==le32_to_cpu (cc->DataLength)) {struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
@@ -1640,11 +1657,14 @@ struct lease_ctx_info *parse_lease_state(void *open_req) lreq->flags = lc->lcontext.LeaseFlags; lreq->epoch = lc->lcontext.Epoch; lreq->duration = lc->lcontext.LeaseDuration; +if (!lease_state_valid (lreq->req_state) || + !lease_v2_flags_valid (lreq->flags)) + goto err_out;if (lreq->flags ==SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE )memcpy (lreq->parent_lease_key, lc->lcontext.ParentLeaseKey,SMB2_LEASE_KEY_SIZE ); lreq->version =2 ; - }else { + }else if (sizeof (struct lease_context ) ==le32_to_cpu (cc->DataLength)) {struct create_lease *lc = (struct create_lease *)cc; if (le16_to_cpu(cc->DataOffset) + le32_to_cpu(cc->DataLength) <
@@ -1655,12 +1675,15 @@ struct lease_ctx_info *parse_lease_state(void *open_req) lreq->req_state = lc->lcontext.LeaseState; lreq->flags = lc->lcontext.LeaseFlags; lreq->duration = lc->lcontext.LeaseDuration; +if (!lease_state_valid (lreq->req_state)) + goto err_out; lreq->version =1 ; - } + }else + goto err_out;return lreq; err_out:kfree (lreq); -return NULL ; +return ERR_PTR (-EINVAL ); }/**
fs/smb/server/smb2pdu.c +23 -1
@@ -2986,6 +2986,17 @@ int smb2_open(struct ksmbd_work *work)if (server_conf.flags &KSMBD_GLOBAL_FLAG_DURABLE_HANDLE && req->CreateContextsOffset) { lc =parse_lease_state (req); +if (IS_ERR (lc)) { + rc =PTR_ERR (lc); + lc =NULL ; + goto err_out2; + } +if (lc && lc->version ==2 && conn->dialect <SMB30_PROT_ID ) { +kfree (lc); + lc =NULL ; +if (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE ) + req_op_level =SMB2_OPLOCK_LEVEL_NONE ; + } rc =parse_durable_handle_context (work, req, lc, &dh_info);if (rc) {ksmbd_debug (SMB ,"error parsing durable handle context\n" );
@@ -3017,8 +3028,19 @@ int smb2_open(struct ksmbd_work *work) goto reconnected_fp; } - }else if (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE ) + }else if (req_op_level ==SMB2_OPLOCK_LEVEL_LEASE ) { lc =parse_lease_state (req); +if (IS_ERR (lc)) { + rc =PTR_ERR (lc); + lc =NULL ; + goto err_out2; + } +if (lc && lc->version ==2 && conn->dialect <SMB30_PROT_ID ) { +kfree (lc); + lc =NULL ; + req_op_level =SMB2_OPLOCK_LEVEL_NONE ; + } + }if (le32_to_cpu (req->ImpersonationLevel) >le32_to_cpu (IL_DELEGATE )) { pr_err("Invalid impersonationlevel : 0x%x\n",
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 254/1193 ksmbd: align SMB2 oplock break ack handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit 80a56d4a826c6c84430286fcf7d8655f7c5b0868 ]
Handle SMB2 oplock break acknowledgments according to the server-side validation rules in MS-SMB2.
Return STATUS_INVALID_DEVICE_STATE when an ACK arrives while the open is not breaking, reject SMB2_OPLOCK_LEVEL_LEASE with STATUS_INVALID_PARAMETER, allow BATCH acknowledgments to EXCLUSIVE, and make invalid ACK levels fail with STATUS_INVALID_OPLOCK_PROTOCOL after lowering the oplock to NONE.
Update the successful response from the final granted oplock level instead of relying on the oplock transition helpers, which could turn invalid ACKs into successful responses.
--- fs/smb/server/smb2pdu.c | 104 ++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 58 deletions(-)
fs/smb/server/smb2pdu.c +46 -58
@@ -8652,11 +8652,10 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work)struct smb2_oplock_break *rsp;struct ksmbd_file *fp;struct oplock_info *opinfo =NULL ; -__le32 err =0 ; -int ret =0 ; +__le32 status =STATUS_SUCCESS ; +int ret;u64 volatile_id, persistent_id;char req_oplevel =0 , rsp_oplevel =0 ; -unsigned int oplock_change_type;WORK_BUFFERS (work, req, rsp);
@@ -8682,71 +8681,55 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work)return ; } -if (opinfo->level ==SMB2_OPLOCK_LEVEL_NONE ) { - rsp->hdr.Status =STATUS_INVALID_OPLOCK_PROTOCOL ; +if (opinfo->op_state !=OPLOCK_ACK_WAIT ) { +ksmbd_debug (SMB ,"unexpected oplock state 0x%x\n" , + opinfo->op_state); + status =STATUS_INVALID_DEVICE_STATE ; goto err_out; } -if (opinfo->op_state ==OPLOCK_STATE_NONE ) { -ksmbd_debug (SMB ,"unexpected oplock state 0x%x\n" , opinfo->op_state); - rsp->hdr.Status =STATUS_UNSUCCESSFUL ; +if (req_oplevel ==SMB2_OPLOCK_LEVEL_LEASE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_PARAMETER ; goto err_out; } -if ((opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE || - opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH ) && - (req_oplevel !=SMB2_OPLOCK_LEVEL_II && - req_oplevel !=SMB2_OPLOCK_LEVEL_NONE )) { - err =STATUS_INVALID_OPLOCK_PROTOCOL ; - oplock_change_type =OPLOCK_WRITE_TO_NONE ; - }else if (opinfo->level ==SMB2_OPLOCK_LEVEL_II && - req_oplevel !=SMB2_OPLOCK_LEVEL_NONE ) { - err =STATUS_INVALID_OPLOCK_PROTOCOL ; - oplock_change_type =OPLOCK_READ_TO_NONE ; - }else if (req_oplevel ==SMB2_OPLOCK_LEVEL_II || - req_oplevel ==SMB2_OPLOCK_LEVEL_NONE ) { - err =STATUS_INVALID_DEVICE_STATE ; -if ((opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE || - opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH ) && - req_oplevel ==SMB2_OPLOCK_LEVEL_II ) { - oplock_change_type =OPLOCK_WRITE_TO_READ ; - }else if ((opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE || - opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH ) && - req_oplevel ==SMB2_OPLOCK_LEVEL_NONE ) { - oplock_change_type =OPLOCK_WRITE_TO_NONE ; - }else if (opinfo->level ==SMB2_OPLOCK_LEVEL_II && - req_oplevel ==SMB2_OPLOCK_LEVEL_NONE ) { - oplock_change_type =OPLOCK_READ_TO_NONE ; - }else { - oplock_change_type =0 ; - } - }else { - oplock_change_type =0 ; +if (opinfo->level ==SMB2_OPLOCK_LEVEL_NONE ) { + status =STATUS_INVALID_OPLOCK_PROTOCOL ; + goto err_out; } -switch (oplock_change_type) { -case OPLOCK_WRITE_TO_READ : - ret =opinfo_write_to_read (opinfo); - rsp_oplevel =SMB2_OPLOCK_LEVEL_II ; -break ; -case OPLOCK_WRITE_TO_NONE : - ret =opinfo_write_to_none (opinfo); - rsp_oplevel =SMB2_OPLOCK_LEVEL_NONE ; -break ; -case OPLOCK_READ_TO_NONE : - ret =opinfo_read_to_none (opinfo); - rsp_oplevel =SMB2_OPLOCK_LEVEL_NONE ; -break ; -default : -pr_err ("unknown oplock change 0x%x -> 0x%x\n" , - opinfo->level, rsp_oplevel); +if (opinfo->level ==SMB2_OPLOCK_LEVEL_EXCLUSIVE && + req_oplevel !=SMB2_OPLOCK_LEVEL_II && + req_oplevel !=SMB2_OPLOCK_LEVEL_NONE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_OPLOCK_PROTOCOL ; + goto err_out; } -if (ret <0 ) { - rsp->hdr.Status = err; +if (opinfo->level ==SMB2_OPLOCK_LEVEL_BATCH && + req_oplevel !=SMB2_OPLOCK_LEVEL_II && + req_oplevel !=SMB2_OPLOCK_LEVEL_NONE && + req_oplevel !=SMB2_OPLOCK_LEVEL_EXCLUSIVE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_OPLOCK_PROTOCOL ; + goto err_out; + } + +if (opinfo->level ==SMB2_OPLOCK_LEVEL_II && + req_oplevel !=SMB2_OPLOCK_LEVEL_NONE ) { + opinfo->level =SMB2_OPLOCK_LEVEL_NONE ; + status =STATUS_INVALID_OPLOCK_PROTOCOL ; goto err_out; } +if (req_oplevel ==SMB2_OPLOCK_LEVEL_EXCLUSIVE ) + rsp_oplevel =SMB2_OPLOCK_LEVEL_NONE ; +else + rsp_oplevel = req_oplevel; + + opinfo->level = rsp_oplevel; + rsp->StructureSize =cpu_to_le16 (24 ); rsp->OplockLevel = rsp_oplevel; rsp->Reserved =0 ;
@@ -8754,11 +8737,16 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work) rsp->VolatileFid = volatile_id; rsp->PersistentFid = persistent_id; ret =ksmbd_iov_pin_rsp (work, rsp,sizeof (struct smb2_oplock_break )); -if (ret) { +if (ret) +ksmbd_debug (SMB ,"failed to pin oplock break response: %d\n" , + ret); + goto out; + err_out: -smb2_set_err_rsp (work); - } + rsp->hdr.Status = status; +smb2_set_err_rsp (work); +out: opinfo->op_state =OPLOCK_STATE_NONE ;wake_up_interruptible_all (&opinfo->oplock_q);opinfo_put (opinfo);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 255/1193 ksmbd: use connection ClientGUID for lease lookup
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
[ Upstream commit fa111daae1a02dbff5693dfc12f368bccd9eb5f4 ]
MS-SMB2 defines the lease table lookup key as Connection.ClientGuid. Use the connection ClientGUID consistently when checking for same-client leases and duplicate lease keys.
Also preserve directory and parent lease metadata when copying an existing lease state to a new open.
--- fs/smb/server/oplock.c | 16 +++++++++------- fs/smb/server/oplock.h | 2 +- fs/smb/server/smb2pdu.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-)
fs/smb/server/oplock.c +9 -7
@@ -520,7 +520,7 @@ static inline int compare_guid_key(struct oplock_info *opinfo,* Return: oplock(lease) object on success, otherwise NULL */ static struct oplock_info *same_client_has_lease (struct ksmbd_inode *ci, -char *client_guid, +const char *client_guid,struct lease_ctx_info *lctx) {int ret;
@@ -1088,7 +1088,7 @@ void destroy_lease_table(struct ksmbd_conn *conn)write_unlock (&lease_list_lock); } -int find_same_lease_key (struct ksmbd_session *sess,struct ksmbd_inode *ci, +int find_same_lease_key (struct ksmbd_conn *conn,struct ksmbd_inode *ci,struct lease_ctx_info *lctx) {struct oplock_info *opinfo;
@@ -1105,7 +1105,7 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci, }list_for_each_entry (lb, &lease_table_list, l_entry) { -if (!memcmp (lb->client_guid, sess->ClientGUID, +if (!memcmp (lb->client_guid, conn->ClientGUID,SMB2_CLIENT_GUID_SIZE )) goto found; }
@@ -1121,7 +1121,7 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,rcu_read_unlock ();if (opinfo->o_fp->f_ci == ci) goto op_next; - err =compare_guid_key (opinfo, sess->ClientGUID, + err =compare_guid_key (opinfo, conn->ClientGUID, lctx->lease_key);if (err) { err = -EINVAL ;
@@ -1154,6 +1154,9 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2) lease2->flags = lease1->flags; lease2->epoch = lease1->epoch; lease2->version = lease1->version; + lease2->is_dir = lease1->is_dir; +memcpy (lease2->parent_lease_key, lease1->parent_lease_key, +SMB2_LEASE_KEY_SIZE ); } static void add_lease_global_list(struct oplock_info *opinfo,
@@ -1298,7 +1301,6 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid, struct ksmbd_file *fp, __u16 tid, struct lease_ctx_info *lctx, int share_ret) { - struct ksmbd_session *sess = work->sess; int err = 0;struct oplock_info *opinfo =NULL , *prev_opinfo =NULL ;struct ksmbd_inode *ci = fp->f_ci;
@@ -1341,12 +1343,12 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,struct oplock_info *m_opinfo;/* is lease already granted ? */ - m_opinfo =same_client_has_lease (ci, sess->ClientGUID, + m_opinfo =same_client_has_lease (ci, work->conn->ClientGUID, lctx);if (m_opinfo) {copy_lease (m_opinfo, opinfo);if (atomic_read (&m_opinfo->breaking_cnt)) - opinfo->o_lease->flags = + opinfo->o_lease->flags |=SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE ;opinfo_put (m_opinfo); goto out;
fs/smb/server/oplock.h +1 -1
@@ -123,7 +123,7 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp);struct create_context *smb2_find_context_vals (void *open_req,const char *tag,int tag_len);struct oplock_info *lookup_lease_in_table (struct ksmbd_conn *conn,char *lease_key); -int find_same_lease_key (struct ksmbd_session *sess,struct ksmbd_inode *ci, +int find_same_lease_key (struct ksmbd_conn *conn,struct ksmbd_inode *ci,struct lease_ctx_info *lctx);void destroy_lease_table (struct ksmbd_conn *conn); void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
fs/smb/server/smb2pdu.c +1 -1
@@ -3514,7 +3514,7 @@ int smb2_open(struct ksmbd_work *work)ksmbd_debug (SMB ,"lease req for(%s) req oplock state 0x%x, lease state 0x%x\n" , name, req_op_level, lc->req_state); - rc =find_same_lease_key (sess, fp->f_ci, lc); + rc =find_same_lease_key (conn, fp->f_ci, lc);if (rc) goto err_out1; } else if (open_flags == O_RDONLY &&
Signature · 1 line
2.53.0