6.0.3-rc1 review
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 338/862 net: prestera: acl: Add check for kmemdup
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 9e6fd874c7bb47b6a4295abc4c81b2f41b97e970 ]
As the kemdup could return NULL, it should be better to check the return value and return error if fails.
Moreover, the return value of prestera_acl_ruleset_keymask_set() should be checked by cascade.
--- drivers/net/ethernet/marvell/prestera/prestera_acl.c | 8 ++++++-- drivers/net/ethernet/marvell/prestera/prestera_acl.h | 4 ++-- drivers/net/ethernet/marvell/prestera/prestera_flower.c | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-)
drivers/net/ethernet/marvell/prestera/prestera_acl.c +6 -2
@@ -178,10 +178,14 @@ prestera_acl_ruleset_create(struct prestera_acl *acl,return ERR_PTR (err); } -void prestera_acl_ruleset_keymask_set (struct prestera_acl_ruleset *ruleset, -void *keymask) +int prestera_acl_ruleset_keymask_set (struct prestera_acl_ruleset *ruleset, +void *keymask) { ruleset->keymask =kmemdup (keymask,ACL_KEYMASK_SIZE ,GFP_KERNEL ); +if (!ruleset->keymask) +return -ENOMEM ; + +return 0 ; }int prestera_acl_ruleset_offload (struct prestera_acl_ruleset *ruleset)
drivers/net/ethernet/marvell/prestera/prestera_acl.h +2 -2
@@ -185,8 +185,8 @@ struct prestera_acl_ruleset * prestera_acl_ruleset_lookup(struct prestera_acl *acl, struct prestera_flow_block *block, u32 chain_index); -void prestera_acl_ruleset_keymask_set (struct prestera_acl_ruleset *ruleset, -void *keymask); +int prestera_acl_ruleset_keymask_set (struct prestera_acl_ruleset *ruleset, +void *keymask);bool prestera_acl_ruleset_is_offload (struct prestera_acl_ruleset *ruleset);int prestera_acl_ruleset_offload (struct prestera_acl_ruleset *ruleset);void prestera_acl_ruleset_put (struct prestera_acl_ruleset *ruleset);
drivers/net/ethernet/marvell/prestera/prestera_flower.c +5 -1
@@ -452,7 +452,9 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block, }/* preserve keymask/template to this ruleset */ -prestera_acl_ruleset_keymask_set (ruleset, rule.re_key.match.mask); + err =prestera_acl_ruleset_keymask_set (ruleset, rule.re_key.match.mask); +if (err) + goto err_ruleset_keymask_set;/* skip error, as it is not possible to reject template operation, * so, keep the reference to the ruleset for rules to be added
@@ -468,6 +470,8 @@ int prestera_flower_tmplt_create(struct prestera_flow_block *block,list_add_rcu (&template->list, &block->template_list);return 0 ; +err_ruleset_keymask_set: +prestera_acl_ruleset_put (ruleset); err_ruleset_get:kfree (template); err_malloc:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 515/862 dyndbg: let query-modname override actual module name
In reply to Greg Kroah-HartmanFrom: Jim Cromie <[email protected]>
[ Upstream commit e75ef56f74965f426dd819a41336b640ffdd8fbc ]
dyndbg's control-parser: ddebug_parse_query(), requires that search
terms: module, func, file, lineno, are used only once in a query; a thing cannot be named both foo and bar.
The cited commit added an overriding module modname, taken from the module loader, which is authoritative. So it set query.module 1st, which disallowed its use in the query-string.
But now, its useful to allow a module-load to enable classes across a whole (or part of) a subsystem at once.
# enable (dynamic-debug in) drm only modprobe drm dyndbg="class DRM_UT_CORE +p"
# get drm_helper too modprobe drm dyndbg="class DRM_UT_CORE module drm* +p"
# get everything that knows DRM_UT_CORE modprobe drm dyndbg="class DRM_UT_CORE module * +p"
# also for boot-args: drm.dyndbg="class DRM_UT_CORE module * +p"
So convert the override into a default, by filling it only when/after the query-string omitted the module.
NB: the query class FOO handling is forthcoming.
--- lib/dynamic_debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
lib/dynamic_debug.c +7 -4
@@ -384,10 +384,6 @@ static int ddebug_parse_query(char *words[], int nwords,return -EINVAL ; } -if (modname) -/* support $modname.dyndbg=<multiple queries> */ - query->module = modname; -for (i =0 ; i < nwords; i +=2 ) {char *keyword = words[i];char *arg = words[i+1 ];
@@ -428,6 +424,13 @@ static int ddebug_parse_query(char *words[], int nwords,if (rc)return rc; } +if (!query->module && modname) +/* +* support $modname.dyndbg=<multiple queries>, when +* not given in the query itself +*/ + query->module = modname; +vpr_info_dq (query,"parsed" );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 616/862 x86/hyperv: Fix struct hv_enlightened_vmcs definition
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit ea9da788a61e47e7ab9cbad397453e51cd82ac0d ]
Section 1.9 of TLFS v6.0b says:
"All structures are padded in such a way that fields are aligned naturally (that is, an 8-byte field is aligned to an offset of 8 bytes and so on)".
'struct enlightened_vmcs' has a glitch:
...
struct {
u32 nested_flush_hypercall:1; /* 836: 0 4 */
u32 msr_bitmap:1; /* 836: 1 4 */
u32 reserved:30; /* 836: 2 4 */
} hv_enlightenments_control; /* 836 4 */
u32 hv_vp_id; /* 840 4 */
u64 hv_vm_id; /* 844 8 */
u64 partition_assist_page; /* 852 8 */...
And the observed values in 'partition_assist_page' make no sense at all. Fix the layout by padding the structure properly.
--- arch/x86/include/asm/hyperv-tlfs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/hyperv-tlfs.h +2 -2
@@ -546,7 +546,7 @@ struct hv_enlightened_vmcs {u64 guest_rip;u32 hv_clean_fields; -u32 hv_padding_32; +u32 padding32_1;u32 hv_synthetic_controls;struct {u32 nested_flush_hypercall:1 ;
@@ -554,7 +554,7 @@ struct hv_enlightened_vmcs { u32 reserved:30; }__packed hv_enlightenments_control;u32 hv_vp_id; - +u32 padding32_2;u64 hv_vm_id;u64 partition_assist_page;u64 padding64_4[4 ];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 621/862 powerpc: Fix SPE Power ISA properties for e500v1 platforms
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 37b9345ce7f4ab17538ea62def6f6d430f091355 ]
Commit 2eb28006431c ("powerpc/e500v2: Add Power ISA properties to comply with ePAPR 1.1") introduced new include file e500v2_power_isa.dtsi and should have used it for all e500v2 platforms. But apparently it was used also for e500v1 platforms mpc8540, mpc8541, mpc8555 and mpc8560.
e500v1 cores compared to e500v2 do not support double precision floating point SPE instructions. Hence power-isa-sp.fd should not be set on e500v1 platforms, which is in e500v2_power_isa.dtsi include file.
Fix this issue by introducing a new e500v1_power_isa.dtsi include file and use it in all e500v1 device tree files.
--- .../boot/dts/fsl/e500v1_power_isa.dtsi | 51 +++++++++++++++++++ arch/powerpc/boot/dts/fsl/mpc8540ads.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8541cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8555cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8560ads.dts | 2 +- 5 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi
arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi new file +51 -0
@@ -0,0 +1,51 @@ +/* + * e500v1 Power ISA Device Tree Source (include) + * + * Copyright 2012 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/ { + cpus { + power-isa-version = "2.03"; + power-isa-b; // Base + power-isa-e; // Embedded + power-isa-atb; // Alternate Time Base + power-isa-cs; // Cache Specification + power-isa-e.le; // Embedded.Little-Endian + power-isa-e.pm; // Embedded.Performance Monitor + power-isa-ecl; // Embedded Cache Locking + power-isa-mmc; // Memory Coherence + power-isa-sp; // Signal Processing Engine + power-isa-sp.fs; // SPE.Embedded Float Scalar Single + power-isa-sp.fv; // SPE.Embedded Float Vector + mmu-type = "power-embedded"; + }; +};
arch/powerpc/boot/dts/fsl/mpc8540ads.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8540ADS";
arch/powerpc/boot/dts/fsl/mpc8541cds.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8541CDS";
arch/powerpc/boot/dts/fsl/mpc8555cds.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8555CDS";
arch/powerpc/boot/dts/fsl/mpc8560ads.dts +1 -1
@@ -7,7 +7,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 361/862 ASoC: amd: acp: add missing platform_device_unregister() in acp_pci_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 6a4ce20fd776d2fd19ffaf85cf34a53761e2c888 ]
Add missing platform_device_unregister() in error path in acp_pci_probe().
--- sound/soc/amd/acp/acp-pci.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/amd/acp/acp-pci.c +1 -0
@@ -104,6 +104,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id addr =pci_resource_start (pci,0 ); chip->base =devm_ioremap (&pci->dev, addr,pci_resource_len (pci,0 ));if (!chip->base) { +platform_device_unregister (dmic_dev); ret = -ENOMEM ; goto release_regions; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 578/862 mfd: fsl-imx25: Fix check for platform_get_irq() errors
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 75db7907355ca5e2ff606e9dd3e86b6c3a455fe2 ]
The mx25_tsadc_remove() function assumes all non-zero returns are success but the platform_get_irq() function returns negative on error and positive non-zero values on success. It never returns zero, but if it did then treat that as a success.
--- drivers/mfd/fsl-imx25-tsadc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/fsl-imx25-tsadc.c +2 -2
@@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev,int irq; irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) +if (irq <0 )return irq; tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops,
@@ -89,7 +89,7 @@ static int mx25_tsadc_unset_irq(struct platform_device *pdev)struct mx25_tsadc *tsadc =platform_get_drvdata (pdev);int irq =platform_get_irq (pdev,0 ); -if (irq) { +if (irq >=0 ) {irq_set_chained_handler_and_data (irq,NULL ,NULL );irq_domain_remove (tsadc->domain); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 260/862 wifi: rtw89: pci: fix interrupt stuck after leaving low power mode
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit b7e715d3dcd2e9fa3a689ba0dd7ab85f8aaf6e9a ]
We turn off interrupt in ISR, and re-enable interrupt in threadfn or napi_poll according to the mode it stays. If we are turning off interrupt, rtwpci->running flag is unset and interrupt handler stop processing even if it was called, so disallow to re-enable interrupt in this situation. Or, wifi chip doesn't trigger interrupt events anymore because interrupt status (ISR) isn't clear by interrupt handler anymore.
--- drivers/net/wireless/realtek/rtw89/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/pci.c +2 -1
@@ -760,7 +760,8 @@ static irqreturn_t rtw89_pci_interrupt_threadfn(int irq, void *dev) enable_intr:spin_lock_irqsave (&rtwpci->irq_lock, flags); -rtw89_chip_enable_intr (rtwdev, rtwpci); +if (likely (rtwpci->running)) +rtw89_chip_enable_intr (rtwdev, rtwpci);spin_unlock_irqrestore (&rtwpci->irq_lock, flags);return IRQ_HANDLED ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 612/862 cpuidle: riscv-sbi: Fix CPU_PM_CPU_IDLE_ENTER_xyz() macro usage
In reply to Greg Kroah-HartmanFrom: Anup Patel <[email protected]>
[ Upstream commit cfadbb9df8c4dc917787da4458327e5ec14743d4 ]
Currently, we are using CPU_PM_CPU_IDLE_ENTER_PARAM() for all SBI HSM suspend types so retentive suspend types are also treated non-retentive and kernel will do redundant additional work for these states.
The BIT[31] of SBI HSM suspend types allows us to differentiate between retentive and non-retentive suspend types so we should use this BIT to call appropriate CPU_PM_CPU_IDLE_ENTER_xyz() macro.
--- drivers/cpuidle/cpuidle-riscv-sbi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/cpuidle/cpuidle-riscv-sbi.c +6 -1
@@ -97,8 +97,13 @@ static int sbi_cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx) {u32 *states =__this_cpu_read (sbi_cpuidle_data.states); +u32 state = states[idx]; -return CPU_PM_CPU_IDLE_ENTER_PARAM (sbi_suspend, idx, states[idx]); +if (state &SBI_HSM_SUSP_NON_RET_BIT ) +return CPU_PM_CPU_IDLE_ENTER_PARAM (sbi_suspend, idx, state); +else +return CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM (sbi_suspend, + idx, state); } static int __sbi_enter_domain_idle_state(struct cpuidle_device *dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 309/862 mips: dts: ralink: mt7621: fix external phy on GB-PC2
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 247825f991b34440f9b9d4fe607502435a42ac7b ]
The address of the external phy on the mdio bus is 5. Update the devicetree for GB-PC2 accordingly.
--- arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/boot/dts/ralink/mt7621-gnubee-gb-pc2.dts +3 -3
@@ -83,12 +83,12 @@ &gmac1 { status = "okay"; - phy-handle = <ðphy7>; + phy-handle = <ðphy5>; }; &mdio { - ethphy7: ethernet-phy@7 { - reg = <7>; + ethphy5: ethernet-phy@5 { + reg = <5>; phy-mode = "rgmii-rxid"; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 330/862 mISDN: fix use-after-free bugs in l1oip timer handlers
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 2568a7e0832ee30b0a351016d03062ab4e0e0a3f ]
The l1oip_cleanup() traverses the l1oip_ilist and calls release_card() to cleanup module and stack. However, release_card() calls del_timer() to delete the timers such as keep_tl and timeout_tl. If the timer handler is running, the del_timer() will not stop it and result in UAF bugs. One of the processes is shown below:
(cleanup routine) | (timer handler)
release_card() | l1oip_timeout()
... |
del_timer() | ...
... |
kfree(hc) //FREE |
| hc->timeout_on = 0 //USEFix by calling del_timer_sync() in release_card(), which makes sure the timer handlers have finished before the resources, such as l1oip and so on, have been deallocated.
What's more, the hc->workq and hc->socket_thread can kick those timers right back in. We add a bool flag to show if card is released. Then, check this flag in hc->workq and hc->socket_thread.
--- drivers/isdn/mISDN/l1oip.h | 1 + drivers/isdn/mISDN/l1oip_core.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-)
drivers/isdn/mISDN/l1oip.h +1 -0
@@ -59,6 +59,7 @@ struct l1oip {int bundle;/* bundle channels in one frm */ int codec;/* codec to use for transmis. */ int limit;/* limit number of bchannels */ +bool shutdown;/* if card is released */ /* timer */ struct timer_list keep_tl;
drivers/isdn/mISDN/l1oip_core.c +7 -6
@@ -275,7 +275,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, p = frame;/* restart timer */ -if (time_before (hc->keep_tl.expires, jiffies +5 *HZ )) +if (time_before (hc->keep_tl.expires, jiffies +5 *HZ ) && !hc->shutdown)mod_timer (&hc->keep_tl, jiffies +L1OIP_KEEPALIVE *HZ );else hc->keep_tl.expires = jiffies +L1OIP_KEEPALIVE *HZ ;
@@ -601,7 +601,9 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) goto multiframe;/* restart timer */ -if (time_before (hc->timeout_tl.expires, jiffies +5 *HZ ) || !hc->timeout_on) { +if ((time_before (hc->timeout_tl.expires, jiffies +5 *HZ ) || + !hc->timeout_on) && + !hc->shutdown) { hc->timeout_on =1 ;mod_timer (&hc->timeout_tl, jiffies +L1OIP_TIMEOUT *HZ ); }else /* only adjust timer */
@@ -1232,11 +1234,10 @@ release_card(struct l1oip *hc) {int ch; -if (timer_pending (&hc->keep_tl)) -del_timer (&hc->keep_tl); + hc->shutdown = true; -if (timer_pending (&hc->timeout_tl)) -del_timer (&hc->timeout_tl); +del_timer_sync (&hc->keep_tl); +del_timer_sync (&hc->timeout_tl);cancel_work_sync (&hc->workq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 591/862 clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit c388cc804016cf0f65afdc2362b120aa594ff3e6 ]
We have discovered random glitches during the system boot up procedure. The problem investigation led us to the weird outcomes: when none of the Renesas 5P49V6901 ports are explicitly enabled by the kernel driver, the glitches disappeared. It was a mystery since the SoC external clock domains were fed with different 5P49V6901 outputs. The driver code didn't seem like bogus either. We almost despaired to find out a root cause when the solution has been found for a more modern revision of the chip. It turned out the 5P49V6901 clock generator stopped its output for a short period of time during the VC5_OUT_DIV_CONTROL register writing. The same problem was found for the 5P49V6965 revision of the chip and was successfully fixed in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") by enabling the "bypass_sync" flag hidden inside "Unused Factory Reserved Register". Even though the 5P49V6901 registers description and programming guide doesn't provide any intel regarding that flag, setting it up anyway in the officially unused register completely eliminated the denoted glitches. Thus let's activate the functionality submitted in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") for the Renesas 5P49V6901 chip too in order to remove the ports implicit inter-dependency.
--- drivers/clk/clk-versaclock5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-versaclock5.c +1 -1
@@ -1204,7 +1204,7 @@ static const struct vc5_chip_info idt_5p49v6901_info = { .model = IDT_VC6_5P49V6901, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = VC5_HAS_PFD_FREQ_DBL, + .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT, };static const struct vc5_chip_info idt_5p49v6965_info = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 777/862 ARM: dts: imx6sl: use tabs for code indent
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit 218db824a7519856d0eaaeb5c41ca504ed550210 ]
This fixes the following error:
arch/arm/boot/dts/imx6sl.dtsi:714: error: code indent should use tabs where possible
--- arch/arm/boot/dts/imx6sl.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm/boot/dts/imx6sl.dtsi +10 -10
@@ -61,10 +61,10 @@ <792000 1175000>, <396000 975000>; fsl,soc-operating-points = - /* ARM kHz SOC-PU uV */ - <996000 1225000>, - <792000 1175000>, - <396000 1175000>; + /* ARM kHz SOC-PU uV */ + <996000 1225000>, + <792000 1175000>, + <396000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>,
@@ -225,7 +225,7 @@ uart5: serial@2018000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02018000 0x4000>; interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -238,7 +238,7 @@ uart1: serial@2020000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -251,7 +251,7 @@ uart2: serial@2024000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02024000 0x4000>; interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -312,7 +312,7 @@ uart3: serial@2034000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02034000 0x4000>; interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -325,7 +325,7 @@ uart4: serial@2038000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02038000 0x4000>; interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -714,7 +714,7 @@ #power-domain-cells = <0>; power-supply = <®_pu>; clocks = <&clks IMX6SL_CLK_GPU2D_OVG>, - <&clks IMX6SL_CLK_GPU2D_PODF>; + <&clks IMX6SL_CLK_GPU2D_PODF>; }; pd_disp: power-domain@2 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 362/862 drm/msm: Make .remove and .shutdown HW shutdown consistent
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit 0a58d2ae572adaec8d046f8d35b40c2c32ac7468 ]
Drivers' .remove and .shutdown callbacks are executed on different code paths. The former is called when a device is removed from the bus, while the latter is called at system shutdown time to quiesce the device.
This means that some overlap exists between the two, because both have to take care of properly shutting down the hardware. But currently the logic used in these two callbacks isn't consistent in msm drivers, which could lead to kernel panic.
For example, on .remove the component is deleted and its .unbind callback leads to the hardware being shutdown but only if the DRM device has been marked as registered.
That check doesn't exist in the .shutdown logic and this can lead to the driver calling drm_atomic_helper_shutdown() for a DRM device that hasn't been properly initialized.
A situation like this can happen if drivers for expected sub-devices fail to probe, since the .bind callback will never be executed. If that is the case, drm_atomic_helper_shutdown() will attempt to take mutexes that are only initialized if drm_mode_config_init() is called during a device bind.
This bug was attempted to be fixed in commit 623f279c7781 ("drm/msm: fix shutdown hook in case GPU components failed to bind"), but unfortunately it still happens in some cases as the one mentioned above, i.e:
systemd-shutdown[1]: Powering off.
kvm: exiting hardware virtualization
platform wifi-firmware.0: Removing from iommu group 12 platform video-firmware.0: Removing from iommu group 10
------------[ cut here ]------------
WARNING: CPU: 6 PID: 1 at drivers/gpu/drm/drm_modeset_lock.c:317 drm_modeset_lock_all_ctx+0x3c4/0x3d0
...
Hardware name: Google CoachZ (rev3+) (DT)
pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : drm_modeset_lock_all_ctx+0x3c4/0x3d0
lr : drm_modeset_lock_all_ctx+0x48/0x3d0
sp : ffff80000805bb80
x29: ffff80000805bb80 x28: ffff327c00128000 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000001 x24: ffffc95d820ec030
x23: ffff327c00bbd090 x22: ffffc95d8215eca0 x21: ffff327c039c5800
x20: ffff327c039c5988 x19: ffff80000805bbe8 x18: 0000000000000034
x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000
x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : ffff327c00128000 x1 : 0000000000000000 x0 : ffff327c039c59b0
Call trace:
drm_modeset_lock_all_ctx+0x3c4/0x3d0
drm_atomic_helper_shutdown+0x70/0x134
msm_drv_shutdown+0x30/0x40
platform_shutdown+0x28/0x40
device_shutdown+0x148/0x350
kernel_power_off+0x38/0x80
__do_sys_reboot+0x288/0x2c0
__arm64_sys_reboot+0x28/0x34
invoke_syscall+0x48/0x114
el0_svc_common.constprop.0+0x44/0xec
do_el0_svc+0x2c/0xc0
el0_svc+0x2c/0x84
el0t_64_sync_handler+0x11c/0x150
el0t_64_sync+0x18c/0x190
---[ end trace 0000000000000000 ]---
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018
Mem abort info:
ESR = 0x0000000096000004
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x04: level 0 translation fault
Data abort info:
ISV = 0, ISS = 0x00000004
CM = 0, WnR = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=000000010eab1000
[0000000000000018] pgd=0000000000000000, p4d=0000000000000000
Internal error: Oops: 96000004 [#1] PREEMPT SMP
...
Hardware name: Google CoachZ (rev3+) (DT)
pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : ww_mutex_lock+0x28/0x32c
lr : drm_modeset_lock_all_ctx+0x1b0/0x3d0
sp : ffff80000805bb50
x29: ffff80000805bb50 x28: ffff327c00128000 x27: 0000000000000000
x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000018
x23: ffff80000805bc10 x22: ffff327c039c5ad8 x21: ffff327c039c5800
x20: ffff80000805bbe8 x19: 0000000000000018 x18: 0000000000000034
x17: 000000040044ffff x16: ffffc95d80cac920 x15: 0000000000000000
x14: 0000000000000315 x13: 0000000000000315 x12: 0000000000000000
x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000
x8 : ffff80000805bc28 x7 : 0000000000000000 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
x2 : ffff327c00128000 x1 : 0000000000000000 x0 : 0000000000000018
Call trace:
ww_mutex_lock+0x28/0x32c
drm_modeset_lock_all_ctx+0x1b0/0x3d0
drm_atomic_helper_shutdown+0x70/0x134
msm_drv_shutdown+0x30/0x40
platform_shutdown+0x28/0x40
device_shutdown+0x148/0x350
kernel_power_off+0x38/0x80
__do_sys_reboot+0x288/0x2c0
__arm64_sys_reboot+0x28/0x34
invoke_syscall+0x48/0x114
el0_svc_common.constprop.0+0x44/0xec
do_el0_svc+0x2c/0xc0
el0_svc+0x2c/0x84
el0t_64_sync_handler+0x11c/0x150
el0t_64_sync+0x18c/0x190
Code: aa0103f4 d503201f d2800001 aa0103e3 (c8e37c02)
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
Kernel Offset: 0x495d77c00000 from 0xffff800008000000
PHYS_OFFSET: 0xffffcd8500000000
CPU features: 0x800,00c2a015,19801c82
Memory Limit: none
---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]------ drivers/gpu/drm/msm/msm_drv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +9 -4
@@ -1244,10 +1244,15 @@ void msm_drv_shutdown(struct platform_device *pdev)struct msm_drm_private *priv =platform_get_drvdata (pdev);struct drm_device *drm = priv ? priv->dev :NULL ; -if (!priv || !priv->kms) -return ; - -drm_atomic_helper_shutdown (drm); +/* +* Shutdown the hw if we're far enough along where things might be on. +* If we run this too early, we'll end up panicking in any variety of +* places. Since we don't register the drm device until late in +* msm_drm_init, drm_dev->registered is used as an indicator that the +* shutdown will be successful. +*/ +if (drm && drm->registered) +drm_atomic_helper_shutdown (drm); }static struct platform_driver msm_platform_driver = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 743/862 ALSA: usb-audio: Register card at the last interface
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 6392dcd1d0c7034ccf630ec55fc9e5810ecadf3b ]
The USB-audio driver matches per interface, and as default, it registers the card instance at the very first instance. This can be a problem for the devices that have multiple interfaces to be probed, as the udev rule isn't applied properly for the later appearing interfaces. Although we introduced the delayed_register option and the quirks for covering those shortcomings, it's nothing but a workaround for specific devices.
This patch is an another attempt to fix the problem in a more generic way. Now the driver checks the whole USB device descriptor at the very first time when an interface is attached to a sound card. It looks at each matching interface in the descriptor and remembers the last matching one. The snd_card_register() is invoked only when this last interface is probed.
After this change, the quirks for the delayed registration become superfluous, hence they are removed along with the patch. OTOH, the delayed_register option is still kept, as it might be useful for some corner cases (e.g. a special driver overtakes the interface probe from the standard driver, and the last interface probe may miss).
--- sound/usb/card.c | 32 +++++++++++++++++++++++++------- sound/usb/quirks.c | 42 ------------------------------------------ sound/usb/quirks.h | 2 -- sound/usb/usbaudio.h | 1 + 4 files changed, 26 insertions(+), 51 deletions(-)
sound/usb/card.c +25 -7
@@ -690,7 +690,7 @@ static bool get_alias_id(struct usb_device *dev, unsigned int *id)return false; } -static bool check_delayed_register_option (struct snd_usb_audio *chip,int iface) +static int check_delayed_register_option (struct snd_usb_audio *chip) {int i;unsigned int id, inum;
@@ -699,14 +699,31 @@ static bool check_delayed_register_option(struct snd_usb_audio *chip, int iface)if (delayed_register[i] &&sscanf (delayed_register[i],"%x:%x" , &id, &inum) ==2 && id == chip->usb_id) -return iface < inum; +return inum; } -return false; +return -1 ; }static const struct usb_device_id usb_audio_ids[];/* defined below */ +/* look for the last interface that matches with our ids and remember it */ +static void find_last_interface (struct snd_usb_audio *chip) +{ +struct usb_host_config *config = chip->dev->actconfig; +struct usb_interface *intf; +int i; + +if (!config) +return ; +for (i =0 ; i < config->desc.bNumInterfaces; i++) { + intf = config->interface[i]; +if (usb_match_id (intf, usb_audio_ids)) + chip->last_iface = intf->altsetting[0 ].desc.bInterfaceNumber; + } +usb_audio_dbg (chip,"Found last interface = %d\n" , chip->last_iface); +} +/* look for the corresponding quirk */ static const struct snd_usb_audio_quirk *get_alias_quirk (struct usb_device *dev,unsigned int id)
@@ -813,6 +830,7 @@ static int usb_audio_probe(struct usb_interface *intf, err = -ENODEV ; goto __error; } +find_last_interface (chip); }if (chip->num_interfaces >=MAX_CARD_INTERFACES ) {
@@ -862,11 +880,11 @@ static int usb_audio_probe(struct usb_interface *intf, chip->need_delayed_register = false;/* clear again */ } -/* we are allowed to call snd_card_register() many times, but first -* check to see if a device needs to skip it or do anything special +/* register card if we reach to the last interface or to the specified +* one given via option */ -if (!snd_usb_registration_quirk (chip, ifnum) && - !check_delayed_register_option (chip, ifnum)) { +if (check_delayed_register_option (chip) == ifnum || + chip->last_iface == ifnum) { err =snd_card_register (chip->card);if (err <0 ) goto __error;
sound/usb/quirks.c +0 -42
48 lines not on this page · raw message
sound/usb/quirks.h +0 -2
@@ -48,8 +48,6 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,struct audioformat *fp, int stream); -bool snd_usb_registration_quirk (struct snd_usb_audio *chip,int iface); -void snd_usb_init_quirk_flags (struct snd_usb_audio *chip);#endif /* __USBAUDIO_QUIRKS_H */
sound/usb/usbaudio.h +1 -0
@@ -37,6 +37,7 @@ struct snd_usb_audio {unsigned int quirk_flags; unsigned int need_delayed_register:1; /* warn for delayed registration */int num_interfaces; +int last_iface;int num_suspended_intf;int sample_rate_read_error;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 749/862 platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2a2565272a3628e45d61625e36ef17af7af4e3de ]
On a MSI S270 with Fedora 37 x86_64 / systemd-251.4 the module does not properly autoload.
This is likely caused by issues with how systemd-udevd handles the single quote char (') which is part of the sys_vendor / chassis_vendor strings on this laptop. As a workaround remove the single quote char + everything behind it from the sys_vendor + chassis_vendor matches. This fixes the module not autoloading.
--- drivers/platform/x86/msi-laptop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/platform/x86/msi-laptop.c +3 -5
@@ -596,11 +596,10 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { { .ident = "MSI S270", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT'L CO.,LTD" ), +DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT" ),DMI_MATCH (DMI_PRODUCT_NAME ,"MS-1013" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"0131" ), -DMI_MATCH (DMI_CHASSIS_VENDOR , -"MICRO-STAR INT'L CO.,LTD" ) +DMI_MATCH (DMI_CHASSIS_VENDOR ,"MICRO-STAR INT" ) }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb
@@ -633,8 +632,7 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"NOTEBOOK" ),DMI_MATCH (DMI_PRODUCT_NAME ,"SAM2000" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"0131" ), -DMI_MATCH (DMI_CHASSIS_VENDOR , -"MICRO-STAR INT'L CO.,LTD" ) +DMI_MATCH (DMI_CHASSIS_VENDOR ,"MICRO-STAR INT" ) }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 748/862 platform/x86: hp-wmi: Setting thermal profile fails with 0x06
In reply to Greg Kroah-HartmanFrom: Jorge Lopez <[email protected]>
[ Upstream commit 00b1829294b7c88ecba92c661fbe6fe347b364d2 ]
Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module.
This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks.
--- drivers/platform/x86/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +10 -1
@@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {enum hp_thermal_profile {HP_THERMAL_PROFILE_PERFORMANCE =0x00 ,HP_THERMAL_PROFILE_DEFAULT =0x01 , -HP_THERMAL_PROFILE_COOL =0x02 +HP_THERMAL_PROFILE_COOL =0x02 , +HP_THERMAL_PROFILE_QUIET =0x03 , };#define IS_HWBLOCKED (x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
@@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,case HP_THERMAL_PROFILE_COOL : *profile =PLATFORM_PROFILE_COOL ;break ; +case HP_THERMAL_PROFILE_QUIET : + *profile =PLATFORM_PROFILE_QUIET ; +break ;default :return -EINVAL ; }
@@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,case PLATFORM_PROFILE_COOL : tp =HP_THERMAL_PROFILE_COOL ;break ; +case PLATFORM_PROFILE_QUIET : + tp =HP_THERMAL_PROFILE_QUIET ; +break ;default :return -EOPNOTSUPP ; }
@@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void) platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + +set_bit (PLATFORM_PROFILE_QUIET , platform_profile_handler.choices); }set_bit (PLATFORM_PROFILE_COOL , platform_profile_handler.choices);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 489/862 media: mediatek: vcodec: Skip non CBR bitrate mode
In reply to Greg Kroah-HartmanFrom: Hirokazu Honda <[email protected]>
[ Upstream commit e7bfdf0a854037e8c0597f1f44f72651869c424d ]
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR is the only bitrate mode supported by the mediatek driver. The other bitrates must be skipped in QUERY_MENU.
--- drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +2 -1
@@ -1403,7 +1403,8 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) V4L2_MPEG_VIDEO_VP8_PROFILE_0, 0, V4L2_MPEG_VIDEO_VP8_PROFILE_0);v4l2_ctrl_new_std_menu (handler, ops,V4L2_CID_MPEG_VIDEO_BITRATE_MODE ,V4L2_MPEG_VIDEO_BITRATE_MODE_CBR , -0 ,V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ); + ~(1 <<V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ), +V4L2_MPEG_VIDEO_BITRATE_MODE_CBR );if (handler->error) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 750/862 ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS
In reply to Greg Kroah-HartmanFrom: Muralidhar Reddy <[email protected]>
[ Upstream commit 9db1c9fa214ef41d098633ff40a87284ca6e1870 ]
added quirks for ESS8336 for AlderLake-PS
--- sound/hda/intel-dsp-config.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/hda/intel-dsp-config.c +5 -0
@@ -427,6 +427,11 @@ static const struct config_entry config_table[] = { .device = 0x51cd, },/* Alderlake-PS */ + { + .flags = FLAG_SOF, + .device = 0x51c9, + .codec_hid = &essx_83x6, + }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c9,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 791/862 ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n
In reply to Greg Kroah-HartmanFrom: Alex Sverdlin <[email protected]>
[ Upstream commit 823f606ab6b4759a1faf0388abcf4fb0776710d2 ]
In case CONFIG_KASAN_VMALLOC=y kasan_populate_vmalloc() allocates the shadow pages dynamically. But even worse is that kasan_release_vmalloc() releases them, which is not compatible with create_mapping() of MODULES_VADDR..MODULES_END range:
BUG: Bad page state in process kworker/9:1 pfn:2068b page:e5e06160 refcount:0 mapcount:0 mapping:00000000 index:0x0 flags: 0x1000(reserved) raw: 00001000 e5e06164 e5e06164 00000000 00000000 00000000 ffffffff 00000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set bad because of flags: 0x1000(reserved) Modules linked in: ip_tables CPU: 9 PID: 154 Comm: kworker/9:1 Not tainted 5.4.188-... #1 Hardware name: LSI Axxia AXM55XX Workqueue: events do_free_init
unwind_backtraceshow_stackdump_stackbad_pagefree_pcp_preparefree_unref_pagekasan_depopulate_vmalloc_pte__apply_to_page_rangeapply_to_existing_page_rangekasan_release_vmalloc__purge_vmap_area_lazy
_vm_unmap_aliases.part.0__vunmapdo_free_initprocess_one_workworker_thread
kthread
--- arch/arm/mm/kasan_init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mm/kasan_init.c +7 -2
@@ -268,12 +268,17 @@ void __init kasan_init(void)/* * 1. The module global variables are in MODULES_VADDR ~ MODULES_END, -* so we need to map this area. +* so we need to map this area if CONFIG_KASAN_VMALLOC=n. With +* VMALLOC support KASAN will manage this region dynamically, +* refer to kasan_populate_vmalloc() and ARM's implementation of +* module_alloc(). * 2. PKMAP_BASE ~ PKMAP_BASE+PMD_SIZE's shadow and MODULES_VADDR * ~ MODULES_END's shadow is in the same PMD_SIZE, so we can't * use kasan_populate_zero_shadow. */ -create_mapping ((void *)MODULES_VADDR , (void *)(PKMAP_BASE +PMD_SIZE )); +if (!IS_ENABLED (CONFIG_KASAN_VMALLOC ) &&IS_ENABLED (CONFIG_MODULES )) +create_mapping ((void *)MODULES_VADDR , (void *)(MODULES_END )); +create_mapping ((void *)PKMAP_BASE , (void *)(PKMAP_BASE +PMD_SIZE ));/* * KAsan may reuse the contents of kasan_early_shadow_pte directly, so
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 751/862 ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
In reply to Greg Kroah-HartmanFrom: Jairaj Arava <[email protected]>
[ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ]
In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path.
Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms.
--- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/sof-pci-dev.c +1 -1
@@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {},
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 794/862 media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit c65c3f3a2cbf21ed429d9b9c725bdb5dc6abf4cf ]
video_unregister_device will release device internally. There is no need to call video_device_release after video_unregister_device.
--- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 1 - drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 - drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/media/platform/amlogic/meson-ge2d/ge2d.c +0 -1
@@ -1030,7 +1030,6 @@ static int ge2d_remove(struct platform_device *pdev)video_unregister_device (ge2d->vfd);v4l2_m2m_release (ge2d->m2m_dev); -video_device_release (ge2d->vfd);v4l2_device_unregister (&ge2d->v4l2_dev);clk_disable_unprepare (ge2d->clk);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +0 -1
@@ -1414,7 +1414,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);video_unregister_device (jpeg->vdev); -video_device_release (jpeg->vdev);v4l2_m2m_release (jpeg->m2m_dev);v4l2_device_unregister (&jpeg->v4l2_dev);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +1 -2
@@ -1399,6 +1399,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)/* Deinit MFC if probe had failed */ err_enc_reg:video_unregister_device (dev->vfd_dec); + dev->vfd_dec =NULL ; err_dec_reg:video_device_release (dev->vfd_enc); err_enc_alloc:
@@ -1444,8 +1445,6 @@ static int s5p_mfc_remove(struct platform_device *pdev)video_unregister_device (dev->vfd_enc);video_unregister_device (dev->vfd_dec); -video_device_release (dev->vfd_enc); -video_device_release (dev->vfd_dec);v4l2_device_unregister (&dev->v4l2_dev);s5p_mfc_unconfigure_dma_memory (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 795/862 clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate
In reply to Greg Kroah-HartmanFrom: Quanyang Wang <[email protected]>
[ Upstream commit 30eaf02149ecc3c5815e45d27187bf09e925071d ]
The function zynqmp_pll_round_rate is used to find a most appropriate PLL frequency which the hardware can generate according to the desired frequency. For example, if the desired frequency is 297MHz, considering the limited range from PS_PLL_VCO_MIN (1.5GHz) to PS_PLL_VCO_MAX (3.0GHz) of PLL, zynqmp_pll_round_rate should return 1.872GHz (297MHz * 5).
There are two problems with the current code of zynqmp_pll_round_rate:
1) When the rate is below PS_PLL_VCO_MIN, it can't find a correct rate when the parameter "rate" is an integer multiple of *prate, in other words, if "f" is zero, zynqmp_pll_round_rate won't return a valid frequency which is from PS_PLL_VCO_MIN to PS_PLL_VCO_MAX. For example, *prate is 33MHz and the rate is 660MHz, zynqmp_pll_round_rate will not boost up rate and just return 660MHz, and this will cause clk_calc_new_rates failure since zynqmp_pll_round_rate returns an invalid rate out of its boundaries.
2) Even if the rate is higher than PS_PLL_VCO_MIN, there is still a risk that zynqmp_pll_round_rate returns an invalid rate because the function DIV_ROUND_CLOSEST makes some loss in the fractional part. If the parent clock *prate is 33333333Hz and we want to set the PLL rate to 1.5GHz, this function will return 1499999985Hz by using the formula below:
value = *prate * DIV_ROUND_CLOSEST(rate, *prate)).
This value is also invalid since it's slightly smaller than PS_PLL_VCO_MIN. because DIV_ROUND_CLOSEST makes some loss in the fractional part.
--- drivers/clk/zynqmp/pll.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/clk/zynqmp/pll.c +15 -16
@@ -102,26 +102,25 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) {u32 fbdiv; -long rate_div, f; +u32 mult, div; -/* Enable the fractional mode if needed */ - rate_div = (rate *FRAC_DIV ) / *prate; - f = rate_div %FRAC_DIV ; -if (f) { -if (rate >PS_PLL_VCO_MAX ) { - fbdiv = rate /PS_PLL_VCO_MAX ; - rate = rate / (fbdiv +1 ); - } -if (rate <PS_PLL_VCO_MIN ) { - fbdiv =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); - rate = rate * fbdiv; - } -return rate; +/* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ +if (rate >PS_PLL_VCO_MAX ) { + div =DIV_ROUND_UP (rate,PS_PLL_VCO_MAX ); + rate = rate / div; + } +if (rate <PS_PLL_VCO_MIN ) { + mult =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); + rate = rate * mult; } fbdiv =DIV_ROUND_CLOSEST (rate, *prate); - fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); -return *prate * fbdiv; +if (fbdiv <PLL_FBDIV_MIN || fbdiv >PLL_FBDIV_MAX ) { + fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); + rate = *prate * fbdiv; + } + +return rate; }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 800/862 dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow
In reply to Greg Kroah-HartmanFrom: Vaishnav Achath <[email protected]>
[ Upstream commit 7c94dcfa8fcff2dba53915f1dabfee49a3df8b88 ]
UDMA_CHAN_RT_*BCNT_REG stores the real-time channel bytecount statistics. These registers are 32-bit hardware counters and the driver uses these counters to monitor the operational progress status for a channel, when transferring more than 4GB of data it was observed that these counters overflow and completion calculation of a operation gets affected and the transfer hangs indefinitely.
This commit adds changes to decrease the byte count for every complete transaction so that these registers never overflow and the proper byte count statistics is maintained for ongoing transaction by the RT counters.
Earlier uc->bcnt used to maintain a count of the completed bytes at driver side, since the RT counters maintain the statistics of current transaction now, the maintenance of uc->bcnt is not necessary.
--- drivers/dma/ti/k3-udma.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/dma/ti/k3-udma.c +17 -8
@@ -300,8 +300,6 @@ struct udma_chan {struct udma_tx_drain tx_drain; -u32 bcnt;/* number of bytes completed since the start of the channel */ -/* Channel configuration parameters */ struct udma_chan_config config;
@@ -757,6 +755,20 @@ static void udma_reset_rings(struct udma_chan *uc) } } +static void udma_decrement_byte_counters (struct udma_chan *uc,u32 val) +{ +if (uc->desc->dir ==DMA_DEV_TO_MEM ) { +udma_rchanrt_write (uc,UDMA_CHAN_RT_BCNT_REG , val); +udma_rchanrt_write (uc,UDMA_CHAN_RT_SBCNT_REG , val); +udma_rchanrt_write (uc,UDMA_CHAN_RT_PEER_BCNT_REG , val); + }else { +udma_tchanrt_write (uc,UDMA_CHAN_RT_BCNT_REG , val); +udma_tchanrt_write (uc,UDMA_CHAN_RT_SBCNT_REG , val); +if (!uc->bchan) +udma_tchanrt_write (uc,UDMA_CHAN_RT_PEER_BCNT_REG , val); + } +} +static void udma_reset_counters (struct udma_chan *uc) {u32 val;
@@ -790,8 +802,6 @@ static void udma_reset_counters(struct udma_chan *uc) val =udma_rchanrt_read (uc,UDMA_CHAN_RT_PEER_BCNT_REG );udma_rchanrt_write (uc,UDMA_CHAN_RT_PEER_BCNT_REG , val); } - - uc->bcnt =0 ; }static int udma_reset_chan (struct udma_chan *uc,bool hard)
@@ -1115,7 +1125,7 @@ static void udma_check_tx_completion(struct work_struct *work)if (uc->desc) {struct udma_desc *d = uc->desc; - uc->bcnt += d->residue; +udma_decrement_byte_counters (uc, d->residue);udma_start (uc);vchan_cookie_complete (&d->vd);break ;
@@ -1168,7 +1178,7 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)vchan_cyclic_callback (&d->vd); }else {if (udma_is_desc_really_done (uc, d)) { - uc->bcnt += d->residue; +udma_decrement_byte_counters (uc, d->residue);udma_start (uc);vchan_cookie_complete (&d->vd); }else {
@@ -1204,7 +1214,7 @@ static irqreturn_t udma_udma_irq_handler(int irq, void *data)vchan_cyclic_callback (&d->vd); }else {/* TODO: figure out the real amount of data */ - uc->bcnt += d->residue; +udma_decrement_byte_counters (uc, d->residue);udma_start (uc);vchan_cookie_complete (&d->vd); }
@@ -3809,7 +3819,6 @@ static enum dma_status udma_tx_status(struct dma_chan *chan, bcnt =udma_tchanrt_read (uc,UDMA_CHAN_RT_BCNT_REG ); } - bcnt -= uc->bcnt;if (bcnt && !(bcnt % uc->desc->residue)) residue =0 ;else
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 797/862 usb: host: xhci-plat: suspend and resume clocks
In reply to Greg Kroah-HartmanFrom: Justin Chen <[email protected]>
[ Upstream commit 8bd954c56197caf5e3a804d989094bc3fe6329aa ]
Introduce XHCI_SUSPEND_RESUME_CLKS quirk as a means to suspend and resume clocks if the hardware is capable of doing so. We assume that clocks will be needed if the device may wake.
--- drivers/usb/host/xhci-plat.c | 16 +++++++++++++++- drivers/usb/host/xhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +15 -1
@@ -437,7 +437,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)* xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ -return xhci_suspend (xhci,device_may_wakeup (dev)); + ret =xhci_suspend (xhci,device_may_wakeup (dev)); +if (ret) +return ret; + +if (!device_may_wakeup (dev) && (xhci->quirks &XHCI_SUSPEND_RESUME_CLKS )) { +clk_disable_unprepare (xhci->clk); +clk_disable_unprepare (xhci->reg_clk); + } + +return 0 ; }static int __maybe_unused xhci_plat_resume (struct device *dev)
@@ -446,6 +455,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)struct xhci_hcd *xhci =hcd_to_xhci (hcd);int ret; +if (!device_may_wakeup (dev) && (xhci->quirks &XHCI_SUSPEND_RESUME_CLKS )) { +clk_prepare_enable (xhci->clk); +clk_prepare_enable (xhci->reg_clk); + } + ret =xhci_priv_resume_quirk (hcd);if (ret)return ret;
drivers/usb/host/xhci.h +1 -0
@@ -1899,6 +1899,7 @@ struct xhci_hcd {#define XHCI_NO_SOFT_RETRY BIT_ULL(40)#define XHCI_BROKEN_D3COLD BIT_ULL(41)#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)unsigned int num_active_eps;unsigned int limit_active_eps;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 689/862 wifi: mac80211: accept STA changes without link changes
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit b303835dabe0340f932ebb4e260d2229f79b0684 ]
If there's no link ID, then check that there are no changes to the link, and if so accept them, unless a new link is created. While at it, reject creating a new link without an address.
This fixes authorizing an MLD (peer) that has no link 0.
--- net/mac80211/cfg.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/mac80211/cfg.c +14 -0
@@ -1610,6 +1610,18 @@ static int sta_link_apply_parameters(struct ieee80211_local *local,rcu_dereference_protected (sta->link[link_id],lockdep_is_held (&local->sta_mtx)); +/* +* If there are no changes, then accept a link that doesn't exist, +* unless it's a new link. +*/ +if (params->link_id <0 && !new_link && + !params->link_mac && !params->txpwr_set && + !params->supported_rates_len && + !params->ht_capa && !params->vht_capa && + !params->he_capa && !params->eht_capa && + !params->opmode_notif_used) +return 0 ; +if (!link || !link_sta)return -EINVAL ;
@@ -1625,6 +1637,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, params->link_mac)) {return -EINVAL ; } + }else if (new_link) { +return -EINVAL ; }if (params->txpwr_set) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 547/862 md: Replace snprintf with scnprintf
In reply to Greg Kroah-HartmanFrom: Saurabh Sengar <[email protected]>
[ Upstream commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 ]
Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer.
[ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at <snip>/lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: <snip> [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/md/raid0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid0.c +1 -1
@@ -47,7 +47,7 @@ static void dump_zones(struct mddev *mddev)int len =0 ;for (k =0 ; k < conf->strip_zone[j].nb_dev; k++) - len +=snprintf (line+len,200 -len,"%s%pg" , k?"/" :"" , + len +=scnprintf (line+len,200 -len,"%s%pg" , k?"/" :"" , conf->devlist[j * raid_disks + k]->bdev);pr_debug ("md: zone%d=[%s]\n" , j, line);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 782/862 ARM: orion: fix include path
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 63872304bdb3decd5454f4dd210c25395278ed13 ]
Now that CONFIG_ARCH_MULTIPLATFORM can be disabled anywhere, there is a build failure for plat-orion:
arch/arm/plat-orion/irq.c:19:10: fatal error: plat/irq.h: No such file or directory
Make the include path unconditional.
--- arch/arm/plat-orion/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/plat-orion/Makefile +1 -1
@@ -2,7 +2,7 @@ # # Makefile for the linux kernel. # -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include +ccflags-y := -I$(srctree)/$(src)/include orion-gpio-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_PLAT_ORION_LEGACY) += irq.o pcie.o time.o common.o mpp.o
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 804/862 usb: gadget: uvc: increase worker prio to WQ_HIGHPRI
In reply to Greg Kroah-HartmanFrom: Michael Grzeschik <[email protected]>
[ Upstream commit 9b91a65230784a9ef644b8bdbb82a79ba4ae9456 ]
This patch is changing the simple workqueue in the gadget driver to be allocated as async_wq with a higher priority. The pump worker, that is filling the usb requests, will have a higher priority and will not be scheduled away so often while the video stream is handled. This will lead to fewer streaming underruns.
--- drivers/usb/gadget/function/f_uvc.c | 4 ++++ drivers/usb/gadget/function/uvc.h | 1 + drivers/usb/gadget/function/uvc_v4l2.c | 2 +- drivers/usb/gadget/function/uvc_video.c | 9 +++++++-- 4 files changed, 13 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_uvc.c +4 -0
@@ -897,10 +897,14 @@ static void uvc_function_unbind(struct usb_configuration *c, {struct usb_composite_dev *cdev = c->cdev;struct uvc_device *uvc =to_uvc (f); +struct uvc_video *video = &uvc->video;long wait_ret =1 ;uvcg_info (f,"%s()\n" , __func__); +if (video->async_wq) +destroy_workqueue (video->async_wq); +/* * If we know we're connected via v4l2, then there should be a cleanup * of the device from userspace either via UVC_EVENT_DISCONNECT or
drivers/usb/gadget/function/uvc.h +1 -0
@@ -88,6 +88,7 @@ struct uvc_video {struct usb_ep *ep;struct work_struct pump; +struct workqueue_struct *async_wq;/* Frame parameters */ u8 bpp;
drivers/usb/gadget/function/uvc_v4l2.c +1 -1
@@ -170,7 +170,7 @@ uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)return ret;if (uvc->state ==UVC_STATE_STREAMING ) -schedule_work (&video->pump); +queue_work (video->async_wq, &video->pump);return ret; }
drivers/usb/gadget/function/uvc_video.c +7 -2
@@ -277,7 +277,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)spin_unlock_irqrestore (&video->req_lock, flags);if (uvc->state ==UVC_STATE_STREAMING ) -schedule_work (&video->pump); +queue_work (video->async_wq, &video->pump); } static int
@@ -485,7 +485,7 @@ int uvcg_video_enable(struct uvc_video *video, int enable) video->req_int_count =0 ; -schedule_work (&video->pump); +queue_work (video->async_wq, &video->pump);return ret; }
@@ -499,6 +499,11 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)spin_lock_init (&video->req_lock);INIT_WORK (&video->pump, uvcg_video_pump); +/* Allocate a work queue for asynchronous video pump handler. */ + video->async_wq =alloc_workqueue ("uvcgadget" ,WQ_UNBOUND |WQ_HIGHPRI ,0 ); +if (!video->async_wq) +return -EINVAL ; + video->uvc = uvc; video->fcc =V4L2_PIX_FMT_YUYV ; video->bpp =16 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 584/862 clk: mediatek: Migrate remaining clk_unregister_*() to clk_hw_unregister_*()
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit fef14676fc4be40b8441745a3c96b7e7d7d8592d ]
During the previous |struct clk| to |struct clk_hw| clk provider API migration in commit 6f691a586296 ("clk: mediatek: Switch to clk_hw provider APIs"), a few clk_unregister_*() calls were missed.
Migrate the remaining ones to the |struct clk_hw| provider API, i.e. change clk_unregister_*() to clk_hw_unregister_*().
--- drivers/clk/mediatek/clk-mtk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/mediatek/clk-mtk.c +5 -5
@@ -80,7 +80,7 @@ int mtk_clk_register_fixed_clks(const struct mtk_fixed_clk *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[rc->id]))continue ; -clk_unregister_fixed_rate (clk_data->hws[rc->id]->clk); +clk_hw_unregister_fixed_rate (clk_data->hws[rc->id]); clk_data->hws[rc->id] =ERR_PTR (-ENOENT ); }
@@ -102,7 +102,7 @@ void mtk_clk_unregister_fixed_clks(const struct mtk_fixed_clk *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[rc->id]))continue ; -clk_unregister_fixed_rate (clk_data->hws[rc->id]->clk); +clk_hw_unregister_fixed_rate (clk_data->hws[rc->id]); clk_data->hws[rc->id] =ERR_PTR (-ENOENT ); } }
@@ -146,7 +146,7 @@ int mtk_clk_register_factors(const struct mtk_fixed_factor *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[ff->id]))continue ; -clk_unregister_fixed_factor (clk_data->hws[ff->id]->clk); +clk_hw_unregister_fixed_factor (clk_data->hws[ff->id]); clk_data->hws[ff->id] =ERR_PTR (-ENOENT ); }
@@ -168,7 +168,7 @@ void mtk_clk_unregister_factors(const struct mtk_fixed_factor *clks, int num,if (IS_ERR_OR_NULL (clk_data->hws[ff->id]))continue ; -clk_unregister_fixed_factor (clk_data->hws[ff->id]->clk); +clk_hw_unregister_fixed_factor (clk_data->hws[ff->id]); clk_data->hws[ff->id] =ERR_PTR (-ENOENT ); } }
@@ -414,7 +414,7 @@ void mtk_clk_unregister_dividers(const struct mtk_clk_divider *mcds, int num,if (IS_ERR_OR_NULL (clk_data->hws[mcd->id]))continue ; -clk_unregister_divider (clk_data->hws[mcd->id]->clk); +clk_hw_unregister_divider (clk_data->hws[mcd->id]); clk_data->hws[mcd->id] =ERR_PTR (-ENOENT ); } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 807/862 blk-throttle: prevent overflow while calculating wait time
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ]
There is a problem found by code review in tg_with_in_bps_limit() that 'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by calling mul_u64_u64_div_u64() instead.
--- block/blk-throttle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
block/blk-throttle.c +3 -5
@@ -806,7 +806,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); -u64 bytes_allowed, extra_bytes, tmp; +u64 bytes_allowed, extra_bytes;unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;unsigned int bio_size =throtl_bio_data_size (bio);
@@ -824,10 +824,8 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd =roundup (jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; -do_div (tmp,HZ ); - bytes_allowed = tmp; + bytes_allowed =mul_u64_u64_div_u64 (bps_limit, (u64 )jiffy_elapsed_rnd, + (u64 )HZ );if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) {if (wait)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 816/862 md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74 ]
A complicated deadlock exists when using the journal and an elevated group_thrtead_cnt. It was found with loop devices, but its not clear whether it can be seen with real disks. The deadlock can occur simply by writing data with an fio script.
When the deadlock occurs, multiple threads will hang in different ways:
1) The group threads will hang in the blk-wbt code with bios waiting to
be submitted to the block layer:
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
__submit_bio+0xe6/0x100
submit_bio_noacct_nocheck+0x42e/0x470
submit_bio_noacct+0x4c2/0xbb0
ops_run_io+0x46b/0x1a30
handle_stripe+0xcd3/0x36b0
handle_active_stripes.constprop.0+0x6f6/0xa60
raid5_do_work+0x177/0x330
Or:
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
__submit_bio+0xe6/0x100
submit_bio_noacct_nocheck+0x42e/0x470
submit_bio_noacct+0x4c2/0xbb0
flush_deferred_bios+0x136/0x170
raid5_do_work+0x262/0x330 2) The r5l_reclaim thread will hang in the same way, submitting a
bio to the block layer:
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
__submit_bio+0xe6/0x100
submit_bio_noacct_nocheck+0x42e/0x470
submit_bio_noacct+0x4c2/0xbb0
submit_bio+0x3f/0xf0
md_super_write+0x12f/0x1b0
md_update_sb.part.0+0x7c6/0xff0
md_update_sb+0x30/0x60
r5l_do_reclaim+0x4f9/0x5e0
r5l_reclaim_thread+0x69/0x30b
However, before hanging, the MD_SB_CHANGE_PENDING flag will be
set for sb_flags in r5l_write_super_and_discard_space(). This
flag will never be cleared because the submit_bio() call never
returns. 3) Due to the MD_SB_CHANGE_PENDING flag being set, handle_stripe() will do no processing on any pending stripes and re-set STRIPE_HANDLE. This will cause the raid5d thread to enter an infinite loop, constantly trying to handle the same stripes stuck in the queue.
The raid5d thread has a blk_plug that holds a number of bios that are also stuck waiting seeing the thread is in a loop that never schedules. These bios have been accounted for by blk-wbt thus preventing the other threads above from continuing when they try to submit bios. --Deadlock.
To fix this, add the same wait_event() that is used in raid5_do_work() to raid5d() such that if MD_SB_CHANGE_PENDING is set, the thread will schedule and wait until the flag is cleared. The schedule action will flush the plug which will allow the r5l_reclaim thread to continue, thus preventing the deadlock.
However, md_check_recovery() calls can also clear MD_SB_CHANGE_PENDING from the same thread and can thus deadlock if the thread is put to sleep. So avoid waiting if md_check_recovery() is being called in the loop.
It's not clear when the deadlock was introduced, but the similar wait_event() call in raid5_do_work() was added in 2017 by this commit:
16d997b78b15 ("md/raid5: simplfy delaying of writes while metadata
is updated.")
--- drivers/md/raid5.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/md/raid5.c +12 -0
@@ -36,6 +36,7 @@*/ #include <linux/blkdev.h> +#include <linux/delay.h> #include <linux/kthread.h> #include <linux/raid/pq.h> #include <linux/async_tx.h>
@@ -6780,7 +6781,18 @@ static void raid5d(struct md_thread *thread)spin_unlock_irq (&conf->device_lock);md_check_recovery (mddev);spin_lock_irq (&conf->device_lock); + +/* +* Waiting on MD_SB_CHANGE_PENDING below may deadlock +* seeing md_check_recovery() is needed to clear +* the flag when using mdmon. +*/ +continue ; } + +wait_event_lock_irq (mddev->sb_wait, + !test_bit (MD_SB_CHANGE_PENDING , &mddev->sb_flags), + conf->device_lock); }pr_debug ("%d stripes handled\n" , handled);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 784/862 btrfs: scrub: properly report super block errors in system log
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit e69bf81c9a339f1b2c041b112a6fbb9f60fc9340 ]
[PROBLEM]
Unlike data/metadata corruption, if scrub detected some error in the super block, the only error message is from the updated device status:
BTRFS info (device dm-1): scrub: started on devid 2
BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0
This is not helpful at all.
[CAUSE]
Unlike data/metadata error reporting, there is no visible report in kernel dmesg to report supper block errors.
In fact, return value of scrub_checksum_super() is intentionally skipped, thus scrub_handle_errored_block() will never be called for super blocks.
[FIX]
Make super block errors to output an error message, now the full dmesg would looks like this:
BTRFS info (device dm-1): scrub: started on devid 2
BTRFS warning (device dm-1): super block error on device /dev/mapper/test-scratch2, physical 67108864 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0
BTRFS info (device dm-1): scrub: started on devid 2
This fix involves:
- Move the super_errors reporting to scrub_handle_errored_block() This allows the device status message to show after the super block error message.
But now we no longer distinguish super block corruption and generation mismatch, now all counted as corruption.
- Properly check the return value from scrub_checksum_super()
- Add extra super block error reporting for scrub_print_warning().
--- fs/btrfs/scrub.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
fs/btrfs/scrub.c +12 -21
@@ -729,6 +729,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) dev = sblock->sectors[0 ]->dev; fs_info = sblock->sctx->fs_info; +/* Super block error, no need to search extent tree. */ +if (sblock->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_SUPER ) { +btrfs_warn_in_rcu (fs_info,"%s on device %s, physical %llu" , + errstr,rcu_str_deref (dev->name), + sblock->sectors[0 ]->physical); +return ; + } path =btrfs_alloc_path ();if (!path)return ;
@@ -804,7 +811,7 @@ static inline void scrub_put_recover(struct btrfs_fs_info *fs_info,static int scrub_handle_errored_block (struct scrub_block *sblock_to_check) {struct scrub_ctx *sctx = sblock_to_check->sctx; -struct btrfs_device *dev; +struct btrfs_device *dev = sblock_to_check->sectors[0 ]->dev;struct btrfs_fs_info *fs_info;u64 logical;unsigned int failed_mirror_index;
@@ -825,13 +832,15 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) fs_info = sctx->fs_info;if (sblock_to_check->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_SUPER ) {/* -* if we find an error in a super block, we just report it. +* If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ +scrub_print_warning ("super block error" , sblock_to_check);spin_lock (&sctx->stat_lock); ++sctx->stat.super_errors;spin_unlock (&sctx->stat_lock); +btrfs_dev_stat_inc_and_print (dev,BTRFS_DEV_STAT_CORRUPTION_ERRS );return 0 ; } logical = sblock_to_check->sectors[0 ]->logical;
@@ -840,7 +849,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) is_metadata = !(sblock_to_check->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_DATA ); have_csum = sblock_to_check->sectors[0 ]->have_csum; - dev = sblock_to_check->sectors[0 ]->dev;if (!sctx->is_dev_replace &&btrfs_repair_one_zone (fs_info, logical))return 0 ;
@@ -1762,7 +1770,7 @@ static int scrub_checksum(struct scrub_block *sblock)else if (flags &BTRFS_EXTENT_FLAG_TREE_BLOCK ) ret =scrub_checksum_tree_block (sblock);else if (flags &BTRFS_EXTENT_FLAG_SUPER ) - (void )scrub_checksum_super (sblock); + ret =scrub_checksum_super (sblock);else WARN_ON (1 );if (ret)
@@ -1901,23 +1909,6 @@ static int scrub_checksum_super(struct scrub_block *sblock)if (memcmp (calculated_csum, s->csum, sctx->fs_info->csum_size)) ++fail_cor; -if (fail_cor + fail_gen) { -/* -* if we find an error in a super block, we just report it. -* They will get written with the next transaction commit -* anyway -*/ -spin_lock (&sctx->stat_lock); - ++sctx->stat.super_errors; -spin_unlock (&sctx->stat_lock); -if (fail_cor) -btrfs_dev_stat_inc_and_print (sector->dev, -BTRFS_DEV_STAT_CORRUPTION_ERRS ); -else -btrfs_dev_stat_inc_and_print (sector->dev, -BTRFS_DEV_STAT_GENERATION_ERRS ); - } -return fail_cor + fail_gen; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 829/862 nvme: copy firmware_rev on each init
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ]
The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data.
--- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +2 -1
@@ -2889,7 +2889,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)nvme_init_subnqn (subsys, ctrl, id);memcpy (subsys->serial, id->sn,sizeof (subsys->serial));memcpy (subsys->model, id->mn,sizeof (subsys->model)); -memcpy (subsys->firmware_rev, id->fr,sizeof (subsys->firmware_rev)); subsys->vendor_id =le16_to_cpu (id->vid); subsys->cmic = id->cmic;
@@ -3108,6 +3107,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } +memcpy (ctrl->subsys->firmware_rev, id->fr, +sizeof (ctrl->subsys->firmware_rev));if (force_apst && (ctrl->quirks &NVME_QUIRK_NO_DEEPEST_PS )) {dev_warn (ctrl->device,"forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 834/862 fsi: occ: Prevent use after free
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit d3e1e24604031b0d83b6c2d38f54eeea265cfcc0 ]
Use get_device and put_device in the open and close functions to make sure the device doesn't get freed while a file descriptor is open.
Also, lock around the freeing of the device buffer and check the buffer before using it in the submit function.
--- drivers/fsi/fsi-occ.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/fsi/fsi-occ.c +15 -3
@@ -94,6 +94,7 @@ static int occ_open(struct inode *inode, struct file *file) client->occ = occ;mutex_init (&client->lock); file->private_data = client; +get_device (occ->dev);/* We allocate a 1-page buffer, make sure it all fits */ BUILD_BUG_ON ((OCC_CMD_DATA_BYTES +3 ) >PAGE_SIZE );
@@ -197,6 +198,7 @@ static int occ_release(struct inode *inode, struct file *file) {struct occ_client *client = file->private_data; +put_device (client->occ->dev);free_page ((unsigned long )client->buffer);kfree (client);
@@ -493,12 +495,19 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,for (i =1 ; i < req_len -2 ; ++i) checksum += byte_request[i]; -mutex_lock (&occ->occ_lock); + rc =mutex_lock_interruptible (&occ->occ_lock); +if (rc) +return rc; occ->client_buffer = response; occ->client_buffer_size = user_resp_len; occ->client_response_size =0 ; +if (!occ->buffer) { + rc = -ENOENT ; + goto done; + } +/* * Get a sequence number and update the counter. Avoid a sequence * number of 0 which would pass the response check below even if the
@@ -671,10 +680,13 @@ static int occ_remove(struct platform_device *pdev) {struct occ *occ =platform_get_drvdata (pdev); -kvfree (occ->buffer); -misc_deregister (&occ->mdev); +mutex_lock (&occ->occ_lock); +kvfree (occ->buffer); + occ->buffer =NULL ; +mutex_unlock (&occ->occ_lock); +device_for_each_child (&pdev->dev,NULL , occ_unregister_child);ida_simple_remove (&occ_ida, occ->idx);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 830/862 nvmet-tcp: add bounds check on Transfer Tag
In reply to Greg Kroah-HartmanFrom: Varun Prakash <[email protected]>
[ Upstream commit b6a545ffa2c192b1e6da4a7924edac5ba9f4ea2b ]
ttag is used as an index to get cmd in nvmet_tcp_handle_h2c_data_pdu(), add a bounds check to avoid out-of-bounds access.
--- drivers/nvme/target/tcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +9 -2
@@ -935,10 +935,17 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue)struct nvme_tcp_data_pdu *data = &queue->pdu.data;struct nvmet_tcp_cmd *cmd; -if (likely (queue->nr_cmds)) +if (likely (queue->nr_cmds)) { +if (unlikely (data->ttag >= queue->nr_cmds)) { +pr_err ("queue %d: received out of bound ttag %u, nr_cmds %u\n" , + queue->idx, data->ttag, queue->nr_cmds); +nvmet_tcp_fatal_error (queue); +return -EPROTO ; + } cmd = &queue->cmds[data->ttag]; -else + }else { cmd = &queue->connect; + }if (le32_to_cpu (data->data_offset) != cmd->rbytes_done) { pr_err("ttag %u unexpected data offset %u (expected %u)\n",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 832/862 blk-mq: use quiesced elevator switch when reinitializing queues
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 8237c01f1696bc53c470493bf1fe092a107648a6 ]
The hctx's run_work may be racing with the elevator switch when reinitializing hardware queues. The queue is merely frozen in this context, but that only prevents requests from allocating and doesn't stop the hctx work from running. The work may get an elevator pointer that's being torn down, and can result in use-after-free errors and kernel panics (example below). Use the quiesced elevator switch instead, and make the previous one static since it is now only used locally.
nvme nvme0: resetting controller
nvme nvme0: 32/0/0 default/read/poll queues
BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 80000020c8861067 P4D 80000020c8861067 PUD 250f8c8067 PMD 0 Oops: 0000 [#1] SMP PTI Workqueue: kblockd blk_mq_run_work_fn RIP: 0010:kyber_has_work+0x29/0x70
...
Call Trace: __blk_mq_do_dispatch_sched+0x83/0x2b0 __blk_mq_sched_dispatch_requests+0x12e/0x170 blk_mq_sched_dispatch_requests+0x30/0x60 __blk_mq_run_hw_queue+0x2b/0x50 process_one_work+0x1ef/0x380 worker_thread+0x2d/0x3e0
--- block/blk-mq.c | 6 +++--- block/blk.h | 3 +-- block/elevator.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-)
block/blk-mq.c +3 -3
@@ -4473,14 +4473,14 @@ static bool blk_mq_elv_switch_none(struct list_head *head,list_add (&qe->node, head);/* -* After elevator_switch_mq, the previous elevator_queue will be +* After elevator_switch, the previous elevator_queue will be * released by elevator_release. The reference of the io scheduler * module get by elevator_get will also be put. So we need to get * a reference of the io scheduler module here to prevent it to be * removed. */ __module_get (qe->type->elevator_owner); -elevator_switch_mq (q,NULL ); +elevator_switch (q,NULL );mutex_unlock (&q->sysfs_lock);return true;
@@ -4512,7 +4512,7 @@ static void blk_mq_elv_switch_back(struct list_head *head,kfree (qe);mutex_lock (&q->sysfs_lock); -elevator_switch_mq (q, t); +elevator_switch (q, t);mutex_unlock (&q->sysfs_lock); }
block/blk.h +1 -2
@@ -270,8 +270,7 @@ bool blk_bio_list_merge(struct request_queue *q, struct list_head *list,void blk_insert_flush (struct request *rq); -int elevator_switch_mq (struct request_queue *q, -struct elevator_type *new_e); +int elevator_switch (struct request_queue *q,struct elevator_type *new_e);void elevator_exit (struct request_queue *q);int elv_register_queue (struct request_queue *q,bool uevent);void elv_unregister_queue (struct request_queue *q);
block/elevator.c +2 -2
@@ -588,7 +588,7 @@ void elv_unregister(struct elevator_type *e) }EXPORT_SYMBOL_GPL (elv_unregister); -int elevator_switch_mq (struct request_queue *q, +static int elevator_switch_mq (struct request_queue *q,struct elevator_type *new_e) {int ret;
@@ -723,7 +723,7 @@ void elevator_init_mq(struct request_queue *q)* need for the new one. this way we have a chance of going back to the old * one, if the new one fails init for some reason. */ -static int elevator_switch (struct request_queue *q,struct elevator_type *new_e) +int elevator_switch (struct request_queue *q,struct elevator_type *new_e) {int err;
Signature · 1 line
2.35.1
Re: [PATCH 6.0 523/862] phy: qcom-qmp-pcie: add pcs_misc sanity check
In reply to Greg Kroah-HartmanQuoted 8 lines · Greg Kroah-Hartman
From: Johan Hovold <[email protected]>
[ Upstream commit
ecd5507e72ea03659dc2cc3e4393fbf8f4e2e02a]Make sure that the (otherwise) optional
pcs_miscIO region has been provided in case the configuration specifies a corresponding initialisation table to avoid crashing with malformed device trees.
Quoted 8 lines
Note that the related debug message is now superfluous as the region is only used when the configuration has a
pcs_misctable.Fixes 421c9a0e9731 ("phy: qcom: qmp: Add SDM845 PCIe QMP PHY support")Signed-off-by Johan Hovold <[email protected]>Signed-off-by Vinod Koul <[email protected]>Signed-off-by Sasha Levin <[email protected]>
This was added to prevent future bugs when adding support for new platforms and did not have a stable tag. Please drop.
Quoted 11 lines
--- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +0
-0@@ -2371,8 +2371,10 @@ int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, of_device_is_compatible(dev->of_node, "qcom,ipq6018-qmp-pcie-phy")) qphy->pcs_misc = qphy->pcs + 0x400;
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c int qcom_qmp_phy_pcie_create(struct device *dev, struct device_node *np, int id, · line 2380
Quoted 10 lines
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +4
-2-if (!qphy->pcs_misc) -dev_vdbg (dev,"PHY pcs_misc-reg not used\n" ); +if (!qphy->pcs_misc) { +if (cfg->pcs_misc_tbl || cfg->pcs_misc_tbl_sec) +return -EINVAL ; + }snprintf (prop_name,sizeof (prop_name),"pipe%d" , id); qphy->pipe_clk =devm_get_clk_from_child (dev, np, prop_name);
Johan
Greg Kroah-Hartman
maintainerPATCH 837/862 usb: typec: ucsi: Dont warn on probe deferral
In reply to Greg Kroah-HartmanFrom: Wayne Chang <[email protected]>
[ Upstream commit fce703a991b7e8c7e1371de95b9abaa832ecf9c3 ]
Deferred probe is an expected return value for fwnode_usb_role_switch_get(). Given that the driver deals with it properly, there's no need to output a warning that may potentially confuse users.
--
V2 -> V3: remove the Fixes and Cc
V1 -> V2: adjust the coding style for better reading format.
drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
--- drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +3 -5
@@ -1067,11 +1067,9 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) cap->fwnode =ucsi_find_fwnode (con); con->usb_role_sw =fwnode_usb_role_switch_get (cap->fwnode); -if (IS_ERR (con->usb_role_sw)) { -dev_err (ucsi->dev,"con%d: failed to get usb role switch\n" , - con->num); -return PTR_ERR (con->usb_role_sw); - } +if (IS_ERR (con->usb_role_sw)) +return dev_err_probe (ucsi->dev,PTR_ERR (con->usb_role_sw), +"con%d: failed to get usb role switch\n" , con->num);/* Delay other interactions with the con until registration is complete */ mutex_lock (&con->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 839/862 perf: Skip and warn on unknown format configN attrs
In reply to Greg Kroah-HartmanFrom: Rob Herring <[email protected]>
commit e552b7be12ed62357df84392efa525ecb01910fb upstream.
If the kernel exposes a new perf_event_attr field in a format attr, perf will return an error stating the specified PMU can't be found. For example, a format attr with 'config3:0-63' causes an error as config3 is unknown to perf. This causes a compatibility issue between a newer kernel with older perf tool.
Before this change with a kernel adding 'config3' I get:
$ perf record -e arm_spe// -- true
event syntax error: 'arm_spe//'
\___ Cannot find PMU `arm_spe'. Missing kernel support?
Run 'perf list' for a list of valid events Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list
available events
After this change, I get:
$ perf record -e arm_spe// -- true WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf! [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.091 MB perf.data ]
To support unknown configN formats, rework the YACC implementation to pass any config[0-9]+ format to perf_pmu__new_format() to handle with a warning.
--- tools/perf/util/parse-events.c | 3 +++ tools/perf/util/pmu.c | 17 +++++++++++++++++ tools/perf/util/pmu.h | 2 ++ tools/perf/util/pmu.l | 2 -- tools/perf/util/pmu.y | 15 ++++----------- 5 files changed, 26 insertions(+), 13 deletions(-)
tools/perf/util/parse-events.c +3 -0
@@ -254,6 +254,9 @@ __add_event(struct list_head *list, intstruct perf_cpu_map *cpus = pmu ?perf_cpu_map__get (pmu->cpus) : cpu_list ?perf_cpu_map__new (cpu_list) :NULL ; +if (pmu) +perf_pmu__warn_invalid_formats (pmu); +if (pmu && attr->type ==PERF_TYPE_RAW )perf_pmu__warn_invalid_config (pmu, attr->config, name);
tools/perf/util/pmu.c +17 -0
@@ -1005,6 +1005,23 @@ err:return NULL ; } +void perf_pmu__warn_invalid_formats (struct perf_pmu *pmu) +{ +struct perf_pmu_format *format; + +/* fake pmu doesn't have format list */ +if (pmu == &perf_pmu__fake) +return ; + +list_for_each_entry (format, &pmu->format, list) +if (format->value >=PERF_PMU_FORMAT_VALUE_CONFIG_END ) { +pr_warning ("WARNING: '%s' format '%s' requires 'perf_event_attr::config%d'" +"which is not supported by this version of perf!\n" , + pmu->name, format->name, format->value); +return ; + } +} +static struct perf_pmu *pmu_find (const char *name) {struct perf_pmu *pmu;
tools/perf/util/pmu.h +2 -0
@@ -17,6 +17,7 @@ enum {PERF_PMU_FORMAT_VALUE_CONFIG ,PERF_PMU_FORMAT_VALUE_CONFIG1 ,PERF_PMU_FORMAT_VALUE_CONFIG2 , + PERF_PMU_FORMAT_VALUE_CONFIG_END, };#define PERF_PMU_FORMAT_BITS 64
@@ -139,6 +140,7 @@ int perf_pmu__caps_parse(struct perf_pmuvoid perf_pmu__warn_invalid_config (struct perf_pmu *pmu,__u64 config,const char *name); +void perf_pmu__warn_invalid_formats (struct perf_pmu *pmu);bool perf_pmu__has_hybrid (void );int perf_pmu__match (char *pattern,char *name,char *tok);
tools/perf/util/pmu.l +0 -2
@@ -27,8 +27,6 @@ num_dec [0-9]+ {num_dec} { return value(10); } config { return PP_CONFIG; } -config1 { return PP_CONFIG1; } -config2 { return PP_CONFIG2; } - { return '-'; } : { return ':'; } , { return ','; }
tools/perf/util/pmu.y +4 -11
@@ -20,7 +20,7 @@ do { \ %} -%token PP_CONFIG PP_CONFIG1 PP_CONFIG2 +%token PP_CONFIG %token PP_VALUE PP_ERROR %type <num> PP_VALUE %type <bits> bit_term
@@ -47,18 +47,11 @@ PP_CONFIG ':' bits $3)); } | -PP_CONFIG1 ':' bits +PP_CONFIG PP_VALUE ':' bits { ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG1, - $3)); -} -| -PP_CONFIG2 ':' bits -{ - ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG2, - $3)); + $2, + $4)); } bits:
Greg Kroah-Hartman
maintainerPATCH 789/862 ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack()
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 5854e4d8530e6ed4c2532a71a6b0474e199d44dd ]
When using the frame pointer unwinder, it was found that the stack trace output of stack_trace_save() is incomplete if the stack contains call_with_stack():
[0x7f00002c] dump_stack_task+0x2c/0x90 [hrtimer]
[0x7f0000a0] hrtimer_hander+0x10/0x18 [hrtimer]
[0x801a67f0] __hrtimer_run_queues+0x1b0/0x3b4
[0x801a7350] hrtimer_run_queues+0xc4/0xd8
[0x801a597c] update_process_times+0x3c/0x88
[0x801b5a98] tick_periodic+0x50/0xd8
[0x801b5bf4] tick_handle_periodic+0x24/0x84
[0x8010ffc4] twd_handler+0x38/0x48
[0x8017d220] handle_percpu_devid_irq+0xa8/0x244
[0x80176e9c] generic_handle_domain_irq+0x2c/0x3c
[0x8052e3a8] gic_handle_irq+0x7c/0x90
[0x808ab15c] generic_handle_arch_irq+0x60/0x80
[0x8051191c] call_with_stack+0x1c/0x20
For the frame pointer unwinder, unwind_frame() checks stackframe::fp by stackframe::sp. Since call_with_stack() switches the SP from one stack to another, stackframe::fp and stackframe: :sp will point to different stacks, so we can no longer check stackframe::fp by stackframe::sp. Skip checking stackframe::fp at this point to avoid this problem.
--- arch/arm/kernel/stacktrace.c | 40 ++++++++++++++++++++++++++++------ arch/arm/lib/call_with_stack.S | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-)
arch/arm/kernel/stacktrace.c +33 -7
@@ -9,6 +9,8 @@#include <asm/stacktrace.h> #include <asm/traps.h> +#include "reboot.h" +#if defined(CONFIG_FRAME_POINTER ) && !defined(CONFIG_ARM_UNWIND )/* * Unwind the current stack frame and store the new register values in the
@@ -39,29 +41,53 @@* Note that with framepointer enabled, even the leaf functions have the same * prologue and epilogue, therefore we can ignore the LR value in this case. */ -int notrace unwind_frame(struct stackframe *frame) + +extern unsigned long call_with_stack_end; + +static int frame_pointer_check (struct stackframe *frame) {unsigned long high, low;unsigned long fp = frame->fp; +unsigned long pc = frame->pc; + +/* +* call_with_stack() is the only place we allow SP to jump from one +* stack to another, with FP and SP pointing to different stacks, +* skipping the FP boundary check at this point. +*/ +if (pc >= (unsigned long )&call_with_stack && + pc < (unsigned long )&call_with_stack_end) +return 0 ;/* only go to a higher address on the stack */ low = frame->sp; high =ALIGN (low,THREAD_SIZE ); -#ifdef CONFIG_CC_IS_CLANG /* check current frame pointer is within bounds */ +#ifdef CONFIG_CC_IS_CLANG if (fp < low +4 || fp > high -4 )return -EINVAL ; - - frame->sp = frame->fp; - frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp)); - frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp +4 ));#else -/* check current frame pointer is within bounds */ if (fp < low +12 || fp > high -4 )return -EINVAL ; +#endif + +return 0 ; +} + +int notrace unwind_frame(struct stackframe *frame) +{ +unsigned long fp = frame->fp; + +if (frame_pointer_check (frame)) +return -EINVAL ;/* restore the registers from the stack frame */ +#ifdef CONFIG_CC_IS_CLANG + frame->sp = frame->fp; + frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp)); + frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp +4 )); +#else frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp -12 )); frame->sp =READ_ONCE_NOCHECK (*(unsigned long *)(fp -8 )); frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp -4 ));
arch/arm/lib/call_with_stack.S +2 -0
@@ -46,4 +46,6 @@ UNWIND( .setfp fpreg, sp ) pop {fpreg, pc} UNWIND( .fnend ) #endif + .globl call_with_stack_end +call_with_stack_end: ENDPROC(call_with_stack)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 848/862 mm: hugetlb: fix UAF in hugetlb_handle_userfault
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
commit 958f32ce832ba781ac20e11bb2d12a9352ea28fc upstream.
The vma_lock and hugetlb_fault_mutex are dropped before handling userfault and reacquire them again after handle_userfault(), but reacquire the vma_lock could lead to UAF[1,2] due to the following race,
hugetlb_fault
hugetlb_no_page
/*unlock vma_lock */
hugetlb_handle_userfault
handle_userfault
/* unlock mm->mmap_lock*/
vm_mmap_pgoff
do_mmap
mmap_region
munmap_vma_range
/* clean old vma */
/* lock vma_lock again <--- UAF */
/* unlock vma_lock */Since the vma_lock will unlock immediately after hugetlb_handle_userfault(), let's drop the unneeded lock and unlock in hugetlb_handle_userfault() to fix the issue.
[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
--- mm/hugetlb.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
mm/hugetlb.c +17 -20
@@ -5482,7 +5482,6 @@ static inline vm_fault_t hugetlb_handle_ unsigned long addr, unsigned long reason) { -vm_fault_t ret;u32 hash;struct vm_fault vmf = { .vma = vma,
@@ -5500,18 +5499,14 @@ static inline vm_fault_t hugetlb_handle_ };/* -* hugetlb_fault_mutex and i_mmap_rwsem must be -* dropped before handling userfault. Reacquire -* after handling fault to make calling code simpler. +* vma_lock and hugetlb_fault_mutex must be dropped before handling +* userfault. Also mmap_lock will be dropped during handling +* userfault, any vma operation should be careful from here. */ hash =hugetlb_fault_mutex_hash (mapping, idx);mutex_unlock (&hugetlb_fault_mutex_table[hash]);i_mmap_unlock_read (mapping); - ret =handle_userfault (&vmf, reason); -i_mmap_lock_read (mapping); -mutex_lock (&hugetlb_fault_mutex_table[hash]); - -return ret; +return handle_userfault (&vmf, reason); } static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
@@ -5529,6 +5524,7 @@ static vm_fault_t hugetlb_no_page(structspinlock_t *ptl;unsigned long haddr = address &huge_page_mask (h);bool new_page, new_pagecache_page = false; +u32 hash =hugetlb_fault_mutex_hash (mapping, idx);/* * Currently, we are forced to kill the process in the event the
@@ -5539,7 +5535,7 @@ static vm_fault_t hugetlb_no_page(structif (is_vma_resv_set (vma,HPAGE_RESV_UNMAPPED )) {pr_warn_ratelimited ("PID %d killed due to inadequate hugepage pool\n" , current->pid); -return ret; + goto out; }/*
@@ -5556,12 +5552,10 @@ retry: page =find_lock_page (mapping, idx);if (!page) {/* Check for page in userfault range */ -if (userfaultfd_missing (vma)) { - ret =hugetlb_handle_userfault (vma, mapping, idx, +if (userfaultfd_missing (vma)) +return hugetlb_handle_userfault (vma, mapping, idx, flags, haddr, address,VM_UFFD_MISSING ); - goto out; - } page =alloc_huge_page (vma, haddr,0 );if (IS_ERR (page)) {
@@ -5621,10 +5615,9 @@ retry:if (userfaultfd_minor (vma)) {unlock_page (page);put_page (page); - ret =hugetlb_handle_userfault (vma, mapping, idx, +return hugetlb_handle_userfault (vma, mapping, idx, flags, haddr, address,VM_UFFD_MINOR ); - goto out; } }
@@ -5682,6 +5675,8 @@ retry:unlock_page (page); out: +mutex_unlock (&hugetlb_fault_mutex_table[hash]); +i_mmap_unlock_read (mapping);return ret; backout:
@@ -5780,11 +5775,13 @@ vm_fault_t hugetlb_fault(struct mm_struc entry =huge_ptep_get (ptep);/* PTE markers should be handled the same way as none pte */ -if (huge_pte_none_mostly (entry)) { - ret =hugetlb_no_page (mm, vma, mapping, idx, address, ptep, +if (huge_pte_none_mostly (entry)) +/* +* hugetlb_no_page will drop vma lock and hugetlb fault +* mutex internally, which make us return immediately. +*/ +return hugetlb_no_page (mm, vma, mapping, idx, address, ptep, entry, flags); - goto out_mutex; - } ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 862/862 lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 0a6de78cff600cb991f2a1b7ed376935871796a0 upstream.
When building with a RISC-V kernel with DWARF5 debug info using clang and the GNU assembler, several instances of the following error appear:
/tmp/vgettimeofday-48aa35.s:2963: Error: non-constant .uleb128 is not supported
Dumping the .s file reveals these .uleb128 directives come from .debug_loc and .debug_ranges:
.Ldebug_loc0:
.byte 4 # DW_LLE_offset_pair
.uleb128 .Lfunc_begin0-.Lfunc_begin0 # starting offset
.uleb128 .Ltmp1-.Lfunc_begin0 # ending offset
.byte 1 # Loc expr size
.byte 90 # DW_OP_reg10
.byte 0 # DW_LLE_end_of_list.Ldebug_ranges0:
.byte 4 # DW_RLE_offset_pair
.uleb128 .Ltmp6-.Lfunc_begin0 # starting offset
.uleb128 .Ltmp27-.Lfunc_begin0 # ending offset
.byte 4 # DW_RLE_offset_pair
.uleb128 .Ltmp28-.Lfunc_begin0 # starting offset
.uleb128 .Ltmp30-.Lfunc_begin0 # ending offset
.byte 0 # DW_RLE_end_of_listThere is an outstanding binutils issue to support a non-constant operand to .sleb128 and .uleb128 in GAS for RISC-V but there does not appear to be any movement on it, due to concerns over how it would work with linker relaxation.
To avoid these build errors, prevent DWARF5 from being selected when using clang and an assembler that does not have support for these symbol deltas, which can be easily checked in Kconfig with as-instr plus the small test program from the dwz test suite from the binutils issue.
--- lib/Kconfig.debug | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
lib/Kconfig.debug +7 -2
@@ -231,6 +231,11 @@ config DEBUG_INFO in the "Debug information" choice below, indicating that debug information will be generated for build targets. +# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which +# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 +config AS_HAS_NON_CONST_LEB128 + def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) + choice prompt "Debug information" depends on DEBUG_KERNEL
@@ -253,7 +258,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help The implicit default version of DWARF debug info produced by a toolchain changes over time.
@@ -277,7 +282,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
Greg Kroah-Hartman
maintainerPATCH 815/862 HID: nintendo: check analog user calibration for plausibility
In reply to Greg Kroah-HartmanFrom: Johnothan King <[email protected]>
[ Upstream commit 50503e360eeb968a3d00234c9cc4057d774c3e9a ]
Arne Wendt writes:
Cheap clone controllers may (falsely) report as having a user calibration for the analog sticks in place, but return wrong/impossible values for the actual calibration data. In the present case at mine, the controller reports having a user calibration in place and successfully executes the read commands. The reported user calibration however is min = center = max = 0.
This pull request addresses problems of this kind by checking the provided user calibration-data for plausibility (min < center < max) and falling back to the default values if implausible.
I'll note that I was experiencing a crash because of this bug when using the GuliKit KingKong 2 controller. The crash manifests as a divide by zero error in the kernel logs:
kernel: divide error: 0000 [#1] PREEMPT SMP NOPTI
--- drivers/hid/hid-nintendo.c | 55 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-)
drivers/hid/hid-nintendo.c +30 -25
@@ -760,12 +760,31 @@ static int joycon_read_stick_calibration(struct joycon_ctlr *ctlr, u16 cal_addr, cal_y->max = cal_y->center + y_max_above; cal_y->min = cal_y->center - y_min_below; -return 0 ; +/* check if calibration values are plausible */ +if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max || + cal_y->min >= cal_y->center || cal_y->center >= cal_y->max) + ret = -EINVAL ; + +return ret; }static const u16 DFLT_STICK_CAL_CEN =2000 ;static const u16 DFLT_STICK_CAL_MAX =3500 ;static const u16 DFLT_STICK_CAL_MIN =500 ; +static void joycon_use_default_calibration (struct hid_device *hdev, +struct joycon_stick_cal *cal_x, +struct joycon_stick_cal *cal_y, +const char *stick,int ret) +{ +hid_warn (hdev, +"Failed to read %s stick cal, using defaults; e=%d\n" , + stick, ret); + + cal_x->center = cal_y->center =DFLT_STICK_CAL_CEN ; + cal_x->max = cal_y->max =DFLT_STICK_CAL_MAX ; + cal_x->min = cal_y->min =DFLT_STICK_CAL_MIN ; +} +static int joycon_request_calibration (struct joycon_ctlr *ctlr) {u16 left_stick_addr =JC_CAL_FCT_DATA_LEFT_ADDR ;
@@ -793,38 +812,24 @@ static int joycon_request_calibration(struct joycon_ctlr *ctlr) &ctlr->left_stick_cal_x, &ctlr->left_stick_cal_y, true); -if (ret) { -hid_warn (ctlr->hdev, -"Failed to read left stick cal, using dflts; e=%d\n" , - ret); - - ctlr->left_stick_cal_x.center =DFLT_STICK_CAL_CEN ; - ctlr->left_stick_cal_x.max =DFLT_STICK_CAL_MAX ; - ctlr->left_stick_cal_x.min =DFLT_STICK_CAL_MIN ; - ctlr->left_stick_cal_y.center =DFLT_STICK_CAL_CEN ; - ctlr->left_stick_cal_y.max =DFLT_STICK_CAL_MAX ; - ctlr->left_stick_cal_y.min =DFLT_STICK_CAL_MIN ; - } +if (ret) +joycon_use_default_calibration (ctlr->hdev, + &ctlr->left_stick_cal_x, + &ctlr->left_stick_cal_y, +"left" , ret);/* read the right stick calibration data */ ret =joycon_read_stick_calibration (ctlr, right_stick_addr, &ctlr->right_stick_cal_x, &ctlr->right_stick_cal_y, false); -if (ret) { -hid_warn (ctlr->hdev, -"Failed to read right stick cal, using dflts; e=%d\n" , - ret); - - ctlr->right_stick_cal_x.center =DFLT_STICK_CAL_CEN ; - ctlr->right_stick_cal_x.max =DFLT_STICK_CAL_MAX ; - ctlr->right_stick_cal_x.min =DFLT_STICK_CAL_MIN ; - ctlr->right_stick_cal_y.center =DFLT_STICK_CAL_CEN ; - ctlr->right_stick_cal_y.max =DFLT_STICK_CAL_MAX ; - ctlr->right_stick_cal_y.min =DFLT_STICK_CAL_MIN ; - } +if (ret) +joycon_use_default_calibration (ctlr->hdev, + &ctlr->right_stick_cal_x, + &ctlr->right_stick_cal_y, +"right" , ret);hid_dbg (ctlr->hdev,"calibration:\n" "l_x_c=%d l_x_max=%d l_x_min=%d\n"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 823/862 io_uring: fix CQE reordering
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit aa1df3a360a0c50e0f0086a785d75c2785c29967 ]
Overflowing CQEs may result in reordering, which is buggy in case of links, F_MORE and so on. If we guarantee that we don't reorder for the unlikely event of a CQ ring overflow, then we can further extend this to not have to terminate multishot requests if it happens. For other operations, like zerocopy sends, we have no choice but to honor CQE ordering.
--- io_uring/io_uring.c | 12 ++++++++++-- io_uring/io_uring.h | 12 +++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-)
io_uring/io_uring.c +10 -2
@@ -567,7 +567,7 @@ static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force)io_cq_lock (ctx);while (!list_empty (&ctx->cq_overflow_list)) { -struct io_uring_cqe *cqe =io_get_cqe (ctx); +struct io_uring_cqe *cqe =io_get_cqe_overflow (ctx, true);struct io_overflow_cqe *ocqe;if (!cqe && !force)
@@ -694,12 +694,19 @@ bool io_req_cqe_overflow(struct io_kiocb *req)* control dependency is enough as we're using WRITE_ONCE to * fill the cq entry */ -struct io_uring_cqe *__io_get_cqe (struct io_ring_ctx *ctx) +struct io_uring_cqe *__io_get_cqe (struct io_ring_ctx *ctx,bool overflow) {struct io_rings *rings = ctx->rings;unsigned int off = ctx->cached_cq_tail & (ctx->cq_entries -1 );unsigned int free, queued, len; +/* +* Posting into the CQ when there are pending overflowed CQEs may break +* ordering guarantees, which will affect links, F_MORE users and more. +* Force overflow the completion. +*/ +if (!overflow && (ctx->check_cq &BIT (IO_CHECK_CQ_OVERFLOW_BIT ))) +return NULL ;/* userspace may cheat modifying the tail, be safe and do min */ queued =min (__io_cqring_events (ctx), ctx->cq_entries);
@@ -2232,6 +2239,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, do { io_cqring_overflow_flush(ctx); + if (io_cqring_events(ctx) >= min_events) return 0; if (!io_run_task_work())
io_uring/io_uring.h +9 -3
@@ -24,7 +24,7 @@ enum { IOU_STOP_MULTISHOT = -ECANCELED, }; -struct io_uring_cqe *__io_get_cqe (struct io_ring_ctx *ctx); +struct io_uring_cqe *__io_get_cqe (struct io_ring_ctx *ctx,bool overflow);bool io_req_cqe_overflow (struct io_kiocb *req);int io_run_task_work_sig (void );void io_req_complete_failed (struct io_kiocb *req,s32 res);
@@ -91,7 +91,8 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx)void io_cq_unlock_post (struct io_ring_ctx *ctx); -static inline struct io_uring_cqe *io_get_cqe (struct io_ring_ctx *ctx) +static inline struct io_uring_cqe *io_get_cqe_overflow (struct io_ring_ctx *ctx, +bool overflow) {if (likely (ctx->cqe_cached < ctx->cqe_sentinel)) {struct io_uring_cqe *cqe = ctx->cqe_cached;
@@ -103,7 +104,12 @@ static inline struct io_uring_cqe *io_get_cqe(struct io_ring_ctx *ctx)return cqe; } -return __io_get_cqe (ctx); +return __io_get_cqe (ctx, overflow); +} + +static inline struct io_uring_cqe *io_get_cqe (struct io_ring_ctx *ctx) +{ +return io_get_cqe_overflow (ctx, false); } static inline bool __io_fill_cqe_req(struct io_ring_ctx *ctx,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 861/862 Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit bb1435f3f575b5213eaf27434efa3971f51c01de upstream.
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT does not give explicit -gdwarf-* flag. The actual DWARF version is up to the toolchain.
The combination of GCC and GAS works fine, and Clang with the integrated assembler is good too.
The combination of Clang and GAS is tricky, but at least, the -g flag works for Clang <=13, which defaults to DWARF v4.
Clang 14 switched its default to DWARF v5.
Now, CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT has the same issue as addressed by commit 98cd6f521f10 ("Kconfig: allow explicit opt in to DWARF v5").
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y for Clang >= 14 and GAS < 2.35 produces a ton of errors like follows:
/tmp/main-c2741c.s: Assembler messages:
/tmp/main-c2741c.s:109: Error: junk at end of line, first unrecognized character is `"' /tmp/main-c2741c.s:109: Error: file number less than one
Add 'depends on' to check toolchains.
--- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
lib/Kconfig.debug +1 -0
@@ -253,6 +253,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) help The implicit default version of DWARF debug info produced by a toolchain changes over time.
Greg Kroah-Hartman
maintainerPATCH 858/862 io_uring: fix fdinfo sqe offsets calculation
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit 00927931cb630bbf8edb6d7f4dadb25139fc5e16 upstream.
Only with the big sqe feature they take 128 bytes per entry, but we unconditionally advance by 128B. Fix it by using sq_shift.
--- io_uring/fdinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/fdinfo.c +1 -1
@@ -95,7 +95,7 @@ static __cold void __io_uring_show_fdinf sq_idx =READ_ONCE (ctx->sq_array[entry & sq_mask]);if (sq_idx > sq_mask)continue ; - sqe = &ctx->sq_sqes[sq_idx <<1 ]; + sqe = &ctx->sq_sqes[sq_idx << sq_shift]; seq_printf(m, "%5u: opcode:%s, fd:%d, flags:%x, off:%llu, " "addr:0x%llx, rw_flags:0x%x, buf_index:%d " "user_data:%llu",
Greg Kroah-Hartman
maintainerPATCH 856/862 powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
commit a4cb3651a174366cc85a677da9e3681fbe97fdae upstream.
It's possible for an interrupt returning to an irqs-disabled context to lose a pending soft-masked irq because it branches to part of the exit code for irqs-enabled contexts, which is meant to clear only the PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This just looks like a simple thinko from a recent commit (if there was no hard mask pending, there would be no reason to clear it anyway).
This also adds comment to the code that actually does need to clear the flag.
--- arch/powerpc/kernel/interrupt_64.S | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/kernel/interrupt_64.S +13 -2
@@ -571,7 +571,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled lbz r11,PACAIRQHAPPENED(r13) andi. r10,r11,PACA_IRQ_MUST_HARD_MASK - beq 1f // No HARD_MASK pending + beq .Lfast_kernel_interrupt_return_\srr\() // No HARD_MASK pending /* Must clear MSR_EE from _MSR */ #ifdef CONFIG_PPC_BOOK3S
@@ -588,12 +588,23 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s b .Lfast_kernel_interrupt_return_\srr\() .Linterrupt_return_\srr\()_soft_enabled: + /* + * In the soft-enabled case, need to double-check that we have no + * pending interrupts that might have come in before we reached the + * restart section of code, and restart the exit so those can be + * handled. + * + * If there are none, it is be possible that the interrupt still + * has PACA_IRQ_HARD_DIS set, which needs to be cleared for the + * interrupted context. This clear will not clobber a new pending + * interrupt coming in, because we're in the restart section, so + * such would return to the restart location. + */ #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif -1: li r11,0 stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS
Greg Kroah-Hartman
maintainerPATCH 854/862 Revert "net/ieee802154: reject zero-sized raw_sendmsg()"
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 2eb2756f6c9e9621e022d78321ce40a62c4520b5 ]
This reverts commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5.
There is a v2 which does return zero if zero length is given.
--- net/ieee802154/socket.c | 3 --- 1 file changed, 3 deletions(-)
net/ieee802154/socket.c +0 -3
@@ -251,9 +251,6 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)return -EOPNOTSUPP ; } -if (!size) -return -EINVAL ; -lock_sock (sk);if (!sk->sk_bound_dev_if) dev =dev_getfirstbyhwtype (sock_net (sk),ARPHRD_IEEE802154 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 673/862 thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash
In reply to Greg Kroah-HartmanFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit 68b99e94a4a2db6ba9b31fe0485e057b9354a640 ]
When CPU 0 is offline and intel_powerclamp is used to inject idle, it generates kernel BUG:
BUG: using smp_processor_id() in preemptible [00000000] code: bash/15687 caller is debug_smp_processor_id+0x17/0x20 CPU: 4 PID: 15687 Comm: bash Not tainted 5.19.0-rc7+ #57 Call Trace: <TASK> dump_stack_lvl+0x49/0x63 dump_stack+0x10/0x16 check_preemption_disabled+0xdd/0xe0 debug_smp_processor_id+0x17/0x20 powerclamp_set_cur_state+0x7f/0xf9 [intel_powerclamp]
...
...
Here CPU 0 is the control CPU by default and changed to the current CPU, if CPU 0 offlined. This check has to be performed under cpus_read_lock(), hence the above warning.
Use get_cpu() instead of smp_processor_id() to avoid this BUG.
--- drivers/thermal/intel/intel_powerclamp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +4 -2
@@ -532,8 +532,10 @@ static int start_power_clamp(void)/* prefer BSP */ control_cpu =0 ; -if (!cpu_online (control_cpu)) - control_cpu =smp_processor_id (); +if (!cpu_online (control_cpu)) { + control_cpu =get_cpu (); +put_cpu (); + } clamping = true;schedule_delayed_work (&poll_pkg_cstate_work,0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 237/862 bpf: Fix reference state management for synchronous callbacks
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 9d9d00ac29d0ef7ce426964de46fa6b380357d0a ]
Currently, verifier verifies callback functions (sync and async) as if they will be executed once, (i.e. it explores execution state as if the function was being called once). The next insn to explore is set to start of subprog and the exit from nested frame is handled using curframe > 0 and prepare_func_exit. In case of async callback it uses a customized variant of push_stack simulating a kind of branch to set up custom state and execution context for the async callback.
While this approach is simple and works when callback really will be executed only once, it is unsafe for all of our current helpers which are for_each style, i.e. they execute the callback multiple times.
A callback releasing acquired references of the caller may do so multiple times, but currently verifier sees it as one call inside the frame, which then returns to caller. Hence, it thinks it released some reference that the cb e.g. got access through callback_ctx (register filled inside cb from spilled typed register on stack).
Similarly, it may see that an acquire call is unpaired inside the callback, so the caller will copy the reference state of callback and then will have to release the register with new ref_obj_ids. But again, the callback may execute multiple times, but the verifier will only account for acquired references for a single symbolic execution of the callback, which will cause leaks.
Note that for async callback case, things are different. While currently we have bpf_timer_set_callback which only executes it once, even for multiple executions it would be safe, as reference state is NULL and check_reference_leak would force program to release state before BPF_EXIT. The state is also unaffected by analysis for the caller frame. Hence async callback is safe.
Since we want the reference state to be accessible, e.g. for pointers loaded from stack through callback_ctx's PTR_TO_STACK, we still have to copy caller's reference_state to callback's bpf_func_state, but we enforce that whatever references it adds to that reference_state has been released before it hits BPF_EXIT. This requires introducing a new callback_ref member in the reference state to distinguish between caller vs callee references. Hence, check_reference_leak now errors out if it sees we are in callback_fn and we have not released callback_ref refs. Since there can be multiple nested callbacks, like frame 0 -> cb1 -> cb2 etc. we need to also distinguish between whether this particular ref belongs to this callback frame or parent, and only error for our own, so we store state->frameno (which is always non-zero for callbacks).
In short, callbacks can read parent reference_state, but cannot mutate it, to be able to use pointers acquired by the caller. They must only undo their changes (by releasing their own acquired_refs before BPF_EXIT) on top of caller reference_state before returning (at which point the caller and callback state will match anyway, so no need to copy it back to caller).
--- include/linux/bpf_verifier.h | 11 ++++++++++ kernel/bpf/verifier.c | 42 ++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 9 deletions(-)
include/linux/bpf_verifier.h +11 -0
@@ -212,6 +212,17 @@ struct bpf_reference_state {* is used purely to inform the user of a reference leak. */ int insn_idx; +/* There can be a case like: +* main (frame 0) +* cb (frame 1) +* func (frame 3) +* cb (frame 4) +* Hence for frame 4, if callback_ref just stored boolean, it would be +* impossible to distinguish nested callback refs. Hence store the +* frameno and compare that to callback_ref in check_reference_leak when +* exiting a callback function. +*/ +int callback_ref; };/* state of the program:
kernel/bpf/verifier.c +33 -9
84 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 828/862 nvme: handle effects after freeing the request
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit bc8fb906b0ff9339b4286698cb7cd9cd5b8c53eb ]
If a reset occurs after the scan work attempts to issue a command, the reset may quisce the admin queue, which blocks the scan work's command from dispatching. The scan work will not be able to complete while the queue is quiesced.
Meanwhile, the reset work will cancel all outstanding admin tags and wait until all requests have transitioned to idle, which includes the passthrough request. But the passthrough request won't be set to idle until after the scan_work flushes, so we're deadlocked.
Fix this by handling the end effects after the request has been freed.
--- drivers/nvme/host/core.c | 17 ++++++----------- drivers/nvme/host/ioctl.c | 9 ++++++++- drivers/nvme/host/nvme.h | 4 +++- drivers/nvme/target/passthru.c | 7 ++++++- 4 files changed, 23 insertions(+), 14 deletions(-)
drivers/nvme/host/core.c +6 -11
@@ -1111,8 +1111,8 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,return effects; } -static void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, -struct nvme_command *cmd,int status) +void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +struct nvme_command *cmd,int status) {if (effects &NVME_CMD_EFFECTS_CSE_MASK ) {nvme_unfreeze (ctrl);
@@ -1148,21 +1148,16 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,break ; } } +EXPORT_SYMBOL_NS_GPL (nvme_passthru_end,NVME_TARGET_PASSTHRU ); -int nvme_execute_passthru_rq (struct request *rq) +int nvme_execute_passthru_rq (struct request *rq,u32 *effects) {struct nvme_command *cmd =nvme_req (rq)->cmd;struct nvme_ctrl *ctrl =nvme_req (rq)->ctrl;struct nvme_ns *ns = rq->q->queuedata; -u32 effects; -int ret; - effects =nvme_passthru_start (ctrl, ns, cmd->common.opcode); - ret =nvme_execute_rq (rq, false); -if (effects)/* nothing to be done for zero cmd effects */ -nvme_passthru_end (ctrl, effects, cmd, ret); - -return ret; + *effects =nvme_passthru_start (ctrl, ns, cmd->common.opcode); +return nvme_execute_rq (rq, false); }EXPORT_SYMBOL_NS_GPL (nvme_execute_passthru_rq,NVME_TARGET_PASSTHRU );
drivers/nvme/host/ioctl.c +8 -1
@@ -136,9 +136,11 @@ static int nvme_submit_user_cmd(struct request_queue *q, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { + struct nvme_ctrl *ctrl;struct request *req;void *meta =NULL ;struct bio *bio; +u32 effects;int ret; req = nvme_alloc_user_request(q, cmd, ubuffer, bufflen, meta_buffer,
@@ -147,8 +149,9 @@ static int nvme_submit_user_cmd(struct request_queue *q,return PTR_ERR (req); bio = req->bio; + ctrl =nvme_req (req)->ctrl; - ret =nvme_execute_passthru_rq (req); + ret =nvme_execute_passthru_rq (req, &effects);if (result) *result =le64_to_cpu (nvme_req (req)->result.u64);
@@ -158,6 +161,10 @@ static int nvme_submit_user_cmd(struct request_queue *q,if (bio)blk_rq_unmap_user (bio);blk_mq_free_request (req); + +if (effects) +nvme_passthru_end (ctrl, effects, cmd, ret); +return ret; }
drivers/nvme/host/nvme.h +3 -1
@@ -1023,7 +1023,9 @@ static inline void nvme_auth_free(struct nvme_ctrl *ctrl) {};u32 nvme_command_effects (struct nvme_ctrl *ctrl,struct nvme_ns *ns,u8 opcode); -int nvme_execute_passthru_rq (struct request *rq); +int nvme_execute_passthru_rq (struct request *rq,u32 *effects); +void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +struct nvme_command *cmd,int status);struct nvme_ctrl *nvme_ctrl_from_file (struct file *file);struct nvme_ns *nvme_find_get_ns (struct nvme_ctrl *ctrl,unsigned nsid);void nvme_put_ns (struct nvme_ns *ns);
drivers/nvme/target/passthru.c +6 -1
@@ -215,9 +215,11 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, p.work);struct request *rq = req->p.rq; +struct nvme_ctrl *ctrl =nvme_req (rq)->ctrl; +u32 effects;int status; - status =nvme_execute_passthru_rq (rq); + status =nvme_execute_passthru_rq (rq, &effects);if (status ==NVME_SC_SUCCESS && req->cmd->common.opcode == nvme_admin_identify) {
@@ -238,6 +240,9 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) req->cqe->result =nvme_req (rq)->result;nvmet_req_complete (req, status);blk_mq_free_request (rq); + +if (effects) +nvme_passthru_end (ctrl, effects, req->cmd, status); } static void nvmet_passthru_req_done(struct request *rq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 629/862 hwrng: imx-rngc - use devm_clk_get_enabled
In reply to Greg Kroah-HartmanFrom: Martin Kaiser <[email protected]>
[ Upstream commit 6a2bc448423cea44e7dba0f72d7c82ae04ab201e ]
Use the new devm_clk_get_enabled function to get our clock.
We don't have to disable and unprepare the clock ourselves any more in error paths and in the remove function.
Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()")
--- drivers/char/hw_random/imx-rngc.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/char/hw_random/imx-rngc.c +6 -19
@@ -245,7 +245,7 @@ static int imx_rngc_probe(struct platform_device *pdev)if (IS_ERR (rngc->base))return PTR_ERR (rngc->base); - rngc->clk =devm_clk_get (&pdev->dev,NULL ); + rngc->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (rngc->clk)) {dev_err (&pdev->dev,"Can not get rng_clk\n" );return PTR_ERR (rngc->clk);
@@ -255,26 +255,20 @@ static int imx_rngc_probe(struct platform_device *pdev)if (irq <0 )return irq; - ret =clk_prepare_enable (rngc->clk); -if (ret) -return ret; - ver_id =readl (rngc->base +RNGC_VER_ID ); rng_type = ver_id >>RNGC_TYPE_SHIFT ;/* * This driver supports only RNGC and RNGB. (There's a different * driver for RNGA.) */ -if (rng_type !=RNGC_TYPE_RNGC && rng_type !=RNGC_TYPE_RNGB ) { - ret = -ENODEV ; - goto err; - } +if (rng_type !=RNGC_TYPE_RNGC && rng_type !=RNGC_TYPE_RNGB ) +return -ENODEV ; ret =devm_request_irq (&pdev->dev, irq, imx_rngc_irq,0 , pdev->name, (void *)rngc);if (ret) {dev_err (rngc->dev,"Can't get interrupt working.\n" ); - goto err; +return ret; }init_completion (&rngc->rng_op_done);
@@ -294,14 +288,14 @@ static int imx_rngc_probe(struct platform_device *pdev) ret =imx_rngc_self_test (rngc);if (ret) {dev_err (rngc->dev,"self test failed\n" ); - goto err; +return ret; } } ret =hwrng_register (&rngc->rng);if (ret) {dev_err (&pdev->dev,"hwrng registration failed\n" ); - goto err; +return ret; } dev_info(&pdev->dev,
@@ -309,11 +303,6 @@ static int imx_rngc_probe(struct platform_device *pdev) rng_type ==RNGC_TYPE_RNGB ?'B' :'C' , (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff);return 0 ; - -err: -clk_disable_unprepare (rngc->clk); - -return ret; } static int __exit imx_rngc_remove(struct platform_device *pdev)
@@ -322,8 +311,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev)hwrng_unregister (&rngc->rng); -clk_disable_unprepare (rngc->clk); -return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 609/862 powerpc/sysdev/fsl_msi: Add missing of_node_put()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit def435c04ee984a5f9ed2711b2bfe946936c6a21 ]
In fsl_setup_msi_irqs(), use of_node_put() to drop the reference returned by of_parse_phandle().
--- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/sysdev/fsl_msi.c +2 -0
@@ -209,8 +209,10 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)dev_err (&pdev->dev,"node %pOF has an invalid fsl,msi phandle %u\n" , hose->dn, np->phandle); +of_node_put (np);return -EINVAL ; } +of_node_put (np); }msi_for_each_desc (entry, &pdev->dev,MSI_DESC_NOTASSOCIATED ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 780/862 arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO voltage
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
[ Upstream commit eef2c0217e02b6c7ed5b10b82ea944127145e113 ]
It turns out that it is not necessary to declare the VSELECT signal as GPIO and let the PMIC driver set it to a fixed high level. This switches the voltage between 3.3V and 1.8V by setting the PMIC register for LDO5 accordingly.
Instead we can do it like other boards already do and simply mux the VSELECT signal of the USDHC interface to the pin. This makes sure that the correct voltage is selected by setting the PMIC's SD_VSEL input to high or low accordingly.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts | 3 +++ arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts +3 -0
@@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; };
@@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; };
@@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; };
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi +0 -2
@@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 {
@@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 838/862 clk: bcm2835: Round UART input clock up
In reply to Greg Kroah-HartmanFrom: Ivan T. Ivanov <[email protected]>
[ Upstream commit f690a4d7a8f66430662975511c86819dc9965bcc ]
It was reported that RPi3[1] and RPi Zero 2W boards have issues with the Bluetooth. It turns out that when switching from initial to operation speed host and device no longer can talk each other because host uses incorrect UART baud rate.
The UART driver used in this case is amba-pl011. Original fix, see below Github link[2], was inside pl011 module, but somehow it didn't look as the right place to fix. Beside that this original rounding function is not exactly perfect for all possible clock values. So I deiced to move the hack to the platform which actually need it.
The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a clock manager that returns the actual frequencies, an expected 48MHz clock is reported as 47999625. If the requested baud rate == requested clock/16, there is no headroom and the slight reduction in actual clock rate results in failure.
If increasing a clock by less than 0.1% changes it from ..999.. to ..000.., round it up.
[1] https://bugzilla.suse.com/show_bug.cgi?id=1188238
[2] https://github.com/raspberrypi/linux/commit/ab3f1b39537f6d3825b8873006fbe2fc5ff057b7
--- drivers/clk/bcm/clk-bcm2835.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/clk/bcm/clk-bcm2835.c +33 -2
@@ -30,6 +30,7 @@#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/math.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/platform_device.h>
@@ -502,6 +503,8 @@ struct bcm2835_clock_data {bool low_jitter;u32 tcnt_mux; + +bool round_up; };struct bcm2835_gate_data {
@@ -993,12 +996,34 @@ static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clockreturn temp; } +static unsigned long bcm2835_round_rate (unsigned long rate) +{ +unsigned long scaler; +unsigned long limit; + + limit = rate /100000 ; + + scaler =1 ; +while (scaler < limit) + scaler *=10 ; + +/* +* If increasing a clock by less than 0.1% changes it +* from ..999.. to ..000.., round up. +*/ +if ((rate + scaler -1 ) / scaler %1000 ==0 ) + rate =roundup (rate, scaler); + +return rate; +} +static unsigned long bcm2835_clock_get_rate (struct clk_hw *hw,unsigned long parent_rate) {struct bcm2835_clock *clock =bcm2835_clock_from_hw (hw);struct bcm2835_cprman *cprman = clock->cprman;const struct bcm2835_clock_data *data = clock->data; +unsigned long rate;u32 div;if (data->int_bits ==0 && data->frac_bits ==0 )
@@ -1006,7 +1031,12 @@ static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, div =cprman_read (cprman, data->div_reg); -return bcm2835_clock_rate_from_divisor (clock, parent_rate, div); + rate =bcm2835_clock_rate_from_divisor (clock, parent_rate, div); + +if (data->round_up) + rate =bcm2835_round_rate (rate); + +return rate; }static void bcm2835_clock_wait_busy (struct bcm2835_clock *clock)
@@ -2143,7 +2173,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .div_reg = CM_UARTDIV, .int_bits = 10, .frac_bits = 12, - .tcnt_mux = 28), + .tcnt_mux = 28, + .round_up = true),/* TV encoder clock. Only operating frequency is 108Mhz. */ [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK(
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 840/862 perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream.
uClibc segfaulted because NULL was passed as the format to fprintf().
That happened because one of the format strings was missing and intel_pt_print_info() didn't check that before calling fprintf().
Add the missing format string, and check format is not NULL before calling fprintf().
--- tools/perf/util/intel-pt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/perf/util/intel-pt.c +7 -2
@@ -4033,6 +4033,7 @@ static const char * const intel_pt_info_ [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", + [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n",
@@ -4047,8 +4048,12 @@ static void intel_pt_print_info(__u64 *aif (!dump_trace)return ; -for (i = start; i <= finish; i++) -fprintf (stdout, intel_pt_info_fmts[i], arr[i]); +for (i = start; i <= finish; i++) { +const char *fmt = intel_pt_info_fmts[i]; + +if (fmt) +fprintf (stdout, fmt, arr[i]); + } }static void intel_pt_print_info_str (const char *name,const char *str)
Greg Kroah-Hartman
maintainerPATCH 860/862 Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 4f001a21080ff2e2f0e1c3692f5e119aedbb3bc1 upstream.
Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for DWARF5") could have cleaned up the code a bit more.
"CC_IS_CLANG &&" is unneeded. No functional change is intended.
--- lib/Kconfig.debug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +2 -2
@@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAUL config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 if using clang without clang's integrated assembler, and gdb 7.0+.
@@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
Re: [PATCH 6.0 525/862] phy: qcom-qmp-pcie-msm8996: fix memleak on probe deferral
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
From: Johan Hovold <[email protected]>
[ Upstream commit
1f69ededf8e80c42352e7f1c165a003614de9cc2]Switch to using the device-managed
of_iomaphelper to avoid leaking memory on probe deferral and driver unbind.Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory.
Again, because of the above, this should not be backported. Please drop.
Quoted 5 lines
Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")Signed-off-by Johan Hovold <[email protected]>Signed-off-by Vinod Koul <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Johan
Greg Kroah-Hartman
maintainerPATCH 826/862 scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
[ Upstream commit 1a77dd1c2bb5d4a58c16d198cf593720787c02e4 ]
Fix this compilation error seen when CONFIG_TRACING is not enabled:
drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_init':drivers/scsi/qla2xxx/qla_os.c:2854:25: error: implicit declaration of function 'trace_array_get_by_name'; did you mean 'trace_array_set_clr_event'? [-Werror=implicit-function-declaration]
2854 | qla_trc_array = trace_array_get_by_name("qla2xxx");
| ^~~~~~~~~~~~~~~~~~~~~~~
| trace_array_set_clr_eventdrivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_uninit':drivers/scsi/qla2xxx/qla_os.c:2869:9: error: implicit declaration of function 'trace_array_put' [-Werror=implicit-function-declaration]
2869 | trace_array_put(qla_trc_array);
| ^~~~~~~~~~~~~~~--- include/linux/trace.h | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
include/linux/trace.h +34 -2
@@ -2,8 +2,6 @@#ifndef _LINUX_TRACE_H#define _LINUX_TRACE_H -#ifdef CONFIG_TRACING -#define TRACE_EXPORT_FUNCTION BIT(0)#define TRACE_EXPORT_EVENT BIT(1)#define TRACE_EXPORT_MARKER BIT(2)
@@ -28,6 +26,8 @@ struct trace_export {int flags; }; +#ifdef CONFIG_TRACING +int register_ftrace_export (struct trace_export *export);int unregister_ftrace_export (struct trace_export *export);
@@ -48,6 +48,38 @@ void osnoise_arch_unregister(void);void osnoise_trace_irq_entry (int id);void osnoise_trace_irq_exit (int id,const char *desc); +#else /* CONFIG_TRACING */ +static inline int register_ftrace_export (struct trace_export *export) +{ +return -EINVAL ; +} +static inline int unregister_ftrace_export (struct trace_export *export) +{ +return 0 ; +} +static inline void trace_printk_init_buffers (void ) +{ +} +static inline int trace_array_printk (struct trace_array *tr,unsigned long ip, +const char *fmt, ...) +{ +return 0 ; +} +static inline int trace_array_init_printk (struct trace_array *tr) +{ +return -EINVAL ; +} +static inline void trace_array_put (struct trace_array *tr) +{ +} +static inline struct trace_array *trace_array_get_by_name (const char *name) +{ +return NULL ; +} +static inline int trace_array_destroy (struct trace_array *tr) +{ +return 0 ; +}#endif /* CONFIG_TRACING */ #endif /* _LINUX_TRACE_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 299/862 libbpf: Fix NULL pointer exception in API btf_dump__dump_type_data
In reply to Greg Kroah-HartmanFrom: Xin Liu <[email protected]>
[ Upstream commit 7620bffbf72cd66a5d18e444a143b5b5989efa87 ]
We found that function btf_dump__dump_type_data can be called by the user as an API, but in this function, the opts parameter may be used as a null pointer.This causes opts->indent_str to trigger a NULL pointer exception.
--- tools/lib/bpf/btf_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +1 -1
@@ -2385,7 +2385,7 @@ int btf_dump__dump_type_data(struct btf_dump *d, __u32 id, d->typed_dump->indent_lvl =OPTS_GET (opts, indent_level,0 );/* default indent string is a tab */ -if (!opts->indent_str) +if (!OPTS_GET (opts, indent_str,NULL )) d->typed_dump->indent_str[0 ] ='\t' ;else libbpf_strlcpy(d->typed_dump->indent_str, opts->indent_str,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 835/862 fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 182d98e00e4745fe253cb0c24c63bbac253464a2 ]
of_parse_phandle returns node pointer with refcount incremented, use of_node_put() on it when done.
--- drivers/fsi/fsi-master-ast-cf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/fsi/fsi-master-ast-cf.c +2 -0
@@ -1324,12 +1324,14 @@ static int fsi_master_acf_probe(struct platform_device *pdev) } master->cvic =devm_of_iomap (&pdev->dev, np,0 ,NULL );if (IS_ERR (master->cvic)) { +of_node_put (np); rc =PTR_ERR (master->cvic);dev_err (&pdev->dev,"Error %d mapping CVIC\n" , rc); goto err_free; } rc =of_property_read_u32 (np,"copro-sw-interrupts" , &master->cvic_sw_irq); +of_node_put (np);if (rc) {dev_err (&pdev->dev,"Can't find coprocessor SW interrupt\n" ); goto err_free;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 852/862 net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 35bbe652c421037822aba29423f5f1f7d0d69f3f upstream.
davinci_mdio.c uses mdio bitbang APIs, so it should select MDIO_BITBANG to prevent build errors.
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_remove':drivers/net/ethernet/ti/davinci_mdio.c:649: undefined reference to `free_mdio_bitbang'
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_probe':drivers/net/ethernet/ti/davinci_mdio.c:545: undefined reference to `alloc_mdio_bitbang'
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_read':drivers/net/ethernet/ti/davinci_mdio.c:236: undefined reference to `mdiobb_read'
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_write':drivers/net/ethernet/ti/davinci_mdio.c:253: undefined reference to `mdiobb_write'
--- drivers/net/ethernet/ti/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/Kconfig +1 -0
@@ -33,6 +33,7 @@ config TI_DAVINCI_MDIO tristate "TI DaVinci MDIO Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST select PHYLIB + select MDIO_BITBANG help This driver supports TI's DaVinci MDIO module.
Greg Kroah-Hartman
maintainerPATCH 847/862 io_uring/net: fix notif cqe reordering
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ upstream commit 108893ddcc4d3aa0a4a02aeb02d478e997001227 ]
send zc is not restricted to !IO_URING_F_UNLOCKED anymore and so we can't use task-tw ordering trick to order notification cqes with requests completions. In this case leave it alone and let io_send_zc_cleanup() flush it.
--- io_uring/net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
io_uring/net.c +8 -2
@@ -1073,8 +1073,14 @@ int io_send_zc(struct io_kiocb *req, unselse if (zc->done_io) ret = zc->done_io; -io_notif_flush (zc->notif); - req->flags &= ~REQ_F_NEED_CLEANUP ; +/* +* If we're in io-wq we can't rely on tw ordering guarantees, defer +* flushing notif to io_send_zc_cleanup() +*/ +if (!(issue_flags &IO_URING_F_UNLOCKED )) { +io_notif_flush (zc->notif); + req->flags &= ~REQ_F_NEED_CLEANUP ; + }io_req_set_res (req, ret,IORING_CQE_F_MORE );return IOU_OK ; }
Re: [PATCH 6.0 526/862] phy: qcom-qmp-combo: fix memleak on probe deferral
In reply to Greg Kroah-HartmanQuoted 9 lines · Greg Kroah-Hartman
From: Johan Hovold <[email protected]>
[ Upstream commit
2de8a325b1084330ae500380cc27edc39f488c30]Switch to using the device-managed
of_iomaphelper to avoid leaking memory on probe deferral and driver unbind.Note that this helper checks for already reserved regions and may fail if there are multiple devices claiming the same memory.
Again, because of the above, this should not be backported. Please drop.
Quoted 5 lines
Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")Signed-off-by Johan Hovold <[email protected]>Signed-off-by Vinod Koul <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Johan
Re: [PATCH 6.0 659/862] =?UTF-8?q?ARM/dma-mapp=D1=96ng:=20dont=20override=20->dma=5Fcohe?= =?UTF-8?q?rent=20when=20set=20from=20a=20bus=20notifier?=
In reply to Greg Kroah-HartmanHi Greg,
I'm seeing:
Subject: [PATCH 6.0 659/862]
=?UTF-8?q?ARM/dma-mapp=D1=96ng:=20dont=20override=20->dma=5Fcohe?=
=?UTF-8?q?rent=20when=20set=20from=20a=20bus=20notifier?=in mutt, and mutt seems to be unable to decode that. Either a mutt bug or a bug in your scripts or git...
Russell.
Quoted 55 lines · Greg Kroah-Hartman
From: Christoph Hellwig <[email protected]>
[ Upstream commit
49bc8bebae79c8516cb12f91818f3a7907e3ebce]Commit
ae626eb97376("ARM/dma-mapping: use dma-direct unconditionally") caused a regression on the mvebu platform, wherein devices that are dma-coherent are marked as dma-noncoherent, because althoughmvebu_hwcc_notifier()after that commit still marks then as coherent, thearm_coherent_dma_ops()function, which is called later, overwrites this setting, since it is being called fromdrivers/of/device.cwith coherency parameter determined byof_dma_is_coherent(), and the device-trees do not declare the 'dma-coherent' property.Fix this by defaulting never clearing the
dma_coherentflag inarm_coherent_dma_ops().Fixes ae626eb97376 ("ARM/dma-mapping: use dma-direct unconditionally")Reported-by Marek Behún <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>Reviewed-by Russell King (Oracle) <[email protected]>Tested-by Marek Behún <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm/mm/dma-mapping.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)arch/arm/mm/dma-mapping.c +10
-2@@ -1769,8 +1769,16 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { }void arch_setup_dma_ops (struct device *dev,u64 dma_base,u64 size,const struct iommu_ops *iommu,bool coherent) { - dev->archdata.dma_coherent = coherent; - dev->dma_coherent = coherent; +/* +* Due to legacy code that sets the ->dma_coherent flag from a bus +* notifier we can't just assign coherent to the ->dma_coherent flag +* here, but instead have to make sure we only set but never clear it +* for now. +*/ +if (coherent) { + dev->archdata.dma_coherent = true; + dev->dma_coherent = true; + }/* * Don't override the dma_ops if they have already been set. Ideally Signature · 1 line
2.35.1
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Greg Kroah-Hartman
maintainerPATCH 825/862 staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()
In reply to Greg Kroah-HartmanFrom: Xiaoke Wang <[email protected]>
[ Upstream commit 708056fba733a73d926772ea4ce9a42d240345da ]
In rtw_init_cmd_priv(), if pcmdpriv->rsp_allocated_buf is allocated in failure, then pcmdpriv->cmd_allocated_buf will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the exit tag to execute the error handler.
So this patch added kfree(pcmdpriv->cmd_allocated_buf); on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed.
--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +6 -10
@@ -161,8 +161,6 @@ static struct cmd_hdl wlancmds[] = {int rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -int res =0 ; -init_completion (&pcmdpriv->cmd_queue_comp);init_completion (&pcmdpriv->terminate_cmdthread_comp);
@@ -175,18 +173,16 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->cmd_allocated_buf =rtw_zmalloc (MAX_CMDSZ +CMDBUFF_ALIGN_SZ ); -if (!pcmdpriv->cmd_allocated_buf) { - res = -ENOMEM ; - goto exit; - } +if (!pcmdpriv->cmd_allocated_buf) +return -ENOMEM ; pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf +CMDBUFF_ALIGN_SZ - ((SIZE_PTR )(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ -1 )); pcmdpriv->rsp_allocated_buf =rtw_zmalloc (MAX_RSPSZ +4 );if (!pcmdpriv->rsp_allocated_buf) { - res = -ENOMEM ; - goto exit; +kfree (pcmdpriv->cmd_allocated_buf); +return -ENOMEM ; } pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf +4 - ((SIZE_PTR )(pcmdpriv->rsp_allocated_buf) &3 );
@@ -196,8 +192,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_cnt =0 ;mutex_init (&pcmdpriv->sctx_mutex); -exit: -return res; + +return 0 ; }static void c2h_wk_callback (struct work_struct *work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 805/862 power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 9d47e01b9d807808224347935562f7043a358054 ]
ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements beyond the end of the adp5061_chg_type[] array.
--- drivers/power/supply/adp5061.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/supply/adp5061.c +3 -3
@@ -427,11 +427,11 @@ static int adp5061_get_chg_type(struct adp5061_state *st,if (ret <0 )return ret; - chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS (status1)]; -if (chg_type >ADP5061_CHG_FAST_CV ) + chg_type =ADP5061_CHG_STATUS_1_CHG_STATUS (status1); +if (chg_type >=ARRAY_SIZE (adp5061_chg_type)) val->intval =POWER_SUPPLY_STATUS_UNKNOWN ;else - val->intval = chg_type; + val->intval = adp5061_chg_type[chg_type];return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 845/862 io_uring/net: rename io_sendzc()
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ upstream commit b0e9b5517eb12fa80c72e205fe28534c2e2f39b9 ]
Simple renaming of io_sendzc*() functions in preparatio to adding a zerocopy sendmsg variant.
--- io_uring/net.c | 6 +++--- io_uring/net.h | 6 +++--- io_uring/opdef.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
io_uring/net.c +3 -3
@@ -875,7 +875,7 @@ out_free:return ret; } -void io_sendzc_cleanup (struct io_kiocb *req) +void io_send_zc_cleanup (struct io_kiocb *req) { struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
@@ -884,7 +884,7 @@ void io_sendzc_cleanup(struct io_kiocb * zc->notif =NULL ; } -int io_sendzc_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) +int io_send_zc_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) { struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);struct io_ring_ctx *ctx = req->ctx;
@@ -989,7 +989,7 @@ static int io_sg_from_iter(struct sock *return ret; } -int io_sendzc (struct io_kiocb *req,unsigned int issue_flags) +int io_send_zc (struct io_kiocb *req,unsigned int issue_flags) {struct sockaddr_storage __address, *addr =NULL ; struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);
io_uring/net.h +3 -3
@@ -55,9 +55,9 @@ int io_connect_prep_async(struct io_kiocint io_connect_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe);int io_connect (struct io_kiocb *req,unsigned int issue_flags); -int io_sendzc (struct io_kiocb *req,unsigned int issue_flags); -int io_sendzc_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe); -void io_sendzc_cleanup (struct io_kiocb *req); +int io_send_zc (struct io_kiocb *req,unsigned int issue_flags); +int io_send_zc_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe); +void io_send_zc_cleanup (struct io_kiocb *req);void io_send_zc_fail (struct io_kiocb *req);void io_netmsg_cache_free (struct io_cache_entry *entry);
io_uring/opdef.c +3 -3
@@ -490,10 +490,10 @@ const struct io_op_def io_op_defs[] = { .manual_alloc = 1,#if defined(CONFIG_NET ) .async_size = sizeof(struct io_async_msghdr), - .prep = io_sendzc_prep, - .issue = io_sendzc, + .prep = io_send_zc_prep, + .issue = io_send_zc, .prep_async = io_sendzc_prep_async, - .cleanup = io_sendzc_cleanup, + .cleanup = io_send_zc_cleanup, .fail = io_send_zc_fail, #else .prep = io_eopnotsupp_prep,
Greg Kroah-Hartman
maintainerPATCH 787/862 btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 8a1ae2781dee9fc21ca82db682d37bea4bd074ad ]
Now that lockdep is staying enabled through our entire CI runs I started seeing the following stack in generic/475
------------[ cut here ]------------ WARNING: CPU: 1 PID: 2171864 at fs/btrfs/discard.c:604 btrfs_discard_update_discardable+0x98/0xb0 CPU: 1 PID: 2171864 Comm: kworker/u4:0 Not tainted 5.19.0-rc8+ #789 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 Workqueue: btrfs-cache btrfs_work_helper RIP: 0010:btrfs_discard_update_discardable+0x98/0xb0 RSP: 0018:ffffb857c2f7bad0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8c85c605c200 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff86807c5b RDI: ffffffff868a831e RBP: ffff8c85c4c54000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff8c85c66932f0 R11: 0000000000000001 R12: ffff8c85c3899010 R13: ffff8c85d5be4f40 R14: ffff8c85c4c54000 R15: ffff8c86114bfa80 FS: 0000000000000000(0000) GS:ffff8c863bd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2e7f168160 CR3: 000000010289a004 CR4: 0000000000370ee0 Call Trace: __btrfs_remove_free_space_cache+0x27/0x30 load_free_space_cache+0xad2/0xaf0 caching_thread+0x40b/0x650 ? lock_release+0x137/0x2d0 btrfs_work_helper+0xf2/0x3e0 ? lock_is_held_type+0xe2/0x140 process_one_work+0x271/0x590 ? process_one_work+0x590/0x590 worker_thread+0x52/0x3b0 ? process_one_work+0x590/0x590 kthread+0xf0/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30
This is the code
ctl = block_group->free_space_ctl;
discard_ctl = &block_group->fs_info->discard_ctl;
lockdep_assert_held(&ctl->tree_lock);We have a temporary free space ctl for loading the free space cache in order to avoid having allocations happening while we're loading the cache. When we hit an error we free it all up, however this also calls btrfs_discard_update_discardable, which requires block_group->free_space_ctl->tree_lock to be held. However this is our temporary ctl so this lock isn't held. Fix this by calling __btrfs_remove_free_space_cache_locked instead so that we only clean up the entries and do not mess with the discardable stats.
--- fs/btrfs/free-space-cache.c | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-)
fs/btrfs/free-space-cache.c +33 -20
@@ -48,6 +48,25 @@ static void bitmap_clear_bits(struct btr struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); +static void __btrfs_remove_free_space_cache_locked ( +struct btrfs_free_space_ctl *ctl) +{ +struct btrfs_free_space *info; +struct rb_node *node; + +while ((node =rb_last (&ctl->free_space_offset)) !=NULL ) { + info = rb_entry(node, struct btrfs_free_space, offset_index); +if (!info->bitmap) { +unlink_free_space (ctl, info, true); +kmem_cache_free (btrfs_free_space_cachep, info); + }else { +free_bitmap (ctl, info); + } + +cond_resched_lock (&ctl->tree_lock); + } +} +static struct inode *__lookup_free_space_inode (struct btrfs_root *root,struct btrfs_path *path,u64 offset)
@@ -881,7 +900,14 @@ out:return ret; free_cache:io_ctl_drop_pages (&io_ctl); -__btrfs_remove_free_space_cache (ctl); + +/* +* We need to call the _locked variant so we don't try to update the +* discard counters. +*/ +spin_lock (&ctl->tree_lock); +__btrfs_remove_free_space_cache_locked (ctl); +spin_unlock (&ctl->tree_lock); goto out; }
@@ -1007,7 +1033,13 @@ int load_free_space_cache(struct btrfs_bif (ret ==0 ) ret =1 ; }else { +/* +* We need to call the _locked variant so we don't try to update +* the discard counters. +*/ +spin_lock (&tmp_ctl.tree_lock);__btrfs_remove_free_space_cache (&tmp_ctl); +spin_unlock (&tmp_ctl.tree_lock);btrfs_warn (fs_info,"block group %llu has wrong amount of free space" , block_group->start);
@@ -2970,25 +3002,6 @@ static void __btrfs_return_cluster_to_frbtrfs_put_block_group (block_group); } -static void __btrfs_remove_free_space_cache_locked ( -struct btrfs_free_space_ctl *ctl) -{ -struct btrfs_free_space *info; -struct rb_node *node; - -while ((node =rb_last (&ctl->free_space_offset)) !=NULL ) { - info = rb_entry(node, struct btrfs_free_space, offset_index); -if (!info->bitmap) { -unlink_free_space (ctl, info, true); -kmem_cache_free (btrfs_free_space_cachep, info); - }else { -free_bitmap (ctl, info); - } - -cond_resched_lock (&ctl->tree_lock); - } -} -void __btrfs_remove_free_space_cache (struct btrfs_free_space_ctl *ctl) {spin_lock (&ctl->tree_lock);
Greg Kroah-Hartman
maintainerPATCH 682/862 wifi: brcmfmac: fix invalid address access when enabling SCAN log level
In reply to Greg Kroah-HartmanFrom: Wright Feng <[email protected]>
[ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ]
The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid.
We replace reqs index with ri to fix the issue.
[ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c
--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +6 -6
@@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)struct brcmf_pno_macaddr_le pfn_mac;u8 *mac_addr =NULL ;u8 *mac_mask =NULL ; -int err, i; +int err, i, ri; -for (i =0 ; i < pi->n_reqs; i++) -if (pi->reqs[i]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; +for (ri =0 ; ri < pi->n_reqs; ri++) +if (pi->reqs[ri]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask;break ; }
@@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0 ] |=0x02 ;brcmf_dbg (SCAN ,"enabling random mac: reqid=%llu mac=%pM\n" , - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err =brcmf_fil_iovar_data_set (ifp,"pfn_macaddr" , &pfn_mac,sizeof (pfn_mac));if (err)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 735/862 ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support
In reply to Greg Kroah-HartmanFrom: Conner Knox <[email protected]>
[ Upstream commit b01104fc62b6194c852124f6c6df1c0a5c031fc1 ]
Add support for Avid Mbox3 USB audio interface at 48kHz
--- sound/usb/quirks-table.h | 76 ++++++++++ sound/usb/quirks.c | 302 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 378 insertions(+)
sound/usb/quirks-table.h +76 -0
@@ -2985,6 +2985,82 @@ YAMAHA_DEVICE(0x7010, "UB99"), } } }, +/* DIGIDESIGN MBOX 3 */ +{ + USB_DEVICE(0x0dba, 0x5000), + .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { + .vendor_name ="Digidesign" , + .product_name ="Mbox 3" , + .ifnum =QUIRK_ANY_INTERFACE , + .type =QUIRK_COMPOSITE , + .data = (const struct snd_usb_audio_quirk []) { + { + .ifnum =0 , + .type =QUIRK_IGNORE_INTERFACE + }, + { + .ifnum =1 , + .type =QUIRK_IGNORE_INTERFACE + }, + { + .ifnum =2 , + .type =QUIRK_AUDIO_FIXED_ENDPOINT , + .data = &(const struct audioformat ) { + .formats =SNDRV_PCM_FMTBIT_S24_3LE , + .channels =4 , + .iface =2 , + .altsetting =1 , + .altset_idx =1 , + .attributes =0x00 , + .endpoint =0x01 , + .ep_attr =USB_ENDPOINT_XFER_ISOC | +USB_ENDPOINT_SYNC_ASYNC , + .rates =SNDRV_PCM_RATE_48000 , + .rate_min =48000 , + .rate_max =48000 , + .nr_rates =1 , + .rate_table = (unsigned int []) { +48000 + } + } + }, + { + .ifnum =3 , + .type =QUIRK_AUDIO_FIXED_ENDPOINT , + .data = &(const struct audioformat ) { + .formats =SNDRV_PCM_FMTBIT_S24_3LE , + .channels =4 , + .iface =3 , + .altsetting =1 , + .altset_idx =1 , + .endpoint =0x81 , + .attributes =0x00 , + .ep_attr =USB_ENDPOINT_XFER_ISOC | +USB_ENDPOINT_SYNC_ASYNC , + .maxpacksize =0x009c , + .rates =SNDRV_PCM_RATE_48000 , + .rate_min =48000 , + .rate_max =48000 , + .nr_rates =1 , + .rate_table = (unsigned int []) { +48000 + } + } + }, + { + .ifnum =4 , + .type =QUIRK_MIDI_FIXED_ENDPOINT , + .data = &(const struct snd_usb_midi_endpoint_info ) { + .out_cables =0x0001 , + .in_cables =0x0001 + } + }, + { + .ifnum =-1 + } + } + } +}, {/* Tascam US122 MKII - playback-only support */ USB_DEVICE_VENDOR_SPEC(0x0644, 0x8021),
sound/usb/quirks.c +302 -0
314 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 707/862 wifi: rtw89: fix rx filter after scan
In reply to Greg Kroah-HartmanFrom: Po-Hao Huang <[email protected]>
[ Upstream commit 812825c2b204c491f1a5586c602e4ac75060493a ]
In monitor mode we should be able to received all packets even if it's not destined to us. But after scan, the configuration was wrongly set, so we fix it.
--- drivers/net/wireless/realtek/rtw89/fw.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +5 -7
@@ -2289,6 +2289,7 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, {struct rtw89_vif *rtwvif = (struct rtw89_vif *)vif->drv_priv;struct cfg80211_scan_request *req = &scan_req->req; +u32 rx_fltr = rtwdev->hal.rx_fltr;u8 mac_addr[ETH_ALEN ]; rtwdev->scan_info.scanning_vif = vif;
@@ -2303,13 +2304,13 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,ether_addr_copy (mac_addr, vif->addr);rtw89_core_scan_start (rtwdev, rtwvif, mac_addr, true); - rtwdev->hal.rx_fltr &= ~B_AX_A_BCN_CHK_EN ; - rtwdev->hal.rx_fltr &= ~B_AX_A_BC ; - rtwdev->hal.rx_fltr &= ~B_AX_A_A1_MATCH ; + rx_fltr &= ~B_AX_A_BCN_CHK_EN ; + rx_fltr &= ~B_AX_A_BC ; + rx_fltr &= ~B_AX_A_A1_MATCH ;rtw89_write32_mask (rtwdev,rtw89_mac_reg_by_idx (R_AX_RX_FLTR_OPT ,RTW89_MAC_0 ),B_AX_RX_FLTR_CFG_MASK , - rtwdev->hal.rx_fltr); + rx_fltr); } void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
@@ -2323,9 +2324,6 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,if (!vif)return ; - rtwdev->hal.rx_fltr |=B_AX_A_BCN_CHK_EN ; - rtwdev->hal.rx_fltr |=B_AX_A_BC ; - rtwdev->hal.rx_fltr |=B_AX_A_A1_MATCH ; rtw89_write32_mask(rtwdev, rtw89_mac_reg_by_idx(R_AX_RX_FLTR_OPT, RTW89_MAC_0), B_AX_RX_FLTR_CFG_MASK,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 620/862 powerpc/64/interrupt: Fix return to masked context after hard-mask irq becomes pending
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit e485f6c751e0a969327336c635ca602feea117f0 ]
If a synchronous interrupt (e.g., hash fault) is taken inside an irqs-disabled region which has MSR[EE]=1, then an asynchronous interrupt that is PACA_IRQ_MUST_HARD_MASK (e.g., PMI) is taken inside the synchronous interrupt handler, then the synchronous interrupt will return with MSR[EE]=1 and the asynchronous interrupt fires again.
If the asynchronous interrupt is a PMI and the original context does not have PMIs disabled (only Linux IRQs), the asynchronous interrupt will fire despite having the PMI marked soft pending. This can confuse the perf code and cause warnings.
This patch changes the interrupt return so that irqs-disabled MSR[EE]=1 contexts will be returned to with MSR[EE]=0 if a PACA_IRQ_MUST_HARD_MASK interrupt has become pending in the meantime.
The longer explanation for what happens:
1. local_irq_disable()
2. Hash fault interrupt fires, do_hash_fault handler runs
3. interrupt_enter_prepare() sets IRQS_ALL_DISABLED
4. interrupt_enter_prepare() sets MSR[EE]=1
5. PMU interrupt fires, masked handler runs
6. Masked handler marks PMI pending
7. Masked handler returns with PACA_IRQ_HARD_DIS set, MSR[EE]=0
8. do_hash_fault interrupt return handler runs
9. interrupt_exit_kernel_prepare() clears PACA_IRQ_HARD_DIS
10. interrupt returns with MSR[EE]=1
11. PMU interrupt fires, perf handler runs
--- arch/powerpc/kernel/interrupt.c | 10 --------- arch/powerpc/kernel/interrupt_64.S | 34 +++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 13 deletions(-)
arch/powerpc/kernel/interrupt.c +0 -10
@@ -431,16 +431,6 @@ notrace unsigned long interrupt_exit_kernel_prepare(struct pt_regs *regs)if (unlikely (stack_store))__hard_EE_RI_disable (); -/* -* Returning to a kernel context with local irqs disabled. -* Here, if EE was enabled in the interrupted context, enable -* it on return as well. A problem exists here where a soft -* masked interrupt may have cleared MSR[EE] and set HARD_DIS -* here, and it will still exist on return to the caller. This -* will be resolved by the masked interrupt firing again. -*/ -if (regs->msr &MSR_EE ) - local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS ;#endif /* CONFIG_PPC64 */ }
arch/powerpc/kernel/interrupt_64.S +31 -3
@@ -559,15 +559,43 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\srr\()_kernel) ld r11,SOFTE(r1) cmpwi r11,IRQS_ENABLED stb r11,PACAIRQSOFTMASK(r13) - bne 1f + beq .Linterrupt_return_\srr\()_soft_enabled + + /* + * Returning to soft-disabled context. + * Check if a MUST_HARD_MASK interrupt has become pending, in which + * case we need to disable MSR[EE] in the return context. + */ + ld r12,_MSR(r1) + andi. r10,r12,MSR_EE + beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled + lbz r11,PACAIRQHAPPENED(r13) + andi. r10,r11,PACA_IRQ_MUST_HARD_MASK + beq 1f // No HARD_MASK pending + + /* Must clear MSR_EE from _MSR */ +#ifdef CONFIG_PPC_BOOK3S + li r10,0 + /* Clear valid before changing _MSR */ + .ifc \srr,srr + stb r10,PACASRR_VALID(r13) + .else + stb r10,PACAHSRR_VALID(r13) + .endif +#endif + xori r12,r12,MSR_EE + std r12,_MSR(r1) + b .Lfast_kernel_interrupt_return_\srr\() + +.Linterrupt_return_\srr\()_soft_enabled: #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif - li r11,0 - stb r11,PACAIRQHAPPENED(r13) # clear out possible HARD_DIS 1: + li r11,0 + stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS .Lfast_kernel_interrupt_return_\srr\(): cmpdi cr1,r3,0
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 798/862 usb: host: xhci-plat: suspend/resume clks for brcm
In reply to Greg Kroah-HartmanFrom: Justin Chen <[email protected]>
[ Upstream commit c69400b09e471a3f1167adead55a808f0da6534a ]
The xhci_plat_brcm xhci block can enter suspend with clock disabled to save power and re-enable them on resume. Make use of the XHCI_SUSPEND_RESUME_CLKS quirk to do so.
--- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +1 -1
@@ -123,7 +123,7 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { };static const struct xhci_plat_priv xhci_plat_brcm = { - .quirks =XHCI_RESET_ON_RESUME , + .quirks =XHCI_RESET_ON_RESUME |XHCI_SUSPEND_RESUME_CLKS , };static const struct of_device_id usb_xhci_of_match[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 801/862 scsi: 3w-9xxx: Avoid disabling device if failing to enable it
In reply to Greg Kroah-HartmanFrom: Letu Ren <[email protected]>
[ Upstream commit 7eff437b5ee1309b34667844361c6bbb5c97df05 ]
The original code will "goto out_disable_device" and call pci_disable_device() if pci_enable_device() fails. The kernel will generate a warning message like "3w-9xxx 0000:00:05.0: disabling already-disabled device".
We shouldn't disable a device that failed to be enabled. A simple return is fine.
--- drivers/scsi/3w-9xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/3w-9xxx.c +1 -1
@@ -2006,7 +2006,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) retval =pci_enable_device (pdev);if (retval) {TW_PRINTK (host,TW_DRIVER ,0x34 ,"Failed to enable pci device" ); - goto out_disable_device; +return -ENODEV ; }pci_set_master (pdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 311/862 libbpf: restore memory layout of bpf_object_open_opts
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit dbdea9b36fb61da3b9a1be0dd63542e2bfd3e5d7 ]
When attach_prog_fd field was removed in libbpf 1.0 and replaced with long: 0 placeholder, it actually shifted all the subsequent fields by 8 byte. This is due to long: 0 promising to adjust next field's offset to long-aligned offset. But in this case we were already long-aligned as pin_root_path is a pointer. So long: 0 had no effect, and thus didn't feel the gap created by removed attach_prog_fd.
Non-zero bitfield should have been used instead. I validated using pahole. Originally kconfig field was at offset 40. With long: 0 it's at offset 32, which is wrong. With this change it's back at offset 40.
While technically libbpf 1.0 is allowed to break backwards compatibility and applications should have been recompiled against libbpf 1.0 headers, but given how trivial it is to preserve memory layout, let's fix this.
--- tools/lib/bpf/libbpf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/bpf/libbpf.h +3 -1
@@ -118,7 +118,9 @@ struct bpf_object_open_opts {* auto-pinned to that path on load; defaults to "/sys/fs/bpf". */ const char *pin_root_path; - long :0; + + __u32 :32 ;/* stub out now removed attach_prog_fd */ +/* Additional kernel config content that augments and overrides * system Kconfig for CONFIG_xxx externs. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 308/862 wifi: ath11k: fix number of VHT beamformee spatial streams
In reply to Greg Kroah-HartmanFrom: Jesus Fernandez Manzano <[email protected]>
[ Upstream commit 55b5ee3357d7bb98ee578cf9b84a652e7a1bc199 ]
The number of spatial streams used when acting as a beamformee in VHT mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and IPQ8074 which respectively have 2 and 4 sts each. So the firmware should report 1 (2 - 1) and 3 (4 - 1).
Fix this by checking that the number of VHT beamformee sts reported by the firmware is not greater than the number of receiving antennas - 1. The fix is based on the same approach used in this same function for sanitizing the number of sounding dimensions reported by the firmware.
Without this change, acting as a beamformee in VHT mode is not working properly.
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +20 -5
@@ -4954,6 +4954,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif)if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE )) { nsts = vht_cap &IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ; nsts >>=IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ; +if (nsts > (ar->num_rx_chains -1 )) + nsts = ar->num_rx_chains -1 ; value |=SM (nsts,WMI_TXBF_STS_CAP_OFFSET ); }
@@ -4994,7 +4996,7 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif)static void ath11k_set_vht_txbf_cap (struct ath11k *ar,u32 *vht_cap) {bool subfer, subfee; -int sound_dim =0 ; +int sound_dim =0 , nsts =0 ; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE )); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ));
@@ -5004,6 +5006,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) subfer = false; } +if (ar->num_rx_chains <2 ) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ); + subfee = false; + } +/* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE );
@@ -5016,7 +5023,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) sound_dim >>=IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT ; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK ; -/* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap &IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ); + nsts >>=IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ;/* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) {
@@ -5028,9 +5037,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) *vht_cap |= sound_dim; } -/* Use the STS advertised by FW unless SU Beamformee is not supported*/ -if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ); +/* Enable Beamformee STS Field only if SU BF is enabled */ +if (subfee) { +if (nsts > (ar->num_rx_chains -1 )) + nsts = ar->num_rx_chains -1 ; + + nsts <<=IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ; + nsts &=IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 790/862 ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 752ec621ef5c30777958cc5eb5f1cf394f7733f4 ]
Because an exception stack frame is not created in the exception entry, save_trace() does special handling for the exception PC, but this is only needed when CONFIG_FRAME_POINTER_UNWIND=y. When CONFIG_ARM_UNWIND=y, unwind annotations have been added to the exception entry and save_trace() will repeatedly save the exception PC:
[0x7f000090] hrtimer_hander+0x8/0x10 [hrtimer]
[0x8019ec50] __hrtimer_run_queues+0x18c/0x394
[0x8019f760] hrtimer_run_queues+0xbc/0xd0
[0x8019def0] update_process_times+0x34/0x80
[0x801ad2a4] tick_periodic+0x48/0xd0
[0x801ad3dc] tick_handle_periodic+0x1c/0x7c
[0x8010f2e0] twd_handler+0x30/0x40
[0x80177620] handle_percpu_devid_irq+0xa0/0x23c
[0x801718d0] generic_handle_domain_irq+0x24/0x34
[0x80502d28] gic_handle_irq+0x74/0x88
[0x8085817c] generic_handle_arch_irq+0x58/0x78
[0x80100ba8] __irq_svc+0x88/0xc8
[0x80108114] arch_cpu_idle+0x38/0x3c
[0x80108114] arch_cpu_idle+0x38/0x3c <==== duplicate saved exception PC
[0x80861bf8] default_idle_call+0x38/0x130
[0x8015d5cc] do_idle+0x150/0x214
[0x8015d978] cpu_startup_entry+0x18/0x1c
[0x808589c0] rest_init+0xd8/0xdc
[0x80c00a44] arch_post_acpi_subsys_init+0x0/0x8We can move the special handling of the exception PC in save_trace() to the unwind_frame() of the frame pointer unwinder.
--- arch/arm/include/asm/stacktrace.h | 6 +++++ arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 44 +++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-)
arch/arm/include/asm/stacktrace.h +6 -0
@@ -21,6 +21,9 @@ struct stackframe {struct llist_node *kr_cur;struct task_struct *tsk;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER +bool ex_frame; +#endif }; static __always_inline
@@ -34,6 +37,9 @@ void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) frame->kr_cur =NULL ; frame->tsk = current;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame->ex_frame =in_entry_text (frame->pc); +#endif }extern int unwind_frame (struct stackframe *frame);
arch/arm/kernel/return_address.c +1 -0
@@ -47,6 +47,7 @@ void *return_address(unsigned int level) frame.kr_cur =NULL ; frame.tsk = current;#endif + frame.ex_frame = false;walk_stackframe (&frame, save_return_addr, &data);
arch/arm/kernel/stacktrace.c +30 -14
80 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 375/862 platform/chrome: cros_ec_typec: Add bit offset for DP VDO
In reply to Greg Kroah-HartmanFrom: Prashant Malani <[email protected]>
[ Upstream commit 1903adae0464c1e1c36b132db474cb3aff7bc727 ]
Use the right macro while constructing the DP_PORT_VDO to ensure the Pin Assignment offsets are correct.
--- drivers/platform/chrome/cros_ec_typec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_typec.c +2 -1
@@ -25,7 +25,8 @@#define DRV_NAME "cros-ec-typec" -#define DP_PORT_VDO (BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D) | DP_CAP_DFP_D) +#define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \ + DP_CAP_DFP_D)/* Supported alt modes. */ enum {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 793/862 media: cx88: Fix a null-ptr-deref bug in buffer_prepare()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 2b064d91440b33fba5b452f2d1b31f13ae911d71 ]
When the driver calls cx88_risc_buffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in buffer_queue().
The following log can reveal it:
[ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:buffer_queue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] __enqueue_in_driver+0x141/0x360 [ 41.837262] vb2_start_streaming+0x62/0x4a0 [ 41.838216] vb2_core_streamon+0x1da/0x2c0 [ 41.838516] __vb2_init_fileio+0x981/0xbc0 [ 41.839141] __vb2_perform_fileio+0xbf9/0x1120 [ 41.840072] vb2_fop_read+0x20e/0x400 [ 41.840346] v4l2_read+0x215/0x290 [ 41.840603] vfs_read+0x162/0x4c0
Fix this by checking the return value of cx88_risc_buffer()
[hverkuil: fix coding style issues]
--- drivers/media/pci/cx88/cx88-vbi.c | 9 +++--- drivers/media/pci/cx88/cx88-video.c | 43 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/media/pci/cx88/cx88-vbi.c +4 -5
@@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb)return -EINVAL ;vb2_set_plane_payload (vb,0 , size); -cx88_risc_buffer (dev->pci, &buf->risc, sgt->sgl, -0 ,VBI_LINE_LENGTH * lines, -VBI_LINE_LENGTH ,0 , - lines); -return 0 ; +return cx88_risc_buffer (dev->pci, &buf->risc, sgt->sgl, +0 ,VBI_LINE_LENGTH * lines, +VBI_LINE_LENGTH ,0 , + lines); }static void buffer_finish (struct vb2_buffer *vb)
drivers/media/pci/cx88/cx88-video.c +22 -21
70 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 315/862 spi: dw: Fix PM disable depth imbalance in dw_spi_bt1_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 618d815fc93477b1675878f3c04ff32657cc18b4 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.
--- drivers/spi/spi-dw-bt1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-dw-bt1.c +3 -1
@@ -293,8 +293,10 @@ static int dw_spi_bt1_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev); ret =dw_spi_add_host (&pdev->dev, dws); -if (ret) +if (ret) { +pm_runtime_disable (&pdev->dev); goto err_disable_clk; + }platform_set_drvdata (pdev, dwsbt1);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 811/862 soundwire: intel: fix error handling on dai registration issues
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ]
The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it.
--- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-)
drivers/soundwire/intel.c +0 -1
@@ -1429,7 +1429,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) ret =intel_register_dai (sdw);if (ret) {dev_err (dev,"DAI registration failed: %d\n" , ret); -snd_soc_unregister_component (dev); goto err_interrupt; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 317/862 skmsg: Schedule psock work if the cached skb exists on the psock
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit bec217197b412d74168c6a42fc0f76d0cc9cad00 ]
In sk_psock_backlog function, for ingress direction skb, if no new data packet arrives after the skb is cached, the cached skb does not have a chance to be added to the receive queue of psock. As a result, the cached skb cannot be received by the upper-layer application. Fix this by reschedule the psock work to dispose the cached skb in sk_msg_recvmsg function.
--- net/core/skmsg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/core/skmsg.c +8 -4
@@ -434,8 +434,10 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,if (copied + copy > len) copy = len - copied; copy =copy_page_to_iter (page, sge->offset, copy, iter); -if (!copy) -return copied ? copied : -EFAULT ; +if (!copy) { + copied = copied ? copied : -EFAULT ; + goto out; + } copied += copy;if (likely (!peek)) {
@@ -455,7 +457,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,* didn't copy the entire length lets just break. */ if (copy != sge->length) -return copied; + goto out;sk_msg_iter_var_next (i); }
@@ -477,7 +479,9 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, } msg_rx =sk_psock_peek_msg (psock); } - +out: +if (psock->work_state.skb && copied >0 ) +schedule_work (&psock->work);return copied; }EXPORT_SYMBOL_GPL (sk_msg_recvmsg);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 844/862 io_uring/net: dont lose partial send_zc on fail
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ upstream commit 5693bcce892d7b8b15a7a92b011d3d40a023b53c ]
Partial zc send may end up in io_req_complete_failed(), which not only would return invalid result but also mask out the notification leading to lifetime issues.
--- io_uring/net.c | 16 ++++++++++++++++ io_uring/net.h | 1 + io_uring/opdef.c | 1 + 3 files changed, 18 insertions(+)
io_uring/net.c +16 -0
@@ -1093,6 +1093,22 @@ void io_sendrecv_fail(struct io_kiocb *rio_req_set_res (req, res, req->cqe.flags); } +void io_send_zc_fail (struct io_kiocb *req) +{ + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); +int res = req->cqe.res; + +if (req->flags &REQ_F_PARTIAL_IO ) { +if (req->flags &REQ_F_NEED_CLEANUP ) { +io_notif_flush (sr->notif); + sr->notif =NULL ; + req->flags &= ~REQ_F_NEED_CLEANUP ; + } + res = sr->done_io; + } +io_req_set_res (req, res, req->cqe.flags); +} +int io_accept_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) { struct io_accept *accept = io_kiocb_to_cmd(req, struct io_accept);
io_uring/net.h +1 -0
@@ -58,6 +58,7 @@ int io_connect(struct io_kiocb *req, unsint io_sendzc (struct io_kiocb *req,unsigned int issue_flags);int io_sendzc_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe);void io_sendzc_cleanup (struct io_kiocb *req); +void io_send_zc_fail (struct io_kiocb *req);void io_netmsg_cache_free (struct io_cache_entry *entry);#else
io_uring/opdef.c +1 -0
@@ -494,6 +494,7 @@ const struct io_op_def io_op_defs[] = { .issue = io_sendzc, .prep_async = io_sendzc_prep_async, .cleanup = io_sendzc_cleanup, + .fail = io_send_zc_fail, #else .prep = io_eopnotsupp_prep,#endif
Greg Kroah-Hartman
maintainerPATCH 796/862 RDMA/rxe: Delete error messages triggered by incoming Read requests
In reply to Greg Kroah-HartmanFrom: Daisuke Matsuda <[email protected]>
[ Upstream commit 2c02249fcbfc066bd33e2a7375c7006d4cb367f6 ]
An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.
--- drivers/infiniband/sw/rxe/rxe_resp.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +3 -7
@@ -809,10 +809,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,if (!skb)return RESPST_ERR_RNR ; - err =rxe_mr_copy (mr, res->read.va,payload_addr (&ack_pkt), - payload,RXE_FROM_MR_OBJ ); -if (err) -pr_err ("Failed copying memory\n" ); +rxe_mr_copy (mr, res->read.va,payload_addr (&ack_pkt), + payload,RXE_FROM_MR_OBJ );if (mr)rxe_put (mr);
@@ -823,10 +821,8 @@ static enum resp_states read_reply(struct rxe_qp *qp, } err =rxe_xmit_packet (qp, &ack_pkt, skb); -if (err) { -pr_err ("Failed sending RDMA reply.\n" ); +if (err)return RESPST_ERR_RNR ; - } res->read.va += payload; res->read.resid -= payload;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 390/862 mmc: au1xmmc: Fix an error handling path in au1xmmc_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5cbedf52608cc3cbc1c2a9a861fb671620427a20 ]
If clk_prepare_enable() fails, there is no point in calling clk_disable_unprepare() in the error handling path.
Move the out_clk label at the right place.
--- drivers/mmc/host/au1xmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/au1xmmc.c +2 -1
@@ -1097,8 +1097,9 @@ static int au1xmmc_probe(struct platform_device *pdev)if (host->platdata && host->platdata->cd_setup && !(mmc->caps &MMC_CAP_NEEDS_POLL )) host->platdata->cd_setup (mmc,0 ); -out_clk: +clk_disable_unprepare (host->clk); +out_clk:clk_put (host->clk); out_irq:free_irq (host->irq, host);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 296/862 libbpf: Fix crash if SEC("freplace") programs dont have attach_prog_fd set
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 749c202cb6ea40f4d7ac95c4a1217a7b506f43a8 ]
Fix SIGSEGV caused by libbpf trying to find attach type in vmlinux BTF for freplace programs. It's wrong to search in vmlinux BTF and libbpf doesn't even mark vmlinux BTF as required for freplace programs. So trying to search anything in obj->vmlinux_btf might cause NULL dereference if nothing else in BPF object requires vmlinux BTF.
Instead, error out if freplace (EXT) program doesn't specify attach_prog_fd during at the load time.
--- tools/lib/bpf/libbpf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
tools/lib/bpf/libbpf.c +9 -4
@@ -9056,11 +9056,15 @@ static int libbpf_find_attach_btf_id(strint err =0 ;/* BPF program's BTF ID */ -if (attach_prog_fd) { +if (prog->type ==BPF_PROG_TYPE_EXT || attach_prog_fd) { +if (!attach_prog_fd) { +pr_warn ("prog '%s': attach program FD is not set\n" , prog->name); +return -EINVAL ; + } err =libbpf_find_prog_btf_id (attach_name, attach_prog_fd);if (err <0 ) { -pr_warn ("failed to find BPF program (FD %d) BTF ID for '%s': %d\n" , - attach_prog_fd, attach_name, err); +pr_warn ("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %d\n" , + prog->name, attach_prog_fd, attach_name, err);return err; } *btf_obj_fd =0 ;
@@ -9077,7 +9081,8 @@ static int libbpf_find_attach_btf_id(str err =find_kernel_btf_id (prog->obj, attach_name, attach_type, btf_obj_fd, btf_type_id); }if (err) { -pr_warn ("failed to find kernel BTF type ID of '%s': %d\n" , attach_name, err); +pr_warn ("prog '%s': failed to find kernel BTF type ID of '%s': %d\n" , + prog->name, attach_name, err);return err; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 398/862 ASoC: SOF: ipc4-topology: Free the ida when IPC fails in sof_ipc4_widget_setup()
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 61eb0add28023119773d6aab8f402e149473920c ]
The allocated ida needs to be freed up if the IPC message fails since next time when we try again to set up the widget we are going to try to allocate another ID and given enough tries, we are going to run out of unique IDs.
--- sound/soc/sof/ipc4-topology.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/sof/ipc4-topology.c +8 -1
@@ -1544,9 +1544,16 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget msg->data_ptr = ipc_data; ret =sof_ipc_tx_message (sdev->ipc, msg, ipc_size,NULL ,0 ); -if (ret <0 ) +if (ret <0 ) {dev_err (sdev->dev,"failed to create module %s\n" , swidget->widget->name); +if (swidget->id != snd_soc_dapm_scheduler) { +struct sof_ipc4_fw_module *fw_module = swidget->module_info; + +ida_free (&fw_module->m_ida, swidget->instance_id); + } + } +return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 806/862 staging: vt6655: fix potential memory leak
In reply to Greg Kroah-HartmanFrom: Nam Cao <[email protected]>
[ Upstream commit c8ff91535880d41b49699b3829fb6151942de29e ]
In function device_init_td0_ring, memory is allocated for member td_info of priv->apTD0Rings[i], with i increasing from 0. In case of allocation failure, the memory is freed in reversed order, with i decreasing to 0. However, the case i=0 is left out and thus memory is leaked.
Modify the memory freeing loop to include the case i=0.
--- drivers/staging/vt6655/device_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/device_main.c +1 -1
@@ -694,7 +694,7 @@ static int device_init_td0_ring(struct vnt_private *priv)return 0 ; err_free_desc: -while (--i) { +while (i--) { desc = &priv->apTD0Rings[i];kfree (desc->td_info); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 289/862 wifi: mt76: mt7915: fix mcs value in ht mode
In reply to Greg Kroah-HartmanFrom: Howard Hsu <[email protected]>
[ Upstream commit c6d3e16ad4362502e804a6ca01e955612f3b8222 ]
Fix the error that mcs will be reduced to a range of 0 to 7 in ht mode.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +6 -4
@@ -1360,7 +1360,7 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,struct sta_phy phy = {};int ret, nrates =0 ; -#define __sta_phy_bitrate_mask_check (_mcs, _gi, _he) \ +#define __sta_phy_bitrate_mask_check (_mcs, _gi, _ht, _he) \ do { \ u8 i, gi = mask->control[band]._gi; \ gi = (_he) ? gi : gi == NL80211_TXRATE_FORCE_SGI; \
@@ -1373,15 +1373,17 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev,continue ; \ nrates +=hweight16 (mask->control[band]._mcs[i]); \ phy.mcs =ffs (mask->control[band]._mcs[i]) -1 ; \ +if (_ht) \ + phy.mcs +=8 * i; \ } \ }while (0 )if (sta->deflink.he_cap.has_he) { -__sta_phy_bitrate_mask_check (he_mcs, he_gi,1 ); +__sta_phy_bitrate_mask_check (he_mcs, he_gi,0 ,1 ); }else if (sta->deflink.vht_cap.vht_supported) { -__sta_phy_bitrate_mask_check (vht_mcs, gi,0 ); +__sta_phy_bitrate_mask_check (vht_mcs, gi,0 ,0 ); }else if (sta->deflink.ht_cap.ht_supported) { -__sta_phy_bitrate_mask_check (ht_mcs, gi,0 ); +__sta_phy_bitrate_mask_check (ht_mcs, gi,1 ,0 ); }else { nrates =hweight32 (mask->control[band].legacy); phy.mcs =ffs (mask->control[band].legacy) -1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 320/862 i2c: mlxbf: support lock mechanism
In reply to Greg Kroah-HartmanFrom: Asmaa Mnebhi <[email protected]>
[ Upstream commit 86067ccfa1424a26491542d6f6d7546d40b61a10 ]
Linux is not the only entity using the BlueField I2C busses so support a lock mechanism provided by hardware to avoid issues when multiple entities are trying to access the same bus.
The lock is acquired whenever written explicitely or the lock register is read. So make sure it is always released at the end of a successful or failed transaction.
--- drivers/i2c/busses/i2c-mlxbf.c | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-mlxbf.c +39 -5
@@ -306,6 +306,7 @@ static u64 mlxbf_i2c_corepll_frequency;* exact. */ #define MLXBF_I2C_SMBUS_TIMEOUT (300 * 1000)/* 300ms */ +#define MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT (300 * 1000)/* 300ms */ /* Encapsulates timing parameters. */ struct mlxbf_i2c_timings {
@@ -514,6 +515,25 @@ static bool mlxbf_smbus_master_wait_for_idle(struct mlxbf_i2c_priv *priv)return false; } +/* +* wait for the lock to be released before acquiring it. +*/ +static bool mlxbf_i2c_smbus_master_lock (struct mlxbf_i2c_priv *priv) +{ +if (mlxbf_smbus_poll (priv->smbus->io,MLXBF_I2C_SMBUS_MASTER_GW , +MLXBF_I2C_MASTER_LOCK_BIT , true, +MLXBF_I2C_SMBUS_LOCK_POLL_TIMEOUT )) +return true; + +return false; +} + +static void mlxbf_i2c_smbus_master_unlock (struct mlxbf_i2c_priv *priv) +{ +/* Clear the gw to clear the lock */ +writel (0 , priv->smbus->io +MLXBF_I2C_SMBUS_MASTER_GW ); +} +static bool mlxbf_i2c_smbus_transaction_success (u32 master_status,u32 cause_status) {
@@ -705,10 +725,19 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, slave = request->slave &GENMASK (6 ,0 ); addr = slave <<1 ; -/* First of all, check whether the HW is idle. */ -if (WARN_ON (!mlxbf_smbus_master_wait_for_idle (priv))) +/* +* Try to acquire the smbus gw lock before any reads of the GW register since +* a read sets the lock. +*/ +if (WARN_ON (!mlxbf_i2c_smbus_master_lock (priv)))return -EBUSY ; +/* Check whether the HW is idle */ +if (WARN_ON (!mlxbf_smbus_master_wait_for_idle (priv))) { + ret = -EBUSY ; + goto out_unlock; + } +/* Set first byte. */ data_desc[data_idx++] = addr;
@@ -732,8 +761,10 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, write_en =1 ; write_len += operation->length;if (data_idx + operation->length > -MLXBF_I2C_MASTER_DATA_DESC_SIZE ) -return -ENOBUFS ; +MLXBF_I2C_MASTER_DATA_DESC_SIZE ) { + ret = -ENOBUFS ; + goto out_unlock; + }memcpy (data_desc + data_idx, operation->buffer, operation->length); data_idx += operation->length;
@@ -765,7 +796,7 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, ret =mlxbf_i2c_smbus_enable (priv, slave, write_len, block_en, pec_en,0 );if (ret) -return ret; + goto out_unlock; }if (read_en) {
@@ -792,6 +823,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, priv->smbus->io + MLXBF_I2C_SMBUS_MASTER_FSM); } +out_unlock: +mlxbf_i2c_smbus_master_unlock (priv); +return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 843/862 io_uring/net: use io_sr_msg for sendzc
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ upstream commit ac9e5784bbe72f4f603d1af84760ec09bc0b5ccd ]
Reuse struct io_sr_msg for zerocopy sends, which is handy. There is only one zerocopy specific field, namely .notif, and we have enough space for it.
--- io_uring/net.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
io_uring/net.c +5 -13
@@ -60,15 +60,7 @@ struct io_sr_msg {unsigned done_io;unsigned msg_flags;u16 flags; -}; - -struct io_sendzc { -struct file *file; -void __user *buf; -unsigned len; -unsigned done_io; -unsigned msg_flags; -u16 flags; +/* used only for sendzc */ u16 addr_len;void __user *addr;struct io_kiocb *notif;
@@ -188,7 +180,7 @@ static int io_sendmsg_copy_hdr(struct ioint io_sendzc_prep_async (struct io_kiocb *req) { - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);struct io_async_msghdr *io;int ret;
@@ -885,7 +877,7 @@ out_free:void io_sendzc_cleanup (struct io_kiocb *req) { - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg); zc->notif->flags |=REQ_F_CQE_SKIP ;io_notif_flush (zc->notif);
@@ -894,7 +886,7 @@ void io_sendzc_cleanup(struct io_kiocb *int io_sendzc_prep (struct io_kiocb *req,const struct io_uring_sqe *sqe) { - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);struct io_ring_ctx *ctx = req->ctx;struct io_kiocb *notif;
@@ -1000,7 +992,7 @@ static int io_sg_from_iter(struct sock *int io_sendzc (struct io_kiocb *req,unsigned int issue_flags) {struct sockaddr_storage __address, *addr =NULL ; - struct io_sendzc *zc = io_kiocb_to_cmd(req, struct io_sendzc); + struct io_sr_msg *zc = io_kiocb_to_cmd(req, struct io_sr_msg);struct msghdr msg;struct iovec iov;struct socket *sock;
Greg Kroah-Hartman
maintainerPATCH 769/862 ARM: dts: imx7d-sdb: config the max pressure for tsc2046
In reply to Greg Kroah-HartmanFrom: Haibo Chen <[email protected]>
[ Upstream commit e7c4ebe2f9cd68588eb24ba4ed122e696e2d5272 ]
Use the general touchscreen method to config the max pressure for touch tsc2046(data sheet suggest 8 bit pressure), otherwise, for ABS_PRESSURE, when config the same max and min value, weston will meet the following issue,
[17:19:39.183] event1 - ADS7846 Touchscreen: is tagged by udev as: Touchscreen [17:19:39.183] event1 - ADS7846 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE [17:19:39.183] event1 - ADS7846 Touchscreen: was rejected [17:19:39.183] event1 - not using input device '/dev/input/event1'
This will then cause the APP weston-touch-calibrator can't list touch devices.
root@imx6ul7d:~# weston-touch-calibrator could not load cursor 'dnd-move' could not load cursor 'dnd-copy' could not load cursor 'dnd-none' No devices listed.
And accroding to binding Doc, "ti,x-max", "ti,y-max", "ti,pressure-max" belong to the deprecated properties, so remove them. Also for "ti,x-min", "ti,y-min", "ti,x-plate-ohms", the value set in dts equal to the default value in driver, so are redundant, also remove here.
--- arch/arm/boot/dts/imx7d-sdb.dts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/arm/boot/dts/imx7d-sdb.dts +1 -6
@@ -206,12 +206,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 774/862 ARM: dts: imx6sl: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 60c9213a1d9941a8b33db570796c3f9be8984974 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +3 -0
@@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 351/862 drm/bridge: it6505: Power on downstream device in .atomic_enable
In reply to Greg Kroah-HartmanFrom: Pin-Yen Lin <[email protected]>
[ Upstream commit fbc1fdaa8338ec4ebd862d918a0ce3e12033e8a3 ]
Send DPCD DP_SET_POWER_D0 command to the monitor in .atomic_enable callback. Without this command, some monitors won't show up again after changing the resolution.
--- drivers/gpu/drm/bridge/ite-it6505.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/ite-it6505.c +3 -0
@@ -2945,6 +2945,9 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge,if (ret)dev_err (dev,"Failed to setup AVI infoframe: %d" , ret); +it6505_drm_dp_link_set_power (&it6505->aux, &it6505->link, +DP_SET_POWER_D0 ); +it6505_update_video_parameter (it6505, mode); ret =it6505_send_video_infoframe (it6505, &frame);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 841/862 perf intel-pt: Fix system_wide dummy event for hybrid
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 6cef7dab3e2e5cb23a13569c3880c0532326748c upstream.
User space tasks can migrate between CPUs, so when tracing selected CPUs, system-wide sideband is still needed, however evlist->core.has_user_cpus is not set in the hybrid case, so check the target cpu_list instead.
--- tools/perf/arch/x86/util/intel-pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/intel-pt.c +1 -1
@@ -871,7 +871,7 @@ static int intel_pt_recording_options(st* User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed. */ - need_system_wide_tracking = evlist->core.has_user_cpus && + need_system_wide_tracking = opts->target.cpu_list && !intel_pt_evsel->core.attr.exclude_user; tracking_evsel =evlist__add_aux_dummy (evlist, need_system_wide_tracking);
Greg Kroah-Hartman
maintainerPATCH 287/862 wifi: mt76: mt7921: add mt7921_mutex_acquire at mt7921_sta_set_decap_offload
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 59c20b91786d5f140ee7be2f24c242b5f8986046 ]
Add mt7921_mutex_acquire at mt7921_[start, stop]_ap to fix the race with the context holding dev->muxtex and the driver might access the device in low power state.
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +4 -0
@@ -1404,6 +1404,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,struct mt7921_sta *msta = (struct mt7921_sta *)sta->drv_priv;struct mt7921_dev *dev =mt7921_hw_dev (hw); +mt7921_mutex_acquire (dev); +if (enabled)set_bit (MT_WCID_FLAG_HDR_TRANS , &msta->wcid.flags);else
@@ -1411,6 +1413,8 @@ static void mt7921_sta_set_decap_offload(struct ieee80211_hw *hw,mt76_connac_mcu_sta_update_hdr_trans (&dev->mt76, vif, &msta->wcid,MCU_UNI_CMD (STA_REC_UPDATE )); + +mt7921_mutex_release (dev); }#if IS_ENABLED (CONFIG_IPV6 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 343/862 net/ieee802154: reject zero-sized raw_sendmsg()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5 ]
syzbot is hitting skb_assert_len() warning at raw_sendmsg() for ieee802154 socket. What commit dc633700f00f726e ("net/af_packet: check len when min_header_len equals to 0") does also applies to ieee802154 socket.
--- net/ieee802154/socket.c | 3 +++ 1 file changed, 3 insertions(+)
net/ieee802154/socket.c +3 -0
@@ -251,6 +251,9 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)return -EOPNOTSUPP ; } +if (!size) +return -EINVAL ; +lock_sock (sk);if (!sk->sk_bound_dev_if) dev =dev_getfirstbyhwtype (sock_net (sk),ARPHRD_IEEE802154 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 306/862 mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 551e4745c7f218da7070b36a06318592913676ff ]
There are sleep in atomic context bugs when uploading device dump data in mwifiex. The root cause is that dev_coredumpv could not be used in atomic contexts, because it calls dev_set_name which include operations that may sleep. The call tree shows execution paths that could lead to bugs:
(Interrupt context)fw_dump_timer_fn
mwifiex_upload_device_dump
dev_coredumpv(..., GFP_KERNEL)
dev_coredumpm()
kzalloc(sizeof(*devcd), gfp); //may sleep dev_set_name
kobject_set_name_vargs
kvasprintf_const(GFP_KERNEL, ...); //may sleep kstrdup(s, GFP_KERNEL); //may sleep
The corresponding fail log is shown below:
[ 135.275938] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start [ 135.281029] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:265 ... [ 135.293613] Call Trace: [ 135.293613] <IRQ> [ 135.293613] dump_stack_lvl+0x57/0x7d [ 135.293613] __might_resched.cold+0x138/0x173 [ 135.293613] ? dev_coredumpm+0xca/0x2e0 [ 135.293613] kmem_cache_alloc_trace+0x189/0x1f0 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] dev_coredumpm+0xca/0x2e0 [ 135.293613] ? devcd_freev+0x10/0x10 [ 135.293613] dev_coredumpv+0x1c/0x20 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] mwifiex_upload_device_dump+0x65/0xb0 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] call_timer_fn+0x122/0x3d0 [ 135.293613] ? msleep_interruptible+0xb0/0xb0 [ 135.293613] ? lock_downgrade+0x3c0/0x3c0 [ 135.293613] ? __next_timer_interrupt+0x13c/0x160 [ 135.293613] ? lockdep_hardirqs_on_prepare+0xe/0x220 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] __run_timers.part.0+0x3f8/0x540 [ 135.293613] ? call_timer_fn+0x3d0/0x3d0 [ 135.293613] ? arch_restore_msi_irqs+0x10/0x10 [ 135.293613] ? lapic_next_event+0x31/0x40 [ 135.293613] run_timer_softirq+0x4f/0xb0 [ 135.293613] __do_softirq+0x1c2/0x651 ... [ 135.293613] RIP: 0010:default_idle+0xb/0x10 [ 135.293613] RSP: 0018:ffff888006317e68 EFLAGS: 00000246 [ 135.293613] RAX: ffffffff82ad8d10 RBX: ffff888006301cc0 RCX: ffffffff82ac90e1 [ 135.293613] RDX: ffffed100d9ff1b4 RSI: ffffffff831ad140 RDI: ffffffff82ad8f20 [ 135.293613] RBP: 0000000000000003 R08: 0000000000000000 R09: ffff88806cff8d9b [ 135.293613] R10: ffffed100d9ff1b3 R11: 0000000000000001 R12: ffffffff84593410 [ 135.293613] R13: 0000000000000000 R14: 0000000000000000 R15: 1ffff11000c62fd2 ... [ 135.389205] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end
This patch uses delayed work to replace timer and moves the operations that may sleep into a delayed work in order to mitigate bugs, it was tested on Marvell 88W8801 chip whose port is usb and the firmware is usb8801_uapsta.bin. The following is the result after using delayed work to replace timer.
[ 134.936453] usb 1-1: == mwifiex dump information to /sys/class/devcoredump start [ 135.043344] usb 1-1: == mwifiex dump information to /sys/class/devcoredump end
As we can see, there is no bug now.
--- drivers/net/wireless/marvell/mwifiex/init.c | 9 +++++---- drivers/net/wireless/marvell/mwifiex/main.h | 3 ++- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/marvell/mwifiex/init.c +5 -4
@@ -51,9 +51,10 @@ static void wakeup_timer_fn(struct timer_list *t) adapter->if_ops.card_reset (adapter); } -static void fw_dump_timer_fn (struct timer_list *t) +static void fw_dump_work (struct work_struct *work) { -struct mwifiex_adapter *adapter =from_timer (adapter, t, devdump_timer); +struct mwifiex_adapter *adapter = + container_of(work, struct mwifiex_adapter, devdump_work.work);mwifiex_upload_device_dump (adapter); }
@@ -309,7 +310,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->active_scan_triggered = false;timer_setup (&adapter->wakeup_timer, wakeup_timer_fn,0 ); adapter->devdump_len =0 ; -timer_setup (&adapter->devdump_timer, fw_dump_timer_fn,0 ); +INIT_DELAYED_WORK (&adapter->devdump_work, fw_dump_work); }/*
@@ -388,7 +389,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) {del_timer (&adapter->wakeup_timer); -del_timer_sync (&adapter->devdump_timer); +cancel_delayed_work_sync (&adapter->devdump_work);mwifiex_cancel_all_pending_cmd (adapter);wake_up_interruptible (&adapter->cmd_wait_q.wait);wake_up_interruptible (&adapter->hs_activate_wait_q);
drivers/net/wireless/marvell/mwifiex/main.h +2 -1
@@ -37,6 +37,7 @@#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/of_irq.h> +#include <linux/workqueue.h> #include "decl.h" #include "ioctl.h"
@@ -1043,7 +1044,7 @@ struct mwifiex_adapter {/* Device dump data/length */ void *devdump_data;int devdump_len; -struct timer_list devdump_timer; +struct delayed_work devdump_work;bool ignore_btcoex_events; };
drivers/net/wireless/marvell/mwifiex/sta_event.c +3 -3
@@ -611,8 +611,8 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv,* transmission event get lost, in this cornel case, * user would still get partial of the dump. */ -mod_timer (&adapter->devdump_timer, - jiffies +msecs_to_jiffies (MWIFIEX_TIMER_10S )); +schedule_delayed_work (&adapter->devdump_work, +msecs_to_jiffies (MWIFIEX_TIMER_10S )); }/* Overflow check */
@@ -631,7 +631,7 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv,return ; upload_dump: -del_timer_sync (&adapter->devdump_timer); +cancel_delayed_work_sync (&adapter->devdump_work);mwifiex_upload_device_dump (adapter); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 335/862 hwmon: (pmbus/mp2888) Fix sensors readouts for MPS Multi-phase mp2888 controller
In reply to Greg Kroah-HartmanFrom: Oleksandr Shamray <[email protected]>
[ Upstream commit 525dd5aed67a2f4f7278116fb92a24e6a53e2622 ]
Fix scale factors for reading MPS Multi-phase mp2888 controller. Fixed sensors:
- PIN/POUT: based on vendor documentation, set bscale factor 0.5W/LSB
- IOUT: based on vendor documentation, set scale factor 0.25 A/LSB
--- drivers/hwmon/pmbus/mp2888.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/hwmon/pmbus/mp2888.c +6 -7
@@ -34,7 +34,7 @@ struct mp2888_data {int curr_sense_gain; }; -#define to_mp2888_data (x) container_of(x, struct mp2888_data, info) +#define to_mp2888_data (x) container_of(x, struct mp2888_data, info)static int mp2888_read_byte_data (struct i2c_client *client,int page,int reg) {
@@ -109,7 +109,7 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page,* - Kcs is the DrMOS current sense gain of power stage, which is obtained from the * register MP2888_MFR_VR_CONFIG1, bits 13-12 with the following selection of DrMOS * (data->curr_sense_gain): -* 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. +* 00b - 8.5µA/A, 01b - 9.7µA/A, 1b - 10µA/A, 11b - 5µA/A. * - Rcs is the internal phase current sense resistor. This parameter depends on hardware * assembly. By default it is set to 1kΩ. In case of different assembly, user should * scale this parameter by dividing it by Rcs.
@@ -118,10 +118,9 @@ mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page,* because sampling of current occurrence of bit weight has a big deviation, especially for * light load. */ - ret =DIV_ROUND_CLOSEST (ret *100 -9800 , data->curr_sense_gain); - ret = (data->phase_curr_resolution) ? ret *2 : ret; + ret =DIV_ROUND_CLOSEST (ret *200 -19600 , data->curr_sense_gain);/* Scale according to total current resolution. */ - ret = (data->total_curr_resolution) ? ret *8 : ret *4 ; + ret = (data->total_curr_resolution) ? ret *2 : ret;return ret; }
@@ -212,7 +211,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase, ret =pmbus_read_word_data (client, page, phase, reg);if (ret <0 )return ret; - ret = data->total_curr_resolution ? ret *2 : ret; + ret = data->total_curr_resolution ? ret :DIV_ROUND_CLOSEST (ret,2 );break ;case PMBUS_POUT_OP_WARN_LIMIT : ret =pmbus_read_word_data (client, page, phase, reg);
@@ -223,7 +222,7 @@ static int mp2888_read_word_data(struct i2c_client *client, int page, int phase,* set 1. Actual power is reported with 0.5W or 1W respectively resolution. Scaling * is needed to match both. */ - ret = data->total_curr_resolution ? ret *4 : ret *2 ; + ret = data->total_curr_resolution ? ret *2 : ret;break ;/* * The below registers are not implemented by device or implemented not according to the
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 340/862 bnx2x: fix potential memory leak in bnx2x_tpa_stop()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit b43f9acbb8942b05252be83ac25a81cec70cc192 ]
bnx2x_tpa_stop() allocates a memory chunk from new_data with bnx2x_frag_alloc(). The new_data should be freed when gets some error. But when "pad + len > fp->rx_buf_size" is true, bnx2x_tpa_stop() returns without releasing the new_data, which will lead to a memory leak.
We should free the new_data with bnx2x_frag_free() when "pad + len > fp->rx_buf_size" is true.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -0
@@ -789,6 +789,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,BNX2X_ERR ("skb_put is about to fail... pad %d len %d rx_buf_size %d\n" , pad, len, fp->rx_buf_size);bnx2x_panic (); +bnx2x_frag_free (fp, new_data); return; }#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 319/862 libbpf: Dont require full struct enum64 in UAPI headers
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 87dbdc230d162bf9ee1ac77c8ade178b6b1e199e ]
Drop the requirement for system-wide kernel UAPI headers to provide full struct btf_enum64 definition. This is an unexpected requirement that slipped in libbpf 1.0 and put unnecessary pressure ([0]) on users to have a bleeding-edge kernel UAPI header from unreleased Linux 6.0.
To achieve this, we forward declare struct btf_enum64. But that's not enough as there is btf_enum64_value() helper that expects to know the layout of struct btf_enum64. So we get a bit creative with reinterpreting memory layout as array of __u32 and accesing lo32/hi32 fields as array elements. Alternative way would be to have a local pointer variable for anonymous struct with exactly the same layout as struct btf_enum64, but that gets us into C++ compiler errors complaining about invalid type casts. So play it safe, if ugly.
[0] Closes: https://github.com/libbpf/libbpf/issues/562
--- tools/lib/bpf/btf.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
tools/lib/bpf/btf.h +24 -1
@@ -487,6 +487,8 @@ static inline struct btf_enum *btf_enum(const struct btf_type *t)return (struct btf_enum *)(t +1 ); } +struct btf_enum64 ; +static inline struct btf_enum64 *btf_enum64 (const struct btf_type *t) {return (struct btf_enum64 *)(t +1 );
@@ -494,7 +496,28 @@ static inline struct btf_enum64 *btf_enum64(const struct btf_type *t)static inline __u64 btf_enum64_value (const struct btf_enum64 *e) { -return ((__u64 )e->val_hi32 <<32 ) | e->val_lo32; +/* struct btf_enum64 is introduced in Linux 6.0, which is very +* bleeding-edge. Here we are avoiding relying on struct btf_enum64 +* definition coming from kernel UAPI headers to support wider range +* of system-wide kernel headers. +* +* Given this header can be also included from C++ applications, that +* further restricts C tricks we can use (like using compatible +* anonymous struct). So just treat struct btf_enum64 as +* a three-element array of u32 and access second (lo32) and third +* (hi32) elements directly. +* +* For reference, here is a struct btf_enum64 definition: +* +* const struct btf_enum64 { +* __u32 name_off; +* __u32 val_lo32; +* __u32 val_hi32; +* }; +*/ +const __u32 *e64 = (const __u32 *)e; + +return ((__u64 )e64[2 ] <<32 ) | e64[1 ]; }static inline struct btf_member *btf_members (const struct btf_type *t)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 827/862 ext2: Use kvmalloc() for group descriptor array
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit e7c7fbb9a8574ebd89cc05db49d806c7476863ad ]
Array of group descriptor block buffers can get rather large. In theory in can reach 1MB for perfectly valid filesystem and even more for maliciously crafted ones. Use kvmalloc() to allocate the array to avoid straining memory allocator with large order allocations unnecessarily.
--- fs/ext2/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext2/super.c +3 -3
@@ -163,7 +163,7 @@ static void ext2_put_super (struct super_block * sb) db_count = sbi->s_gdb_count;for (i =0 ; i < db_count; i++)brelse (sbi->s_group_desc[i]); -kfree (sbi->s_group_desc); +kvfree (sbi->s_group_desc);kfree (sbi->s_debts);percpu_counter_destroy (&sbi->s_freeblocks_counter);percpu_counter_destroy (&sbi->s_freeinodes_counter);
@@ -1092,7 +1092,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } db_count = (sbi->s_groups_count +EXT2_DESC_PER_BLOCK (sb) -1 ) /EXT2_DESC_PER_BLOCK (sb); - sbi->s_group_desc =kmalloc_array (db_count, + sbi->s_group_desc =kvmalloc_array (db_count,sizeof (struct buffer_head *),GFP_KERNEL );if (sbi->s_group_desc ==NULL ) {
@@ -1218,7 +1218,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)for (i =0 ; i < db_count; i++)brelse (sbi->s_group_desc[i]); failed_mount_group_desc: -kfree (sbi->s_group_desc); +kvfree (sbi->s_group_desc);kfree (sbi->s_debts); failed_mount:brelse (bh);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 359/862 drm:pl111: Add of_node_put() when breaking out of for_each_available_child_of_node()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit e0686dc6f2252e009c455fe99e2ce9d62a60eb47 ]
The reference 'child' in the iteration of for_each_available_child_of_node() is only escaped out into a local variable which is only used to check its value. So we still need to the of_node_put() when breaking of the for_each_available_child_of_node() which will automatically increase and decrease the refcount.
--- drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/pl111/pl111_versatile.c +1 -0
@@ -404,6 +404,7 @@ static int pl111_vexpress_clcd_init(struct device *dev, struct device_node *np,if (of_device_is_compatible (child,"arm,pl111" )) { has_coretile_clcd = true; ct_clcd = child; +of_node_put (child);break ; }if (of_device_is_compatible (child,"arm,hdlcd" )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 413/862 ASoC: rockchip: i2s: use regmap_read_poll_timeout_atomic to poll I2S_CLR
In reply to Greg Kroah-HartmanFrom: Judy Hsiao <[email protected]>
[ Upstream commit f0c8d7468af0001b80b0c86802ee28063f800987 ]
1. Uses regmap_read_poll_timeout_atomic to poll I2S_CLR as it is called within a spin lock.
2. Fixes the typo of break condition in regmap_read_poll_timeout_atomic.
--- sound/soc/rockchip/rockchip_i2s.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +12 -12
@@ -162,12 +162,12 @@ static int rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on) I2S_CLR_TXC | I2S_CLR_RXC);if (ret <0 ) goto end; - ret =regmap_read_poll_timeout (i2s->regmap, -I2S_CLR , - val, - val !=0 , -20 , -200 ); + ret =regmap_read_poll_timeout_atomic (i2s->regmap, +I2S_CLR , + val, + val ==0 , +20 , +200 );if (ret <0 )dev_warn (i2s->dev,"fail to clear: %d\n" , ret); }
@@ -220,12 +220,12 @@ static int rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) I2S_CLR_TXC | I2S_CLR_RXC);if (ret <0 ) goto end; - ret =regmap_read_poll_timeout (i2s->regmap, -I2S_CLR , - val, - val !=0 , -20 , -200 ); + ret =regmap_read_poll_timeout_atomic (i2s->regmap, +I2S_CLR , + val, + val ==0 , +20 , +200 );if (ret <0 )dev_warn (i2s->dev,"fail to clear: %d\n" , ret); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 345/862 net: mvpp2: fix mvpp2 debugfs leak
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit 0152dfee235e87660f52a117fc9f70dc55956bb4 ]
When mvpp2 is unloaded, the driver specific debugfs directory is not removed, which technically leads to a memory leak. However, this directory is only created when the first device is probed, so the hardware is present. Removing the module is only something a developer would to when e.g. testing out changes, so the module would be reloaded. So this memory leak is minor.
The original attempt in commit fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()") that was labelled as a memory leak fix was not, it fixed a refcount leak, but in doing so created a problem when the module is reloaded - the directory already exists, but mvpp2_root is NULL, so we lose all debugfs entries. This fix has been reverted.
This is the alternative fix, where we remove the offending directory whenever the driver is unloaded.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 10 ++++++++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +1 -0
@@ -1530,6 +1530,7 @@ u32 mvpp2_read(struct mvpp2 *priv, u32 offset);void mvpp2_dbgfs_init (struct mvpp2 *priv,const char *name);void mvpp2_dbgfs_cleanup (struct mvpp2 *priv); +void mvpp2_dbgfs_exit (void );void mvpp23_rx_fifo_fc_en (struct mvpp2 *priv,int port,bool en);
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +8 -2
@@ -691,6 +691,13 @@ static int mvpp2_dbgfs_port_init(struct dentry *parent,return 0 ; } +static struct dentry *mvpp2_root; + +void mvpp2_dbgfs_exit (void ) +{ +debugfs_remove (mvpp2_root); +} +void mvpp2_dbgfs_cleanup (struct mvpp2 *priv) {debugfs_remove_recursive (priv->dbgfs_dir);
@@ -700,10 +707,9 @@ void mvpp2_dbgfs_cleanup(struct mvpp2 *priv)void mvpp2_dbgfs_init (struct mvpp2 *priv,const char *name) { -struct dentry *mvpp2_dir, *mvpp2_root; +struct dentry *mvpp2_dir;int ret, i; - mvpp2_root =debugfs_lookup (MVPP2_DRIVER_NAME ,NULL );if (!mvpp2_root) mvpp2_root =debugfs_create_dir (MVPP2_DRIVER_NAME ,NULL );
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +12 -1
@@ -7706,7 +7706,18 @@ static struct platform_driver mvpp2_driver = { }, }; -module_platform_driver (mvpp2_driver); +static int __init mvpp2_driver_init (void ) +{ +return platform_driver_register (&mvpp2_driver); +} +module_init (mvpp2_driver_init); + +static void __exit mvpp2_driver_exit(void) +{ +platform_driver_unregister (&mvpp2_driver); +mvpp2_dbgfs_exit (); +} +module_exit (mvpp2_driver_exit);MODULE_DESCRIPTION ("Marvell PPv2 Ethernet Driver - www.marvell.com" );MODULE_AUTHOR ("Marcin Wojtas <[email protected]>" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 812/862 hid: topre: Add driver fixing report descriptor
In reply to Greg Kroah-HartmanFrom: Harry Stern <[email protected]>
[ Upstream commit a109d5c45b3d6728b9430716b915afbe16eef27c ]
The Topre REALFORCE R2 firmware incorrectly reports that interface descriptor number 1, input report descriptor 2's events are array events rather than variable events. That particular report descriptor is used to report keypresses when there are more than 6 keys held at a time. This bug prevents events from this interface from being registered properly, so only 6 keypresses (from a different interface) can be registered at once, rather than full n-key rollover.
This commit fixes the bug by setting the correct value in a report_fixup function.
The original bug report can be found here:
Thanks to Benjamin Tissoires for diagnosing the issue with the report descriptor.
--- drivers/hid/Kconfig | 6 +++++ drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-topre.c | 49 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 drivers/hid/hid-topre.c
drivers/hid/Kconfig +6 -0
@@ -1141,6 +1141,12 @@ config HID_TOPSEED Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic CLLRCMCE remote control. +config HID_TOPRE + tristate "Topre REALFORCE keyboards" + depends on HID + help + Say Y for N-key rollover support on Topre REALFORCE R2 108 key keyboards. + config HID_THINGM tristate "ThingM blink(1) USB RGB LED" depends on HID
drivers/hid/Makefile +1 -0
@@ -123,6 +123,7 @@ obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o hid-thrustmaster.o obj-$(CONFIG_HID_TIVO) += hid-tivo.o obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o +obj-$(CONFIG_HID_TOPRE) += hid-topre.o obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o obj-$(CONFIG_HID_U2FZERO) += hid-u2fzero.o hid-uclogic-objs := hid-uclogic-core.o \
drivers/hid/hid-ids.h +3 -0
@@ -1231,6 +1231,9 @@#define USB_DEVICE_ID_TIVO_SLIDE 0x1201#define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 +#define USB_VENDOR_ID_TOPRE 0x0853 +#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148 +#define USB_VENDOR_ID_TOPSEED 0x0766#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
drivers/hid/hid-topre.c new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 266/862 wifi: mac80211: mlme: assign link address correctly
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit acdc3e47881d86dc1cb89d4603e3fed90ab150db ]
Right now, we assign the link address only after we add the link to the driver, which is quite obviously wrong. It happens to work in many cases because it gets updated immediately, and then link_conf updates may update it, but it's clearly not really right.
Set the link address during ieee80211_mgd_setup_link() so it's set before telling the driver about the link.
--- net/mac80211/mlme.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/mac80211/mlme.c +2 -3
@@ -6291,6 +6291,8 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link)if (sdata->u.mgd.assoc_data)ether_addr_copy (link->conf->addr, sdata->u.mgd.assoc_data->link[link_id].addr); +else if (!is_valid_ether_addr (link->conf->addr)) +eth_random_addr (link->conf->addr); }/* scan finished notification */
@@ -6378,9 +6380,6 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, goto out_err; } -if (mlo && !is_valid_ether_addr (link->conf->addr)) -eth_random_addr (link->conf->addr); -if (WARN_ON (!ifmgd->auth_data && !ifmgd->assoc_data)) { err = -EINVAL ; goto out_err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 786/862 btrfs: dont print information about space cache or tree every remount
In reply to Greg Kroah-HartmanFrom: Maciej S. Szmigiero <[email protected]>
[ Upstream commit dbecac26630014d336a8e5ea67096ff18210fb9c ]
btrfs currently prints information about space cache or free space tree being in use on every remount, regardless whether such remount actually enabled or disabled one of these features.
This is actually unnecessary since providing remount options changing the state of these features will explicitly print the appropriate notice.
Let's instead print such unconditional information just on an initial mount to avoid filling the kernel log when, for example, laptop-mode-tools remount the fs on some events.
--- fs/btrfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/btrfs/super.c +7 -4
@@ -626,6 +626,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,int saved_compress_level;bool saved_compress_force;int no_compress =0 ; +const bool remounting =test_bit (BTRFS_FS_STATE_REMOUNTING , &info->fs_state);if (btrfs_fs_compat_ro (info,FREE_SPACE_TREE ))btrfs_set_opt (info->mount_opt,FREE_SPACE_TREE );
@@ -1137,10 +1138,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, }if (!ret) ret =btrfs_check_mountopts_zoned (info); -if (!ret &&btrfs_test_opt (info,SPACE_CACHE )) -btrfs_info (info,"disk space caching is enabled" ); -if (!ret &&btrfs_test_opt (info,FREE_SPACE_TREE )) -btrfs_info (info,"using free space tree" ); +if (!ret && !remounting) { +if (btrfs_test_opt (info,SPACE_CACHE )) +btrfs_info (info,"disk space caching is enabled" ); +if (btrfs_test_opt (info,FREE_SPACE_TREE )) +btrfs_info (info,"using free space tree" ); + }return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 396/862 ALSA: hda/hdmi: Fix the converter allocation for the silent stream
In reply to Greg Kroah-HartmanFrom: Jaroslav Kysela <[email protected]>
[ Upstream commit fc6f923ecfa2fafd0600f1b7e2de09baf29865e2 ]
Track the converters handling the silent stream using a new variable to avoid mixing of the open/close and silent stream use. This change ensures the proper allocation of the converters.
--- sound/pci/hda/patch_hdmi.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
sound/pci/hda/patch_hdmi.c +12 -8
@@ -54,6 +54,7 @@ MODULE_PARM_DESC(enable_all_pins, "Forcibly enable all pins");struct hdmi_spec_per_cvt {hda_nid_t cvt_nid;bool assigned;/* the stream has been assigned */ +bool silent_stream;/* silent stream activated */ unsigned int channels_min;unsigned int channels_max;u32 rates;
@@ -988,7 +989,8 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,* of the pin. */ static int hdmi_choose_cvt (struct hda_codec *codec, -int pin_idx,int *cvt_id) +int pin_idx,int *cvt_id, +bool silent) {struct hdmi_spec *spec = codec->spec;struct hdmi_spec_per_pin *per_pin;
@@ -1003,6 +1005,9 @@ static int hdmi_choose_cvt(struct hda_codec *codec,if (per_pin && per_pin->silent_stream) { cvt_idx =cvt_nid_to_cvt_index (codec, per_pin->cvt_nid); + per_cvt =get_cvt (spec, cvt_idx); +if (per_cvt->assigned && !silent) +return -EBUSY ;if (cvt_id) *cvt_id = cvt_idx;return 0 ;
@@ -1013,7 +1018,7 @@ static int hdmi_choose_cvt(struct hda_codec *codec, per_cvt =get_cvt (spec, cvt_idx);/* Must not already be assigned */ -if (per_cvt->assigned) +if (per_cvt->assigned || per_cvt->silent_stream)continue ;if (per_pin ==NULL )break ;
@@ -1199,7 +1204,7 @@ static int hdmi_pcm_open_no_pin(struct hda_pcm_stream *hinfo,if (pcm_idx <0 )return -EINVAL ; - err =hdmi_choose_cvt (codec,-1 , &cvt_idx); + err =hdmi_choose_cvt (codec,-1 , &cvt_idx, false);if (err)return err;
@@ -1267,7 +1272,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, } } - err =hdmi_choose_cvt (codec, pin_idx, &cvt_idx); + err =hdmi_choose_cvt (codec, pin_idx, &cvt_idx, false);if (err <0 ) goto unlock;
@@ -1278,7 +1283,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,set_bit (pcm_idx, &spec->pcm_in_use); per_pin =get_pin (spec, pin_idx); per_pin->cvt_nid = per_cvt->cvt_nid; - per_pin->silent_stream = false; hinfo->nid = per_cvt->cvt_nid;/* flip stripe flag for the assigned stream if supported */
@@ -1760,14 +1764,14 @@ static void silent_stream_enable(struct hda_codec *codec, } pin_idx =pin_id_to_pin_index (codec, per_pin->pin_nid, per_pin->dev_id); - err =hdmi_choose_cvt (codec, pin_idx, &cvt_idx); + err =hdmi_choose_cvt (codec, pin_idx, &cvt_idx, true);if (err) {codec_err (codec,"hdmi: no free converter to enable silent mode\n" ); goto unlock_out; } per_cvt =get_cvt (spec, cvt_idx); - per_cvt->assigned = true; + per_cvt->silent_stream = true; per_pin->cvt_nid = per_cvt->cvt_nid; per_pin->silent_stream = true;
@@ -1827,7 +1831,7 @@ static void silent_stream_disable(struct hda_codec *codec, cvt_idx =cvt_nid_to_cvt_index (codec, per_pin->cvt_nid);if (cvt_idx >=0 && cvt_idx < spec->num_cvts) { per_cvt =get_cvt (spec, cvt_idx); - per_cvt->assigned = false; + per_cvt->silent_stream = false; }if (spec->silent_stream_type ==SILENT_STREAM_I915 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 293/862 Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 812e92b824c1db16c9519f8624d48a9901a0d38f ]
Due to change to switch to use lock_sock inside rfcomm_sk_state_change the socket shutdown/release procedure can cause a deadlock:
rfcomm_sock_shutdown():
lock_sock();
__rfcomm_sock_close():
rfcomm_dlc_close():
__rfcomm_dlc_close():
rfcomm_dlc_lock();
rfcomm_sk_state_change():
lock_sock();To fix this when the call __rfcomm_sock_close is now done without holding the lock_sock since rfcomm_dlc_lock exists to protect the dlc data there is no need to use lock_sock in that code path.
--- net/bluetooth/rfcomm/sock.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/rfcomm/sock.c +3 -0
@@ -902,7 +902,10 @@ static int rfcomm_sock_shutdown(struct socket *sock, int how)lock_sock (sk);if (!sk->sk_shutdown) { sk->sk_shutdown =SHUTDOWN_MASK ; + +release_sock (sk);__rfcomm_sock_close (sk); +lock_sock (sk);if (sock_flag (sk,SOCK_LINGER ) && sk->sk_lingertime && !(current->flags &PF_EXITING ))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 336/862 net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit a91b750fd6629354460282bbf5146c01b05c4859 ]
syzbot is reporting lockdep warning at rds_tcp_reset_callbacks() [1], for commit ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") added cancel_delayed_work_sync() into a section protected by lock_sock() without realizing that rds_send_xmit() might call lock_sock().
We don't need to protect cancel_delayed_work_sync() using lock_sock(), for even if rds_{send,recv}_worker() re-queued this work while __flush_work()
from cancel_delayed_work_sync() was waiting for this work to complete,
retried rds_{send,recv}_worker() is no-op due to the absence of RDS_CONN_UP bit.
--- net/rds/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/tcp.c +1 -1
@@ -166,10 +166,10 @@ void rds_tcp_reset_callbacks(struct socket *sock,*/ atomic_set (&cp->cp_state,RDS_CONN_RESETTING );wait_event (cp->cp_waitq, !test_bit (RDS_IN_XMIT , &cp->cp_flags)); -lock_sock (osock->sk);/* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync (&cp->cp_send_w);cancel_delayed_work_sync (&cp->cp_recv_w); +lock_sock (osock->sk);if (tc->t_tinc) {rds_inc_put (&tc->t_tinc->ti_inc); tc->t_tinc =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 370/862 ASoC: tas2764: Fix mute/unmute
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
[ Upstream commit f5ad67f13623548e5aff847f89700c178aaf2a98 ]
Because the PWR_CTRL field is modeled as the power state of the DAC widget, and at the same time it is used to implement mute/unmute, we need some additional book-keeping to have the right end result no matter the sequence of calls. Without this fix, one permanently mutes an ongoing stream by toggling the associated speaker pin control.
(This mirrors commit 1e5907bcb3a3 ("ASoC: tas2770: Fix handling of mute/unmute") which was a fix to the tas2770 driver.)
--- sound/soc/codecs/tas2764.c | 57 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 25 deletions(-)
sound/soc/codecs/tas2764.c +32 -25
@@ -34,6 +34,9 @@ struct tas2764_priv {int v_sense_slot;int i_sense_slot; + +bool dac_powered; +bool unmuted; };static void tas2764_reset (struct tas2764_priv *tas2764)
@@ -50,6 +53,26 @@ static void tas2764_reset(struct tas2764_priv *tas2764)usleep_range (1000 ,2000 ); } +static int tas2764_update_pwr_ctrl (struct tas2764_priv *tas2764) +{ +struct snd_soc_component *component = tas2764->component; +unsigned int val; +int ret; + +if (tas2764->dac_powered) + val = tas2764->unmuted ? +TAS2764_PWR_CTRL_ACTIVE :TAS2764_PWR_CTRL_MUTE ; +else + val =TAS2764_PWR_CTRL_SHUTDOWN ; + + ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , +TAS2764_PWR_CTRL_MASK , val); +if (ret <0 ) +return ret; + +return 0 ; +} +#ifdef CONFIG_PM static int tas2764_codec_suspend (struct snd_soc_component *component) {
@@ -82,9 +105,7 @@ static int tas2764_codec_resume(struct snd_soc_component *component)usleep_range (1000 ,2000 ); } - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_ACTIVE ); + ret =tas2764_update_pwr_ctrl (tas2764);if (ret <0 )return ret;
@@ -118,14 +139,12 @@ static int tas2764_dac_event(struct snd_soc_dapm_widget *w,switch (event) {case SND_SOC_DAPM_POST_PMU : - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_MUTE ); + tas2764->dac_powered = true; + ret =tas2764_update_pwr_ctrl (tas2764);break ;case SND_SOC_DAPM_PRE_PMD : - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_SHUTDOWN ); + tas2764->dac_powered = false; + ret =tas2764_update_pwr_ctrl (tas2764);break ;default :dev_err (tas2764->dev,"Unsupported event\n" );
@@ -170,17 +189,11 @@ static const struct snd_soc_dapm_route tas2764_audio_map[] = {static int tas2764_mute (struct snd_soc_dai *dai,int mute,int direction) { -struct snd_soc_component *component = dai->component; -int ret; - - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , - mute ?TAS2764_PWR_CTRL_MUTE :0 ); +struct tas2764_priv *tas2764 = +snd_soc_component_get_drvdata (dai->component); -if (ret <0 ) -return ret; - -return 0 ; + tas2764->unmuted = !mute; +return tas2764_update_pwr_ctrl (tas2764); }static int tas2764_set_bitwidth (struct tas2764_priv *tas2764,int bitwidth)
@@ -494,12 +507,6 @@ static int tas2764_codec_probe(struct snd_soc_component *component)if (ret <0 )return ret; - ret =snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_MUTE ); -if (ret <0 ) -return ret; -return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 808/862 ata: libahci_platform: Sanity check the DT child nodes number
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 3c132ea6508b34956e5ed88d04936983ec230601 ]
Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical from the further AHCI-platform initialization point of view since exceeding the ports upper limit will cause allocating more resources than will be used afterwards. But detecting too many child DT-nodes doesn't seem right since it's very unlikely to have it on an ordinary platform. In accordance with the AHCI specification there can't be more than 32 ports implemented at least due to having the CAP.NP field of 5 bits wide and the PI register of dword size. Thus if such situation is found the DTB must have been corrupted and the data read from it shouldn't be reliable. Let's consider that as an erroneous situation and halt further resources allocation.
Note it's logically more correct to have the nports set only after the initialization value is checked for being sane. So while at it let's make sure nports is assigned with a correct value.
--- drivers/ata/libahci_platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +12 -2
@@ -451,14 +451,24 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, } } - hpriv->nports = child_nodes =of_get_child_count (dev->of_node); +/* +* Too many sub-nodes most likely means having something wrong with +* the firmware. +*/ + child_nodes =of_get_child_count (dev->of_node); +if (child_nodes >AHCI_MAX_PORTS ) { + rc = -EINVAL ; + goto err_out; + }/* * If no sub-node was found, we still need to set nports to * one in order to be able to use the * ahci_platform_[en|dis]able_[phys|regulators] functions. */ -if (!child_nodes) +if (child_nodes) + hpriv->nports = child_nodes; +else hpriv->nports =1 ; hpriv->phys =devm_kcalloc (dev, hpriv->nports,sizeof (*hpriv->phys),GFP_KERNEL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 292/862 wifi: mt76: mt7921e: fix rmmod crash in driver reload test
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit b5a62d612b7baf6e09884e4de94decb6391d6a9d ]
In insmod/rmmod stress test, the following crash dump shows up immediately. The problem is caused by missing mt76_dev in mt7921_pci_remove(). We should make sure the drvdata is ready before probe() finished.
[168.862789] ================================================================== [168.862797] BUG: KASAN: user-memory-access in try_to_grab_pending+0x59/0x480 [168.862805] Write of size 8 at addr 0000000000006df0 by task rmmod/5361 [168.862812] CPU: 7 PID: 5361 Comm: rmmod Tainted: G OE 5.19.0-rc6 #1 [168.862816] Hardware name: Intel(R) Client Systems NUC8i7BEH/NUC8BEB, 05/04/2020 [168.862820] Call Trace: [168.862822] <TASK> [168.862825] dump_stack_lvl+0x49/0x63 [168.862832] print_report.cold+0x493/0x6b7 [168.862845] kasan_report+0xa7/0x120 [168.862857] kasan_check_range+0x163/0x200 [168.862861] __kasan_check_write+0x14/0x20 [168.862866] try_to_grab_pending+0x59/0x480 [168.862870] __cancel_work_timer+0xbb/0x340 [168.862898] cancel_work_sync+0x10/0x20 [168.862902] mt7921_pci_remove+0x61/0x1c0 [mt7921e] [168.862909] pci_device_remove+0xa3/0x1d0 [168.862914] device_remove+0xc4/0x170 [168.862920] device_release_driver_internal+0x163/0x300 [168.862925] driver_detach+0xc7/0x1a0 [168.862930] bus_remove_driver+0xeb/0x2d0 [168.862935] driver_unregister+0x71/0xb0 [168.862939] pci_unregister_driver+0x30/0x230 [168.862944] mt7921_pci_driver_exit+0x10/0x1b [mt7921e] [168.862949] __x64_sys_delete_module+0x2f9/0x4b0 [168.862968] do_syscall_64+0x38/0x90 [168.862973] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Test steps:
1. insmode
2. do not ifup
3. rmmod quickly (within 1 second)
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +2 -0
@@ -288,6 +288,8 @@ static int mt7921_pci_probe(struct pci_dev *pdev, goto err_free_pci_vec; } +pci_set_drvdata (pdev, mdev); + dev = container_of(mdev, struct mt7921_dev, mt76); dev->hif_ops = &mt7921_pcie_ops;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 363/862 platform/chrome: fix double-free in chromeos_laptop_prepare()
In reply to Greg Kroah-HartmanFrom: Rustam Subkhankulov <[email protected]>
[ Upstream commit 6ad4194d6a1e1d11b285989cd648ef695b4a93c0 ]
If chromeos_laptop_prepare_i2c_peripherals() fails after allocating memory for 'cros_laptop->i2c_peripherals', this memory is freed at 'err_out' label and nonzero value is returned. Then chromeos_laptop_destroy() is called, resulting in double-free error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/platform/chrome/chromeos_laptop.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/platform/chrome/chromeos_laptop.c +13 -11
@@ -740,6 +740,7 @@ static int __init chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, const struct chromeos_laptop *src) { + struct i2c_peripheral *i2c_peripherals;struct i2c_peripheral *i2c_dev;struct i2c_board_info *info;int i;
@@ -748,17 +749,15 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,if (!src->num_i2c_peripherals)return 0 ; - cros_laptop->i2c_peripherals =kmemdup (src->i2c_peripherals, - src->num_i2c_peripherals * -sizeof (*src->i2c_peripherals), -GFP_KERNEL ); -if (!cros_laptop->i2c_peripherals) + i2c_peripherals =kmemdup (src->i2c_peripherals, + src->num_i2c_peripherals * +sizeof (*src->i2c_peripherals), +GFP_KERNEL ); +if (!i2c_peripherals)return -ENOMEM ; - cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; - -for (i =0 ; i < cros_laptop->num_i2c_peripherals; i++) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; +for (i =0 ; i < src->num_i2c_peripherals; i++) { + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info; error =chromeos_laptop_setup_irq (i2c_dev);
@@ -775,16 +774,19 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop, } } + cros_laptop->i2c_peripherals = i2c_peripherals; + cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals; +return 0 ; err_out:while (--i >=0 ) { - i2c_dev = &cros_laptop->i2c_peripherals[i]; + i2c_dev = &i2c_peripherals[i]; info = &i2c_dev->board_info;if (!IS_ERR_OR_NULL (info->fwnode))fwnode_remove_software_node (info->fwnode); } -kfree (cros_laptop->i2c_peripherals); +kfree (i2c_peripherals);return error; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 303/862 bpftool: Fix wrong cgroup attach flags being assigned to effective progs
In reply to Greg Kroah-HartmanFrom: Pu Lehui <[email protected]>
[ Upstream commit bdcee1b0b0834d031c76a12209840afe949b048a ]
When root-cgroup attach multi progs and sub-cgroup attach a override prog, bpftool will display incorrectly for the attach flags of the sub-cgroup’s effective progs:
$ bpftool cgroup tree /sys/fs/cgroup effective CgroupPath ID AttachType AttachFlags Name /sys/fs/cgroup 6 cgroup_sysctl multi sysctl_tcp_mem 13 cgroup_sysctl multi sysctl_tcp_mem /sys/fs/cgroup/cg1 20 cgroup_sysctl override sysctl_tcp_mem 6 cgroup_sysctl override sysctl_tcp_mem <- wrong 13 cgroup_sysctl override sysctl_tcp_mem <- wrong /sys/fs/cgroup/cg1/cg2 20 cgroup_sysctl sysctl_tcp_mem 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem
Attach flags is only valid for attached progs of this layer cgroup, but not for effective progs. For querying with EFFECTIVE flags, exporting attach flags does not make sense. So let's remove the AttachFlags field and the associated logic. After this patch, the above effective cgroup tree will show as bellow:
$ bpftool cgroup tree /sys/fs/cgroup effective CgroupPath ID AttachType Name /sys/fs/cgroup 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem /sys/fs/cgroup/cg1 20 cgroup_sysctl sysctl_tcp_mem 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem /sys/fs/cgroup/cg1/cg2 20 cgroup_sysctl sysctl_tcp_mem 6 cgroup_sysctl sysctl_tcp_mem 13 cgroup_sysctl sysctl_tcp_mem
--- tools/bpf/bpftool/cgroup.c | 54 ++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-)
tools/bpf/bpftool/cgroup.c +49 -5
@@ -136,8 +136,8 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type,jsonw_string_field (json_wtr,"attach_type" , attach_type_str); else jsonw_uint_field(json_wtr, "attach_type", attach_type); -jsonw_string_field (json_wtr,"attach_flags" , - attach_flags_str); +if (!(query_flags &BPF_F_QUERY_EFFECTIVE )) +jsonw_string_field (json_wtr,"attach_flags" , attach_flags_str);jsonw_string_field (json_wtr,"name" , prog_name);if (attach_btf_name)jsonw_string_field (json_wtr,"attach_btf_name" , attach_btf_name);
@@ -150,7 +150,10 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type,printf ("%-15s" , attach_type_str); else printf("type %-10u", attach_type); -printf (" %-15s %-15s" , attach_flags_str, prog_name); +if (query_flags &BPF_F_QUERY_EFFECTIVE ) +printf (" %-15s" , prog_name); +else +printf (" %-15s %-15s" , attach_flags_str, prog_name);if (attach_btf_name)printf (" %-15s" , attach_btf_name);else if (info.attach_btf_id)
@@ -195,6 +198,32 @@ static int cgroup_has_attached_progs(int cgroup_fd)return no_prog ?0 :1 ; } + +static int show_effective_bpf_progs (int cgroup_fd,enum bpf_attach_type type, +int level) +{ +LIBBPF_OPTS (bpf_prog_query_opts, p); +__u32 prog_ids[1024 ] = {0 }; +__u32 iter; +int ret; + + p.query_flags = query_flags; + p.prog_cnt =ARRAY_SIZE (prog_ids); + p.prog_ids = prog_ids; + + ret =bpf_prog_query_opts (cgroup_fd, type, &p); +if (ret) +return ret; + +if (p.prog_cnt ==0 ) +return 0 ; + +for (iter =0 ; iter < p.prog_cnt; iter++) +show_bpf_prog (prog_ids[iter], type,NULL , level); + +return 0 ; +} +static int show_attached_bpf_progs (int cgroup_fd,enum bpf_attach_type type,int level) {
@@ -245,6 +274,14 @@ static int show_attached_bpf_progs(int cgroup_fd, enum bpf_attach_type type,return 0 ; } +static int show_bpf_progs (int cgroup_fd,enum bpf_attach_type type, +int level) +{ +return query_flags &BPF_F_QUERY_EFFECTIVE ? +show_effective_bpf_progs (cgroup_fd, type, level) : +show_attached_bpf_progs (cgroup_fd, type, level); +} +static int do_show (int argc,char **argv) {enum bpf_attach_type type;
@@ -292,6 +329,8 @@ static int do_show(int argc, char **argv)if (json_output)jsonw_start_array (json_wtr); +else if (query_flags &BPF_F_QUERY_EFFECTIVE ) +printf ("%-8s %-15s %-15s\n" ,"ID" ,"AttachType" ,"Name" );else printf ("%-8s %-15s %-15s %-15s\n" ,"ID" ,"AttachType" ,"AttachFlags" ,"Name" );
@@ -304,7 +343,7 @@ static int do_show(int argc, char **argv)* If we were able to get the show for at least one * attach type, let's return 0. */ -if (show_attached_bpf_progs (cgroup_fd, type,0 ) ==0 ) +if (show_bpf_progs (cgroup_fd, type,0 ) ==0 ) ret =0 ; }
@@ -362,7 +401,7 @@ static int do_show_tree_fn(const char *fpath, const struct stat *sb, btf_vmlinux =libbpf_find_kernel_btf ();for (type =0 ; type < __MAX_BPF_ATTACH_TYPE; type++) -show_attached_bpf_progs (cgroup_fd, type, ftw->level); +show_bpf_progs (cgroup_fd, type, ftw->level);if (errno ==EINVAL )/* Last attach type does not support query.
@@ -436,6 +475,11 @@ static int do_show_tree(int argc, char **argv)if (json_output)jsonw_start_array (json_wtr); +else if (query_flags &BPF_F_QUERY_EFFECTIVE ) +printf ("%s\n" +"%-8s %-15s %-15s\n" , +"CgroupPath" , +"ID" ,"AttachType" ,"Name" );else printf("%s\n" "%-8s %-15s %-15s %-15s\n",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 785/862 btrfs: scrub: try to fix super block errors
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit f9eab5f0bba76742af654f33d517bf62a0db8f12 ]
[BUG]
The following script shows that, although scrub can detect super block errors, it never tries to fix it:
mkfs.btrfs -f -d raid1 -m raid1 $dev1 $dev2 xfs_io -c "pwrite 67108864 4k" $dev2
mount $dev1 $mnt
btrfs scrub start -B $dev2
btrfs scrub start -Br $dev2
umount $mnt
The first scrub reports the super error correctly:
scrub done for f3289218-abd3-41ac-a630-202f766c0859
Scrub started: Tue Aug 2 14:44:11 2022
Status: finished
Duration: 0:00:00
Total to scrub: 1.26GiB
Rate: 0.00B/s
Error summary: super=1
Corrected: 0
Uncorrectable: 0
Unverified: 0But the second read-only scrub still reports the same super error:
Scrub started: Tue Aug 2 14:44:11 2022
Status: finished
Duration: 0:00:00
Total to scrub: 1.26GiB
Rate: 0.00B/s
Error summary: super=1
Corrected: 0
Uncorrectable: 0
Unverified: 0[CAUSE]
The comments already shows that super block can be easily fixed by committing a transaction:
/*
* If we find an error in a super block, we just report it.
* They will get written with the next transaction commit
* anyway
*/
But the truth is, such assumption is not always true, and since scrub should try to repair every error it found (except for read-only scrub), we should really actively commit a transaction to fix this.
[FIX]
Just commit a transaction if we found any super block errors, after everything else is done.
We cannot do this just after scrub_supers(), as btrfs_commit_transaction() will try to pause and wait for the running scrub, thus we can not call it with scrub_lock hold.
--- fs/btrfs/scrub.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
fs/btrfs/scrub.c +36 -0
@@ -4093,6 +4093,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,int ret;struct btrfs_device *dev;unsigned int nofs_flag; +bool need_commit = false;if (btrfs_fs_closing (fs_info))return -EAGAIN ;
@@ -4196,6 +4197,12 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,*/ nofs_flag =memalloc_nofs_save ();if (!is_dev_replace) { +u64 old_super_errors; + +spin_lock (&sctx->stat_lock); + old_super_errors = sctx->stat.super_errors; +spin_unlock (&sctx->stat_lock); +btrfs_info (fs_info,"scrub: started on devid %llu" , devid);/* * by holding device list mutex, we can
@@ -4204,6 +4211,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,mutex_lock (&fs_info->fs_devices->device_list_mutex); ret =scrub_supers (sctx, dev);mutex_unlock (&fs_info->fs_devices->device_list_mutex); + +spin_lock (&sctx->stat_lock); +/* +* Super block errors found, but we can not commit transaction +* at current context, since btrfs_commit_transaction() needs +* to pause the current running scrub (hold by ourselves). +*/ +if (sctx->stat.super_errors > old_super_errors && !sctx->readonly) + need_commit = true; +spin_unlock (&sctx->stat_lock); }if (!ret)
@@ -4230,6 +4247,25 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,scrub_workers_put (fs_info);scrub_put_ctx (sctx); +/* +* We found some super block errors before, now try to force a +* transaction commit, as scrub has finished. +*/ +if (need_commit) { +struct btrfs_trans_handle *trans; + + trans =btrfs_start_transaction (fs_info->tree_root,0 ); +if (IS_ERR (trans)) { + ret =PTR_ERR (trans); +btrfs_err (fs_info, +"scrub: failed to start transaction to fix super block errors: %d" , ret); +return ret; + } + ret =btrfs_commit_transaction (trans); +if (ret <0 ) +btrfs_err (fs_info, +"scrub: failed to commit transaction to fix super block errors: %d" , ret); + }return ret; out:scrub_workers_put (fs_info);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 360/862 ASoC: mt6359: fix tests for platform_get_irq() failure
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 51eea3a6fb4d39c2cc71824e6eee5949d7ae4d1c ]
The platform_get_irq() returns negative error codes. It can't actually return zero, but if it did that should be treated as success.
--- sound/soc/codecs/mt6359-accdet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/mt6359-accdet.c +3 -3
@@ -965,7 +965,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev)mutex_init (&priv->res_lock); priv->accdet_irq =platform_get_irq (pdev,0 ); -if (priv->accdet_irq) { +if (priv->accdet_irq >=0 ) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_irq, NULL, mt6359_accdet_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
@@ -979,7 +979,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev)if (priv->caps &ACCDET_PMIC_EINT0 ) { priv->accdet_eint0 =platform_get_irq (pdev,1 ); -if (priv->accdet_eint0) { +if (priv->accdet_eint0 >=0 ) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint0, NULL, mt6359_accdet_irq,
@@ -994,7 +994,7 @@ static int mt6359_accdet_probe(struct platform_device *pdev) } }else if (priv->caps &ACCDET_PMIC_EINT1 ) { priv->accdet_eint1 =platform_get_irq (pdev,2 ); -if (priv->accdet_eint1) { +if (priv->accdet_eint1 >=0 ) { ret = devm_request_threaded_irq(&pdev->dev, priv->accdet_eint1, NULL, mt6359_accdet_irq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 323/862 netfilter: nft_fib: Fix for rpath check with VRF devices
In reply to Greg Kroah-HartmanFrom: Phil Sutter <[email protected]>
[ Upstream commit 2a8a7c0eaa8747c16aa4a48d573aa920d5c00a5c ]
Analogous to commit b575b24b8eee3 ("netfilter: Fix rpfilter dropping vrf packets by mistake") but for nftables fib expression:
Add special treatment of VRF devices so that typical reverse path filtering via 'fib saddr . iif oif' expression works as expected.
--- net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++ net/ipv6/netfilter/nft_fib_ipv6.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-)
net/ipv4/netfilter/nft_fib_ipv4.c +3 -0
@@ -83,6 +83,9 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,else oif =NULL ; +if (priv->flags &NFTA_FIB_F_IIF ) + fl4.flowi4_oif =l3mdev_master_ifindex_rcu (oif); +if (nft_hook (pkt) ==NF_INET_PRE_ROUTING &&nft_fib_is_loopback (pkt->skb,nft_in (pkt))) {nft_fib_store_result (dest, priv,nft_in (pkt));
net/ipv6/netfilter/nft_fib_ipv6.c +5 -1
@@ -41,6 +41,9 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,if (ipv6_addr_type (&fl6->daddr) &IPV6_ADDR_LINKLOCAL ) { lookup_flags |=RT6_LOOKUP_F_IFACE ; fl6->flowi6_oif =get_ifindex (dev ? dev : pkt->skb->dev); + }else if ((priv->flags &NFTA_FIB_F_IIF ) && + (netif_is_l3_master (dev) ||netif_is_l3_slave (dev))) { + fl6->flowi6_oif = dev->ifindex; }if (ipv6_addr_type (&fl6->saddr) &IPV6_ADDR_UNICAST )
@@ -197,7 +200,8 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,if (rt->rt6i_flags & (RTF_REJECT |RTF_ANYCAST |RTF_LOCAL )) goto put_rt_err; -if (oif && oif != rt->rt6i_idev->dev) +if (oif && oif != rt->rt6i_idev->dev && +l3mdev_master_ifindex_rcu (rt->rt6i_idev->dev) != oif->ifindex) goto put_rt_err;nft_fib_store_result (dest, priv, rt->rt6i_idev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 842/862 io_uring/net: refactor io_sr_msg types
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ upstream commit 0b048557db761d287777360a100e1d010760d209 ]
In preparation for using struct io_sr_msg for zerocopy sends, clean up types. First, flags can be u16 as it's provided by the userspace in u16 ioprio, as well as addr_len. This saves us 4 bytes. Also use unsigned for size and done_io, both are as well limited to u32.
--- io_uring/net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
io_uring/net.c +7 -7
@@ -56,21 +56,21 @@ struct io_sr_msg {struct user_msghdr __user *umsg;void __user *buf; }; +unsigned len; +unsigned done_io;unsigned msg_flags; -unsigned flags; -size_t len; -size_t done_io; +u16 flags; };struct io_sendzc {struct file *file;void __user *buf; -size_t len; +unsigned len; +unsigned done_io;unsigned msg_flags; -unsigned flags; -unsigned addr_len; +u16 flags; +u16 addr_len;void __user *addr; -size_t done_io;struct io_kiocb *notif; };
Greg Kroah-Hartman
maintainerPATCH 776/862 ARM: dts: imx6sx: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 415432c008b2bce8138841356ba444631cabaa50 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6sx.dtsi +6 -0
@@ -164,12 +164,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 272/862 wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration
In reply to Greg Kroah-HartmanFrom: Bitterblue Smith <[email protected]>
[ Upstream commit e963a19c64ac0d2f8785d36a27391abd91ac77aa ]
Found by comparing with the vendor driver. Currently this affects only the RTL8192EU, which is the only gen2 chip with 2 TX paths supported by this driver. It's unclear what kind of effect the mistake had in practice, since I don't have any RTL8192EU devices to test it.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2 -2
@@ -2929,12 +2929,12 @@ bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, }if (!(simubitmap &0x30 ) && priv->tx_paths >1 ) { -/* path B RX OK */ +/* path B TX OK */ for (i =4 ; i <6 ; i++) result[3 ][i] = result[c1][i]; } -if (!(simubitmap &0x30 ) && priv->tx_paths >1 ) { +if (!(simubitmap &0xc0 ) && priv->tx_paths >1 ) {/* path B RX OK */ for (i =6 ; i <8 ; i++) result[3 ][i] = result[c1][i];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 329/862 eth: alx: take rtnl_lock on resume
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 6ad1c94e1e7e374d88f0cfd77936dddb8339aaba ]
Zbynek reports that alx trips an rtnl assertion on resume:
RTNL: assertion failed at net/core/dev.c (2891)
RIP: 0010:netif_set_real_num_tx_queues+0x1ac/0x1c0 Call Trace: <TASK> __alx_open+0x230/0x570 [alx] alx_resume+0x54/0x80 [alx] ? pci_legacy_resume+0x80/0x80 dpm_run_callback+0x4a/0x150 device_resume+0x8b/0x190 async_resume+0x19/0x30 async_run_entry_fn+0x30/0x130 process_one_work+0x1e5/0x3b0
indeed the driver does not hold rtnl_lock during its internal close and re-open functions during suspend/resume. Note that this is not a huge bug as the driver implements its own locking, and does not implement changing the number of queues, but we need to silence the splat.
--- drivers/net/ethernet/atheros/alx/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/atheros/alx/main.c +5 -0
@@ -1912,11 +1912,14 @@ static int alx_suspend(struct device *dev)if (!netif_running (alx->dev))return 0 ; + +rtnl_lock ();netif_device_detach (alx->dev);mutex_lock (&alx->mtx);__alx_stop (alx);mutex_unlock (&alx->mtx); +rtnl_unlock ();return 0 ; }
@@ -1927,6 +1930,7 @@ static int alx_resume(struct device *dev)struct alx_hw *hw = &alx->hw;int err; +rtnl_lock ();mutex_lock (&alx->mtx);alx_reset_phy (hw);
@@ -1943,6 +1947,7 @@ static int alx_resume(struct device *dev) unlock:mutex_unlock (&alx->mtx); +rtnl_unlock ();return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 819/862 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit a6fc2f1b092787e9d7dbe472d720cede81680315 ]
This selects the SOF/ITP counter be running on ref_clk. As documented U2_FREECLK_EXISTS has to be set to 0 as well.
--- drivers/usb/dwc3/core.c | 8 +++++++- drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +7 -1
@@ -407,6 +407,10 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) reg |=FIELD_PREP (DWC3_GFLADJ_REFCLK_FLADJ_MASK , fladj) |FIELD_PREP (DWC3_GFLADJ_240MHZDECR , decr >>1 ) |FIELD_PREP (DWC3_GFLADJ_240MHZDECR_PLS1 , decr &1 ); + +if (dwc->gfladj_refclk_lpm_sel) + reg |=DWC3_GFLADJ_REFCLK_LPM_SEL ; +dwc3_writel (dwc->regs,DWC3_GFLADJ , reg); }
@@ -788,7 +792,7 @@ static int dwc3_phy_setup(struct dwc3 *dwc)else reg |=DWC3_GUSB2PHYCFG_ENBLSLPM ; -if (dwc->dis_u2_freeclk_exists_quirk) +if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS ;dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg);
@@ -1524,6 +1528,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-tx-ipgap-linecheck-quirk"); dwc->parkmode_disable_ss_quirk =device_property_read_bool (dev,"snps,parkmode-disable-ss-quirk" ); + dwc->gfladj_refclk_lpm_sel =device_property_read_bool (dev, +"snps,gfladj-refclk-lpm-sel-quirk" ); dwc->tx_de_emphasis_quirk =device_property_read_bool (dev,"snps,tx_de_emphasis_quirk" );
drivers/usb/dwc3/core.h +2 -0
@@ -391,6 +391,7 @@#define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7)#define DWC3_GFLADJ_30MHZ_MASK 0x3f#define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8) +#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23)#define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24)#define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31)
@@ -1312,6 +1313,7 @@ struct dwc3 { unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 386/862 ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON
In reply to Greg Kroah-HartmanFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 404bec4c8f6c38ae5fa208344f1086d38026e93d ]
Here we're using function mtk_adsp_dump() from mtk-adsp-common:
explicitly import its namespace.
--- sound/soc/sof/mediatek/mt8195/mt8195.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/mediatek/mt8195/mt8195.c +1 -0
@@ -652,4 +652,5 @@ static struct platform_driver snd_sof_of_mt8195_driver = {module_platform_driver (snd_sof_of_mt8195_driver);MODULE_IMPORT_NS (SND_SOC_SOF_XTENSA ); +MODULE_IMPORT_NS (SND_SOC_SOF_MTK_COMMON );MODULE_LICENSE ("Dual BSD/GPL" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 447/862 ARM: Drop CMDLINE_* dependency on ATAGS
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 136f4b1ec7c962ee37a787e095fd37b058d72bd3 ]
On arm32, the configuration options to specify the kernel command line type depend on ATAGS. However, the actual CMDLINE cofiguration option does not depend on ATAGS, and the code that handles this is not specific to ATAGS (see drivers/of/fdt.c:early_init_dt_scan_chosen()).
Hence users who desire to override the kernel command line on arm32 must enable support for ATAGS, even on a pure-DT system. Other architectures (arm64, loongarch, microblaze, nios2, powerpc, and riscv) do not impose such a restriction.
Hence drop the dependency on ATAGS.
--- arch/arm/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm/Kconfig +0 -1
@@ -1671,7 +1671,6 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 357/862 drm/format-helper: Fix test on big endian architectures
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit 18c8485236a5e3f491b670c018ae391c9cb84dfa ]
The tests fail on big endian architectures, like PowerPC:
$ ./tools/testing/kunit/kunit.py run \ --kunitconfig=drivers/gpu/drm/tests \ --arch=powerpc --cross_compile=powerpc64-linux-gnu-
Transform the XRGB8888 buffer from little endian to the CPU endian before calling the conversion function to avoid this error.
--- .../gpu/drm/tests/drm_format_helper_test.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/tests/drm_format_helper_test.c +21 -2
@@ -111,6 +111,21 @@ static size_t conversion_buf_size(u32 dst_format, unsigned int dst_pitch,return dst_pitch *drm_rect_height (clip); } +static u32 *le32buf_to_cpu (struct kunit *test,const u32 *buf,size_t buf_size) +{ +u32 *dst =NULL ; +int n; + + dst =kunit_kzalloc (test,sizeof (*dst) * buf_size,GFP_KERNEL ); +if (!dst) +return NULL ; + +for (n =0 ; n < buf_size; n++) + dst[n] =le32_to_cpu ((__force __le32 )buf[n]); + +return dst; +} +static void xrgb8888_to_rgb332_case_desc (struct xrgb8888_to_rgb332_case *t,char *desc) {
@@ -125,6 +140,7 @@ static void xrgb8888_to_rgb332_test(struct kunit *test)const struct xrgb8888_to_rgb332_case *params = test->param_value;size_t dst_size;__u8 *dst =NULL ; +__u32 *src =NULL ;struct drm_framebuffer fb = { .format =drm_format_info (DRM_FORMAT_XRGB8888 ),
@@ -138,8 +154,11 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) dst =kunit_kzalloc (test, dst_size,GFP_KERNEL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dst); -drm_fb_xrgb8888_to_rgb332 (dst, params->dst_pitch, params->xrgb8888, - &fb, ¶ms->clip); + src =le32buf_to_cpu (test, params->xrgb8888,TEST_BUF_SIZE ); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, src); + +drm_fb_xrgb8888_to_rgb332 (dst, params->dst_pitch, src, &fb, + ¶ms->clip);KUNIT_EXPECT_EQ (test,memcmp (dst, params->expected, dst_size),0 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 344/862 once: add DO_ONCE_SLOW() for sleepable contexts
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 62c07983bef9d3e78e71189441e1a470f0d1e653 ]
Christophe Leroy reported a ~80ms latency spike
happening at first TCP connect() time.
This is because __inet_hash_connect() uses get_random_once()
to populate a perturbation table which became quite big
after commit 4c2c8f03a5ab ("tcp: increase source port perturb table to 2^16")
get_random_once() uses DO_ONCE(), which block hard irqs for the duration of the operation.
This patch adds DO_ONCE_SLOW() which uses a mutex instead of a spinlock for operations where we prefer to stay in process context.
Then __inet_hash_connect() can use get_random_slow_once() to populate its perturbation table.
--- include/linux/once.h | 28 ++++++++++++++++++++++++++++ lib/once.c | 30 ++++++++++++++++++++++++++++++ net/ipv4/inet_hashtables.c | 4 ++-- 3 files changed, 60 insertions(+), 2 deletions(-)
include/linux/once.h +28 -0
@@ -5,10 +5,18 @@#include <linux/types.h> #include <linux/jump_label.h> +/* Helpers used from arbitrary contexts. +* Hard irqs are blocked, be cautious. +*/ bool __do_once_start (bool *done,unsigned long *flags);void __do_once_done (bool *done,struct static_key_true *once_key,unsigned long *flags,struct module *mod); +/* Variant for process contexts only. */ +bool __do_once_slow_start (bool *done); +void __do_once_slow_done (bool *done,struct static_key_true *once_key, +struct module *mod); +/* Call a function exactly once. The idea of DO_ONCE() is to perform * a function call such as initialization of random seeds, etc, only * once, where DO_ONCE() can live in the fast-path. After @func has
@@ -52,7 +60,27 @@ void __do_once_done(bool *done, struct static_key_true *once_key, ___ret; \ }) +/* Variant of DO_ONCE() for process/sleepable contexts. */ +#define DO_ONCE_SLOW (func, ...) \ + ({ \ + bool ___ret = false; \ + static bool __section(".data.once") ___done = false; \ + static DEFINE_STATIC_KEY_TRUE(___once_key); \ + if (static_branch_unlikely(&___once_key)) { \ + ___ret = __do_once_slow_start(&___done); \ + if (unlikely(___ret)) { \ + func(__VA_ARGS__); \ + __do_once_slow_done(&___done, &___once_key, \ + THIS_MODULE); \ + } \ + } \ + ___ret; \ + }) +#define get_random_once (buf, nbytes) \ DO_ONCE(get_random_bytes, (buf), (nbytes)) +#define get_random_slow_once (buf, nbytes) \ + DO_ONCE_SLOW(get_random_bytes, (buf), (nbytes)) +#endif /* _LINUX_ONCE_H */
lib/once.c +30 -0
@@ -66,3 +66,33 @@ void __do_once_done(bool *done, struct static_key_true *once_key,once_disable_jump (once_key, mod); }EXPORT_SYMBOL (__do_once_done); + +static DEFINE_MUTEX (once_mutex); + +bool __do_once_slow_start (bool *done) +__acquires (once_mutex) +{ +mutex_lock (&once_mutex); +if (*done) { +mutex_unlock (&once_mutex); +/* Keep sparse happy by restoring an even lock count on +* this mutex. In case we return here, we don't call into +* __do_once_done but return early in the DO_ONCE_SLOW() macro. +*/ +__acquire (once_mutex); +return false; + } + +return true; +} +EXPORT_SYMBOL (__do_once_slow_start); + +void __do_once_slow_done (bool *done,struct static_key_true *once_key, +struct module *mod) +__releases (once_mutex) +{ + *done = true; +mutex_unlock (&once_mutex); +once_disable_jump (once_key, mod); +} +EXPORT_SYMBOL (__do_once_slow_done);
net/ipv4/inet_hashtables.c +2 -2
@@ -729,8 +729,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,if (likely (remaining >1 )) remaining &= ~1U ; -net_get_random_once (table_perturb, -INET_TABLE_PERTURB_SIZE *sizeof (*table_perturb)); +get_random_slow_once (table_perturb, +INET_TABLE_PERTURB_SIZE *sizeof (*table_perturb)); index = port_offset & (INET_TABLE_PERTURB_SIZE -1 ); offset =READ_ONCE (table_perturb[index]) + (port_offset >>32 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 302/862 bpf, cgroup: Reject prog_attach_flags array when effective query
In reply to Greg Kroah-HartmanFrom: Pu Lehui <[email protected]>
[ Upstream commit 0e426a3ae030a9e891899370229e117158b35de6 ]
Attach flags is only valid for attached progs of this layer cgroup, but not for effective progs. For querying with EFFECTIVE flags, exporting attach flags does not make sense. So when effective query, we reject prog_attach_flags array and don't need to populate it. Also we limit attach_flags to output 0 during effective query.
--- include/uapi/linux/bpf.h | 7 +++++-- kernel/bpf/cgroup.c | 28 ++++++++++++++++++---------- tools/include/uapi/linux/bpf.h | 7 +++++-- 3 files changed, 28 insertions(+), 14 deletions(-)
include/uapi/linux/bpf.h +5 -2
@@ -1233,7 +1233,7 @@ enum {/* Query effective (directly attached + inherited from ancestor cgroups) * programs that will be executed for events within a cgroup. -* attach_flags with this flag are returned only for directly attached programs. +* attach_flags with this flag are always returned 0. */ #define BPF_F_QUERY_EFFECTIVE (1U << 0)
@@ -1432,7 +1432,10 @@ union bpf_attr {__u32 attach_flags;__aligned_u64 prog_ids;__u32 prog_cnt; -__aligned_u64 prog_attach_flags;/* output: per-program attach_flags */ +/* output: per-program attach_flags. +* not allowed to be set during effective query. +*/ +__aligned_u64 prog_attach_flags; } query;struct {/* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
kernel/bpf/cgroup.c +18 -10
@@ -1020,6 +1020,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, union bpf_attr __user *uattr) {__u32 __user *prog_attach_flags =u64_to_user_ptr (attr->query.prog_attach_flags); +bool effective_query = attr->query.query_flags &BPF_F_QUERY_EFFECTIVE ;__u32 __user *prog_ids =u64_to_user_ptr (attr->query.prog_ids);enum bpf_attach_type type = attr->query.attach_type;enum cgroup_bpf_attach_type from_atype, to_atype;
@@ -1029,8 +1030,12 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,int total_cnt =0 ;u32 flags; +if (effective_query && prog_attach_flags) +return -EINVAL ; +if (type ==BPF_LSM_CGROUP ) { -if (attr->query.prog_cnt && prog_ids && !prog_attach_flags) +if (!effective_query && attr->query.prog_cnt && + prog_ids && !prog_attach_flags)return -EINVAL ; from_atype =CGROUP_LSM_START ;
@@ -1045,7 +1050,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, }for (atype = from_atype; atype <= to_atype; atype++) { -if (attr->query.query_flags &BPF_F_QUERY_EFFECTIVE ) { +if (effective_query) { effective =rcu_dereference_protected (cgrp->bpf.effective[atype],lockdep_is_held (&cgroup_mutex)); total_cnt +=bpf_prog_array_length (effective);
@@ -1054,6 +1059,8 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, } } +/* always output uattr->query.attach_flags as 0 during effective query */ + flags = effective_query ?0 : flags;if (copy_to_user (&uattr->query.attach_flags, &flags,sizeof (flags)))return -EFAULT ;if (copy_to_user (&uattr->query.prog_cnt, &total_cnt,sizeof (total_cnt)))
@@ -1068,7 +1075,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, }for (atype = from_atype; atype <= to_atype && total_cnt; atype++) { -if (attr->query.query_flags &BPF_F_QUERY_EFFECTIVE ) { +if (effective_query) { effective =rcu_dereference_protected (cgrp->bpf.effective[atype],lockdep_is_held (&cgroup_mutex)); cnt =min_t (int,bpf_prog_array_length (effective), total_cnt);
@@ -1090,15 +1097,16 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,if (++i == cnt)break ; } - } -if (prog_attach_flags) { - flags = cgrp->bpf.flags[atype]; +if (prog_attach_flags) { + flags = cgrp->bpf.flags[atype]; -for (i =0 ; i < cnt; i++) -if (copy_to_user (prog_attach_flags + i, &flags,sizeof (flags))) -return -EFAULT ; - prog_attach_flags += cnt; +for (i =0 ; i < cnt; i++) +if (copy_to_user (prog_attach_flags + i, + &flags,sizeof (flags))) +return -EFAULT ; + prog_attach_flags += cnt; + } } prog_ids += cnt;
tools/include/uapi/linux/bpf.h +5 -2
@@ -1233,7 +1233,7 @@ enum {/* Query effective (directly attached + inherited from ancestor cgroups) * programs that will be executed for events within a cgroup. -* attach_flags with this flag are returned only for directly attached programs. +* attach_flags with this flag are always returned 0. */ #define BPF_F_QUERY_EFFECTIVE (1U << 0)
@@ -1432,7 +1432,10 @@ union bpf_attr {__u32 attach_flags;__aligned_u64 prog_ids;__u32 prog_cnt; -__aligned_u64 prog_attach_flags;/* output: per-program attach_flags */ +/* output: per-program attach_flags. +* not allowed to be set during effective query. +*/ +__aligned_u64 prog_attach_flags; } query;struct {/* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 783/862 btrfs: dump extra info if one free space cache has more bitmaps than it should
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit 62cd9d4474282a1eb84f945955c56cbfc42e1ffe ]
There is an internal report on hitting the following ASSERT() in recalculate_thresholds():
ASSERT(ctl->total_bitmaps <= max_bitmaps);
Above @max_bitmaps is calculated using the following variables:
- bytes_per_bg
8 * 4096 * 4096 (128M) for x86_64/x86.
- block_group->length
The length of the block group.
@max_bitmaps is the rounded up value of block_group->length / 128M.
Normally one free space cache should not have more bitmaps than above value, but when it happens the ASSERT() can be triggered if CONFIG_BTRFS_ASSERT is also enabled.
But the ASSERT() itself won't provide enough info to know which is going wrong.
Is the bg too small thus it only allows one bitmap?
Or is there something else wrong?
So although I haven't found extra reports or crash dump to do further investigation, add the extra info to make it more helpful to debug.
--- fs/btrfs/free-space-cache.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/free-space-cache.c +6 -0
@@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) max_bitmaps =max_t (u64, max_bitmaps,1 ); +if (ctl->total_bitmaps > max_bitmaps) +btrfs_err (block_group->fs_info, +"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu" , + block_group->start, block_group->length, + ctl->total_bitmaps, ctl->unit, max_bitmaps, + bytes_per_bg);ASSERT (ctl->total_bitmaps <= max_bitmaps);/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 452/862 ARM: dts: exynos: fix polarity of VBUS GPIO of Origen
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a08137bd1e0a7ce951dce9ce4a83e39d379b6e1b ]
EHCI Oxynos (drivers/usb/host/ehci-exynos.c) drives VBUS GPIO high when trying to power up the bus, therefore the GPIO in DTS must be marked as "active high". This will be important when EHCI driver is converted to gpiod API that respects declared polarities.
--- arch/arm/boot/dts/exynos4412-origen.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-origen.dts +1 -1
@@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 183/862 drm/i915/guc: Fix revocation of non-persistent contexts
In reply to Greg Kroah-HartmanFrom: Tvrtko Ursulin <[email protected]>
commit 7023472834a39341460dae5c9b506c76c5940cad upstream.
Patch which added graceful exit for non-persistent contexts missed the fact it is not enough to set the exiting flag on a context and let the backend handle it from there.
GuC backend cannot handle it because it runs independently in the firmware and driver might not see the requests ever again. Patch also missed the fact some usages of intel_context_is_banned in the GuC backend needed replacing with newly introduced intel_context_is_schedulable.
Fix the first issue by calling into backend revoke when we know this is the last chance to do it. Fix the second issue by replacing intel_context_is_banned with intel_context_is_schedulable, which should always be safe since latter is a superset of the former.
v2:
* Just call ce->ops->revoke unconditionally. (Andrzej)
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 8 ------ drivers/gpu/drm/i915/gt/intel_context.c | 5 +--- drivers/gpu/drm/i915/gt/intel_context.h | 3 -- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 26 +++++++++++----------- 4 files changed, 17 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -7
@@ -1387,14 +1387,8 @@ kill_engines(struct i915_gem_engines *en*/ for_each_gem_engine (ce, engines, it) {struct intel_engine_cs *engine; -bool skip = false; -if (exit) - skip =intel_context_set_exiting (ce); -else if (!persistent) - skip =intel_context_exit_nonpersistent (ce,NULL ); - -if (skip) +if ((exit || !persistent) &&intel_context_revoke (ce))continue ;/* Already marked. */ /*
drivers/gpu/drm/i915/gt/intel_context.c +2 -3
@@ -614,13 +614,12 @@ bool intel_context_ban(struct intel_contreturn ret; } -bool intel_context_exit_nonpersistent (struct intel_context *ce, -struct i915_request *rq) +bool intel_context_revoke (struct intel_context *ce) {bool ret =intel_context_set_exiting (ce);if (ce->ops->revoke) - ce->ops->revoke (ce, rq, ce->engine->props.preempt_timeout_ms); + ce->ops->revoke (ce,NULL , ce->engine->props.preempt_timeout_ms);return ret; }
drivers/gpu/drm/i915/gt/intel_context.h +1 -2
@@ -329,8 +329,7 @@ static inline bool intel_context_set_exireturn test_and_set_bit (CONTEXT_EXITING , &ce->flags); } -bool intel_context_exit_nonpersistent (struct intel_context *ce, -struct i915_request *rq); +bool intel_context_revoke (struct intel_context *ce);static inline bool intel_context_force_single_submission (const struct intel_context *ce)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +13 -13
@@ -684,7 +684,7 @@ static int __guc_add_request(struct inte* Corner case where requests were sitting in the priority list or a * request resubmitted after the context was banned. */ -if (unlikely (intel_context_is_banned (ce))) { +if (unlikely (!intel_context_is_schedulable (ce))) {i915_request_put (i915_request_mark_eio (rq));intel_engine_signal_breadcrumbs (ce->engine);return 0 ;
@@ -870,15 +870,15 @@ static int guc_wq_item_append(struct int struct i915_request *rq) {struct intel_context *ce =request_to_scheduling_context (rq); -int ret =0 ; +int ret; -if (likely (!intel_context_is_banned (ce))) { - ret =__guc_wq_item_append (rq); +if (unlikely (!intel_context_is_schedulable (ce))) +return 0 ; -if (unlikely (ret == -EBUSY )) { - guc->stalled_request = rq; - guc->submission_stall_reason =STALL_MOVE_LRC_TAIL ; - } + ret =__guc_wq_item_append (rq); +if (unlikely (ret == -EBUSY )) { + guc->stalled_request = rq; + guc->submission_stall_reason =STALL_MOVE_LRC_TAIL ; }return ret;
@@ -897,7 +897,7 @@ static bool multi_lrc_submit(struct i915* submitting all the requests generated in parallel. */ return test_bit (I915_FENCE_FLAG_SUBMIT_PARALLEL , &rq->fence.flags) || -intel_context_is_banned (ce); + !intel_context_is_schedulable (ce); }static int guc_dequeue_one_context (struct intel_guc *guc)
@@ -966,7 +966,7 @@ register_context:struct intel_context *ce =request_to_scheduling_context (last);if (unlikely (!ctx_id_mapped (guc, ce->guc_id.id) && - !intel_context_is_banned (ce))) { +intel_context_is_schedulable (ce))) { ret =try_context_registration (ce, false);if (unlikely (ret == -EPIPE )) { goto deadlk;
@@ -1576,7 +1576,7 @@ static void guc_reset_state(struct intel {struct intel_engine_cs *engine =__context_to_physical_engine (ce); -if (intel_context_is_banned (ce)) +if (!intel_context_is_schedulable (ce))return ;GEM_BUG_ON (!intel_context_is_pinned (ce));
@@ -4434,12 +4434,12 @@ static void guc_handle_context_reset(str {trace_intel_context_reset (ce); -if (likely (!intel_context_is_banned (ce))) { +if (likely (intel_context_is_schedulable (ce))) {capture_error_state (guc, ce);guc_context_replay (ce); }else {drm_info (&guc_to_gt (guc)->i915->drm, -"Ignoring context reset notification of banned context 0x%04X on %s" , +"Ignoring context reset notification of exiting context 0x%04X on %s" , ce->guc_id.id, ce->engine->name); } }
Greg Kroah-Hartman
maintainerPATCH 218/862 ACPI: PCC: replace wait_for_completion()
In reply to Greg Kroah-HartmanFrom: Huisong Li <[email protected]>
[ Upstream commit 91cefefb699120efd0a5ba345d12626b688f86ce ]
Currently, the function waiting for completion of mailbox operation is 'wait_for_completion()'. The PCC method will be permanently blocked if this mailbox message fails to execute. So this patch replaces it with 'wait_for_completion_timeout()'. And set the timeout interval to an arbitrary retries on top of nominal to prevent the remote processor is slow to respond to PCC commands.
--- drivers/acpi/acpi_pcc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/acpi/acpi_pcc.c +21 -2
@@ -23,6 +23,12 @@#include <acpi/pcc.h> +/* +* Arbitrary retries in case the remote processor is slow to respond +* to PCC commands +*/ +#define PCC_CMD_WAIT_RETRIES_NUM 500 +struct pcc_data {struct pcc_mbox_chan *pcc_chan;void __iomem *pcc_comm_addr;
@@ -89,6 +95,7 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr, {int ret;struct pcc_data *data = region_context; +u64 usecs_lat;reinit_completion (&data->done);
@@ -99,8 +106,20 @@ acpi_pcc_address_space_handler(u32 function, acpi_physical_address addr,if (ret <0 )return AE_ERROR ; -if (data->pcc_chan->mchan->mbox->txdone_irq) -wait_for_completion (&data->done); +if (data->pcc_chan->mchan->mbox->txdone_irq) { +/* +* pcc_chan->latency is just a Nominal value. In reality the remote +* processor could be much slower to reply. So add an arbitrary +* amount of wait on top of Nominal. +*/ + usecs_lat =PCC_CMD_WAIT_RETRIES_NUM * data->pcc_chan->latency; + ret =wait_for_completion_timeout (&data->done, +usecs_to_jiffies (usecs_lat)); +if (ret ==0 ) { +pr_err ("PCC command executed timeout!\n" ); +return AE_TIME ; + } + }mbox_client_txdone (data->pcc_chan->mchan, ret);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 449/862 ext4: dont run ext4lazyinit for read-only filesystems
In reply to Greg Kroah-HartmanFrom: Josh Triplett <[email protected]>
[ Upstream commit 426d15ad11419066f7042ffa8fbf1b5c21a1ecbe ]
On a read-only filesystem, we won't invoke the block allocator, so we don't need to prefetch the block bitmaps.
This avoids starting and running the ext4lazyinit thread at all on a system with no read-write ext4 filesystems (for instance, a container VM with read-only filesystems underneath an overlayfs).
--- fs/ext4/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext4/super.c +3 -3
@@ -3962,9 +3962,9 @@ int ext4_register_li_request(struct super_block *sb, goto out; } -if (test_opt (sb,NO_PREFETCH_BLOCK_BITMAPS ) && - (first_not_zeroed == ngroups ||sb_rdonly (sb) || - !test_opt (sb,INIT_INODE_TABLE ))) +if (sb_rdonly (sb) || + (test_opt (sb,NO_PREFETCH_BLOCK_BITMAPS ) && + (first_not_zeroed == ngroups || !test_opt (sb,INIT_INODE_TABLE )))) goto out; elr =ext4_li_request_new (sb, first_not_zeroed);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 508/862 dmaengine: hisilicon: Disable channels when unregister hisi_dma
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit e3bdaa04ada31f46d0586df83a2789b8913053c5 ]
When hisi_dma is unloaded or unbinded, all of channels should be disabled. This patch disables DMA channels when driver is unloaded or unbinded.
--- drivers/dma/hisi_dma.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/dma/hisi_dma.c +9 -5
@@ -180,7 +180,8 @@ static void hisi_dma_reset_qp_point(struct hisi_dma_dev *hdma_dev, u32 index)hisi_dma_chan_write (hdma_dev->base,HISI_DMA_CQ_HEAD_PTR , index,0 ); } -static void hisi_dma_reset_hw_chan (struct hisi_dma_chan *chan) +static void hisi_dma_reset_or_disable_hw_chan (struct hisi_dma_chan *chan, +bool disable) {struct hisi_dma_dev *hdma_dev = chan->hdma_dev;u32 index = chan->qp_num, tmp;
@@ -201,8 +202,11 @@ static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan)hisi_dma_do_reset (hdma_dev, index);hisi_dma_reset_qp_point (hdma_dev, index);hisi_dma_pause_dma (hdma_dev, index, false); -hisi_dma_enable_dma (hdma_dev, index, true); -hisi_dma_unmask_irq (hdma_dev, index); + +if (!disable) { +hisi_dma_enable_dma (hdma_dev, index, true); +hisi_dma_unmask_irq (hdma_dev, index); + } ret = readl_relaxed_poll_timeout(hdma_dev->base + HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp,
@@ -218,7 +222,7 @@ static void hisi_dma_free_chan_resources(struct dma_chan *c)struct hisi_dma_chan *chan =to_hisi_dma_chan (c);struct hisi_dma_dev *hdma_dev = chan->hdma_dev; -hisi_dma_reset_hw_chan (chan); +hisi_dma_reset_or_disable_hw_chan (chan, false);vchan_free_chan_resources (&chan->vc);memset (chan->sq,0 ,sizeof (struct hisi_dma_sqe ) * hdma_dev->chan_depth);
@@ -394,7 +398,7 @@ static void hisi_dma_enable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index)static void hisi_dma_disable_qp (struct hisi_dma_dev *hdma_dev,u32 qp_index) { -hisi_dma_reset_hw_chan (&hdma_dev->chan[qp_index]); +hisi_dma_reset_or_disable_hw_chan (&hdma_dev->chan[qp_index], true); }static void hisi_dma_enable_qps (struct hisi_dma_dev *hdma_dev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 318/862 cw1200: fix incorrect check to determine if no element is found in list
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
[ Upstream commit 86df5de5c632d3bd940f59bbb14ae912aa9cc363 ]
The bug is here: "} else if (item) {".
The list iterator value will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found in list.
Use a new value 'iter' as the list iterator, while use the old value 'item' as a dedicated pointer to point to the found element, which
1. can fix this bug, due to now 'item' is NULL only if it's not found.
2. do not need to change all the uses of 'item' after the loop.
3. can also limit the scope of the list iterator 'iter' *only inside* the traversal loop by simply declaring 'iter' inside the loop in the future, as usage of the iterator outside of the list_for_each_entry is considered harmful. https://lkml.org/lkml/2022/2/17/1032
--- drivers/net/wireless/st/cw1200/queue.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/st/cw1200/queue.c +10 -8
@@ -91,23 +91,25 @@ static void __cw1200_queue_gc(struct cw1200_queue *queue, bool unlock) {struct cw1200_queue_stats *stats = queue->stats; -struct cw1200_queue_item *item =NULL , *tmp; +struct cw1200_queue_item *item =NULL , *iter, *tmp;bool wakeup_stats = false; -list_for_each_entry_safe (item, tmp, &queue->queue, head) { -if (time_is_after_jiffies (item->queue_timestamp + queue->ttl)) +list_for_each_entry_safe (iter, tmp, &queue->queue, head) { +if (time_is_after_jiffies (iter->queue_timestamp + queue->ttl)) { + item = iter;break ; + } --queue->num_queued; - --queue->link_map_cache[item->txpriv.link_id]; + --queue->link_map_cache[iter->txpriv.link_id];spin_lock_bh (&stats->lock); --stats->num_queued; -if (!--stats->link_map_cache[item->txpriv.link_id]) +if (!--stats->link_map_cache[iter->txpriv.link_id]) wakeup_stats = true;spin_unlock_bh (&stats->lock);cw1200_debug_tx_ttl (stats->priv); -cw1200_queue_register_post_gc (head, item); - item->skb =NULL ; -list_move_tail (&item->head, &queue->free_pool); +cw1200_queue_register_post_gc (head, iter); + iter->skb =NULL ; +list_move_tail (&iter->head, &queue->free_pool); }if (wakeup_stats)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 154/862 ring-buffer: Check pending waiters when doing wake ups as well
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit ec0bbc5ec5664dcee344f79373852117dc672c86 upstream.
The wake up waiters only checks the "wakeup_full" variable and not the "full_waiters_pending". The full_waiters_pending is set when a waiter is added to the wait queue. The wakeup_full is only set when an event is triggered, and it clears the full_waiters_pending to avoid multiple calls to irq_work_queue().
The irq_work callback really needs to check both wakeup_full as well as full_waiters_pending such that this code can be used to wake up waiters when a file is closed that represents the ring buffer and the waiters need to be woken up.
--- kernel/trace/ring_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/ring_buffer.c +2 -1
@@ -917,8 +917,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work);wake_up_all (&rbwork->waiters); -if (rbwork->wakeup_full) { +if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false;wake_up_all (&rbwork->full_waiters); } }
Greg Kroah-Hartman
maintainerPATCH 752/862 ASoC: sunxi: sun4i-codec: set debugfs_prefix for CPU DAI component
In reply to Greg Kroah-HartmanFrom: Mikhail Rudenko <[email protected]>
[ Upstream commit 717a8ff20f32792d6a94f2883e771482c37d844b ]
At present, succesfull probing of H3 Codec results in an error
debugfs: Directory '1c22c00.codec' with parent 'H3 Audio Codec' already present!
This is caused by a directory name conflict between codec components. Fix it by setting debugfs_prefix for the CPU DAI component.
--- sound/soc/sunxi/sun4i-codec.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/sunxi/sun4i-codec.c +3 -0
@@ -1232,6 +1232,9 @@ static const struct snd_soc_component_driver sun8i_a23_codec_codec = {static const struct snd_soc_component_driver sun4i_codec_component = { .name ="sun4i-codec" , .legacy_dai_naming =1 , +#ifdef CONFIG_DEBUG_FS + .debugfs_prefix ="cpu" , +#endif };#define SUN4I_CODEC_RATES SNDRV_PCM_RATE_CONTINUOUS
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 182/862 drm/i915/gt: Use i915_vm_put on ppgtt_create error paths
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 20e377e7b2e7c327039f10db80ba5bcc1f6c882d upstream.
Now that the scratch page and page directories have a reference back to the i915_address_space, we cannot do an immediate free of the ppgtt upon error as those buffer objects will perform a later i915_vm_put in their deferred frees.
The downside is that by replacing the onion unwind along the error paths, the ppgtt cleanup must handle a partially constructed vm. This includes ensuring that the vm->cleanup is set prior to the error path.
--- drivers/gpu/drm/i915/gt/gen6_ppgtt.c | 16 ++++----- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 58 ++++++++++++++++++----------------- drivers/gpu/drm/i915/gt/intel_gtt.c | 3 + 3 files changed, 41 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/gt/gen6_ppgtt.c +8 -8
@@ -247,6 +247,7 @@ err_scratch1:i915_gem_object_put (vm->scratch[1 ]); err_scratch0:i915_gem_object_put (vm->scratch[0 ]); + vm->scratch[0 ] =NULL ;return ret; }
@@ -268,9 +269,10 @@ static void gen6_ppgtt_cleanup(struct i9gen6_ppgtt_free_pd (ppgtt);free_scratch (vm); -mutex_destroy (&ppgtt->flush); +if (ppgtt->base.pd) +free_pd (&ppgtt->base.vm, ppgtt->base.pd); -free_pd (&ppgtt->base.vm, ppgtt->base.pd); +mutex_destroy (&ppgtt->flush); } static void pd_vma_bind(struct i915_address_space *vm,
@@ -449,19 +451,17 @@ struct i915_ppgtt *gen6_ppgtt_create(str err =gen6_ppgtt_init_scratch (ppgtt);if (err) - goto err_free; + goto err_put; ppgtt->base.pd =gen6_alloc_top_pd (ppgtt);if (IS_ERR (ppgtt->base.pd)) { err =PTR_ERR (ppgtt->base.pd); - goto err_scratch; + goto err_put; }return &ppgtt->base; -err_scratch: -free_scratch (&ppgtt->base.vm); -err_free: -kfree (ppgtt); +err_put: +i915_vm_put (&ppgtt->base.vm);return ERR_PTR (err); }
drivers/gpu/drm/i915/gt/gen8_ppgtt.c +30 -28
101 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gtt.c +3 -0
@@ -405,6 +405,9 @@ void free_scratch(struct i915_address_sp {int i; +if (!vm->scratch[0 ]) +return ; +for (i =0 ; i <= vm->top; i++)i915_gem_object_put (vm->scratch[i]); }
Greg Kroah-Hartman
maintainerPATCH 446/862 ARM: dts: exynos: correct s5k6a3 reset polarity on Midas family
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 3ba2d4bb9592bf7a6a3fe3dbe711ecfc3d004bab ]
According to s5k6a3 driver code, the reset line for the chip appears to be active low. This also matches the typical polarity of reset lines in general. Let's fix it up as having correct polarity in DTS is important when the driver will be switched over to gpiod API.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -586,7 +586,7 @@ clocks = <&camera 1>; clock-names = "extclk"; samsung,camclk-out = <1>; - gpios = <&gpm1 6 GPIO_ACTIVE_HIGH>; + gpios = <&gpm1 6 GPIO_ACTIVE_LOW>; port { is_s5k6a3_ep: endpoint {
Signature · 1 line
2.35.1