4.19.191-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 157/425 KVM: s390: split kvm_s390_logical_to_effective
In reply to Greg Kroah-HartmanFrom: Claudio Imbrenda <[email protected]>
commit f85f1baaa18932a041fd2b1c2ca6cfd9898c7d2b upstream.
Split kvm_s390_logical_to_effective to a generic function called _kvm_s390_logical_to_effective. The new function takes a PSW and an address and returns the address with the appropriate bits masked off. The old function now calls the new function with the appropriate PSW from the vCPU.
This is needed to avoid code duplication for vSIE.
--- arch/s390/kvm/gaccess.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
arch/s390/kvm/gaccess.h +24 -7
@@ -37,6 +37,29 @@ static inline unsigned long kvm_s390_rea }/** +* _kvm_s390_logical_to_effective - convert guest logical to effective address +* @psw: psw of the guest +* @ga: guest logical address +* +* Convert a guest logical address to an effective address by applying the +* rules of the addressing mode defined by bits 31 and 32 of the given PSW +* (extendended/basic addressing mode). +* +* Depending on the addressing mode, the upper 40 bits (24 bit addressing +* mode), 33 bits (31 bit addressing mode) or no bits (64 bit addressing +* mode) of @ga will be zeroed and the remaining bits will be returned. +*/ +static inline unsigned long _kvm_s390_logical_to_effective (psw_t *psw, +unsigned long ga) +{ +if (psw_bits (*psw).eaba ==PSW_BITS_AMODE_64BIT ) +return ga; +if (psw_bits (*psw).eaba ==PSW_BITS_AMODE_31BIT ) +return ga & ((1UL <<31 ) -1 ); +return ga & ((1UL <<24 ) -1 ); +} + +/** * kvm_s390_logical_to_effective - convert guest logical to effective address * @vcpu: guest virtual cpu * @ga: guest logical address
@@ -52,13 +75,7 @@ static inline unsigned long kvm_s390_reastatic inline unsigned long kvm_s390_logical_to_effective (struct kvm_vcpu *vcpu,unsigned long ga) { -psw_t *psw = &vcpu->arch.sie_block->gpsw; - -if (psw_bits (*psw).eaba ==PSW_BITS_AMODE_64BIT ) -return ga; -if (psw_bits (*psw).eaba ==PSW_BITS_AMODE_31BIT ) -return ga & ((1UL <<31 ) -1 ); -return ga & ((1UL <<24 ) -1 ); +return _kvm_s390_logical_to_effective (&vcpu->arch.sie_block->gpsw, ga); }/*
Greg Kroah-Hartman
maintainerPATCH 158/425 KVM: s390: fix guarded storage control register handling
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
commit 44bada28219031f9e8e86b84460606efa57b871e upstream.
store_regs_fmt2() has an ordering problem: first the guarded storage facility is enabled on the local cpu, then preemption disabled, and then the STGSC (store guarded storage controls) instruction is executed.
If the process gets scheduled away between enabling the guarded storage facility and before preemption is disabled, this might lead to a special operation exception and therefore kernel crash as soon as the process is scheduled back and the STGSC instruction is executed.
--- arch/s390/kvm/kvm-s390.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kvm/kvm-s390.c +2 -2
@@ -3624,16 +3624,16 @@ static void store_regs(struct kvm_vcpu * current->thread.fpu.fpc = vcpu->arch.host_fpregs.fpc; current->thread.fpu.regs = vcpu->arch.host_fpregs.regs;if (MACHINE_HAS_GS ) { +preempt_disable ();__ctl_set_bit (2 ,4 );if (vcpu->arch.gs_enabled)save_gs_cb (current->thread.gs_cb); -preempt_disable (); current->thread.gs_cb = vcpu->arch.host_gscb;restore_gs_cb (vcpu->arch.host_gscb); -preempt_enable ();if (!vcpu->arch.host_gscb)__ctl_clear_bit (2 ,4 ); vcpu->arch.host_gscb =NULL ; +preempt_enable (); }/* SIE will save etoken directly into SDNX and therefore kvm_run */ }
Greg Kroah-Hartman
maintainerPATCH 159/425 KVM: s390: split kvm_s390_real_to_abs
In reply to Greg Kroah-HartmanFrom: Claudio Imbrenda <[email protected]>
commit c5d1f6b531e68888cbe6718b3f77a60115d58b9c upstream.
A new function _kvm_s390_real_to_abs will apply prefixing to a real address with a given prefix value.
The old kvm_s390_real_to_abs becomes now a wrapper around the new function.
This is needed to avoid code duplication in vSIE.
--- arch/s390/kvm/gaccess.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
arch/s390/kvm/gaccess.h +17 -6
@@ -18,17 +18,14 @@/** * kvm_s390_real_to_abs - convert guest real address to guest absolute address -* @vcpu - guest virtual cpu +* @prefix - guest prefix * @gra - guest real address * * Returns the guest absolute address that corresponds to the passed guest real -* address @gra of a virtual guest cpu by applying its prefix. +* address @gra of by applying the given prefix. */ -static inline unsigned long kvm_s390_real_to_abs (struct kvm_vcpu *vcpu, -unsigned long gra) +static inline unsigned long _kvm_s390_real_to_abs (u32 prefix,unsigned long gra) { -unsigned long prefix =kvm_s390_get_prefix (vcpu); -if (gra <2 *PAGE_SIZE ) gra += prefix;else if (gra >= prefix && gra < prefix +2 *PAGE_SIZE )
@@ -37,6 +34,20 @@ static inline unsigned long kvm_s390_rea }/** +* kvm_s390_real_to_abs - convert guest real address to guest absolute address +* @vcpu - guest virtual cpu +* @gra - guest real address +* +* Returns the guest absolute address that corresponds to the passed guest real +* address @gra of a virtual guest cpu by applying its prefix. +*/ +static inline unsigned long kvm_s390_real_to_abs (struct kvm_vcpu *vcpu, +unsigned long gra) +{ +return _kvm_s390_real_to_abs (kvm_s390_get_prefix (vcpu), gra); +} + +/** * _kvm_s390_logical_to_effective - convert guest logical to effective address * @psw: psw of the guest * @ga: guest logical address
Greg Kroah-Hartman
maintainerPATCH 160/425 ovl: fix missing revert_creds() on error path
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 7b279bbfd2b230c7a210ff8f405799c7e46bbf48 upstream.
Smatch complains about missing that the ovl_override_creds() doesn't have a matching revert_creds() if the dentry is disconnected. Fix this by moving the ovl_override_creds() until after the disconnected check.
--- fs/overlayfs/copy_up.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/overlayfs/copy_up.c +2 -1
@@ -824,7 +824,7 @@ static int ovl_copy_up_one(struct dentryint ovl_copy_up_flags (struct dentry *dentry,int flags) {int err =0 ; -const struct cred *old_cred =ovl_override_creds (dentry->d_sb); +const struct cred *old_cred;bool disconnected = (dentry->d_flags &DCACHE_DISCONNECTED );/*
@@ -835,6 +835,7 @@ int ovl_copy_up_flags(struct dentry *denif (WARN_ON (disconnected &&d_is_dir (dentry)))return -EIO ; + old_cred =ovl_override_creds (dentry->d_sb);while (!err) {struct dentry *next;struct dentry *parent =NULL ;
Greg Kroah-Hartman
maintainerPATCH 161/425 usb: gadget: pch_udc: Revert d3cb25a12138 completely
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit 50a318cc9b54a36f00beadf77e578a50f3620477 upstream.
The commit d3cb25a12138 ("usb: gadget: udc: fix spin_lock in pch_udc") obviously was not thought through and had made the situation even worse than it was before. Two changes after almost reverted it. but a few leftovers have been left as it. With this revert d3cb25a12138 completely.
While at it, narrow down the scope of unlocked section to prevent potential race when prot_stall is assigned.
--- drivers/usb/gadget/udc/pch_udc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/usb/gadget/udc/pch_udc.c +13 -4
@@ -600,18 +600,22 @@ static void pch_udc_reconnect(struct pchstatic inline void pch_udc_vbus_session (struct pch_udc_dev *dev,int is_active) { +unsigned long iflags; + +spin_lock_irqsave (&dev->lock, iflags);if (is_active) {pch_udc_reconnect (dev); dev->vbus_session =1 ; }else {if (dev->driver && dev->driver->disconnect) { -spin_lock (&dev->lock); +spin_unlock_irqrestore (&dev->lock, iflags); dev->driver->disconnect (&dev->gadget); -spin_unlock (&dev->lock); +spin_lock_irqsave (&dev->lock, iflags); }pch_udc_set_disconnect (dev); dev->vbus_session =0 ; } +spin_unlock_irqrestore (&dev->lock, iflags); }/**
@@ -1168,20 +1172,25 @@ static int pch_udc_pcd_selfpowered(strucstatic int pch_udc_pcd_pullup (struct usb_gadget *gadget,int is_on) {struct pch_udc_dev *dev; +unsigned long iflags;if (!gadget)return -EINVAL ; + dev = container_of(gadget, struct pch_udc_dev, gadget); + +spin_lock_irqsave (&dev->lock, iflags);if (is_on) {pch_udc_reconnect (dev); }else {if (dev->driver && dev->driver->disconnect) { -spin_lock (&dev->lock); +spin_unlock_irqrestore (&dev->lock, iflags); dev->driver->disconnect (&dev->gadget); -spin_unlock (&dev->lock); +spin_lock_irqsave (&dev->lock, iflags); }pch_udc_set_disconnect (dev); } +spin_unlock_irqrestore (&dev->lock, iflags);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 162/425 memory: gpmc: fix out of bounds read and dereference on gpmc_cs[]
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit e004c3e67b6459c99285b18366a71af467d869f5 ]
Currently the array gpmc_cs is indexed by cs before it cs is range checked and the pointer read from this out-of-index read is dereferenced. Fix this by performing the range check on cs before the read and the following pointer dereference.
Addresses-Coverity: ("Negative array index read")
--- drivers/memory/omap-gpmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +5 -2
@@ -1028,8 +1028,8 @@ EXPORT_SYMBOL(gpmc_cs_request);void gpmc_cs_free (int cs) { -struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; -struct resource *res = &gpmc->mem; +struct gpmc_cs_data *gpmc; +struct resource *res;spin_lock (&gpmc_mem_lock);if (cs >= gpmc_cs_num || cs <0 || !gpmc_cs_reserved (cs)) {
@@ -1038,6 +1038,9 @@ void gpmc_cs_free(int cs)spin_unlock (&gpmc_mem_lock);return ; } + gpmc = &gpmc_cs[cs]; + res = &gpmc->mem; +gpmc_cs_disable_mem (cs);if (res->flags)release_resource (res);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 163/425 ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas family
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 8a45f33bd36efbb624198cfa9fdf1f66fd1c3d26 ]
The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -187,7 +187,7 @@ max77693-fuel-gauge@36 { compatible = "maxim,max17047"; interrupt-parent = <&gpx2>; - interrupts = <3 IRQ_TYPE_EDGE_FALLING>; + interrupts = <3 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&max77693_fuel_irq>; reg = <0x36>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 164/425 ARM: dts: exynos: correct MUIC interrupt trigger level on Midas family
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 15107e443ab8c6cb35eff10438993e4bc944d9ae ]
The Maxim MUIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -139,7 +139,7 @@ max77693@66 { compatible = "maxim,max77693"; interrupt-parent = <&gpx1>; - interrupts = <5 IRQ_TYPE_EDGE_FALLING>; + interrupts = <5 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&max77693_irq>; reg = <0x66>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 165/425 ARM: dts: exynos: correct PMIC interrupt trigger level on Midas family
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit e52dcd6e70fab51f53292e53336ecb007bb60889 ]
The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -579,7 +579,7 @@ max77686: max77686_pmic@9 { compatible = "maxim,max77686"; interrupt-parent = <&gpx0>; - interrupts = <7 IRQ_TYPE_NONE>; + interrupts = <7 IRQ_TYPE_LEVEL_LOW>; pinctrl-0 = <&max77686_irq>; pinctrl-names = "default"; reg = <0x09>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 166/425 ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid X/U3 family
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 6503c568e97a52f8b7a3109718db438e52e59485 ]
The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.
--- arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +1 -1
@@ -265,7 +265,7 @@ max77686: pmic@9 { compatible = "maxim,max77686"; interrupt-parent = <&gpx3>; - interrupts = <2 IRQ_TYPE_NONE>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&max77686_irq>; reg = <0x09>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 167/425 ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f6368c60561370e4a92fac22982a3bd656172170 ]
The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.
--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5250-smdk5250.dts +1 -1
@@ -132,7 +132,7 @@ compatible = "maxim,max77686"; reg = <0x09>; interrupt-parent = <&gpx3>; - interrupts = <2 IRQ_TYPE_NONE>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&max77686_irq>; wakeup-source;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 168/425 ARM: dts: exynos: correct PMIC interrupt trigger level on Snow
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 8987efbb17c2522be8615085df9a14da2ab53d34 ]
The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.
--- arch/arm/boot/dts/exynos5250-snow-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5250-snow-common.dtsi +1 -1
@@ -292,7 +292,7 @@ max77686: max77686@9 { compatible = "maxim,max77686"; interrupt-parent = <&gpx3>; - interrupts = <2 IRQ_TYPE_NONE>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&max77686_irq>; wakeup-source;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 169/425 serial: stm32: fix incorrect characters on console
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit f264c6f6aece81a9f8fbdf912b20bd3feb476a7a ]
Incorrect characters are observed on console during boot. This issue occurs when init/main.c is modifying termios settings to open /dev/console on the rootfs.
This patch adds a waiting loop in set_termios to wait for TX shift register empty (and TX FIFO if any) before stopping serial port.
--- drivers/tty/serial/stm32-usart.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/tty/serial/stm32-usart.c +11 -1
@@ -637,8 +637,9 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,unsigned int baud, bits;u32 usartdiv, mantissa, fraction, oversampling;tcflag_t cflag = termios->c_cflag; -u32 cr1, cr2, cr3; +u32 cr1, cr2, cr3, isr;unsigned long flags; +int ret;if (!stm32_port->hw_flow_control) cflag &= ~CRTSCTS ;
@@ -647,6 +648,15 @@ static void stm32_set_termios(struct uart_port *port, struct ktermios *termios,spin_lock_irqsave (&port->lock, flags); + ret =readl_relaxed_poll_timeout_atomic (port->membase + ofs->isr, + isr, + (isr &USART_SR_TC ), +10 ,100000 ); + +/* Send the TC error message only when ISR_TC is not set. */ +if (ret) +dev_err (port->dev,"Transmission is not complete\n" ); +/* Stop serial port and reset value */ writel_relaxed (0 , port->membase + ofs->cr1);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 170/425 serial: stm32: fix tx_empty condition
In reply to Greg Kroah-HartmanFrom: Erwan Le Ray <[email protected]>
[ Upstream commit 3db1d52466dc11dca4e47ef12a6e6e97f846af62 ]
In "tx_empty", we should poll TC bit in both DMA and PIO modes (instead of TXE) to check transmission data register has been transmitted independently of the FIFO mode. TC indicates that both transmit register and shift register are empty. When shift register is empty, tx_empty should return TIOCSER_TEMT instead of TC value.
Cleans the USART_CR_TC TCCF register define (transmission complete clear flag) as it is duplicate of USART_ICR_TCCF.
--- drivers/tty/serial/stm32-usart.c | 5 ++++- drivers/tty/serial/stm32-usart.h | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/stm32-usart.c +4 -1
@@ -472,7 +472,10 @@ static unsigned int stm32_tx_empty(struct uart_port *port)struct stm32_port *stm32_port =to_stm32_port (port);struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; -return readl_relaxed (port->membase + ofs->isr) &USART_SR_TXE ; +if (readl_relaxed (port->membase + ofs->isr) &USART_SR_TC ) +return TIOCSER_TEMT ; + +return 0 ; }static void stm32_set_mctrl (struct uart_port *port,unsigned int mctrl)
drivers/tty/serial/stm32-usart.h +0 -3
@@ -123,9 +123,6 @@ struct stm32_usart_info stm32h7_info = {/* Dummy bits */ #define USART_SR_DUMMY_RX BIT(16) -/* USART_ICR (F7) */ -#define USART_CR_TC BIT(6) -/* USART_DR */ #define USART_DR_MASK GENMASK(8, 0)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 171/425 usb: typec: tcpci: Check ROLE_CONTROL while interpreting CC_STATUS
In reply to Greg Kroah-HartmanFrom: Badhri Jagan Sridharan <[email protected]>
[ Upstream commit 19c234a14eafca78e0bc14ffb8be3891096ce147 ]
While interpreting CC_STATUS, ROLE_CONTROL has to be read to make sure that CC1/CC2 is not forced presenting Rp/Rd.
Quoted 1 line
From the TCPCI spec:
4.4.5.2 ROLE_CONTROL (Normative):
The TCPM shall write B6 (DRP) = 0b and B3..0 (CC1/CC2) if it wishes to control the Rp/Rd directly instead of having the TCPC perform DRP toggling autonomously. When controlling Rp/Rd directly, the TCPM writes to B3..0 (CC1/CC2) each time it wishes to change the CC1/CC2 values. This control is used for TCPM-TCPC implementing Source or Sink only as well as when a connection has been detected via DRP toggling but the TCPM wishes to attempt Try.Src or Try.Snk.
Table 4-22. CC_STATUS Register Definition:
If (ROLE_CONTROL.CC1 = Rd) or ConnectResult=1)
00b: SNK.Open (Below maximum vRa)
01b: SNK.Default (Above minimum vRd-Connect)
10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp-1.5A 11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp-3.0A
If (ROLE_CONTROL.CC2=Rd) or (ConnectResult=1)
00b: SNK.Open (Below maximum vRa)
01b: SNK.Default (Above minimum vRd-Connect)
10b: SNK.Power1.5 (Above minimum vRd-Connect) Detects Rp 1.5A 11b: SNK.Power3.0 (Above minimum vRd-Connect) Detects Rp 3.0A
--- drivers/usb/typec/tcpci.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/usb/typec/tcpci.c +18 -3
@@ -20,6 +20,15 @@#define PD_RETRY_COUNT 3 +#define tcpc_presenting_cc1_rd (reg) \ + (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ + (((reg) & (TCPC_ROLE_CTRL_CC1_MASK << TCPC_ROLE_CTRL_CC1_SHIFT)) == \ + (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC1_SHIFT))) +#define tcpc_presenting_cc2_rd (reg) \ + (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ + (((reg) & (TCPC_ROLE_CTRL_CC2_MASK << TCPC_ROLE_CTRL_CC2_SHIFT)) == \ + (TCPC_ROLE_CTRL_CC_RD << TCPC_ROLE_CTRL_CC2_SHIFT))) +struct tcpci {struct device *dev;
@@ -168,19 +177,25 @@ static int tcpci_get_cc(struct tcpc_dev *tcpc, enum typec_cc_status *cc1, enum typec_cc_status *cc2) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); -unsigned int reg; +unsigned int reg, role_control;int ret; + ret =regmap_read (tcpci->regmap,TCPC_ROLE_CTRL , &role_control); +if (ret <0 ) +return ret; + ret =regmap_read (tcpci->regmap,TCPC_CC_STATUS , ®);if (ret <0 )return ret; *cc1 =tcpci_to_typec_cc ((reg >>TCPC_CC_STATUS_CC1_SHIFT ) &TCPC_CC_STATUS_CC1_MASK , - reg &TCPC_CC_STATUS_TERM ); + reg &TCPC_CC_STATUS_TERM || +tcpc_presenting_cc1_rd (role_control)); *cc2 =tcpci_to_typec_cc ((reg >>TCPC_CC_STATUS_CC2_SHIFT ) &TCPC_CC_STATUS_CC2_MASK , - reg &TCPC_CC_STATUS_TERM ); + reg &TCPC_CC_STATUS_TERM || +tcpc_presenting_cc2_rd (role_control));return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 172/425 regmap: set debugfs_name to NULL after it is freed
In reply to Greg Kroah-HartmanFrom: Meng Li <[email protected]>
[ Upstream commit e41a962f82e7afb5b1ee644f48ad0b3aee656268 ]
There is a upstream commit cffa4b2122f5("regmap:debugfs:
Fix a memory leak when calling regmap_attach_dev") that adds a if condition when create name for debugfs_name. With below function invoking logical, debugfs_name is freed in regmap_debugfs_exit(), but it is not created again because of the if condition introduced by above commit. regmap_reinit_cache()
regmap_debugfs_exit() ... regmap_debugfs_init()
So, set debugfs_name to NULL after it is freed.
--- drivers/base/regmap/regmap-debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/regmap/regmap-debugfs.c +1 -0
@@ -665,6 +665,7 @@ void regmap_debugfs_exit(struct regmap *map)regmap_debugfs_free_dump_cache (map);mutex_unlock (&map->cache_lock);kfree (map->debugfs_name); + map->debugfs_name =NULL ; }else {struct regmap_debugfs_node *node, *tmp;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 173/425 mtd: rawnand: fsmc: Fix error code in fsmc_nand_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e7a97528e3c787802d8c643d6ab2f428511bb047 ]
If dma_request_channel() fails then the probe fails and it should return a negative error code, but currently it returns success.
--- drivers/mtd/nand/raw/fsmc_nand.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/nand/raw/fsmc_nand.c +2 -0
@@ -1099,11 +1099,13 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) host->read_dma_chan =dma_request_channel (mask, filter,NULL );if (!host->read_dma_chan) {dev_err (&pdev->dev,"Unable to get read dma channel\n" ); + ret = -ENODEV ; goto disable_clk; } host->write_dma_chan =dma_request_channel (mask, filter,NULL );if (!host->write_dma_chan) {dev_err (&pdev->dev,"Unable to get write dma channel\n" ); + ret = -ENODEV ; goto release_dma_read_chan; } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 174/425 mtd: rawnand: brcmnand: fix OOB R/W with Hamming ECC
In reply to Greg Kroah-HartmanFrom: Álvaro Fernández Rojas <[email protected]>
[ Upstream commit f5200c14242fb8fa4a9b93f7fd4064d237e58785 ]
Hamming ECC doesn't cover the OOB data, so reading or writing OOB shall always be done without ECC enabled.
This is a problem when adding JFFS2 cleanmarkers to erased blocks. If JFFS2 clenmarkers are added to the OOB with ECC enabled, OOB bytes will be changed from ff ff ff to 00 00 00, reporting incorrect ECC errors.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +6 -0
@@ -2239,6 +2239,12 @@ static int brcmnand_attach_chip(struct nand_chip *chip) ret =brcmstb_choose_ecc_layout (host); +/* If OOB is written with ECC enabled it will cause ECC errors */ +if (is_hamming_ecc (host->ctrl, &host->hwcfg)) { + chip->ecc.write_oob = brcmnand_write_oob_raw; + chip->ecc.read_oob = brcmnand_read_oob_raw; + } +return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 175/425 mtd: Handle possible -EPROBE_DEFER from parse_mtd_partitions()
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 08608adb520e51403be7592c2214846fa440a23a ]
There are chances that the parse_mtd_partitions() function will return -EPROBE_DEFER in mtd_device_parse_register(). This might happen when the dependency is not available for the parser. For instance, on SDX55 the MTD_QCOMSMEM_PARTS parser depends on the QCOM_SMEM driver to parse the partitions defined in the shared memory region. With the current flow, the error returned from parse_mtd_partitions() will be discarded in favor of trying to add the fallback partition.
This will prevent the driver to end up in probe deferred pool and the partitions won't be parsed even after the QCOM_SMEM driver is available.
Fix this issue by bailing out of mtd_device_parse_register() when -EPROBE_DEFER error is returned from parse_mtd_partitions() function and propagate the error code to the driver core for probing later.
--- drivers/mtd/mtdcore.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/mtdcore.c +3 -0
@@ -712,6 +712,9 @@ int mtd_device_parse_register(struct mtd_info *mtd, const char * const *types,/* Prefer parsed partitions over driver-provided fallback */ ret =parse_mtd_partitions (mtd, types, parser_data); +if (ret == -EPROBE_DEFER ) + goto out; +if (ret >0 ) ret =0 ;else if (nr_parts)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 176/425 mtd: rawnand: qcom: Return actual error code instead of -ENODEV
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 55fbb9ba4f06cb6aff32daca1e1910173c13ec51 ]
In qcom_probe_nand_devices() function, the error code returned by qcom_nand_host_init_and_register() is converted to -ENODEV in the case of failure. This poses issue if -EPROBE_DEFER is returned when the dependency is not available for a component like parser.
So let's restructure the error handling logic a bit and return the actual error code in case of qcom_nand_host_init_and_register() failure.
--- drivers/mtd/nand/raw/qcom_nandc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/qcom_nandc.c +2 -5
@@ -2865,7 +2865,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)struct device *dev = nandc->dev;struct device_node *dn = dev->of_node, *child;struct qcom_nand_host *host; -int ret; +int ret = -ENODEV ;for_each_available_child_of_node (dn, child) { host =devm_kzalloc (dev,sizeof (*host),GFP_KERNEL );
@@ -2883,10 +2883,7 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)list_add_tail (&host->node, &nandc->host_list); } -if (list_empty (&nandc->host_list)) -return -ENODEV ; - -return 0 ; +return ret; }/* parse custom DT properties here */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 177/425 x86/microcode: Check for offline CPUs before requesting new microcode
In reply to Greg Kroah-HartmanFrom: Otavio Pontes <[email protected]>
[ Upstream commit 7189b3c11903667808029ec9766a6e96de5012a5 ]
Currently, the late microcode loading mechanism checks whether any CPUs are offlined, and, in such a case, aborts the load attempt.
However, this must be done before the kernel caches new microcode from the filesystem. Otherwise, when offlined CPUs are onlined later, those cores are going to be updated through the CPU hotplug notifier callback with the new microcode, while CPUs previously onine will continue to run with the older microcode.
For example:
Turn off one core (2 threads):
echo 0 > /sys/devices/system/cpu/cpu3/online
echo 0 > /sys/devices/system/cpu/cpu1/online
Install the ucode fails because a primary SMT thread is offline:
cp intel-ucode/06-8e-09 /lib/firmware/intel-ucode/ echo 1 > /sys/devices/system/cpu/microcode/reload
bash: echo: write error: Invalid argument
Turn the core back on
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 1 > /sys/devices/system/cpu/cpu1/online
cat /proc/cpuinfo |grep microcode
microcode : 0x30
microcode : 0xde
microcode : 0x30
microcode : 0xde
The rationale for why the update is aborted when at least one primary thread is offline is because even if that thread is soft-offlined and idle, it will still have to participate in broadcasted MCE's synchronization dance or enter SMM, and in both examples it will execute instructions so it better have the same microcode revision as the other cores.
[ bp: Heavily edit and extend commit message with the reasoning behind all
this. ]
--- arch/x86/kernel/cpu/microcode/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/microcode/core.c +4 -4
@@ -627,16 +627,16 @@ static ssize_t reload_store(struct device *dev,if (val !=1 )return size; - tmp_ret = microcode_ops->request_microcode_fw (bsp, µcode_pdev->dev, true); -if (tmp_ret !=UCODE_NEW ) -return size; -get_online_cpus (); ret =check_online_cpus ();if (ret) goto put; + tmp_ret = microcode_ops->request_microcode_fw (bsp, µcode_pdev->dev, true); +if (tmp_ret !=UCODE_NEW ) + goto put; +mutex_lock (µcode_mutex); ret =microcode_reload_late ();mutex_unlock (µcode_mutex);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 178/425 usb: gadget: pch_udc: Replace cpu_to_le32() by lower_32_bits()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 91356fed6afd1c83bf0d3df1fc336d54e38f0458 ]
Either way ~0 will be in the correct byte order, hence replace cpu_to_le32() by lower_32_bits(). Moreover, it makes sparse happy, otherwise it complains:
.../pch_udc.c:1813:27: warning: incorrect type in assignment (different base types).../pch_udc.c:1813:27: expected unsigned int [usertype] dataptr.../pch_udc.c:1813:27: got restricted __le32 [usertype]
--- drivers/usb/gadget/udc/pch_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/pch_udc.c +1 -1
@@ -1782,7 +1782,7 @@ static struct usb_request *pch_udc_alloc_request(struct usb_ep *usbep, }/* prevent from using desc. - set HOST BUSY */ dma_desc->status |=PCH_UDC_BS_HST_BSY ; - dma_desc->dataptr =cpu_to_le32 (DMA_ADDR_INVALID ); + dma_desc->dataptr =lower_32_bits (DMA_ADDR_INVALID ); req->td_data = dma_desc; req->td_data_last = dma_desc; req->chain_len =1 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 179/425 usb: gadget: pch_udc: Check if driver is present before calling ->setup()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit fbdbbe6d3ee502b3bdeb4f255196bb45003614be ]
Since we have a separate routine for VBUS sense, the interrupt may occur before gadget driver is present. Hence, ->setup() call may oops the kernel:
[ 55.245843] BUG: kernel NULL pointer dereference, address: 00000010 ... [ 55.245843] EIP: pch_udc_isr.cold+0x162/0x33f ... [ 55.245843] <IRQ> [ 55.245843] ? pch_udc_svc_data_out+0x160/0x160
Check if driver is present before calling ->setup().
--- drivers/usb/gadget/udc/pch_udc.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/usb/gadget/udc/pch_udc.c +18 -10
@@ -2325,6 +2325,21 @@ static void pch_udc_svc_data_out(struct pch_udc_dev *dev, int ep_num)pch_udc_set_dma (dev,DMA_DIR_RX ); } +static int pch_udc_gadget_setup (struct pch_udc_dev *dev) + __must_hold(&dev->lock) +{ +int rc; + +/* In some cases we can get an interrupt before driver gets setup */ +if (!dev->driver) +return -ESHUTDOWN ; + +spin_unlock (&dev->lock); + rc = dev->driver->setup (&dev->gadget, &dev->setup_data); +spin_lock (&dev->lock); +return rc; +} +/** * pch_udc_svc_control_in() - Handle Control IN endpoint interrupts * @dev: Reference to the device structure
@@ -2396,15 +2411,12 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev) dev->gadget.ep0 = &dev->ep[UDC_EP0IN_IDX ].ep; else /* OUT */ dev->gadget.ep0 = &ep->ep; -spin_lock (&dev->lock);/* If Mass storage Reset */ if ((dev->setup_data.bRequestType ==0x21 ) && (dev->setup_data.bRequest ==0xFF )) dev->prot_stall =0 ;/* call gadget with setup data received */ - setup_supported = dev->driver->setup (&dev->gadget, - &dev->setup_data); -spin_unlock (&dev->lock); + setup_supported =pch_udc_gadget_setup (dev);if (dev->setup_data.bRequestType &USB_DIR_IN ) { ep->td_data->status = (ep->td_data->status &
@@ -2652,9 +2664,7 @@ static void pch_udc_svc_intf_interrupt(struct pch_udc_dev *dev) dev->ep[i].halted =0 ; } dev->stall =0 ; -spin_unlock (&dev->lock); - dev->driver->setup (&dev->gadget, &dev->setup_data); -spin_lock (&dev->lock); +pch_udc_gadget_setup (dev); }/**
@@ -2689,9 +2699,7 @@ static void pch_udc_svc_cfg_interrupt(struct pch_udc_dev *dev) dev->stall =0 ;/* call gadget zero with setup data received */ -spin_unlock (&dev->lock); - dev->driver->setup (&dev->gadget, &dev->setup_data); -spin_lock (&dev->lock); +pch_udc_gadget_setup (dev); }/**
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 180/425 usb: gadget: pch_udc: Check for DMA mapping error
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 4a28d77e359009b846951b06f7c0d8eec8dce298 ]
DMA mapping might fail, we have to check it with dma_mapping_error(). Otherwise DMA-API is not happy:
DMA-API: pch_udc 0000:02:02.4: device driver failed to check map error[device address=0x00000000027ee678] [size=64 bytes] [mapped as single]
--- drivers/usb/gadget/udc/pch_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/pch_udc.c +1 -1
@@ -2973,7 +2973,7 @@ static int init_dma_pools(struct pch_udc_dev *dev) dev->dma_addr =dma_map_single (&dev->pdev->dev, ep0out_buf,UDC_EP0OUT_BUFF_SIZE *4 ,DMA_FROM_DEVICE ); -return 0 ; +return dma_mapping_error (&dev->pdev->dev, dev->dma_addr); } static int pch_udc_start(struct usb_gadget *g,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 181/425 crypto: qat - dont release uninitialized resources
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit b66accaab3791e15ac99c92f236d0d3a6d5bd64e ]
adf_vf_isr_resource_alloc() is not unwinding correctly when error happens and it want to release uninitialized resources. To fix this, only release initialized resources.
[ 1.792845] Trying to free already-free IRQ 11 [ 1.793091] WARNING: CPU: 0 PID: 182 at kernel/irq/manage.c:1821 free_irq+0x202/0x380 [ 1.801340] Call Trace: [ 1.801477] adf_vf_isr_resource_free+0x32/0xb0 [intel_qat] [ 1.801785] adf_vf_isr_resource_alloc+0x14d/0x150 [intel_qat] [ 1.802105] adf_dev_init+0xba/0x140 [intel_qat]
--- drivers/crypto/qat/qat_common/adf_vf_isr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/crypto/qat/qat_common/adf_vf_isr.c +13 -4
@@ -304,17 +304,26 @@ int adf_vf_isr_resource_alloc(struct adf_accel_dev *accel_dev) goto err_out;if (adf_setup_pf2vf_bh (accel_dev)) - goto err_out; + goto err_disable_msi;if (adf_setup_bh (accel_dev)) - goto err_out; + goto err_cleanup_pf2vf_bh;if (adf_request_msi_irq (accel_dev)) - goto err_out; + goto err_cleanup_bh;return 0 ; + +err_cleanup_bh: +adf_cleanup_bh (accel_dev); + +err_cleanup_pf2vf_bh: +adf_cleanup_pf2vf_bh (accel_dev); + +err_disable_msi: +adf_disable_msi (accel_dev); + err_out: -adf_vf_isr_resource_free (accel_dev);return -EFAULT ; }EXPORT_SYMBOL_GPL (adf_vf_isr_resource_alloc);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 182/425 crypto: qat - ADF_STATUS_PF_RUNNING should be set after adf_dev_init
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit 8609f5cfdc872fc3a462efa6a3eca5cb1e2f6446 ]
ADF_STATUS_PF_RUNNING is (only) used and checked by adf_vf2pf_shutdown() before calling adf_iov_putmsg()->mutex_lock(vf2pf_lock), however the vf2pf_lock is initialized in adf_dev_init(), which can fail and when it fail, the vf2pf_lock is either not initialized or destroyed, a subsequent use of vf2pf_lock will cause issue.
To fix this issue, only set this flag if adf_dev_init() returns 0.
[ 7.178404] BUG: KASAN: user-memory-access in __mutex_lock.isra.0+0x1ac/0x7c0 [ 7.180345] Call Trace: [ 7.182576] mutex_lock+0xc9/0xd0 [ 7.183257] adf_iov_putmsg+0x118/0x1a0 [intel_qat] [ 7.183541] adf_vf2pf_shutdown+0x4d/0x7b [intel_qat] [ 7.183834] adf_dev_shutdown+0x172/0x2b0 [intel_qat] [ 7.184127] adf_probe+0x5e9/0x600 [qat_dh895xccvf]
--- drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 4 ++-- drivers/crypto/qat/qat_c62xvf/adf_drv.c | 4 ++-- drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c +2 -2
@@ -238,12 +238,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_err_free_reg; -set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status); - ret =adf_dev_init (accel_dev);if (ret) goto out_err_dev_shutdown; +set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status); + ret =adf_dev_start (accel_dev);if (ret) goto out_err_dev_stop;
drivers/crypto/qat/qat_c62xvf/adf_drv.c +2 -2
@@ -238,12 +238,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_err_free_reg; -set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status); - ret =adf_dev_init (accel_dev);if (ret) goto out_err_dev_shutdown; +set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status); + ret =adf_dev_start (accel_dev);if (ret) goto out_err_dev_stop;
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c +2 -2
@@ -238,12 +238,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_err_free_reg; -set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status); - ret =adf_dev_init (accel_dev);if (ret) goto out_err_dev_shutdown; +set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status); + ret =adf_dev_start (accel_dev);if (ret) goto out_err_dev_stop;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 183/425 fotg210-udc: Fix DMA on EP0 for length > max packet size
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit 755915fc28edfc608fa89a163014acb2f31c1e19 ]
For a 75 Byte request, it would send the first 64 separately, then detect that the remaining 11 Byte fit into a single DMA, but due to this bug set the length to the original 75 Bytes. This leads to a DMA failure (which is ignored...) and the request completes without the remaining bytes having been sent.
--- drivers/usb/gadget/udc/fotg210-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/fotg210-udc.c +1 -1
@@ -345,7 +345,7 @@ static void fotg210_start_dma(struct fotg210_ep *ep,if (req->req.length - req->req.actual > ep->ep.maxpacket) length = ep->ep.maxpacket;else - length = req->req.length; + length = req->req.length - req->req.actual; } d = dma_map_single(NULL, buffer, length,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 184/425 fotg210-udc: Fix EP0 IN requests bigger than two packets
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit 078ba935651e149c92c41161e0322e3372cc2705 ]
For a 134 Byte packet, it sends the first two 64 Byte packets just fine, but then notice that less than a packet is remaining and call fotg210_done without actually sending the rest.
--- drivers/usb/gadget/udc/fotg210-udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/fotg210-udc.c +1 -1
@@ -824,7 +824,7 @@ static void fotg210_ep0in(struct fotg210_udc *fotg210)if (req->req.length)fotg210_start_dma (ep, req); -if ((req->req.length - req->req.actual) < ep->ep.maxpacket) +if (req->req.actual == req->req.length)fotg210_done (ep, req,0 ); }else {fotg210_set_cxdone (fotg210);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 185/425 fotg210-udc: Remove a dubious condition leading to fotg210_done
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit c7f755b243494d6043aadcd9a2989cb157958b95 ]
When the EP0 IN request was not completed but less than a packet sent, it would complete the request successfully. That doesn't make sense and can't really happen as fotg210_start_dma always sends min(length, maxpkt) bytes.
--- drivers/usb/gadget/udc/fotg210-udc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/gadget/udc/fotg210-udc.c +1 -2
@@ -382,8 +382,7 @@ static void fotg210_ep0_queue(struct fotg210_ep *ep, }if (ep->dir_in) {/* if IN */ fotg210_start_dma (ep, req); -if ((req->req.length == req->req.actual) || - (req->req.actual < ep->ep.maxpacket)) +if (req->req.length == req->req.actual)fotg210_done (ep, req,0 ); }else {/* OUT */ u32 value =ioread32 (ep->fotg210->reg +FOTG210_DMISGR0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 186/425 fotg210-udc: Mask GRP2 interrupts we dont handle
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit 9aee3a23d6455200702f3a57e731fa11e8408667 ]
Currently it leaves unhandled interrupts unmasked, but those are never acked. In the case of a "device idle" interrupt, this leads to an effectively frozen system until plugging it in.
--- drivers/usb/gadget/udc/fotg210-udc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/gadget/udc/fotg210-udc.c +6 -0
@@ -1030,6 +1030,12 @@ static void fotg210_init(struct fotg210_udc *fotg210) value &= ~DMCR_GLINT_EN ;iowrite32 (value, fotg210->reg +FOTG210_DMCR ); +/* enable only grp2 irqs we handle */ +iowrite32 (~(DISGR2_DMA_ERROR |DISGR2_RX0BYTE_INT |DISGR2_TX0BYTE_INT + |DISGR2_ISO_SEQ_ABORT_INT |DISGR2_ISO_SEQ_ERR_INT + |DISGR2_RESM_INT |DISGR2_SUSP_INT |DISGR2_USBRST_INT ), + fotg210->reg +FOTG210_DMISGR2 ); +/* disable all fifo interrupt */ iowrite32 (~(u32 )0 , fotg210->reg +FOTG210_DMISGR1 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 187/425 fotg210-udc: Dont DMA more than the buffer can take
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit 3e7c2510bdfe89a9ec223dd7acd6bfc8bb1cbeb6 ]
Before this, it wrote as much as available into the buffer, even if it didn't fit.
--- drivers/usb/gadget/udc/fotg210-udc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/fotg210-udc.c +3 -2
@@ -337,8 +337,9 @@ static void fotg210_start_dma(struct fotg210_ep *ep, }else { buffer = req->req.buf + req->req.actual; length =ioread32 (ep->fotg210->reg + -FOTG210_FIBCR (ep->epnum -1 )); - length &=FIBCR_BCFX ; +FOTG210_FIBCR (ep->epnum -1 )) &FIBCR_BCFX ; +if (length > req->req.length - req->req.actual) + length = req->req.length - req->req.actual; } }else { buffer = req->req.buf + req->req.actual;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 188/425 fotg210-udc: Complete OUT requests on short packets
In reply to Greg Kroah-HartmanFrom: Fabian Vogt <[email protected]>
[ Upstream commit 75bb93be0027123b5db6cbcce89eb62f0f6b3c5b ]
A short packet indicates the end of a transfer and marks the request as complete.
--- drivers/usb/gadget/udc/fotg210-udc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/fotg210-udc.c +6 -2
@@ -853,12 +853,16 @@ static void fotg210_out_fifo_handler(struct fotg210_ep *ep) {struct fotg210_request *req =list_entry (ep->queue.next, struct fotg210_request, queue); +int disgr1 =ioread32 (ep->fotg210->reg +FOTG210_DISGR1 );fotg210_start_dma (ep, req); -/* finish out transfer */ +/* Complete the request when it's full or a short packet arrived. +* Like other drivers, short_not_ok isn't handled. +*/ +if (req->req.length == req->req.actual || - req->req.actual < ep->ep.maxpacket) + (disgr1 &DISGR1_SPK_INT (ep->epnum -1 )))fotg210_done (ep, req,0 ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 189/425 mtd: require write permissions for locking and badblock ioctls
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 1e97743fd180981bef5f01402342bb54bf1c6366 ]
MEMLOCK, MEMUNLOCK and OTPLOCK modify protection bits. Thus require write permission. Depending on the hardware MEMLOCK might even be write-once, e.g. for SPI-NOR flashes with their WP# tied to GND. OTPLOCK is always write-once.
MEMSETBADBLOCK modifies the bad block table.
--- drivers/mtd/mtdchar.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/mtdchar.c +4 -4
@@ -663,16 +663,12 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)case MEMGETINFO :case MEMREADOOB :case MEMREADOOB64 : -case MEMLOCK : -case MEMUNLOCK :case MEMISLOCKED :case MEMGETOOBSEL :case MEMGETBADBLOCK : -case MEMSETBADBLOCK :case OTPSELECT :case OTPGETREGIONCOUNT :case OTPGETREGIONINFO : -case OTPLOCK :case ECCGETLAYOUT :case ECCGETSTATS :case MTDFILEMODE :
@@ -683,9 +679,13 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)/* "dangerous" commands */ case MEMERASE :case MEMERASE64 : +case MEMLOCK : +case MEMUNLOCK : +case MEMSETBADBLOCK :case MEMWRITEOOB :case MEMWRITEOOB64 :case MEMWRITE : +case OTPLOCK :if (!(file->f_mode &FMODE_WRITE ))return -EPERM ;break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 190/425 bus: qcom: Put child node before return
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit ac6ad7c2a862d682bb584a4bc904d89fa7721af8 ]
Put child node before return to fix potential reference count leak. Generally, the reference count of child is incremented and decremented automatically in the macro for_each_available_child_of_node() and should be decremented manually if the loop is broken in loop body.
--- drivers/bus/qcom-ebi2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bus/qcom-ebi2.c +3 -1
@@ -357,8 +357,10 @@ static int qcom_ebi2_probe(struct platform_device *pdev)/* Figure out the chipselect */ ret =of_property_read_u32 (child,"reg" , &csindex); -if (ret) +if (ret) { +of_node_put (child);return ret; + }if (csindex >5 ) { dev_err(dev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 191/425 soundwire: bus: Fix device found flag correctly
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit f03690f4f6992225d05dbd1171212e5be5a370dd ]
found flag is used to indicate SoundWire devices that are both enumerated on the bus and available in the device list. However this flag is not reset correctly after one iteration, This could miss some of the devices that are enumerated on the bus but not in device list. So reset this correctly to fix this issue!
--- drivers/soundwire/bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soundwire/bus.c +2 -1
@@ -514,7 +514,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)struct sdw_slave *slave, *_s;struct sdw_slave_id id;struct sdw_msg msg; -bool found = false; +bool found;int count =0 , ret;u64 addr;
@@ -545,6 +545,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)sdw_extract_slave_id (bus, addr, &id); + found = false;/* Now compare with entries */ list_for_each_entry_safe (slave, _s, &bus->slaves, node) {if (sdw_compare_devid (slave, id) ==0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 192/425 phy: marvell: ARMADA375_USBCLUSTER_PHY should not default to y, unconditionally
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 6cb17707aad869de163d7bf42c253caf501be4e2 ]
Merely enabling CONFIG_COMPILE_TEST should not enable additional code. To fix this, restrict the automatic enabling of ARMADA375_USBCLUSTER_PHY to MACH_ARMADA_375, and ask the user in case of compile-testing.
--- drivers/phy/marvell/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/marvell/Kconfig +2 -2
@@ -2,8 +2,8 @@ # Phy drivers for Marvell platforms # config ARMADA375_USBCLUSTER_PHY - def_bool y - depends on MACH_ARMADA_375 || COMPILE_TEST + bool "Armada 375 USB cluster PHY support" if COMPILE_TEST + default y if MACH_ARMADA_375 depends on OF && HAS_IOMEM select GENERIC_PHY
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 193/425 crypto: qat - fix error path in adf_isr_resource_alloc()
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 83dc1173d73f80cbce2fee4d308f51f87b2f26ae ]
The function adf_isr_resource_alloc() is not unwinding correctly in case of error.
This patch fixes the error paths and propagate the errors to the caller.
--- drivers/crypto/qat/qat_common/adf_isr.c | 29 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/crypto/qat/qat_common/adf_isr.c +21 -8
@@ -330,19 +330,32 @@ int adf_isr_resource_alloc(struct adf_accel_dev *accel_dev) ret =adf_isr_alloc_msix_entry_table (accel_dev);if (ret) -return ret; -if (adf_enable_msix (accel_dev)) goto err_out; -if (adf_setup_bh (accel_dev)) - goto err_out; + ret =adf_enable_msix (accel_dev); +if (ret) + goto err_free_msix_table; -if (adf_request_irqs (accel_dev)) - goto err_out; + ret =adf_setup_bh (accel_dev); +if (ret) + goto err_disable_msix; + + ret =adf_request_irqs (accel_dev); +if (ret) + goto err_cleanup_bh;return 0 ; + +err_cleanup_bh: +adf_cleanup_bh (accel_dev); + +err_disable_msix: +adf_disable_msix (&accel_dev->accel_pci_dev); + +err_free_msix_table: +adf_isr_free_msix_entry_table (accel_dev); + err_out: -adf_isr_resource_free (accel_dev); -return -EFAULT ; +return ret; }EXPORT_SYMBOL_GPL (adf_isr_resource_alloc);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 194/425 usb: gadget: aspeed: fix dma map failure
In reply to Greg Kroah-HartmanFrom: Tao Ren <[email protected]>
[ Upstream commit bd4d607044b961cecbf8c4c2f3bb5da4fb156993 ]
Currently the virtual port_dev device is passed to DMA API, and this is wrong because the device passed to DMA API calls must be the actual hardware device performing the DMA.
The patch replaces usb_gadget_map_request/usb_gadget_unmap_request APIs with usb_gadget_map_request_by_dev/usb_gadget_unmap_request_by_dev APIs so the DMA capable platform device can be passed to the DMA APIs.
The patch fixes below backtrace detected on Facebook AST2500 OpenBMC platforms:
[<80106550>] show_stack+0x20/0x24 [<80106868>] dump_stack+0x28/0x30 [<80823540>] __warn+0xfc/0x110 [<8011ac30>] warn_slowpath_fmt+0xb0/0xc0 [<8011ad44>] dma_map_page_attrs+0x24c/0x314 [<8016a27c>] usb_gadget_map_request_by_dev+0x100/0x1e4 [<805cedd8>] usb_gadget_map_request+0x1c/0x20 [<805cefbc>] ast_vhub_epn_queue+0xa0/0x1d8 [<7f02f710>] usb_ep_queue+0x48/0xc4 [<805cd3e8>] ecm_do_notify+0xf8/0x248 [<7f145920>] ecm_set_alt+0xc8/0x1d0 [<7f145c34>] composite_setup+0x680/0x1d30 [<7f00deb8>] ast_vhub_ep0_handle_setup+0xa4/0x1bc [<7f02ee94>] ast_vhub_dev_irq+0x58/0x84 [<7f0309e0>] ast_vhub_irq+0xb0/0x1c8 [<7f02e118>] __handle_irq_event_percpu+0x50/0x19c [<8015e5bc>] handle_irq_event_percpu+0x38/0x8c [<8015e758>] handle_irq_event+0x38/0x4c
--- drivers/usb/gadget/udc/aspeed-vhub/core.c | 3 ++- drivers/usb/gadget/udc/aspeed-vhub/epn.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/aspeed-vhub/core.c +2 -1
@@ -36,6 +36,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req, int status) {bool internal = req->internal; +struct ast_vhub *vhub = ep->vhub;EPVDBG (ep,"completing request @%p, status %d\n" , req, status);
@@ -46,7 +47,7 @@ void ast_vhub_done(struct ast_vhub_ep *ep, struct ast_vhub_req *req,if (req->req.dma) {if (!WARN_ON (!ep->dev)) -usb_gadget_unmap_request (&ep->dev->gadget, +usb_gadget_unmap_request_by_dev (&vhub->pdev->dev, &req->req, ep->epn.is_in); req->req.dma =0 ; }
drivers/usb/gadget/udc/aspeed-vhub/epn.c +1 -1
@@ -376,7 +376,7 @@ static int ast_vhub_epn_queue(struct usb_ep* u_ep, struct usb_request *u_req,if (ep->epn.desc_mode || ((((unsigned long )u_req->buf &7 ) ==0 ) && (ep->epn.is_in || !(u_req->length & (u_ep->maxpacket -1 ))))) { - rc =usb_gadget_map_request (&ep->dev->gadget, u_req, + rc =usb_gadget_map_request_by_dev (&vhub->pdev->dev, u_req, ep->epn.is_in);if (rc) { dev_warn(&vhub->pdev->dev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 195/425 USB: gadget: udc: fix wrong pointer passed to IS_ERR() and PTR_ERR()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2e3d055bf27d70204cae349335a62a4f9b7c165a ]
IS_ERR() and PTR_ERR() use wrong pointer, it should be udc->virt_addr, fix it.
--- drivers/usb/gadget/udc/snps_udc_plat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/snps_udc_plat.c +2 -2
@@ -114,8 +114,8 @@ static int udc_plat_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); udc->virt_addr =devm_ioremap_resource (dev, res); -if (IS_ERR (udc->regs)) -return PTR_ERR (udc->regs); +if (IS_ERR (udc->virt_addr)) +return PTR_ERR (udc->virt_addr);/* udc csr registers base */ udc->csr = udc->virt_addr +UDC_CSR_ADDR ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 196/425 soundwire: stream: fix memory leak in stream config error path
In reply to Greg Kroah-HartmanFrom: Rander Wang <[email protected]>
[ Upstream commit 48f17f96a81763c7c8bf5500460a359b9939359f ]
When stream config is failed, master runtime will release all slave runtime in the slave_rt_list, but slave runtime is not added to the list at this time. This patch frees slave runtime in the config error path to fix the memory leak.
--- drivers/soundwire/stream.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/soundwire/stream.c +9 -1
@@ -1182,8 +1182,16 @@ int sdw_stream_add_slave(struct sdw_slave *slave, } ret =sdw_config_stream (&slave->dev, stream, stream_config, true); -if (ret) +if (ret) { +/* +* sdw_release_master_stream will release s_rt in slave_rt_list in +* stream_error case, but s_rt is only added to slave_rt_list +* when sdw_config_stream is successful, so free s_rt explicitly +* when sdw_config_stream is failed. +*/ +kfree (s_rt); goto stream_error; + }list_add_tail (&s_rt->m_rt_node, &m_rt->slave_rt_list);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 197/425 mtd: rawnand: gpmi: Fix a double free in gpmi_nand_init
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 076de75de1e53160e9b099f75872c1f9adf41a0b ]
If the callee gpmi_alloc_dma_buffer() failed to alloc memory for this->raw_buffer, gpmi_free_dma_buffer() will be called to free this->auxiliary_virt. But this->auxiliary_virt is still a non-NULL and valid ptr.
Then gpmi_alloc_dma_buffer() returns err and gpmi_free_dma_buffer() is called again to free this->auxiliary_virt in err_out. This causes a double free.
As gpmi_free_dma_buffer() has already called in gpmi_alloc_dma_buffer's error path, so it should return err directly instead of releasing the dma buffer again.
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +1 -1
@@ -1931,7 +1931,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this) this->bch_geometry.auxiliary_size =128 ; ret =gpmi_alloc_dma_buffer (this);if (ret) - goto err_out; +return ret; chip->dummy_controller.ops = &gpmi_nand_controller_ops; ret =nand_scan (chip,GPMI_IS_MX6 (this) ?2 :1 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 198/425 irqchip/gic-v3: Fix OF_BAD_ADDR error handling
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 8e13d96670a4c050d4883e6743a9e9858e5cfe10 ]
When building with extra warnings enabled, clang points out a mistake in the error handling:
drivers/irqchip/irq-gic-v3-mbi.c:306:21: error: result of comparison of constant 18446744073709551615 with expression of type 'phys_addr_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (mbi_phys_base == OF_BAD_ADDR) {Truncate the constant to the same type as the variable it gets compared to, to shut make the check work and void the warning.
--- drivers/irqchip/irq-gic-v3-mbi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3-mbi.c +1 -1
@@ -297,7 +297,7 @@ int __init mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent) reg =of_get_property (np,"mbi-alias" ,NULL );if (reg) { mbi_phys_base =of_translate_address (np, reg); -if (mbi_phys_base ==OF_BAD_ADDR ) { +if (mbi_phys_base == (phys_addr_t )OF_BAD_ADDR ) { ret = -ENXIO ; goto err_free_mbi; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 199/425 staging: rtl8192u: Fix potential infinite loop
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit f9b9263a25dc3d2eaaa829e207434db6951ca7bc ]
The for-loop iterates with a u8 loop counter i and compares this with the loop upper limit of riv->ieee80211->LinkDetectInfo.SlotNum that is a u16 type. There is a potential infinite loop if SlotNum is larger than the u8 loop counter. Fix this by making the loop counter the same type as SlotNum.
Addresses-Coverity: ("Infinite loop")
--- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -1
@@ -3379,7 +3379,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, u32 *TotalRxDataNum) {u16 SlotIndex; -u8 i; +u16 i; *TotalRxBcnNum =0 ; *TotalRxDataNum =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 200/425 staging: greybus: uart: fix unprivileged TIOCCSERIAL
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 60c6b305c11b5fd167ce5e2ce42f3a9098c388f0 ]
TIOCSSERIAL is a horrid, underspecified, legacy interface which for most serial devices is only useful for setting the close_delay and closing_wait parameters.
A non-privileged user has only ever been able to set the since long deprecated ASYNC_SPD flags and trying to change any other *supported* feature should result in -EPERM being returned. Setting the current values for any supported features should return success.
Fix the greybus implementation which instead indicated that the TIOCSSERIAL ioctl was not even implemented when a non-privileged user set the current values.
--- drivers/staging/greybus/uart.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/greybus/uart.c +0 -2
@@ -656,8 +656,6 @@ static int set_serial_info(struct gb_tty *gb_tty,if ((close_delay != gb_tty->port.close_delay) || (closing_wait != gb_tty->port.closing_wait)) retval = -EPERM ; -else - retval = -EOPNOTSUPP ; }else { gb_tty->port.close_delay = close_delay; gb_tty->port.closing_wait = closing_wait;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 201/425 spi: Fix use-after-free with devm_spi_alloc_*
In reply to Greg Kroah-HartmanFrom: William A. Kennington III <[email protected]>
[ Upstream commit 794aaf01444d4e765e2b067cba01cc69c1c68ed9 ]
We can't rely on the contents of the devres list during spi_unregister_controller(), as the list is already torn down at the time we perform devres_find() for devm_spi_release_controller. This causes devices registered with devm_spi_alloc_{master,slave}() to be mistakenly identified as legacy, non-devm managed devices and have their reference counters decremented below 0.
------------[ cut here ]------------ WARNING: CPU: 1 PID: 660 at lib/refcount.c:28 refcount_warn_saturate+0x108/0x174 [<b0396f04>] (refcount_warn_saturate) from [<b03c56a4>] (kobject_put+0x90/0x98) [<b03c5614>] (kobject_put) from [<b0447b4c>] (put_device+0x20/0x24) r4:b6700140 [<b0447b2c>] (put_device) from [<b07515e8>] (devm_spi_release_controller+0x3c/0x40) [<b07515ac>] (devm_spi_release_controller) from [<b045343c>] (release_nodes+0x84/0xc4) r5:b6700180 r4:b6700100 [<b04533b8>] (release_nodes) from [<b0454160>] (devres_release_all+0x5c/0x60) r8:b1638c54 r7:b117ad94 r6:b1638c10 r5:b117ad94 r4:b163dc10 [<b0454104>] (devres_release_all) from [<b044e41c>] (__device_release_driver+0x144/0x1ec) r5:b117ad94 r4:b163dc10 [<b044e2d8>] (__device_release_driver) from [<b044f70c>] (device_driver_detach+0x84/0xa0) r9:00000000 r8:00000000 r7:b117ad94 r6:b163dc54 r5:b1638c10 r4:b163dc10 [<b044f688>] (device_driver_detach) from [<b044d274>] (unbind_store+0xe4/0xf8)
Instead, determine the devm allocation state as a flag on the controller which is guaranteed to be stable during cleanup.
--- drivers/spi/spi.c | 9 ++------- include/linux/spi/spi.h | 3 +++ 2 files changed, 5 insertions(+), 7 deletions(-)
drivers/spi/spi.c +2 -7
@@ -2084,6 +2084,7 @@ struct spi_controller *__devm_spi_alloc_controller(struct device *dev, ctlr =__spi_alloc_controller (dev, size, slave);if (ctlr) { + ctlr->devm_allocated = true; *ptr = ctlr;devres_add (dev, ptr); }else {
@@ -2344,11 +2345,6 @@ int devm_spi_register_controller(struct device *dev, }EXPORT_SYMBOL_GPL (devm_spi_register_controller); -static int devm_spi_match_controller (struct device *dev,void *res,void *ctlr) -{ -return *(struct spi_controller **)res == ctlr; -} -static int __unregister (struct device *dev,void *null) {spi_unregister_device (to_spi_device (dev));
@@ -2395,8 +2391,7 @@ void spi_unregister_controller(struct spi_controller *ctlr)/* Release the last reference on the controller if its driver * has not yet been converted to devm_spi_alloc_master/slave(). */ -if (!devres_find (ctlr->dev.parent, devm_spi_release_controller, - devm_spi_match_controller, ctlr)) +if (!ctlr->devm_allocated)put_device (&ctlr->dev);/* free bus id */
include/linux/spi/spi.h +3 -0
@@ -450,6 +450,9 @@ struct spi_controller {#define SPI_MASTER_GPIO_SS BIT(5)/* GPIO CS must select slave */ +/* flag indicating this is a non-devres managed controller */ +bool devm_allocated; +/* flag indicating this is an SPI slave controller */ bool slave;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 202/425 soc: qcom: mdt_loader: Validate that p_filesz < p_memsz
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 84168d1b54e76a1bcb5192991adde5176abe02e3 ]
The code validates that segments of p_memsz bytes of a segment will fit in the provided memory region, but does not validate that p_filesz bytes will, which means that an incorrectly crafted ELF header might write beyond the provided memory region.
--- drivers/soc/qcom/mdt_loader.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/soc/qcom/mdt_loader.c +8 -0
@@ -168,6 +168,14 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,break ; } +if (phdr->p_filesz > phdr->p_memsz) { +dev_err (dev, +"refusing to load segment %d with p_filesz > p_memsz\n" , + i); + ret = -EINVAL ; +break ; + } + ptr = mem_region + offset;if (phdr->p_filesz) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 203/425 soc: qcom: mdt_loader: Detect truncated read of segments
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 0648c55e3a21ccd816e99b6600d6199fbf39d23a ]
Given that no validation of how much data the firmware loader read in for a given segment truncated segment files would best case result in a hash verification failure, without any indication of what went wrong.
Improve this by validating that the firmware loader did return the amount of data requested.
--- drivers/soc/qcom/mdt_loader.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/soc/qcom/mdt_loader.c +9 -0
@@ -187,6 +187,15 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw,break ; } +if (seg_fw->size != phdr->p_filesz) { +dev_err (dev, +"failed to load segment %d from truncated file %s\n" , + i, fw_name); +release_firmware (seg_fw); + ret = -EINVAL ; +break ; + } +release_firmware (seg_fw); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 204/425 ACPI: CPPC: Replace cppc_attr with kobj_attribute
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 2bc6262c6117dd18106d5aa50d53e945b5d99c51 ]
All of the CPPC sysfs show functions are called via indirect call in kobj_attr_show(), where they should be of type
ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);
because that is the type of the ->show() member in 'struct kobj_attribute' but they are actually of type
ssize_t (*show)(struct kobject *kobj, struct attribute *attr, char *buf);
because of the ->show() member in 'struct cppc_attr', resulting in a Control Flow Integrity violation [1].
$ cat /sys/devices/system/cpu/cpu0/acpi_cppc/highest_perf 3400
$ dmesg | grep "CFI failure" [ 175.970559] CFI failure (target: show_highest_perf+0x0/0x8):
As far as I can tell, the only difference between 'struct cppc_attr' and 'struct kobj_attribute' aside from the type of the attr parameter is the type of the count parameter in the ->store() member (ssize_t vs. size_t), which does not actually matter because all of these nodes are read-only.
Eliminate 'struct cppc_attr' in favor of 'struct kobj_attribute' to fix the violation.
[1]: https://lore.kernel.org/r/[email protected]/
--- drivers/acpi/cppc_acpi.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/acpi/cppc_acpi.c +3 -11
@@ -122,23 +122,15 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);*/ #define NUM_RETRIES 500ULL -struct cppc_attr { -struct attribute attr; -ssize_t (*show)(struct kobject *kobj, -struct attribute *attr,char *buf); -ssize_t (*store)(struct kobject *kobj, -struct attribute *attr,const char *c,ssize_t count); -}; -#define define_one_cppc_ro (_name) \ -static struct cppc_attr _name = \ +static struct kobj_attribute _name = \ __ATTR(_name, 0444, show_##_name, NULL)#define to_cpc_desc (a) container_of(a, struct cpc_desc, kobj)#define show_cppc_data (access_fn, struct_name, member_name) \ static ssize_t show_##member_name(struct kobject *kobj, \ - struct attribute *attr, char *buf) \ + struct kobj_attribute *attr, char *buf) \ { \ struct cpc_desc *cpc_ptr = to_cpc_desc(kobj); \ struct struct_name st_name = {0}; \
@@ -164,7 +156,7 @@ show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, reference_perf);show_cppc_data (cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time);static ssize_t show_feedback_ctrs (struct kobject *kobj, -struct attribute *attr,char *buf) +struct kobj_attribute *attr,char *buf) {struct cpc_desc *cpc_ptr =to_cpc_desc (kobj);struct cppc_perf_fb_ctrs fb_ctrs = {0 };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 205/425 crypto: qat - Fix a double free in adf_create_ring
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit f7cae626cabb3350b23722b78fe34dd7a615ca04 ]
In adf_create_ring, if the callee adf_init_ring() failed, the callee will free the ring->base_addr by dma_free_coherent() and return -EFAULT. Then adf_create_ring will goto err and the ring->base_addr will be freed again in adf_cleanup_ring().
My patch sets ring->base_addr to NULL after the first freed to avoid the double free.
--- drivers/crypto/qat/qat_common/adf_transport.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/qat/qat_common/adf_transport.c +1 -0
@@ -197,6 +197,7 @@ static int adf_init_ring(struct adf_etr_ring_data *ring)dev_err (&GET_DEV (accel_dev),"Ring address not aligned\n" );dma_free_coherent (&GET_DEV (accel_dev), ring_size_bytes, ring->base_addr, ring->dma_addr); + ring->base_addr =NULL ;return -EFAULT ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 206/425 cpufreq: armada-37xx: Fix setting TBG parent for load levels
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 22592df194e31baf371906cc720da38fa0ab68f5 ]
With CPU frequency determining software [1] we have discovered that after this driver does one CPU frequency change, the base frequency of the CPU is set to the frequency of TBG-A-P clock, instead of the TBG that is parent to the CPU.
This can be reproduced on EspressoBIN and Turris MOX:
cd /sys/devices/system/cpu/cpufreq/policy0 echo powersave >scaling_governor
echo performance >scaling_governor
Running the mhz tool before this driver is loaded reports 1000 MHz, and after loading the driver and executing commands above the tool reports 800 MHz.
The change of TBG clock selector is supposed to happen in function armada37xx_cpufreq_dvfs_setup. Before the function returns, it does this:
parent = clk_get_parent(clk);
clk_set_parent(clk, parent);
The armada-37xx-periph clock driver has the .set_parent method implemented correctly for this, so if the method was actually called, this would work. But since the introduction of the common clock framework in commit b2476490ef11 ("clk: introduce the common clock..."), the clk_set_parent function checks whether the parent is actually changing, and if the requested new parent is same as the old parent (which is obviously the case for the code above), the .set_parent method is not called at all.
This patch fixes this issue by filling the correct TBG clock selector directly in the armada37xx_cpufreq_dvfs_setup during the filling of other registers at the same address. But the determination of CPU TBG index cannot be done via the common clock framework, therefore we need to access the North Bridge Peripheral Clock registers directly in this driver.
[1] https://github.com/wtarreau/mhz
--- drivers/cpufreq/armada-37xx-cpufreq.c | 35 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/cpufreq/armada-37xx-cpufreq.c +23 -12
@@ -25,6 +25,10 @@#include "cpufreq-dt.h" +/* Clk register set */ +#define ARMADA_37XX_CLK_TBG_SEL 0 +#define ARMADA_37XX_CLK_TBG_SEL_CPU_OFF 22 +/* Power management in North Bridge register set */ #define ARMADA_37XX_NB_L0L1 0x18#define ARMADA_37XX_NB_L2L3 0x1C
@@ -120,10 +124,15 @@ static struct armada_37xx_dvfs *armada_37xx_cpu_freq_info_get(u32 freq)* will be configured then the DVFS will be enabled. */ static void __init armada37xx_cpufreq_dvfs_setup (struct regmap *base, -struct clk *clk,u8 *divider) +struct regmap *clk_base,u8 *divider) { +u32 cpu_tbg_sel;int load_lvl; -struct clk *parent; + +/* Determine to which TBG clock is CPU connected */ +regmap_read (clk_base,ARMADA_37XX_CLK_TBG_SEL , &cpu_tbg_sel); + cpu_tbg_sel >>=ARMADA_37XX_CLK_TBG_SEL_CPU_OFF ; + cpu_tbg_sel &=ARMADA_37XX_NB_TBG_SEL_MASK ;for (load_lvl =0 ; load_lvl <LOAD_LEVEL_NR ; load_lvl++) {unsigned int reg, mask, val, offset =0 ;
@@ -142,6 +151,11 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base, mask = (ARMADA_37XX_NB_CLK_SEL_MASK <<ARMADA_37XX_NB_CLK_SEL_OFF ); +/* Set TBG index, for all levels we use the same TBG */ + val = cpu_tbg_sel <<ARMADA_37XX_NB_TBG_SEL_OFF ; + mask = (ARMADA_37XX_NB_TBG_SEL_MASK + <<ARMADA_37XX_NB_TBG_SEL_OFF ); +/* * Set cpu divider based on the pre-computed array in * order to have balanced step.
@@ -160,14 +174,6 @@ static void __init armada37xx_cpufreq_dvfs_setup(struct regmap *base,regmap_update_bits (base, reg, mask, val); } - -/* -* Set cpu clock source, for all the level we keep the same -* clock source that the one already configured. For this one -* we need to use the clock framework -*/ - parent =clk_get_parent (clk); -clk_set_parent (clk, parent); }/*
@@ -360,11 +366,16 @@ static int __init armada37xx_cpufreq_driver_init(void)struct platform_device *pdev;unsigned long freq;unsigned int cur_frequency, base_frequency; -struct regmap *nb_pm_base, *avs_base; +struct regmap *nb_clk_base, *nb_pm_base, *avs_base;struct device *cpu_dev;int load_lvl, ret;struct clk *clk, *parent; + nb_clk_base = +syscon_regmap_lookup_by_compatible ("marvell,armada-3700-periph-clock-nb" ); +if (IS_ERR (nb_clk_base)) +return -ENODEV ; + nb_pm_base =syscon_regmap_lookup_by_compatible ("marvell,armada-3700-nb-pm" );
@@ -441,7 +452,7 @@ static int __init armada37xx_cpufreq_driver_init(void)armada37xx_cpufreq_avs_configure (avs_base, dvfs);armada37xx_cpufreq_avs_setup (avs_base, dvfs); -armada37xx_cpufreq_dvfs_setup (nb_pm_base, clk, dvfs->divider); +armada37xx_cpufreq_dvfs_setup (nb_pm_base, nb_clk_base, dvfs->divider);clk_put (clk); for (load_lvl = ARMADA_37XX_DVFS_LOAD_0; load_lvl < LOAD_LEVEL_NR;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 207/425 clk: mvebu: armada-37xx-periph: remove .set_parent method for CPU PM clock
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 4e435a9dd26c46ac018997cc0562d50b1a96f372 ]
Remove the .set_parent method in clk_pm_cpu_ops.
This method was supposed to be needed by the armada-37xx-cpufreq driver, but was never actually called due to wrong assumptions in the cpufreq driver. After this was fixed in the cpufreq driver, this method is not needed anymore.
--- drivers/clk/mvebu/armada-37xx-periph.c | 28 -------------------------- 1 file changed, 28 deletions(-)
drivers/clk/mvebu/armada-37xx-periph.c +0 -28
@@ -428,33 +428,6 @@ static u8 clk_pm_cpu_get_parent(struct clk_hw *hw)return val; } -static int clk_pm_cpu_set_parent (struct clk_hw *hw,u8 index) -{ -struct clk_pm_cpu *pm_cpu =to_clk_pm_cpu (hw); -struct regmap *base = pm_cpu->nb_pm_base; -int load_level; - -/* -* We set the clock parent only if the DVFS is available but -* not enabled. -*/ -if (IS_ERR (base) ||armada_3700_pm_dvfs_is_enabled (base)) -return -EINVAL ; - -/* Set the parent clock for all the load level */ -for (load_level =0 ; load_level <LOAD_LEVEL_NR ; load_level++) { -unsigned int reg, mask, val, - offset =ARMADA_37XX_NB_TBG_SEL_OFF ; - -armada_3700_pm_dvfs_update_regs (load_level, ®, &offset); - - val = index << offset; - mask =ARMADA_37XX_NB_TBG_SEL_MASK << offset; -regmap_update_bits (base, reg, mask, val); - } -return 0 ; -} -static unsigned long clk_pm_cpu_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) {
@@ -580,7 +553,6 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate,static const struct clk_ops clk_pm_cpu_ops = { .get_parent = clk_pm_cpu_get_parent, - .set_parent = clk_pm_cpu_set_parent, .round_rate = clk_pm_cpu_round_rate, .set_rate = clk_pm_cpu_set_rate, .recalc_rate = clk_pm_cpu_recalc_rate,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 208/425 cpufreq: armada-37xx: Fix the AVS value for load L1
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit d118ac2062b5b8331c8768ac81e016617e0996ee ]
The original CPU voltage value for load L1 is too low for Armada 37xx SoC when base CPU frequency is 1000 or 1200 MHz. It leads to instabilities where CPU gets stuck soon after dynamic voltage scaling from load L1 to L0.
Update the CPU voltage value for load L1 accordingly when base frequency is 1000 or 1200 MHz. The minimal L1 value for base CPU frequency 1000 MHz is updated from the original 1.05V to 1.108V and for 1200 MHz is updated to 1.155V. This minimal L1 value is used only in the case when it is lower than value for L0.
This change fixes CPU instability issues on 1 GHz and 1.2 GHz variants of Espressobin and 1 GHz Turris Mox.
Marvell previously for 1 GHz variant of Espressobin provided a patch [1] suitable only for their Marvell Linux kernel 4.4 fork which workarounded this issue. Patch forced CPU voltage value to 1.108V in all loads. But such change does not fix CPU instability issues on 1.2 GHz variants of Armada 3720 SoC.
During testing we come to the conclusion that using 1.108V as minimal value for L1 load makes 1 GHz variants of Espressobin and Turris Mox boards stable. And similarly 1.155V for 1.2 GHz variant of Espressobin.
These two values 1.108V and 1.155V are documented in Armada 3700 Hardware Specifications as typical initial CPU voltage values.
Discussion about this issue is also at the Armbian forum [2].
[1] - https://github.com/MarvellEmbeddedProcessors/linux-marvell/commit/dc33b62c90696afb6adc7dbcc4ebbd48bedec269
[2] - https://forum.armbian.com/topic/10429-how-to-make-espressobin-v7-stable/
--- drivers/cpufreq/armada-37xx-cpufreq.c | 37 +++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
drivers/cpufreq/armada-37xx-cpufreq.c +37 -0
@@ -73,6 +73,8 @@#define LOAD_LEVEL_NR 4#define MIN_VOLT_MV 1000 +#define MIN_VOLT_MV_FOR_L1_1000MHZ 1108 +#define MIN_VOLT_MV_FOR_L1_1200MHZ 1155/* AVS value for the corresponding voltage (in mV) */ static int avs_map[] = {
@@ -208,6 +210,8 @@ static u32 armada_37xx_avs_val_match(int target_vm)* - L2 & L3 voltage should be about 150mv smaller than L0 voltage. * This function calculates L1 & L2 & L3 AVS values dynamically based * on L0 voltage and fill all AVS values to the AVS value table. +* When base CPU frequency is 1000 or 1200 MHz then there is additional +* minimal avs value for load L1. */ static void __init armada37xx_cpufreq_avs_configure (struct regmap *base,struct armada_37xx_dvfs *dvfs)
@@ -239,6 +243,19 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base,for (load_level =1 ; load_level <LOAD_LEVEL_NR ; load_level++) dvfs->avs[load_level] = avs_min; +/* +* Set the avs values for load L0 and L1 when base CPU frequency +* is 1000/1200 MHz to its typical initial values according to +* the Armada 3700 Hardware Specifications. +*/ +if (dvfs->cpu_freq_max >=1000 *1000 *1000 ) { +if (dvfs->cpu_freq_max >=1200 *1000 *1000 ) + avs_min =armada_37xx_avs_val_match (MIN_VOLT_MV_FOR_L1_1200MHZ ); +else + avs_min =armada_37xx_avs_val_match (MIN_VOLT_MV_FOR_L1_1000MHZ ); + dvfs->avs[0 ] = dvfs->avs[1 ] = avs_min; + } +return ; }
@@ -258,6 +275,26 @@ static void __init armada37xx_cpufreq_avs_configure(struct regmap *base, target_vm = avs_map[l0_vdd_min] -150 ; target_vm = target_vm >MIN_VOLT_MV ? target_vm :MIN_VOLT_MV ; dvfs->avs[2 ] = dvfs->avs[3 ] =armada_37xx_avs_val_match (target_vm); + +/* +* Fix the avs value for load L1 when base CPU frequency is 1000/1200 MHz, +* otherwise the CPU gets stuck when switching from load L1 to load L0. +* Also ensure that avs value for load L1 is not higher than for L0. +*/ +if (dvfs->cpu_freq_max >=1000 *1000 *1000 ) { +u32 avs_min_l1; + +if (dvfs->cpu_freq_max >=1200 *1000 *1000 ) + avs_min_l1 =armada_37xx_avs_val_match (MIN_VOLT_MV_FOR_L1_1200MHZ ); +else + avs_min_l1 =armada_37xx_avs_val_match (MIN_VOLT_MV_FOR_L1_1000MHZ ); + +if (avs_min_l1 > dvfs->avs[0 ]) + avs_min_l1 = dvfs->avs[0 ]; + +if (dvfs->avs[1 ] < avs_min_l1) + dvfs->avs[1 ] = avs_min_l1; + } } static void __init armada37xx_cpufreq_avs_setup(struct regmap *base,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 209/425 clk: mvebu: armada-37xx-periph: Fix switching CPU freq from 250 Mhz to 1 GHz
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 4decb9187589f61fe9fc2bc4d9b01160b0a610c5 ]
It was observed that the workaround introduced by commit 61c40f35f5cd ("clk: mvebu: armada-37xx-periph: Fix switching CPU rate from 300Mhz to 1.2GHz") when base CPU frequency is 1.2 GHz is also required when base CPU frequency is 1 GHz. Otherwise switching CPU frequency directly from L2 (250 MHz) to L0 (1 GHz) causes a crash.
When base CPU frequency is just 800 MHz no crashed were observed during switch from L2 to L0.
--- drivers/clk/mvebu/armada-37xx-periph.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/clk/mvebu/armada-37xx-periph.c +7 -5
@@ -475,8 +475,10 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate, }/* -* Switching the CPU from the L2 or L3 frequencies (300 and 200 Mhz -* respectively) to L0 frequency (1.2 Ghz) requires a significant +* Workaround when base CPU frequnecy is 1000 or 1200 MHz +* +* Switching the CPU from the L2 or L3 frequencies (250/300 or 200 MHz +* respectively) to L0 frequency (1/1.2 GHz) requires a significant * amount of time to let VDD stabilize to the appropriate * voltage. This amount of time is large enough that it cannot be * covered by the hardware countdown register. Due to this, the CPU
@@ -486,15 +488,15 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate,* To work around this problem, we prevent switching directly from the * L2/L3 frequencies to the L0 frequency, and instead switch to the L1 * frequency in-between. The sequence therefore becomes: -* 1. First switch from L2/L3(200/300MHz) to L1(600MHZ) +* 1. First switch from L2/L3 (200/250/300 MHz) to L1 (500/600 MHz) * 2. Sleep 20ms for stabling VDD voltage -* 3. Then switch from L1(600MHZ) to L0(1200Mhz). +* 3. Then switch from L1 (500/600 MHz) to L0 (1000/1200 MHz). */ static void clk_pm_cpu_set_rate_wa (unsigned long rate,struct regmap *base) {unsigned int cur_level; -if (rate !=1200 *1000 *1000 ) +if (rate <1000 *1000 *1000 )return ;regmap_read (base,ARMADA_37XX_NB_CPU_LOAD , &cur_level);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 210/425 clk: mvebu: armada-37xx-periph: Fix workaround for switching from L1 to L0
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit e93033aff684641f71a436ca7a9d2a742126baaf ]
When CPU frequency is at 250 MHz and set_rate() is called with 500 MHz (L1) quickly followed by a call with 1 GHz (L0), the CPU does not necessarily stay in L1 for at least 20ms as is required by Marvell errata.
This situation happens frequently with the ondemand cpufreq governor and can be also reproduced with userspace governor. In most cases it causes CPU to crash.
This change fixes the above issue and ensures that the CPU always stays in L1 for at least 20ms when switching from any state to L0.
--- drivers/clk/mvebu/armada-37xx-periph.c | 45 ++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-)
drivers/clk/mvebu/armada-37xx-periph.c +39 -6
@@ -74,6 +74,7 @@ struct clk_pm_cpu {void __iomem *reg_div;u8 shift_div;struct regmap *nb_pm_base; +unsigned long l1_expiration; };#define to_clk_double_div (_hw) container_of(_hw, struct clk_double_div, hw)
@@ -492,22 +493,52 @@ static long clk_pm_cpu_round_rate(struct clk_hw *hw, unsigned long rate,* 2. Sleep 20ms for stabling VDD voltage * 3. Then switch from L1 (500/600 MHz) to L0 (1000/1200 MHz). */ -static void clk_pm_cpu_set_rate_wa (unsigned long rate,struct regmap *base) +static void clk_pm_cpu_set_rate_wa (struct clk_pm_cpu *pm_cpu, +unsigned int new_level,unsigned long rate, +struct regmap *base) {unsigned int cur_level; -if (rate <1000 *1000 *1000 ) -return ; -regmap_read (base,ARMADA_37XX_NB_CPU_LOAD , &cur_level); cur_level &=ARMADA_37XX_NB_CPU_LOAD_MASK ; -if (cur_level <=ARMADA_37XX_DVFS_LOAD_1 ) + +if (cur_level == new_level) +return ; + +/* +* System wants to go to L1 on its own. If we are going from L2/L3, +* remember when 20ms will expire. If from L0, set the value so that +* next switch to L0 won't have to wait. +*/ +if (new_level ==ARMADA_37XX_DVFS_LOAD_1 ) { +if (cur_level ==ARMADA_37XX_DVFS_LOAD_0 ) + pm_cpu->l1_expiration = jiffies; +else + pm_cpu->l1_expiration = jiffies +msecs_to_jiffies (20 );return ; + } + +/* +* If we are setting to L2/L3, just invalidate L1 expiration time, +* sleeping is not needed. +*/ +if (rate <1000 *1000 *1000 ) + goto invalidate_l1_exp; + +/* +* We are going to L0 with rate >= 1GHz. Check whether we have been at +* L1 for long enough time. If not, go to L1 for 20ms. +*/ +if (pm_cpu->l1_expiration && jiffies >= pm_cpu->l1_expiration) + goto invalidate_l1_exp;regmap_update_bits (base,ARMADA_37XX_NB_CPU_LOAD ,ARMADA_37XX_NB_CPU_LOAD_MASK ,ARMADA_37XX_DVFS_LOAD_1 );msleep (20 ); + +invalidate_l1_exp: + pm_cpu->l1_expiration =0 ; } static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
@@ -541,7 +572,9 @@ static int clk_pm_cpu_set_rate(struct clk_hw *hw, unsigned long rate, reg =ARMADA_37XX_NB_CPU_LOAD ; mask =ARMADA_37XX_NB_CPU_LOAD_MASK ; -clk_pm_cpu_set_rate_wa (rate, base); +/* Apply workaround when base CPU frequency is 1000 or 1200 MHz */ +if (parent_rate >=1000 *1000 *1000 ) +clk_pm_cpu_set_rate_wa (pm_cpu, load_level, rate, base);regmap_update_bits (base, reg, mask, load_level);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 211/425 cpufreq: armada-37xx: Fix driver cleanup when registration failed
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 92963903a8e11b9576eb7249f8e81eefa93b6f96 ]
Commit 8db82563451f ("cpufreq: armada-37xx: fix frequency calculation for opp") changed calculation of frequency passed to the dev_pm_opp_add() function call. But the code for dev_pm_opp_remove() function call was not updated, so the driver cleanup phase does not work when registration fails.
This fixes the issue by using the same frequency in both calls.
--- drivers/cpufreq/armada-37xx-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/armada-37xx-cpufreq.c +1 -1
@@ -523,7 +523,7 @@ disable_dvfs: remove_opp:/* clean-up the already added opp before leaving */ while (load_lvl-- >ARMADA_37XX_DVFS_LOAD_0 ) { - freq = cur_frequency / dvfs->divider[load_lvl]; + freq = base_frequency / dvfs->divider[load_lvl];dev_pm_opp_remove (cpu_dev, freq); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 212/425 cpufreq: armada-37xx: Fix determining base CPU frequency
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 8bad3bf23cbc40abe1d24cec08a114df6facf858 ]
When current CPU load is not L0 then loading armada-37xx-cpufreq.ko driver fails with following error:
# modprobe armada-37xx-cpufreq
[ 502.702097] Unsupported CPU frequency 250 MHzThis issue was partially fixed by commit 8db82563451f ("cpufreq:
armada-37xx: fix frequency calculation for opp"), but only for calculating CPU frequency for opp.
Fix this also for determination of base CPU frequency.
--- drivers/cpufreq/armada-37xx-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/armada-37xx-cpufreq.c +1 -1
@@ -471,7 +471,7 @@ static int __init armada37xx_cpufreq_driver_init(void)return -EINVAL ; } - dvfs =armada_37xx_cpu_freq_info_get (cur_frequency); + dvfs =armada_37xx_cpu_freq_info_get (base_frequency);if (!dvfs) {clk_put (clk);return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 213/425 usb: gadget: r8a66597: Add missing null check on return from platform_get_resource
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 9c2076090c2815fe7c49676df68dde7e60a9b9fc ]
The call to platform_get_resource can potentially return a NULL pointer on failure, so add this check and return -EINVAL if it fails.
Addresses-Coverity: ("Dereference null return")
--- drivers/usb/gadget/udc/r8a66597-udc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/udc/r8a66597-udc.c +2 -0
@@ -1852,6 +1852,8 @@ static int r8a66597_probe(struct platform_device *pdev)return PTR_ERR (reg); ires =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); +if (!ires) +return -EINVAL ; irq = ires->start; irq_trigger = ires->flags &IRQF_TRIGGER_MASK ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 214/425 USB: cdc-acm: fix unprivileged TIOCCSERIAL
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit dd5619582d60007139f0447382d2839f4f9e339b ]
TIOCSSERIAL is a horrid, underspecified, legacy interface which for most serial devices is only useful for setting the close_delay and closing_wait parameters.
A non-privileged user has only ever been able to set the since long deprecated ASYNC_SPD flags and trying to change any other *supported* feature should result in -EPERM being returned. Setting the current values for any supported features should return success.
Fix the cdc-acm implementation which instead indicated that the TIOCSSERIAL ioctl was not even implemented when a non-privileged user set the current values.
--- drivers/usb/class/cdc-acm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/usb/class/cdc-acm.c +0 -2
@@ -987,8 +987,6 @@ static int set_serial_info(struct acm *acm,if ((new_serial.close_delay != old_close_delay) || (new_serial.closing_wait != old_closing_wait)) retval = -EPERM ; -else - retval = -EOPNOTSUPP ; }else { acm->port.close_delay = close_delay; acm->port.closing_wait = closing_wait;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 215/425 tty: actually undefine superseded ASYNC flags
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit d09845e98a05850a8094ea8fd6dd09a8e6824fff ]
Some kernel-internal ASYNC flags have been superseded by tty-port flags and should no longer be used by kernel drivers.
Fix the misspelled "__KERNEL__" compile guards which failed their sole purpose to break out-of-tree drivers that have not yet been updated.
--- include/uapi/linux/tty_flags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/tty_flags.h +2 -2
@@ -39,7 +39,7 @@* WARNING: These flags are no longer used and have been superceded by the * TTY_PORT_ flags in the iflags field (and not userspace-visible) */ -#ifndef _KERNEL_ +#ifndef __KERNEL__#define ASYNCB_INITIALIZED 31/* Serial port was initialized */ #define ASYNCB_SUSPENDED 30/* Serial port is suspended */ #define ASYNCB_NORMAL_ACTIVE 29/* Normal device is active */
@@ -81,7 +81,7 @@#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI) -#ifndef _KERNEL_ +#ifndef __KERNEL__/* These flags are no longer used (and were always masked from userspace) */ #define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)#define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 216/425 tty: fix return value for unsupported ioctls
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 1b8b20868a6d64cfe8174a21b25b74367bdf0560 ]
Drivers should return -ENOTTY ("Inappropriate I/O control operation") when an ioctl isn't supported, while -EINVAL is used for invalid arguments.
Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned -EINVAL when a tty driver did not implement the corresponding operations.
Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a corresponding Fixes tag below.
--- drivers/tty/tty_io.c | 8 ++++---- include/linux/tty_driver.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/tty/tty_io.c +4 -4
@@ -2432,14 +2432,14 @@ out:* @p: pointer to result * * Obtain the modem status bits from the tty driver if the feature -* is supported. Return -EINVAL if it is not available. +* is supported. Return -ENOTTY if it is not available. * * Locking: none (up to the driver) */ static int tty_tiocmget (struct tty_struct *tty,int __user *p) { -int retval = -EINVAL ; +int retval = -ENOTTY ;if (tty->ops->tiocmget) { retval = tty->ops->tiocmget (tty);
@@ -2457,7 +2457,7 @@ static int tty_tiocmget(struct tty_struct *tty, int __user *p)* @p: pointer to desired bits * * Set the modem status bits from the tty driver if the feature -* is supported. Return -EINVAL if it is not available. +* is supported. Return -ENOTTY if it is not available. * * Locking: none (up to the driver) */
@@ -2469,7 +2469,7 @@ static int tty_tiocmset(struct tty_struct *tty, unsigned int cmd,unsigned int set, clear, val;if (tty->ops->tiocmset ==NULL ) -return -EINVAL ; +return -ENOTTY ; retval =get_user (val, p);if (retval)
include/linux/tty_driver.h +1 -1
@@ -236,7 +236,7 @@* * Called when the device receives a TIOCGICOUNT ioctl. Passed a kernel * structure to complete. This method is optional and will only be called -* if provided (otherwise EINVAL will be returned). +* if provided (otherwise ENOTTY will be returned). */ #include <linux/export.h>
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 217/425 firmware: qcom-scm: Fix QCOM_SCM configuration
In reply to Greg Kroah-HartmanFrom: He Ying <[email protected]>
[ Upstream commit 2954a6f12f250890ec2433cec03ba92784d613e8 ]
When CONFIG_QCOM_SCM is y and CONFIG_HAVE_ARM_SMCCC is not set, compiling errors are encountered as follows:
drivers/firmware/qcom_scm-smc.o: In function `__scm_smc_do_quirk':
qcom_scm-smc.c:(.text+0x36): undefined reference to __arm_smccc_smc' drivers/firmware/qcom_scm-legacy.o: In function scm_legacy_call':
qcom_scm-legacy.c:(.text+0xe2): undefined reference to __arm_smccc_smc' drivers/firmware/qcom_scm-legacy.o: In function scm_legacy_call_atomic':
qcom_scm-legacy.c:(.text+0x1f0): undefined reference to `__arm_smccc_smc'
Note that __arm_smccc_smc is defined when HAVE_ARM_SMCCC is y. So add dependency on HAVE_ARM_SMCCC in QCOM_SCM configuration.
--- drivers/firmware/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/Kconfig +1 -0
@@ -248,6 +248,7 @@ config FW_CFG_SYSFS_CMDLINE config QCOM_SCM bool depends on ARM || ARM64 + depends on HAVE_ARM_SMCCC select RESET_CONTROLLER config QCOM_SCM_32
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 218/425 usbip: vudc: fix missing unlock on error in usbip_sockfd_store()
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 1d08ed588c6a85a35a24c82eb4cf0807ec2b366a ]
Add the missing unlock before return from function usbip_sockfd_store() in the error handling case.
--- drivers/usb/usbip/vudc_sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/usbip/vudc_sysfs.c +2 -0
@@ -157,12 +157,14 @@ static ssize_t usbip_sockfd_store(struct device *dev, tcp_rx =kthread_create (&v_rx_loop, &udc->ud,"vudc_rx" );if (IS_ERR (tcp_rx)) {sockfd_put (socket); +mutex_unlock (&udc->ud.sysfs_lock);return -EINVAL ; } tcp_tx =kthread_create (&v_tx_loop, &udc->ud,"vudc_tx" );if (IS_ERR (tcp_tx)) {kthread_stop (tcp_rx);sockfd_put (socket); +mutex_unlock (&udc->ud.sysfs_lock);return -EINVAL ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 219/425 platform/x86: pmc_atom: Match all Beckhoff Automation baytrail boards with critclk_systems DMI table
In reply to Greg Kroah-HartmanFrom: Steffen Dirkwinkel <[email protected]>
[ Upstream commit d21e5abd3a005253eb033090aab2e43bce090d89 ]
pmc_plt_clk* clocks are used for ethernet controllers, so need to stay turned on. This adds the affected board family to critclk_systems DMI table, so the clocks are marked as CLK_CRITICAL and not turned off.
This replaces the previously listed boards with a match for the whole device family CBxx63. CBxx63 matches only baytrail devices. There are new affected boards that would otherwise need to be listed. There are unaffected boards in the family, but having the clocks turned on is not an issue.
--- drivers/platform/x86/pmc_atom.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-)
drivers/platform/x86/pmc_atom.c +2 -26
@@ -423,34 +423,10 @@ static const struct dmi_system_id critclk_systems[] = { }, {/* pmc_plt_clk* - are used for ethernet controllers */ - .ident = "Beckhoff CB3163", + .ident = "Beckhoff Baytrail", .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"Beckhoff Automation" ), - DMI_MATCH(DMI_BOARD_NAME, "CB3163"), - }, - }, - { -/* pmc_plt_clk* - are used for ethernet controllers */ - .ident ="Beckhoff CB4063" , - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Beckhoff Automation" ), - DMI_MATCH(DMI_BOARD_NAME, "CB4063"), - }, - }, - { -/* pmc_plt_clk* - are used for ethernet controllers */ - .ident ="Beckhoff CB6263" , - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Beckhoff Automation" ), - DMI_MATCH(DMI_BOARD_NAME, "CB6263"), - }, - }, - { -/* pmc_plt_clk* - are used for ethernet controllers */ - .ident ="Beckhoff CB6363" , - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Beckhoff Automation" ), - DMI_MATCH(DMI_BOARD_NAME, "CB6363"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "CBxx63"), }, }, {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 220/425 x86/platform/uv: Fix !KEXEC build failure
In reply to Greg Kroah-HartmanFrom: Ingo Molnar <[email protected]>
[ Upstream commit c2209ea55612efac75de0a58ef5f7394fae7fa0f ]
When KEXEC is disabled, the UV build fails:
arch/x86/platform/uv/uv_nmi.c:875:14: error: ‘uv_nmi_kexec_failed’ undeclared (first use in this function)
Since uv_nmi_kexec_failed is only defined in the KEXEC_CORE #ifdef branch, this code cannot ever have been build tested:
if (main)
pr_err("UV: NMI kdump: KEXEC not supported in this kernel\n");
atomic_set(&uv_nmi_kexec_failed, 1);Nor is this use possible in uv_handle_nmi():
atomic_set(&uv_nmi_kexec_failed, 0);
These bugs were introduced in this commit:
d0a9964e9873: ("x86/platform/uv: Implement simple dump failover if kdump fails")
Which added the uv_nmi_kexec_failed assignments to !KEXEC code, while making the definition KEXEC-only - apparently without testing the !KEXEC case.
Instead of complicating the #ifdef maze, simplify the code by requiring X86_UV to depend on KEXEC_CORE. This pattern is present in other architectures as well.
( We'll remove the untested, 7 years old !KEXEC complications from the file in a
separate commit. )
--- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -533,6 +533,7 @@ config X86_UV depends on X86_EXTENDED_PLATFORM depends on NUMA depends on EFI + depends on KEXEC_CORE depends on X86_X2APIC depends on PCI ---help---
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 221/425 Drivers: hv: vmbus: Increase wait time for VMbus unload
In reply to Greg Kroah-HartmanFrom: Michael Kelley <[email protected]>
[ Upstream commit 77db0ec8b7764cb9b09b78066ebfd47b2c0c1909 ]
When running in Azure, disks may be connected to a Linux VM with read/write caching enabled. If a VM panics and issues a VMbus UNLOAD request to Hyper-V, the response is delayed until all dirty data in the disk cache is flushed. In extreme cases, this flushing can take 10's of seconds, depending on the disk speed and the amount of dirty data. If kdump is configured for the VM, the current 10 second timeout in vmbus_wait_for_unload() may be exceeded, and the UNLOAD complete message may arrive well after the kdump kernel is already running, causing problems. Note that no problem occurs if kdump is not enabled because Hyper-V waits for the cache flush before doing a reboot through the BIOS/UEFI code.
Fix this problem by increasing the timeout in vmbus_wait_for_unload() to 100 seconds. Also output periodic messages so that if anyone is watching the serial console, they won't think the VM is completely hung.
--- drivers/hv/channel_mgmt.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
drivers/hv/channel_mgmt.c +25 -5
@@ -773,6 +773,12 @@ static void init_vp_index(struct vmbus_channel *channel, u16 dev_type)free_cpumask_var (available_mask); } +#define UNLOAD_DELAY_UNIT_MS 10/* 10 milliseconds */ +#define UNLOAD_WAIT_MS (100*1000)/* 100 seconds */ +#define UNLOAD_WAIT_LOOPS (UNLOAD_WAIT_MS/UNLOAD_DELAY_UNIT_MS) +#define UNLOAD_MSG_MS (5*1000)/* Every 5 seconds */ +#define UNLOAD_MSG_LOOPS (UNLOAD_MSG_MS/UNLOAD_DELAY_UNIT_MS) +static void vmbus_wait_for_unload (void ) {int cpu;
@@ -790,12 +796,17 @@ static void vmbus_wait_for_unload(void)* vmbus_connection.unload_event. If not, the last thing we can do is * read message pages for all CPUs directly. * -* Wait no more than 10 seconds so that the panic path can't get -* hung forever in case the response message isn't seen. +* Wait up to 100 seconds since an Azure host must writeback any dirty +* data in its disk cache before the VMbus UNLOAD request will +* complete. This flushing has been empirically observed to take up +* to 50 seconds in cases with a lot of dirty data, so allow additional +* leeway and for inaccuracies in mdelay(). But eventually time out so +* that the panic path can't get hung forever in case the response +* message isn't seen. */ -for (i =0 ; i <1000 ; i++) { +for (i =1 ; i <=UNLOAD_WAIT_LOOPS ; i++) {if (completion_done (&vmbus_connection.unload_event)) -break ; + goto completed;for_each_online_cpu (cpu) {struct hv_per_cpu_context *hv_cpu
@@ -818,9 +829,18 @@ static void vmbus_wait_for_unload(void)vmbus_signal_eom (msg, message_type); } -mdelay (10 ); +/* +* Give a notice periodically so someone watching the +* serial output won't think it is completely hung. +*/ +if (!(i %UNLOAD_MSG_LOOPS )) +pr_notice ("Waiting for VMBus UNLOAD to complete\n" ); + +mdelay (UNLOAD_DELAY_UNIT_MS ); } +pr_err ("Continuing even though VMBus UNLOAD did not complete\n" ); +completed:/* * We're crashing and already got the UNLOAD_RESPONSE, cleanup all * maybe-pending messages on all CPUs to be able to receive new
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 222/425 usb: dwc2: Fix host mode hibernation exit with remote wakeup flow.
In reply to Greg Kroah-HartmanFrom: Artur Petrosyan <[email protected]>
[ Upstream commit c2db8d7b9568b10e014af83b3c15e39929e3579e ]
Added setting "port_connect_status_change" flag to "1" in order to re-enumerate, because after exit from hibernation port connection status is not detected.
--- drivers/usb/dwc2/hcd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/usb/dwc2/hcd.c +9 -1
@@ -5741,7 +5741,15 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup,return ret; } -dwc2_hcd_rem_wakeup (hsotg); +if (rem_wakeup) { +dwc2_hcd_rem_wakeup (hsotg); +/* +* Change "port_connect_status_change" flag to re-enumerate, +* because after exit from hibernation port connection status +* is not detected. +*/ + hsotg->flags.b.port_connect_status_change =1 ; + } hsotg->hibernated =0 ; hsotg->bus_suspended =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 223/425 usb: dwc2: Fix hibernation between host and device modes.
In reply to Greg Kroah-HartmanFrom: Artur Petrosyan <[email protected]>
[ Upstream commit 24d209dba5a3959b2ebde7cf3ad40c8015e814cf ]
When core is in hibernation in host mode and a device cable was connected then driver exited from device hibernation. However, registers saved for host mode and when exited from device hibernation register restore would be done for device register which was wrong because there was no device registers stored to restore.
- Added dwc_handle_gpwrdn_disc_det() function which handles gpwrdn disconnect detect flow and exits hibernation without restoring the registers.
- Updated exiting from hibernation in GPWRDN_STS_CHGINT with calling dwc_handle_gpwrdn_disc_det() function. Here no register is restored which is the solution described above.
--- drivers/usb/dwc2/core_intr.c | 154 +++++++++++++++++++---------------- 1 file changed, 83 insertions(+), 71 deletions(-)
drivers/usb/dwc2/core_intr.c +83 -71
@@ -653,6 +653,71 @@ static u32 dwc2_read_common_intr(struct dwc2_hsotg *hsotg)return 0 ; } +/** +* dwc_handle_gpwrdn_disc_det() - Handles the gpwrdn disconnect detect. +* Exits hibernation without restoring registers. +* +* @hsotg: Programming view of DWC_otg controller +* @gpwrdn: GPWRDN register +*/ +static inline void dwc_handle_gpwrdn_disc_det (struct dwc2_hsotg *hsotg, +u32 gpwrdn) +{ +u32 gpwrdn_tmp; + +/* Switch-on voltage to the core */ + gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); + gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH ; +dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); +udelay (5 ); + +/* Reset core */ + gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); + gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN ; +dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); +udelay (5 ); + +/* Disable Power Down Clamp */ + gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); + gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP ; +dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); +udelay (5 ); + +/* Deassert reset core */ + gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); + gpwrdn_tmp |=GPWRDN_PWRDNRSTN ; +dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); +udelay (5 ); + +/* Disable PMU interrupt */ + gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); + gpwrdn_tmp &= ~GPWRDN_PMUINTSEL ; +dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); + +/* De-assert Wakeup Logic */ + gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); + gpwrdn_tmp &= ~GPWRDN_PMUACTV ; +dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); + + hsotg->hibernated =0 ; + hsotg->bus_suspended =0 ; + +if (gpwrdn &GPWRDN_IDSTS ) { + hsotg->op_state =OTG_STATE_B_PERIPHERAL ; +dwc2_core_init (hsotg, false); +dwc2_enable_global_interrupts (hsotg); +dwc2_hsotg_core_init_disconnected (hsotg, false); +dwc2_hsotg_core_connect (hsotg); + }else { + hsotg->op_state =OTG_STATE_A_HOST ; + +/* Initialize the Core for Host mode */ +dwc2_core_init (hsotg, false); +dwc2_enable_global_interrupts (hsotg); +dwc2_hcd_start (hsotg); + } +} +/* * GPWRDN interrupt handler. *
@@ -674,64 +739,14 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg)if ((gpwrdn &GPWRDN_DISCONN_DET ) && (gpwrdn &GPWRDN_DISCONN_DET_MSK ) && !linestate) { -u32 gpwrdn_tmp; -dev_dbg (hsotg->dev,"%s: GPWRDN_DISCONN_DET\n" , __func__); - -/* Switch-on voltage to the core */ - gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); - gpwrdn_tmp &= ~GPWRDN_PWRDNSWTCH ; -dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); -udelay (10 ); - -/* Reset core */ - gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); - gpwrdn_tmp &= ~GPWRDN_PWRDNRSTN ; -dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); -udelay (10 ); - -/* Disable Power Down Clamp */ - gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); - gpwrdn_tmp &= ~GPWRDN_PWRDNCLMP ; -dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); -udelay (10 ); - -/* Deassert reset core */ - gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); - gpwrdn_tmp |=GPWRDN_PWRDNRSTN ; -dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); -udelay (10 ); - -/* Disable PMU interrupt */ - gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); - gpwrdn_tmp &= ~GPWRDN_PMUINTSEL ; -dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); - -/* De-assert Wakeup Logic */ - gpwrdn_tmp =dwc2_readl (hsotg,GPWRDN ); - gpwrdn_tmp &= ~GPWRDN_PMUACTV ; -dwc2_writel (hsotg, gpwrdn_tmp,GPWRDN ); - - hsotg->hibernated =0 ; - -if (gpwrdn &GPWRDN_IDSTS ) { - hsotg->op_state =OTG_STATE_B_PERIPHERAL ; -dwc2_core_init (hsotg, false); -dwc2_enable_global_interrupts (hsotg); -dwc2_hsotg_core_init_disconnected (hsotg, false); -dwc2_hsotg_core_connect (hsotg); - }else { - hsotg->op_state =OTG_STATE_A_HOST ; - -/* Initialize the Core for Host mode */ -dwc2_core_init (hsotg, false); -dwc2_enable_global_interrupts (hsotg); -dwc2_hcd_start (hsotg); - } - } - -if ((gpwrdn &GPWRDN_LNSTSCHG ) && - (gpwrdn &GPWRDN_LNSTSCHG_MSK ) && linestate) { +/* +* Call disconnect detect function to exit from +* hibernation +*/ +dwc_handle_gpwrdn_disc_det (hsotg, gpwrdn); + }else if ((gpwrdn &GPWRDN_LNSTSCHG ) && + (gpwrdn &GPWRDN_LNSTSCHG_MSK ) && linestate) {dev_dbg (hsotg->dev,"%s: GPWRDN_LNSTSCHG\n" , __func__);if (hsotg->hw_params.hibernation && hsotg->hibernated) {
@@ -742,24 +757,21 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg)dwc2_exit_hibernation (hsotg,1 ,0 ,1 ); } } - } -if ((gpwrdn &GPWRDN_RST_DET ) && (gpwrdn &GPWRDN_RST_DET_MSK )) { + }else if ((gpwrdn &GPWRDN_RST_DET ) && + (gpwrdn &GPWRDN_RST_DET_MSK )) {dev_dbg (hsotg->dev,"%s: GPWRDN_RST_DET\n" , __func__);if (!linestate && (gpwrdn &GPWRDN_BSESSVLD ))dwc2_exit_hibernation (hsotg,0 ,1 ,0 ); - } -if ((gpwrdn &GPWRDN_STS_CHGINT ) && - (gpwrdn &GPWRDN_STS_CHGINT_MSK ) && linestate) { + }else if ((gpwrdn &GPWRDN_STS_CHGINT ) && + (gpwrdn &GPWRDN_STS_CHGINT_MSK )) {dev_dbg (hsotg->dev,"%s: GPWRDN_STS_CHGINT\n" , __func__); -if (hsotg->hw_params.hibernation && - hsotg->hibernated) { -if (gpwrdn &GPWRDN_IDSTS ) { -dwc2_exit_hibernation (hsotg,0 ,0 ,0 ); -call_gadget (hsotg, resume); - }else { -dwc2_exit_hibernation (hsotg,1 ,0 ,1 ); - } - } +/* +* As GPWRDN_STS_CHGINT exit from hibernation flow is +* the same as in GPWRDN_DISCONN_DET flow. Call +* disconnect detect helper function to exit from +* hibernation. +*/ +dwc_handle_gpwrdn_disc_det (hsotg, gpwrdn); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 224/425 ttyprintk: Add TTY hangup callback.
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit c0070e1e60270f6a1e09442a9ab2335f3eaeaad2 ]
syzbot is reporting hung task due to flood of
tty_warn(tty, "%s: tty->count = 1 port count = %d\n", __func__,
port->count);
message [1], for ioctl(TIOCVHANGUP) prevents tty_port_close() from decrementing port->count due to tty_hung_up_p() == true.
----------
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int i;
int fd[10];
for (i = 0; i < 10; i++)
fd[i] = open("/dev/ttyprintk", O_WRONLY);
ioctl(fd[0], TIOCVHANGUP);
for (i = 0; i < 10; i++)
close(fd[i]);
close(open("/dev/ttyprintk", O_WRONLY));
return 0;
}----------
When TTY hangup happens, port->count needs to be reset via "struct tty_operations"->hangup callback.
[1] https://syzkaller.appspot.com/bug?id=39ea6caa479af471183997376dc7e90bc7d64a6a
--- drivers/char/ttyprintk.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/char/ttyprintk.c +11 -0
@@ -159,12 +159,23 @@ static int tpk_ioctl(struct tty_struct *tty,return 0 ; } +/* +* TTY operations hangup function. +*/ +static void tpk_hangup (struct tty_struct *tty) +{ +struct ttyprintk_port *tpkp = tty->driver_data; + +tty_port_hangup (&tpkp->port); +} +static const struct tty_operations ttyprintk_ops = { .open = tpk_open, .close = tpk_close, .write = tpk_write, .write_room = tpk_write_room, .ioctl = tpk_ioctl, + .hangup = tpk_hangup, };static const struct tty_port_operations null_ops = { };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 225/425 soc: aspeed: fix a ternary sign expansion bug
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 5ffa828534036348fa90fb3079ccc0972d202c4a ]
The intent here was to return negative error codes but it actually returns positive values. The problem is that type promotion with ternary operations is quite complicated.
"ret" is an int. "copied" is a u32. And the snoop_file_read() function returns long. What happens is that "ret" is cast to u32 and becomes positive then it's cast to long and it's still positive.
Fix this by removing the ternary so that "ret" is type promoted directly to long.
--- drivers/misc/aspeed-lpc-snoop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/aspeed-lpc-snoop.c +3 -1
@@ -99,8 +99,10 @@ static ssize_t snoop_file_read(struct file *file, char __user *buffer,return -EINTR ; } ret =kfifo_to_user (&chan->fifo, buffer, count, &copied); +if (ret) +return ret; -return ret ? ret : copied; +return copied; } static __poll_t snoop_file_poll(struct file *file,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 226/425 media: vivid: fix assignment of dev->fbuf_out_flags
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 5cde22fcc7271812a7944c47b40100df15908358 ]
Currently the chroma_flags and alpha_flags are being zero'd with a bit-wise mask and the following statement should be bit-wise or'ing in the new flag bits but instead is making a direct assignment. Fix this by using the |= operator rather than an assignment.
Addresses-Coverity: ("Unused value")
--- drivers/media/platform/vivid/vivid-vid-out.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/vivid/vivid-vid-out.c +1 -1
@@ -998,7 +998,7 @@ int vivid_vid_out_s_fbuf(struct file *file, void *fh,return -EINVAL ; } dev->fbuf_out_flags &= ~(chroma_flags | alpha_flags); - dev->fbuf_out_flags = a->flags & (chroma_flags | alpha_flags); + dev->fbuf_out_flags |= a->flags & (chroma_flags | alpha_flags);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 227/425 media: omap4iss: return error code when omap4iss_get() failed
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 8938c48fa25b491842ece9eb38f0bea0fcbaca44 ]
If omap4iss_get() failed, it need return error code in iss_probe().
--- drivers/staging/media/omap4iss/iss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/media/omap4iss/iss.c +3 -1
@@ -1244,8 +1244,10 @@ static int iss_probe(struct platform_device *pdev)if (ret <0 ) goto error; -if (!omap4iss_get (iss)) +if (!omap4iss_get (iss)) { + ret = -EINVAL ; goto error; + } ret =iss_reset (iss);if (ret <0 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 228/425 media: m88rs6000t: avoid potential out-of-bounds reads on arrays
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 9baa3d64e8e2373ddd11c346439e5dfccb2cbb0d ]
There a 3 array for-loops that don't check the upper bounds of the index into arrays and this may lead to potential out-of-bounds reads. Fix this by adding array size upper bounds checks to be full safe.
Addresses-Coverity: ("Out-of-bounds read")
--- drivers/media/tuners/m88rs6000t.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/tuners/m88rs6000t.c +3 -3
@@ -534,7 +534,7 @@ static int m88rs6000t_get_rf_strength(struct dvb_frontend *fe, u16 *strength) PGA2_cri =PGA2_GC >>2 ; PGA2_crf =PGA2_GC &0x03 ; -for (i =0 ; i <=RF_GC ; i++) +for (i =0 ; i <=RF_GC && i <ARRAY_SIZE (RFGS ); i++)RFG +=RFGS [i];if (RF_GC ==0 )
@@ -546,12 +546,12 @@ static int m88rs6000t_get_rf_strength(struct dvb_frontend *fe, u16 *strength)if (RF_GC ==3 )RFG +=100 ; -for (i =0 ; i <=IF_GC ; i++) +for (i =0 ; i <=IF_GC && i <ARRAY_SIZE (IFGS ); i++)IFG +=IFGS [i];TIAG =TIA_GC *TIA_GS ; -for (i =0 ; i <=BB_GC ; i++) +for (i =0 ; i <=BB_GC && i <ARRAY_SIZE (BBGS ); i++)BBG +=BBGS [i];PGA2G = PGA2_cri * PGA2_cri_GS + PGA2_crf * PGA2_crf_GS;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 229/425 drm/amdkfd: fix build error with AMD_IOMMU_V2=m
In reply to Greg Kroah-HartmanFrom: Felix Kuehling <[email protected]>
[ Upstream commit 1e87068570a2cc4db5f95a881686add71729e769 ]
Using 'imply AMD_IOMMU_V2' does not guarantee that the driver can link against the exported functions. If the GPU driver is built-in but the IOMMU driver is a loadable module, the kfd_iommu.c file is indeed built but does not work:
x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_bind_process_to_device':
kfd_iommu.c:(.text+0x516): undefined reference to `amd_iommu_bind_pasid'
x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_unbind_process':
kfd_iommu.c:(.text+0x691): undefined reference to `amd_iommu_unbind_pasid'
x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_suspend':
kfd_iommu.c:(.text+0x966): undefined reference to `amd_iommu_set_invalidate_ctx_cb'
x86_64-linux-ld: kfd_iommu.c:(.text+0x97f): undefined reference to `amd_iommu_set_invalid_ppr_cb'
x86_64-linux-ld: kfd_iommu.c:(.text+0x9a4): undefined reference to `amd_iommu_free_device'
x86_64-linux-ld: drivers/gpu/drm/amd/amdkfd/kfd_iommu.o: in function `kfd_iommu_resume':
kfd_iommu.c:(.text+0xa9a): undefined reference to `amd_iommu_init_device'
x86_64-linux-ld: kfd_iommu.c:(.text+0xadc): undefined reference to `amd_iommu_set_invalidate_ctx_cb'
x86_64-linux-ld: kfd_iommu.c:(.text+0xaff): undefined reference to `amd_iommu_set_invalid_ppr_cb'
x86_64-linux-ld: kfd_iommu.c:(.text+0xc72): undefined reference to `amd_iommu_bind_pasid'
x86_64-linux-ld: kfd_iommu.c:(.text+0xe08): undefined reference to `amd_iommu_set_invalidate_ctx_cb'
x86_64-linux-ld: kfd_iommu.c:(.text+0xe26): undefined reference to `amd_iommu_set_invalid_ppr_cb'
x86_64-linux-ld: kfd_iommu.c:(.text+0xe42): undefined reference to `amd_iommu_free_device'
Use IS_REACHABLE to only build IOMMU-V2 support if the amd_iommu symbols are reachable by the amdkfd driver. Output a warning if they are not, because that may not be what the user was expecting.
--- drivers/gpu/drm/amd/amdkfd/kfd_iommu.c | 6 ++++++ drivers/gpu/drm/amd/amdkfd/kfd_iommu.h | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_iommu.c +6 -0
@@ -20,6 +20,10 @@* OTHER DEALINGS IN THE SOFTWARE. */ +#include <linux/kconfig.h> + +#if IS_REACHABLE (CONFIG_AMD_IOMMU_V2 ) +#include <linux/printk.h> #include <linux/device.h> #include <linux/slab.h>
@@ -366,3 +370,5 @@ int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev) return 0; } + +#endif
drivers/gpu/drm/amd/amdkfd/kfd_iommu.h +7 -2
@@ -23,7 +23,9 @@#ifndef __KFD_IOMMU_H__#define __KFD_IOMMU_H__ -#if defined(CONFIG_AMD_IOMMU_V2_MODULE ) || defined(CONFIG_AMD_IOMMU_V2 ) +#include <linux/kconfig.h> + +#if IS_REACHABLE (CONFIG_AMD_IOMMU_V2 )#define KFD_SUPPORT_IOMMU_V2
@@ -46,6 +48,9 @@ static inline int kfd_iommu_check_device(struct kfd_dev *kfd) }static inline int kfd_iommu_device_init (struct kfd_dev *kfd) { +#if IS_MODULE (CONFIG_AMD_IOMMU_V2 ) +WARN_ONCE (1 ,"iommu_v2 module is not usable by built-in KFD" ); +#endif return 0 ; }
@@ -73,6 +78,6 @@ static inline int kfd_iommu_add_perf_counters(struct kfd_topology_device *kdev)return 0 ; } -#endif /* defined(CONFIG_AMD_IOMMU_V2) */ +#endif /* IS_REACHABLE(CONFIG_AMD_IOMMU_V2) */ #endif /* __KFD_IOMMU_H__ */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 230/425 x86/kprobes: Fix to check non boostable prefixes correctly
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 6dd3b8c9f58816a1354be39559f630cd1bd12159 ]
There are 2 bugs in the can_boost() function because of using x86 insn decoder. Since the insn->opcode never has a prefix byte, it can not find CS override prefix in it. And the insn->attr is the attribute of the opcode, thus inat_is_address_size_prefix( insn->attr) always returns false.
Fix those by checking each prefix bytes with for_each_insn_prefix loop and getting the correct attribute for each prefix byte. Also, this removes unlikely, because this is a slow path.
--- arch/x86/kernel/kprobes/core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
arch/x86/kernel/kprobes/core.c +12 -5
@@ -170,6 +170,8 @@ NOKPROBE_SYMBOL(skip_prefixes);int can_boost (struct insn *insn,void *addr) {kprobe_opcode_t opcode; +insn_byte_t prefix; +int i;if (search_exception_tables ((unsigned long )addr))return 0 ;/* Page fault may occur on this address. */
@@ -182,9 +184,14 @@ int can_boost(struct insn *insn, void *addr)if (insn->opcode.nbytes !=1 )return 0 ; -/* Can't boost Address-size override prefix */ -if (unlikely (inat_is_address_size_prefix (insn->attr))) -return 0 ; +for_each_insn_prefix (insn, i, prefix) { +insn_attr_t attr; + + attr =inat_get_opcode_attribute (prefix); +/* Can't boost Address-size override prefix and CS override prefix */ +if (prefix ==0x2e ||inat_is_address_size_prefix (attr)) +return 0 ; + } opcode = insn->opcode.bytes[0 ];
@@ -209,8 +216,8 @@ int can_boost(struct insn *insn, void *addr)/* clear and set flags are boostable */ return (opcode ==0xf5 || (0xf7 < opcode && opcode <0xfe ));default : -/* CS override prefix and call are not boostable */ -return (opcode !=0x2e && opcode !=0x9a ); +/* call is not boostable */ +return opcode !=0x9a ; } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 231/425 pata_arasan_cf: fix IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit c7e8f404d56b99c80990b19a402c3f640d74be05 ]
The driver's probe() method is written as if platform_get_irq() returns 0 on error, while actually it returns a negative error code (with all the other values considered valid IRQs). Rewrite the driver's IRQ checking code to pass the positive IRQ #s to ata_host_activate(), propagate upstream -EPROBE_DEFER, and set up the driver to polling mode on (negative) errors and IRQ0 (libata treats IRQ #0 as a polling mode anyway)...
--- drivers/ata/pata_arasan_cf.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/ata/pata_arasan_cf.c +11 -4
@@ -817,12 +817,19 @@ static int arasan_cf_probe(struct platform_device *pdev)else quirk =CF_BROKEN_UDMA ;/* as it is on spear1340 */ -/* if irq is 0, support only PIO */ - acdev->irq =platform_get_irq (pdev,0 ); -if (acdev->irq) +/* +* If there's an error getting IRQ (or we do get IRQ0), +* support only PIO +*/ + ret =platform_get_irq (pdev,0 ); +if (ret >0 ) { + acdev->irq = ret; irq_handler = arasan_cf_interrupt; -else + }else if (ret == -EPROBE_DEFER ) { +return ret; + }else { quirk |=CF_BROKEN_MWDMA |CF_BROKEN_UDMA ; + } acdev->pbase = res->start; acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 232/425 pata_ipx4xx_cf: fix IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit e379b40cc0f179403ce0b82b7e539f635a568da5 ]
The driver's probe() method is written as if platform_get_irq() returns 0 on error, while actually it returns a negative error code (with all the other values considered valid IRQs). Rewrite the driver's IRQ checking code to pass the positive IRQ #s to ata_host_activate(), propagate errors upstream, and treat IRQ0 as error, returning -EINVAL, as the libata code treats 0 as an indication that polling should be used anyway...
--- drivers/ata/pata_ixp4xx_cf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/ata/pata_ixp4xx_cf.c +5 -1
@@ -169,8 +169,12 @@ static int ixp4xx_pata_probe(struct platform_device *pdev)return -ENOMEM ; irq =platform_get_irq (pdev,0 ); -if (irq) +if (irq >0 )irq_set_irq_type (irq,IRQ_TYPE_EDGE_RISING ); +else if (irq <0 ) +return irq; +else +return -EINVAL ;/* Setup expansion bus chip selects */ *data->cs0_cfg = data->cs0_bits;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 233/425 sata_mv: add IRQ checks
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit e6471a65fdd5efbb8dd2732dd0f063f960685ceb ]
The function mv_platform_probe() neglects to check the results of the calls to platform_get_irq() and irq_of_parse_and_map() and blithely passes them to ata_host_activate() -- while the latter only checks for IRQ0 (treating it as a polling mode indicattion) and passes the negative values to devm_request_irq() causing it to fail as it takes unsigned values for the IRQ #...
Add to mv_platform_probe() the proper IRQ checks to pass the positive IRQ #s to ata_host_activate(), propagate upstream the negative error codes, and override the IRQ0 with -EINVAL (as we don't want the polling mode).
--- drivers/ata/sata_mv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ata/sata_mv.c +4 -0
@@ -4110,6 +4110,10 @@ static int mv_platform_probe(struct platform_device *pdev) n_ports = mv_platform_data->n_ports; irq =platform_get_irq (pdev,0 ); } +if (irq <0 ) +return irq; +if (!irq) +return -EINVAL ; host =ata_host_alloc_pinfo (&pdev->dev, ppi, n_ports); hpriv =devm_kzalloc (&pdev->dev,sizeof (*hpriv),GFP_KERNEL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 234/425 ata: libahci_platform: fix IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit b30d0040f06159de97ad9c0b1536f47250719d7d ]
Iff platform_get_irq() returns 0, ahci_platform_init_host() would return 0 early (as if the call was successful). Override IRQ0 with -EINVAL instead as the 'libata' regards 0 as "no IRQ" (thus polling) anyway...
--- drivers/ata/libahci_platform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/ata/libahci_platform.c +3 -1
@@ -544,11 +544,13 @@ int ahci_platform_init_host(struct platform_device *pdev,int i, irq, n_ports, rc; irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { +if (irq <0 ) {if (irq != -EPROBE_DEFER )dev_err (dev,"no irq\n" );return irq; } +if (!irq) +return -EINVAL ; hpriv->irq = irq;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 235/425 nvme: retrigger ANA log update if group descriptor isnt found
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit dd8f7fa908f66dd44abcd83cbb50410524b9f8ef ]
If ANA is enabled but no ANA group descriptor is found when creating a new namespace the ANA log is most likely out of date, so trigger a re-read. The namespace will be tagged with the NS_ANA_PENDING flag to exclude it from path selection until the ANA log has been re-read.
--- drivers/nvme/host/multipath.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/nvme/host/multipath.c +4 -0
@@ -516,6 +516,10 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id)if (desc.state) {/* found the group desc: update */ nvme_update_ns_ana_state (&desc, ns); + }else { +/* group desc not found: trigger a re-read */ +set_bit (NVME_NS_ANA_PENDING , &ns->flags); +queue_work (nvme_wq, &ns->ctrl->ana_work); } }else {mutex_lock (&ns->head->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 236/425 vfio/mdev: Do not allow a mdev_type to have a NULL parent pointer
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit b5a1f8921d5040bb788492bf33a66758021e4be5 ]
There is a small race where the parent is NULL even though the kobj has already been made visible in sysfs.
For instance the attribute_group is made visible in sysfs_create_files() and the mdev_type_attr_show() does:
ret = attr->show(kobj, type->parent->dev, buf);
Which will crash on NULL parent. Move the parent setup to before the type pointer leaves the stack frame.
Message-Id: <[email protected]>
--- drivers/vfio/mdev/mdev_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vfio/mdev/mdev_sysfs.c +1 -1
@@ -108,6 +108,7 @@ struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent,return ERR_PTR (-ENOMEM ); type->kobj.kset = parent->mdev_types_kset; + type->parent = parent; ret = kobject_init_and_add(&type->kobj, &mdev_type_ktype, NULL, "%s-%s", dev_driver_string(parent->dev),
@@ -135,7 +136,6 @@ struct mdev_type *add_mdev_supported_type(struct mdev_parent *parent, } type->group = group; - type->parent = parent;return type; attrs_failed:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 237/425 clk: qcom: a53-pll: Add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Chen Hui <[email protected]>
[ Upstream commit 790b516ada10a4dcc0f0a56dc0ced475d86d5820 ]
CONFIG_QCOM_A53PLL is tristate option and therefore this driver can be compiled as a module. This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/clk/qcom/a53-pll.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/a53-pll.c +1 -0
@@ -93,6 +93,7 @@ static const struct of_device_id qcom_a53pll_match_table[] = { { .compatible = "qcom,msm8916-a53pll" }, { } }; +MODULE_DEVICE_TABLE (of, qcom_a53pll_match_table);static struct platform_driver qcom_a53pll_driver = { .probe = qcom_a53pll_probe,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 238/425 clk: uniphier: Fix potential infinite loop
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit f6b1340dc751a6caa2a0567b667d0f4f4172cd58 ]
The for-loop iterates with a u8 loop counter i and compares this with the loop upper limit of num_parents that is an int type. There is a potential infinite loop if num_parents is larger than the u8 loop counter. Fix this by making the loop counter the same type as num_parents. Also make num_parents an unsigned int to match the return type of the call to clk_hw_get_num_parents.
Addresses-Coverity: ("Infinite loop")
--- drivers/clk/uniphier/clk-uniphier-mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/uniphier/clk-uniphier-mux.c +2 -2
@@ -40,10 +40,10 @@ static int uniphier_clk_mux_set_parent(struct clk_hw *hw, u8 index)static u8 uniphier_clk_mux_get_parent (struct clk_hw *hw) {struct uniphier_clk_mux *mux =to_uniphier_clk_mux (hw); -int num_parents =clk_hw_get_num_parents (hw); +unsigned int num_parents =clk_hw_get_num_parents (hw);int ret;unsigned int val; -u8 i; +unsigned int i; ret =regmap_read (mux->regmap, mux->reg, &val);if (ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 239/425 scsi: jazz_esp: Add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 38fca15c29db6ed06e894ac194502633e2a7d1fb ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the real error code. Stop calling request_irq() with the invalid IRQ #s.
--- drivers/scsi/jazz_esp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/jazz_esp.c +3 -1
@@ -170,7 +170,9 @@ static int esp_jazz_probe(struct platform_device *dev)if (!esp->command_block) goto fail_unmap_regs; - host->irq =platform_get_irq (dev,0 ); + host->irq = err =platform_get_irq (dev,0 ); +if (err <0 ) + goto fail_unmap_command_block; err =request_irq (host->irq, scsi_esp_intr,IRQF_SHARED ,"ESP" , esp);if (err <0 ) goto fail_unmap_command_block;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 240/425 scsi: sun3x_esp: Add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 14b321380eb333c82853d7d612d0995f05f88fdc ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding the real error code. Stop calling request_irq() with the invalid IRQ #s.
--- drivers/scsi/sun3x_esp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/sun3x_esp.c +3 -1
@@ -233,7 +233,9 @@ static int esp_sun3x_probe(struct platform_device *dev)if (!esp->command_block) goto fail_unmap_regs_dma; - host->irq =platform_get_irq (dev,0 ); + host->irq = err =platform_get_irq (dev,0 ); +if (err <0 ) + goto fail_unmap_command_block; err =request_irq (host->irq, scsi_esp_intr,IRQF_SHARED ,"SUN3X ESP" , esp);if (err <0 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 241/425 scsi: sni_53c710: Add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 1160d61bc51e87e509cfaf9da50a0060f67b6de4 ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to request_irq() (which takes *unsigned* IRQ #s), causing it to fail with -EINVAL (overridden by -ENODEV further below). Stop calling request_irq() with the invalid IRQ #s.
--- drivers/scsi/sni_53c710.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/sni_53c710.c +4 -1
@@ -71,6 +71,7 @@ static int snirm710_probe(struct platform_device *dev)struct NCR_700_Host_Parameters *hostdata;struct Scsi_Host *host;struct resource *res; +int rc; res =platform_get_resource (dev,IORESOURCE_MEM ,0 );if (!res)
@@ -96,7 +97,9 @@ static int snirm710_probe(struct platform_device *dev) goto out_kfree; host->this_id =7 ; host->base = base; - host->irq =platform_get_irq (dev,0 ); + host->irq = rc =platform_get_irq (dev,0 ); +if (rc <0 ) + goto out_put_host;if (request_irq (host->irq, NCR_700_intr,IRQF_SHARED ,"snirm710" , host)) {printk (KERN_ERR "snirm710: request_irq failed!\n" ); goto out_put_host;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 242/425 scsi: ibmvfc: Fix invalid state machine BUG_ON()
In reply to Greg Kroah-HartmanFrom: Brian King <[email protected]>
[ Upstream commit 15cfef8623a449d40d16541687afd58e78033be3 ]
This fixes an issue hitting the BUG_ON() in ibmvfc_do_work(). When going through a host action of IBMVFC_HOST_ACTION_RESET, we change the action to IBMVFC_HOST_ACTION_TGT_DEL, then drop the host lock, and reset the CRQ, which changes the host state to IBMVFC_NO_CRQ. If, prior to setting the host state to IBMVFC_NO_CRQ, ibmvfc_init_host() is called, it can then end up changing the host action to IBMVFC_HOST_ACTION_INIT. If we then change the host state to IBMVFC_NO_CRQ, we will then hit the BUG_ON().
Make a couple of changes to avoid this. Leave the host action to be IBMVFC_HOST_ACTION_RESET or IBMVFC_HOST_ACTION_REENABLE until after we drop the host lock and reset or reenable the CRQ. Also harden the host state machine to ensure we cannot leave the reset / reenable state until we've finished processing the reset or reenable.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 57 ++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 19 deletions(-)
drivers/scsi/ibmvscsi/ibmvfc.c +38 -19
@@ -506,8 +506,17 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,if (vhost->action ==IBMVFC_HOST_ACTION_ALLOC_TGTS ) vhost->action = action;break ; +case IBMVFC_HOST_ACTION_REENABLE : +case IBMVFC_HOST_ACTION_RESET : + vhost->action = action; +break ;case IBMVFC_HOST_ACTION_INIT :case IBMVFC_HOST_ACTION_TGT_DEL : +case IBMVFC_HOST_ACTION_LOGO : +case IBMVFC_HOST_ACTION_QUERY_TGTS : +case IBMVFC_HOST_ACTION_TGT_DEL_FAILED : +case IBMVFC_HOST_ACTION_NONE : +default :switch (vhost->action) {case IBMVFC_HOST_ACTION_RESET :case IBMVFC_HOST_ACTION_REENABLE :
@@ -517,15 +526,6 @@ static void ibmvfc_set_host_action(struct ibmvfc_host *vhost,break ; }break ; -case IBMVFC_HOST_ACTION_LOGO : -case IBMVFC_HOST_ACTION_QUERY_TGTS : -case IBMVFC_HOST_ACTION_TGT_DEL_FAILED : -case IBMVFC_HOST_ACTION_NONE : -case IBMVFC_HOST_ACTION_RESET : -case IBMVFC_HOST_ACTION_REENABLE : -default : - vhost->action = action; -break ; } }
@@ -4346,26 +4346,45 @@ static void ibmvfc_do_work(struct ibmvfc_host *vhost)case IBMVFC_HOST_ACTION_INIT_WAIT :break ;case IBMVFC_HOST_ACTION_RESET : - vhost->action =IBMVFC_HOST_ACTION_TGT_DEL ;spin_unlock_irqrestore (vhost->host->host_lock, flags); rc =ibmvfc_reset_crq (vhost); +spin_lock_irqsave (vhost->host->host_lock, flags); -if (rc ==H_CLOSED ) +if (!rc || rc ==H_CLOSED )vio_enable_interrupts (to_vio_dev (vhost->dev)); -if (rc || (rc =ibmvfc_send_crq_init (vhost)) || - (rc =vio_enable_interrupts (to_vio_dev (vhost->dev)))) { -ibmvfc_link_down (vhost,IBMVFC_LINK_DEAD ); -dev_err (vhost->dev,"Error after reset (rc=%d)\n" , rc); +if (vhost->action ==IBMVFC_HOST_ACTION_RESET ) { +/* +* The only action we could have changed to would have +* been reenable, in which case, we skip the rest of +* this path and wait until we've done the re-enable +* before sending the crq init. +*/ + vhost->action =IBMVFC_HOST_ACTION_TGT_DEL ; + +if (rc || (rc =ibmvfc_send_crq_init (vhost)) || + (rc =vio_enable_interrupts (to_vio_dev (vhost->dev)))) { +ibmvfc_link_down (vhost,IBMVFC_LINK_DEAD ); +dev_err (vhost->dev,"Error after reset (rc=%d)\n" , rc); + } }break ;case IBMVFC_HOST_ACTION_REENABLE : - vhost->action =IBMVFC_HOST_ACTION_TGT_DEL ;spin_unlock_irqrestore (vhost->host->host_lock, flags); rc =ibmvfc_reenable_crq_queue (vhost); +spin_lock_irqsave (vhost->host->host_lock, flags); -if (rc || (rc =ibmvfc_send_crq_init (vhost))) { -ibmvfc_link_down (vhost,IBMVFC_LINK_DEAD ); -dev_err (vhost->dev,"Error after enable (rc=%d)\n" , rc); +if (vhost->action ==IBMVFC_HOST_ACTION_REENABLE ) { +/* +* The only action we could have changed to would have +* been reset, in which case, we skip the rest of this +* path and wait until we've done the reset before +* sending the crq init. +*/ + vhost->action =IBMVFC_HOST_ACTION_TGT_DEL ; +if (rc || (rc =ibmvfc_send_crq_init (vhost))) { +ibmvfc_link_down (vhost,IBMVFC_LINK_DEAD ); +dev_err (vhost->dev,"Error after enable (rc=%d)\n" , rc); + } }break ;case IBMVFC_HOST_ACTION_LOGO :
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 243/425 mfd: stm32-timers: Avoid clearing auto reload register
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 4917e498c6894ba077867aff78f82cffd5ffbb5c ]
The ARR register is cleared unconditionally upon probing, after the maximum value has been read. This initial condition is rather not intuitive, when considering the counter child driver. It rather expects the maximum value by default:
- The counter interface shows a zero value by default for 'ceiling' attribute.
- Enabling the counter without any prior configuration makes it doesn't count.
The reset value of ARR register is the maximum. So Choice here is to backup it, and restore it then, instead of clearing its value. It also fixes the initial condition seen by the counter driver.
--- drivers/mfd/stm32-timers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mfd/stm32-timers.c +6 -1
@@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {static void stm32_timers_get_arr_size (struct stm32_timers *ddata) { +u32 arr; + +/* Backup ARR to restore it after getting the maximum value */ +regmap_read (ddata->regmap,TIM_ARR , &arr); +/* * Only the available bits will be written so when readback * we get the maximum value of auto reload register */ regmap_write (ddata->regmap,TIM_ARR , ~0L );regmap_read (ddata->regmap,TIM_ARR , &ddata->max_arr); -regmap_write (ddata->regmap,TIM_ARR ,0x0 ); +regmap_write (ddata->regmap,TIM_ARR , arr); } static void stm32_timers_dma_probe(struct device *dev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 244/425 HSI: core: fix resource leaks in hsi_add_client_from_dt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 5c08b0f75575648032f309a6f58294453423ed93 ]
If some of the allocations fail between the dev_set_name() and the device_register() then the name will not be freed. Fix this by moving dev_set_name() directly in front of the call to device_register().
--- drivers/hsi/hsi_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hsi/hsi_core.c +1 -2
@@ -223,8 +223,6 @@ static void hsi_add_client_from_dt(struct hsi_port *port,if (err) goto err; -dev_set_name (&cl->device,"%s" , name); - err =hsi_of_property_parse_mode (client,"hsi-mode" , &mode);if (err) { err = hsi_of_property_parse_mode(client, "hsi-rx-mode",
@@ -306,6 +304,7 @@ static void hsi_add_client_from_dt(struct hsi_port *port, cl->device.release = hsi_client_release; cl->device.of_node = client; +dev_set_name (&cl->device,"%s" , name);if (device_register (&cl->device) <0 ) {pr_err ("hsi: failed to register client: %s\n" , name);put_device (&cl->device);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 245/425 x86/events/amd/iommu: Fix sysfs type mismatch
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit de5bc7b425d4c27ae5faa00ea7eb6b9780b9a355 ]
dev_attr_show() calls _iommu_event_show() via an indirect call but _iommu_event_show()'s type does not currently match the type of the show() member in 'struct device_attribute', resulting in a Control Flow Integrity violation.
$ cat /sys/devices/amd_iommu_1/events/mem_dte_hit csource=0x0a
$ dmesg | grep "CFI failure" [ 3526.735140] CFI failure (target: _iommu_event_show...):
Change _iommu_event_show() and 'struct amd_iommu_event_desc' to 'struct device_attribute' so that there is no more CFI violation.
--- arch/x86/events/amd/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/events/amd/iommu.c +3 -3
@@ -84,12 +84,12 @@ static struct attribute_group amd_iommu_events_group = { };struct amd_iommu_event_desc { -struct kobj_attribute attr; +struct device_attribute attr;const char *event; }; -static ssize_t _iommu_event_show (struct kobject *kobj, -struct kobj_attribute *attr,char *buf) +static ssize_t _iommu_event_show (struct device *dev, +struct device_attribute *attr,char *buf) {struct amd_iommu_event_desc *event = container_of(attr, struct amd_iommu_event_desc, attr);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 246/425 sched/debug: Fix cgroup_path[] serialization
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit ad789f84c9a145f8a18744c0387cec22ec51651e ]
The handling of sysrq key can be activated by echoing the key to /proc/sysrq-trigger or via the magic key sequence typed into a terminal that is connected to the system in some way (serial, USB or other mean). In the former case, the handling is done in a user context. In the latter case, it is likely to be in an interrupt context.
Currently in print_cpu() of kernel/sched/debug.c, sched_debug_lock is taken with interrupt disabled for the whole duration of the calls to print_*_stats() and print_rq() which could last for the quite some time if the information dump happens on the serial console.
If the system has many cpus and the sched_debug_lock is somehow busy (e.g. parallel sysrq-t), the system may hit a hard lockup panic depending on the actually serial console implementation of the system.
The purpose of sched_debug_lock is to serialize the use of the global cgroup_path[] buffer in print_cpu(). The rests of the printk calls don't need serialization from sched_debug_lock.
Calling printk() with interrupt disabled can still be problematic if multiple instances are running. Allocating a stack buffer of PATH_MAX bytes is not feasible because of the limited size of the kernel stack.
The solution implemented in this patch is to allow only one caller at a time to use the full size group_path[], while other simultaneous callers will have to use shorter stack buffers with the possibility of path name truncation. A "..." suffix will be printed if truncation may have happened. The cgroup path name is provided for informational purpose only, so occasional path name truncation should not be a big problem.
--- kernel/sched/debug.c | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-)
kernel/sched/debug.c +29 -13
@@ -11,8 +11,6 @@*/ #include "sched.h" -static DEFINE_SPINLOCK (sched_debug_lock); -/* * This allows printing both to /proc/sched_debug and * to the console
@@ -434,16 +432,37 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group#endif #ifdef CONFIG_CGROUP_SCHED +static DEFINE_SPINLOCK (sched_debug_lock);static char group_path[PATH_MAX ]; -static char *task_group_path (struct task_group *tg) +static void task_group_path (struct task_group *tg,char *path,int plen) { -if (autogroup_path (tg, group_path,PATH_MAX )) -return group_path; +if (autogroup_path (tg, path, plen)) +return ; -cgroup_path (tg->css.cgroup, group_path,PATH_MAX ); +cgroup_path (tg->css.cgroup, path, plen); +} -return group_path; +/* +* Only 1 SEQ_printf_task_group_path() caller can use the full length +* group_path[] for cgroup path. Other simultaneous callers will have +* to use a shorter stack buffer. A "..." suffix is appended at the end +* of the stack buffer so that it will show up in case the output length +* matches the given buffer size to indicate possible path name truncation. +*/ +#define SEQ_printf_task_group_path(m, tg, fmt...) \ +{ \ + if (spin_trylock(&sched_debug_lock)) { \ + task_group_path(tg, group_path, sizeof(group_path)); \ + SEQ_printf(m, fmt, group_path); \ + spin_unlock(&sched_debug_lock); \ + } else { \ + char buf[128]; \ + char *bufend = buf + sizeof(buf) - 3; \ + task_group_path(tg, buf, bufend - buf); \ + strcpy(bufend - 1, "..."); \ + SEQ_printf(m, fmt, buf); \ + } \ }#endif
@@ -470,7 +489,7 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)SEQ_printf (m," %d %d" ,task_node (p),task_numa_group_id (p));#endif #ifdef CONFIG_CGROUP_SCHED -SEQ_printf (m," %s" ,task_group_path (task_group (p))); + SEQ_printf_task_group_path(m, task_group(p), " %s")#endif SEQ_printf (m,"\n" );
@@ -507,7 +526,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)#ifdef CONFIG_FAIR_GROUP_SCHED SEQ_printf (m,"\n" ); -SEQ_printf (m,"cfs_rq[%d]:%s\n" , cpu,task_group_path (cfs_rq->tg)); +SEQ_printf_task_group_path (m, cfs_rq->tg,"cfs_rq[%d]:%s\n" , cpu);#else SEQ_printf (m,"\n" );SEQ_printf (m,"cfs_rq[%d]:\n" , cpu);
@@ -579,7 +598,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq) {#ifdef CONFIG_RT_GROUP_SCHED SEQ_printf (m,"\n" ); -SEQ_printf (m,"rt_rq[%d]:%s\n" , cpu,task_group_path (rt_rq->tg)); +SEQ_printf_task_group_path (m, rt_rq->tg,"rt_rq[%d]:%s\n" , cpu);#else SEQ_printf (m,"\n" );SEQ_printf (m,"rt_rq[%d]:\n" , cpu);
@@ -631,7 +650,6 @@ void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)static void print_cpu (struct seq_file *m,int cpu) {struct rq *rq =cpu_rq (cpu); -unsigned long flags;#ifdef CONFIG_X86 {
@@ -690,13 +708,11 @@ do { \ }#undef P -spin_lock_irqsave (&sched_debug_lock, flags);print_cfs_stats (m, cpu);print_rt_stats (m, cpu);print_dl_stats (m, cpu);print_rq (m, rq, cpu); -spin_unlock_irqrestore (&sched_debug_lock, flags);SEQ_printf (m,"\n" ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 247/425 drivers/block/null_blk/main: Fix a double free in null_init.
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 72ce11ddfa4e9e1879103581a60b7e34547eaa0a ]
In null_init, null_add_dev(dev) is called.
In null_add_dev, it calls null_free_zoned_dev(dev) to free dev->zones via kvfree(dev->zones) in out_cleanup_zone branch and returns err. Then null_init accept the err code and then calls null_free_dev(dev).
But in null_free_dev(dev), dev->zones is freed again by null_free_zoned_dev().
My patch set dev->zones to NULL in null_free_zoned_dev() after kvfree(dev->zones) is called, to avoid the double free.
--- drivers/block/null_blk_zoned.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/null_blk_zoned.c +1 -0
@@ -56,6 +56,7 @@ int null_zone_init(struct nullb_device *dev)void null_zone_exit (struct nullb_device *dev) {kvfree (dev->zones); + dev->zones =NULL ; } static void null_zone_fill_bio(struct nullb_device *dev, struct bio *bio,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 248/425 HID: plantronics: Workaround for double volume key presses
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit f567d6ef8606fb427636e824c867229ecb5aefab ]
Plantronics Blackwire 3220 Series (047f:c056) sends HID reports twice for each volume key press. This patch adds a quirk to hid-plantronics for this product ID, which will ignore the second volume key press if it happens within 5 ms from the last one that was handled.
The patch was tested on the mentioned model only, it shouldn't affect other models, however, this quirk might be needed for them too. Auto-repeat (when a key is held pressed) is not affected, because the rate is about 3 times per second, which is far less frequent than once in 5 ms.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-plantronics.c | 60 +++++++++++++++++++++++++++++++++-- include/linux/hid.h | 2 ++ 3 files changed, 61 insertions(+), 2 deletions(-)
drivers/hid/hid-ids.h +1 -0
@@ -904,6 +904,7 @@#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003#define USB_VENDOR_ID_PLANTRONICS 0x047f +#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056#define USB_VENDOR_ID_PANASONIC 0x04da#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
drivers/hid/hid-plantronics.c +58 -2
113 lines not on this page · raw message
include/linux/hid.h +2 -0
@@ -270,6 +270,8 @@ struct hid_item {#define HID_CP_SELECTION 0x000c0080#define HID_CP_MEDIASELECTION 0x000c0087#define HID_CP_SELECTDISC 0x000c00ba +#define HID_CP_VOLUMEUP 0x000c00e9 +#define HID_CP_VOLUMEDOWN 0x000c00ea#define HID_CP_PLAYBACKSPEED 0x000c00f1#define HID_CP_PROXIMITY 0x000c0109#define HID_CP_SPEAKERSYSTEM 0x000c0160
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 249/425 perf symbols: Fix dso__fprintf_symbols_by_name() to return the number of printed chars
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 210e4c89ef61432040c6cd828fefa441f4887186 ]
The 'ret' variable was initialized to zero but then it was not updated from the fprintf() return, fix it.
--- tools/perf/util/symbol_fprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/symbol_fprintf.c +1 -1
@@ -66,7 +66,7 @@ size_t dso__fprintf_symbols_by_name(struct dso *dso,for (nd =rb_first (&dso->symbol_names); nd; nd =rb_next (nd)) { pos = rb_entry(nd, struct symbol_name_rb_node, rb_node); -fprintf (fp,"%s\n" , pos->sym.name); + ret +=fprintf (fp,"%s\n" , pos->sym.name); }return ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 250/425 net: lapbether: Prevent racing when checking whether the netif is running
In reply to Greg Kroah-HartmanFrom: Xie He <[email protected]>
[ Upstream commit 5acd0cfbfbb5a688da1bfb1a2152b0c855115a35 ]
There are two "netif_running" checks in this driver. One is in "lapbeth_xmit" and the other is in "lapbeth_rcv". They serve to make sure that the LAPB APIs called in these functions are called before "lapb_unregister" is called by the "ndo_stop" function.
However, these "netif_running" checks are unreliable, because it's possible that immediately after "netif_running" returns true, "ndo_stop" is called (which causes "lapb_unregister" to be called).
This patch adds locking to make sure "lapbeth_xmit" and "lapbeth_rcv" can reliably check and ensure the netif is running while doing their work.
--- drivers/net/wan/lapbether.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/net/wan/lapbether.c +25 -7
@@ -56,6 +56,8 @@ struct lapbethdev {struct list_head node;struct net_device *ethdev;/* link to ethernet device */ struct net_device *axdev;/* lapbeth device (lapb#) */ +bool up; +spinlock_t up_lock;/* Protects "up" */ };static LIST_HEAD (lapbeth_devices);
@@ -103,8 +105,9 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packercu_read_lock (); lapbeth =lapbeth_get_x25_dev (dev);if (!lapbeth) - goto drop_unlock; -if (!netif_running (lapbeth->axdev)) + goto drop_unlock_rcu; +spin_lock_bh (&lapbeth->up_lock); +if (!lapbeth->up) goto drop_unlock; len = skb->data[0 ] + skb->data[1 ] *256 ;
@@ -119,11 +122,14 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe goto drop_unlock; } out: +spin_unlock_bh (&lapbeth->up_lock);rcu_read_unlock ();return 0 ; drop_unlock:kfree_skb (skb); goto out; +drop_unlock_rcu: +rcu_read_unlock (); drop:kfree_skb (skb);return 0 ;
@@ -151,13 +157,11 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)static netdev_tx_t lapbeth_xmit (struct sk_buff *skb,struct net_device *dev) { +struct lapbethdev *lapbeth =netdev_priv (dev);int err; -/* -* Just to be *really* sure not to send anything if the interface -* is down, the ethernet device may have gone. -*/ -if (!netif_running (dev)) +spin_lock_bh (&lapbeth->up_lock); +if (!lapbeth->up) goto drop;/* There should be a pseudo header of 1 byte added by upper layers.
@@ -188,6 +192,7 @@ static netdev_tx_t lapbeth_xmit(struct sk_buff *skb, goto drop; } out: +spin_unlock_bh (&lapbeth->up_lock);return NETDEV_TX_OK ; drop:kfree_skb (skb);
@@ -279,6 +284,7 @@ static const struct lapb_register_struct lapbeth_callbacks = {*/ static int lapbeth_open (struct net_device *dev) { +struct lapbethdev *lapbeth =netdev_priv (dev);int err;if ((err =lapb_register (dev, &lapbeth_callbacks)) !=LAPB_OK ) {
@@ -286,13 +292,22 @@ static int lapbeth_open(struct net_device *dev)return -ENODEV ; } +spin_lock_bh (&lapbeth->up_lock); + lapbeth->up = true; +spin_unlock_bh (&lapbeth->up_lock); +return 0 ; }static int lapbeth_close (struct net_device *dev) { +struct lapbethdev *lapbeth =netdev_priv (dev);int err; +spin_lock_bh (&lapbeth->up_lock); + lapbeth->up = false; +spin_unlock_bh (&lapbeth->up_lock); +if ((err =lapb_unregister (dev)) !=LAPB_OK )pr_err ("lapb_unregister error: %d\n" , err);
@@ -350,6 +365,9 @@ static int lapbeth_new_device(struct net_device *dev)dev_hold (dev); lapbeth->ethdev = dev; + lapbeth->up = false; +spin_lock_init (&lapbeth->up_lock); + rc = -EIO ;if (register_netdevice (ndev)) goto fail;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 251/425 powerpc/prom: Mark identical_pvr_fixup as __init
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 1ef1dd9c7ed27b080445e1576e8a05957e0e4dfc ]
If identical_pvr_fixup() is not inlined, there are two modpost warnings:
WARNING: modpost: vmlinux.o(.text+0x54e8): Section mismatch in reference from the function identical_pvr_fixup() to the function .init.text:of_get_flat_dt_prop()
The function identical_pvr_fixup() references
the function __init of_get_flat_dt_prop().
This is often because identical_pvr_fixup lacks a __init annotation or the annotation of of_get_flat_dt_prop is wrong.
WARNING: modpost: vmlinux.o(.text+0x551c): Section mismatch in reference from the function identical_pvr_fixup() to the function .init.text:identify_cpu()
The function identical_pvr_fixup() references
the function __init identify_cpu().
This is often because identical_pvr_fixup lacks a __init annotation or the annotation of identify_cpu is wrong.
identical_pvr_fixup() calls two functions marked as __init and is only called by a function marked as __init so it should be marked as __init as well. At the same time, remove the inline keywork as it is not necessary to inline this function. The compiler is still free to do so if it feels it is worthwhile since commit 889b3c1245de ("compiler:
remove CONFIG_OPTIMIZE_INLINING entirely").
--- arch/powerpc/kernel/prom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom.c +1 -1
@@ -266,7 +266,7 @@ static struct feature_property { };#if defined(CONFIG_44x) && defined(CONFIG_PPC_FPU ) -static inline void identical_pvr_fixup (unsigned long node) +static __init void identical_pvr_fixup (unsigned long node) {unsigned int pvr;const char *model =of_get_flat_dt_prop (node,"model" ,NULL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 252/425 powerpc: Fix HAVE_HARDLOCKUP_DETECTOR_ARCH build configuration
In reply to Greg Kroah-HartmanFrom: Chen Huang <[email protected]>
[ Upstream commit 4fe529449d85e78972fa327999961ecc83a0b6db ]
When compiling the powerpc with the SMP disabled, it shows the issue:
arch/powerpc/kernel/watchdog.c: In function ‘watchdog_smp_panic’:arch/powerpc/kernel/watchdog.c:177:4: error: implicit declaration of function ‘smp_send_nmi_ipi’; did you mean ‘smp_send_stop’? [-Werror=implicit-function-declaration]
177 | smp_send_nmi_ipi(c, wd_lockup_ipi, 1000000);
| ^~~~~~~~~~~~~~~~
| smp_send_stopcc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:273: arch/powerpc/kernel/watchdog.o] Error 1 make[1]: *** [scripts/Makefile.build:534: arch/powerpc/kernel] Error 2
make: *** [Makefile:1980: arch/powerpc] Error 2
make: *** Waiting for unfinished jobs....
We found that powerpc used ipi to implement hardlockup watchdog, so the HAVE_HARDLOCKUP_DETECTOR_ARCH should depend on the SMP.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -208,7 +208,7 @@ config PPC select HAVE_MEMBLOCK_NODE_MAP select HAVE_MOD_ARCH_SPECIFIC select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S) - select HAVE_HARDLOCKUP_DETECTOR_ARCH if (PPC64 && PPC_BOOK3S) + select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC64 && PPC_BOOK3S && SMP select HAVE_OPROFILE select HAVE_OPTPROBES if PPC64 select HAVE_PERF_EVENTS
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 253/425 ALSA: core: remove redundant spin_lock pair in snd_card_disconnect
In reply to Greg Kroah-HartmanFrom: Jia Zhou <[email protected]>
[ Upstream commit abc21649b3e5c34b143bf86f0c78e33d5815e250 ]
modification in commit 2a3f7221acdd ("ALSA: core: Fix card races between register and disconnect") resulting in this problem.
--- sound/core/init.c | 2 -- 1 file changed, 2 deletions(-)
sound/core/init.c +0 -2
@@ -405,10 +405,8 @@ int snd_card_disconnect(struct snd_card *card)return 0 ; } card->shutdown =1 ; -spin_unlock (&card->files_lock);/* replace file->f_op with special dummy operations */ -spin_lock (&card->files_lock);list_for_each_entry (mfile, &card->files_list, list) {/* it's critical part, use endless loop */ /* we have no room to fail */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 254/425 bug: Remove redundant condition check in report_bug
In reply to Greg Kroah-HartmanFrom: Andrew Scull <[email protected]>
[ Upstream commit 3ad1a6cb0abc63d036fc866bd7c2c5983516dec5 ]
report_bug() will return early if it cannot find a bug corresponding to the provided address. The subsequent test for the bug will always be true so remove it.
--- lib/bug.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
lib/bug.c +15 -18
@@ -155,30 +155,27 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) file =NULL ; line =0 ; - warning =0 ; -if (bug) {#ifdef CONFIG_DEBUG_BUGVERBOSE #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS - file = bug->file; + file = bug->file;#else - file = (const char *)bug + bug->file_disp; + file = (const char *)bug + bug->file_disp;#endif - line = bug->line; + line = bug->line;#endif - warning = (bug->flags &BUGFLAG_WARNING ) !=0 ; - once = (bug->flags &BUGFLAG_ONCE ) !=0 ; - done = (bug->flags &BUGFLAG_DONE ) !=0 ; - -if (warning && once) { -if (done) -return BUG_TRAP_TYPE_WARN ; - -/* -* Since this is the only store, concurrency is not an issue. -*/ - bug->flags |=BUGFLAG_DONE ; - } + warning = (bug->flags &BUGFLAG_WARNING ) !=0 ; + once = (bug->flags &BUGFLAG_ONCE ) !=0 ; + done = (bug->flags &BUGFLAG_DONE ) !=0 ; + +if (warning && once) { +if (done) +return BUG_TRAP_TYPE_WARN ; + +/* +* Since this is the only store, concurrency is not an issue. +*/ + bug->flags |=BUGFLAG_DONE ; }if (warning) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 255/425 nfc: pn533: prevent potential memory corruption
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ca4d4c34ae9aa5c3c0da76662c5e549d2fc0cc86 ]
If the "type_a->nfcid_len" is too large then it would lead to memory corruption in pn533_target_found_type_a() when we do:
memcpy(nfc_tgt->nfcid1, tgt_type_a->nfcid_data, nfc_tgt->nfcid1_len);
--- drivers/nfc/pn533/pn533.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nfc/pn533/pn533.c +3 -0
@@ -692,6 +692,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a,if (PN533_TYPE_A_SEL_CASCADE (type_a->sel_res) !=0 )return false; +if (type_a->nfcid_len >NFC_NFCID1_MAXSIZE ) +return false; +return true; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 256/425 net: hns3: Limiting the scope of vector_ring_chain variable
In reply to Greg Kroah-HartmanFrom: Salil Mehta <[email protected]>
[ Upstream commit d392ecd1bc29ae15b0e284d5f732c2d36f244271 ]
Limiting the scope of the variable vector_ring_chain to the block where it is used.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 -1
@@ -2639,7 +2639,6 @@ static void hns3_add_ring_to_group(struct hns3_enet_ring_group *group,static int hns3_nic_init_vector_data (struct hns3_nic_priv *priv) { -struct hnae3_ring_chain_node vector_ring_chain;struct hnae3_handle *h = priv->ae_handle;struct hns3_enet_tqp_vector *tqp_vector;int ret =0 ;
@@ -2669,6 +2668,8 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) }for (i =0 ; i < priv->vector_num; i++) { +struct hnae3_ring_chain_node vector_ring_chain; + tqp_vector = &priv->tqp_vector[i]; tqp_vector->rx_group.total_bytes =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 257/425 ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 5fb45414ae03421255593fd5556aa2d1d82303aa ]
There are a few calls of usb_driver_claim_interface() but all of those miss the proper error checks, as reported by Coverity. This patch adds those missing checks.
Along with it, replace the magic pointer with -1 with a constant USB_AUDIO_IFACE_UNUSED for better readability.
Addresses-Coverity-ID: 1475943 ("Error handling issues")
Addresses-Coverity-ID: 1475944 ("Error handling issues")
Addresses-Coverity-ID: 1475945 ("Error handling issues")
--- sound/usb/card.c | 14 +++++++------- sound/usb/quirks.c | 16 ++++++++++++---- sound/usb/usbaudio.h | 2 ++ 3 files changed, 21 insertions(+), 11 deletions(-)
sound/usb/card.c +7 -7
@@ -189,9 +189,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ctrlif, interface);return -EINVAL ; } -usb_driver_claim_interface (&usb_audio_driver, iface, (void *)-1L ); - -return 0 ; +return usb_driver_claim_interface (&usb_audio_driver, iface, +USB_AUDIO_IFACE_UNUSED ); } if ((altsd->bInterfaceClass != USB_CLASS_AUDIO &&
@@ -211,7 +210,8 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int intif (!snd_usb_parse_audio_interface (chip, interface)) {usb_set_interface (dev, interface,0 );/* reset the current interface */ -usb_driver_claim_interface (&usb_audio_driver, iface, (void *)-1L ); +return usb_driver_claim_interface (&usb_audio_driver, iface, +USB_AUDIO_IFACE_UNUSED ); }return 0 ;
@@ -707,7 +707,7 @@ static void usb_audio_disconnect(struct usb_interface *intf)struct snd_card *card;struct list_head *p; -if (chip == (void *)-1L ) +if (chip ==USB_AUDIO_IFACE_UNUSED )return ; card = chip->card;
@@ -807,7 +807,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)struct usb_mixer_interface *mixer;struct list_head *p; -if (chip == (void *)-1L ) +if (chip ==USB_AUDIO_IFACE_UNUSED )return 0 ;if (!chip->num_suspended_intf++) {
@@ -839,7 +839,7 @@ static int __usb_audio_resume(struct usb_interface *intf, bool reset_resume)struct list_head *p;int err =0 ; -if (chip == (void *)-1L ) +if (chip ==USB_AUDIO_IFACE_UNUSED )return 0 ;atomic_inc (&chip->active);/* avoid autopm */
sound/usb/quirks.c +12 -4
@@ -66,8 +66,12 @@ static int create_composite_quirk(struct snd_usb_audio *chip,if (!iface)continue ;if (quirk->ifnum != probed_ifnum && - !usb_interface_claimed (iface)) -usb_driver_claim_interface (driver, iface, (void *)-1L ); + !usb_interface_claimed (iface)) { + err =usb_driver_claim_interface (driver, iface, +USB_AUDIO_IFACE_UNUSED ); +if (err <0 ) +return err; + } }return 0 ;
@@ -401,8 +405,12 @@ static int create_autodetect_quirks(struct snd_usb_audio *chip,continue ; err =create_autodetect_quirk (chip, iface, driver); -if (err >=0 ) -usb_driver_claim_interface (driver, iface, (void *)-1L ); +if (err >=0 ) { + err =usb_driver_claim_interface (driver, iface, +USB_AUDIO_IFACE_UNUSED ); +if (err <0 ) +return err; + } }return 0 ;
sound/usb/usbaudio.h +2 -0
@@ -68,6 +68,8 @@ struct snd_usb_audio {struct usb_host_interface *ctrl_intf;/* the audio control interface */ }; +#define USB_AUDIO_IFACE_UNUSED ((void *)-1L) + #define usb_audio_err(chip, fmt, args...) \ dev_err(&(chip)->dev->dev, fmt, ##args) #define usb_audio_warn(chip, fmt, args...) \
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 258/425 liquidio: Fix unintented sign extension of a left shift of a u16
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 298b58f00c0f86868ea717426beb5c1198772f81 ]
The macro CN23XX_PEM_BAR1_INDEX_REG is being used to shift oct->pcie_port (a u16) left 24 places. There are two subtle issues here, first the shift gets promoted to an signed int and then sign extended to a u64. If oct->pcie_port is 0x80 or more then the upper bits get sign extended to 1. Secondly shfiting a u16 24 bits will lead to an overflow so it needs to be cast to a u64 for all the bits to not overflow.
It is entirely possible that the u16 port value is never large enough for this to fail, but it is useful to fix unintended overflows such as this.
Fix this by casting the port parameter to the macro to a u64 before the shift.
Addresses-Coverity: ("Unintended sign extension")
--- drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_regs.h +1 -1
@@ -521,7 +521,7 @@#define CN23XX_BAR1_INDEX_OFFSET 3#define CN23XX_PEM_BAR1_INDEX_REG (port, idx) \ - (CN23XX_PEM_BAR1_INDEX_START + ((port) << CN23XX_PEM_OFFSET) + \ + (CN23XX_PEM_BAR1_INDEX_START + (((u64)port) << CN23XX_PEM_OFFSET) + \ ((idx) << CN23XX_BAR1_INDEX_OFFSET))/*############################ DPI #########################*/
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 259/425 powerpc/64s: Fix pte update for kernel memory on radix
In reply to Greg Kroah-HartmanFrom: Jordan Niethe <[email protected]>
[ Upstream commit b8b2f37cf632434456182e9002d63cbc4cccc50c ]
When adding a PTE a ptesync is needed to order the update of the PTE with subsequent accesses otherwise a spurious fault may be raised.
radix__set_pte_at() does not do this for performance gains. For non-kernel memory this is not an issue as any faults of this kind are corrected by the page fault handler. For kernel memory these faults are not handled. The current solution is that there is a ptesync in flush_cache_vmap() which should be called when mapping from the vmalloc region.
However, map_kernel_page() does not call flush_cache_vmap(). This is troublesome in particular for code patching with Strict RWX on radix. In do_patch_instruction() the page frame that contains the instruction to be patched is mapped and then immediately patched. With no ordering or synchronization between setting up the PTE and writing to the page it is possible for faults.
As the code patching is done using __put_user_asm_goto() the resulting fault is obscured - but using a normal store instead it can be seen:
BUG: Unable to handle kernel data access on write at 0xc008000008f24a3c Faulting instruction address: 0xc00000000008bd74 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA PowerNV Modules linked in: nop_module(PO+) [last unloaded: nop_module] CPU: 4 PID: 757 Comm: sh Tainted: P O 5.10.0-rc5-01361-ge3c1b78c8440-dirty #43 NIP: c00000000008bd74 LR: c00000000008bd50 CTR: c000000000025810 REGS: c000000016f634a0 TRAP: 0300 Tainted: P O (5.10.0-rc5-01361-ge3c1b78c8440-dirty) MSR: 9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE> CR: 44002884 XER: 00000000 CFAR: c00000000007c68c DAR: c008000008f24a3c DSISR: 42000000 IRQMASK: 1
This results in the kind of issue reported here:
https://lore.kernel.org/linuxppc-dev/[email protected]/
Chris Riedl suggested a reliable way to reproduce the issue:
$ mount -t debugfs none /sys/kernel/debug $ (while true; do echo function > /sys/kernel/debug/tracing/current_tracer ; echo nop > /sys/kernel/debug/tracing/current_tracer ; done) &
Turning ftrace on and off does a large amount of code patching which in usually less then 5min will crash giving a trace like:
ftrace-powerpc: (____ptrval____): replaced (4b473b11) != old (60000000) ------------[ ftrace bug ]------------
ftrace failed to modify
[<c000000000bf8e5c>] napi_busy_loop+0xc/0x390
actual: 11:3b:47:4b
Setting ftrace call site to call ftrace function
ftrace record flags: 80000001
(1)
expected tramp: c00000000006c96c
------------[ cut here ]------------
WARNING: CPU: 4 PID: 809 at kernel/trace/ftrace.c:2065 ftrace_bug+0x28c/0x2e8
Modules linked in: nop_module(PO-) [last unloaded: nop_module]
CPU: 4 PID: 809 Comm: sh Tainted: P O 5.10.0-rc5-01360-gf878ccaf250a #1
NIP: c00000000024f334 LR: c00000000024f330 CTR: c0000000001a5af0
REGS: c000000004c8b760 TRAP: 0700 Tainted: P O (5.10.0-rc5-01360-gf878ccaf250a)
MSR: 900000000282b033 <SF,HV,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 28008848 XER: 20040000
CFAR: c0000000001a9c98 IRQMASK: 0
GPR00: c00000000024f330 c000000004c8b9f0 c000000002770600 0000000000000022
GPR04: 00000000ffff7fff c000000004c8b6d0 0000000000000027 c0000007fe9bcdd8
GPR08: 0000000000000023 ffffffffffffffd8 0000000000000027 c000000002613118
GPR12: 0000000000008000 c0000007fffdca00 0000000000000000 0000000000000000
GPR16: 0000000023ec37c5 0000000000000000 0000000000000000 0000000000000008
GPR20: c000000004c8bc90 c0000000027a2d20 c000000004c8bcd0 c000000002612fe8
GPR24: 0000000000000038 0000000000000030 0000000000000028 0000000000000020
GPR28: c000000000ff1b68 c000000000bf8e5c c00000000312f700 c000000000fbb9b0
NIP ftrace_bug+0x28c/0x2e8
LR ftrace_bug+0x288/0x2e8
Call Trace:
ftrace_bug+0x288/0x2e8 (unreliable)
ftrace_modify_all_code+0x168/0x210
arch_ftrace_update_code+0x18/0x30
ftrace_run_update_code+0x44/0xc0
ftrace_startup+0xf8/0x1c0
register_ftrace_function+0x4c/0xc0
function_trace_init+0x80/0xb0
tracing_set_tracer+0x2a4/0x4f0
tracing_set_trace_write+0xd4/0x130
vfs_write+0xf0/0x330
ksys_write+0x84/0x140
system_call_exception+0x14c/0x230
system_call_common+0xf0/0x27cTo fix this when updating kernel memory PTEs using ptesync.
--- arch/powerpc/include/asm/book3s/64/radix.h | 6 ++++-- arch/powerpc/mm/pgtable-radix.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/book3s/64/radix.h +4 -2
@@ -204,8 +204,10 @@ static inline void radix__set_pte_at(struct mm_struct *mm, unsigned long addr,* from ptesync, it should probably go into update_mmu_cache, rather * than set_pte_at (which is used to set ptes unrelated to faults). * -* Spurious faults to vmalloc region are not tolerated, so there is -* a ptesync in flush_cache_vmap. +* Spurious faults from the kernel memory are not tolerated, so there +* is a ptesync in flush_cache_vmap, and __map_kernel_page() follows +* the pte update sequence from ISA Book III 6.10 Translation Table +* Update Synchronization Requirements. */ }
arch/powerpc/mm/pgtable-radix.c +2 -2
@@ -115,7 +115,7 @@ static int early_map_kernel_page(unsigned long ea, unsigned long pa, set_the_pte:set_pte_at (&init_mm, ea, ptep,pfn_pte (pfn, flags)); -smp_wmb (); + asmvolatile ("ptesync" : : :"memory" );return 0 ; }
@@ -169,7 +169,7 @@ static int __map_kernel_page(unsigned long ea, unsigned long pa, set_the_pte:set_pte_at (&init_mm, ea, ptep,pfn_pte (pfn, flags)); -smp_wmb (); + asmvolatile ("ptesync" : : :"memory" );return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 260/425 powerpc/perf: Fix PMU constraint check for EBB events
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 10f8f96179ecc7f69c927f6d231f6d02736cea83 ]
The power PMU group constraints includes check for EBB events to make sure all events in a group must agree on EBB. This will prevent scheduling EBB and non-EBB events together. But in the existing check, settings for constraint mask and value is interchanged. Patch fixes the same.
Before the patch, PMU selftest "cpu_event_pinned_vs_ebb_test" fails with below in dmesg logs. This happens because EBB event gets enabled along with a non-EBB cpu event.
[35600.453346] cpu_event_pinne[41326]: illegal instruction (4) at 10004a18 nip 10004a18 lr 100049f8 code 1 in cpu_event_pinned_vs_ebb_test[10000000+10000]
Test results after the patch:
$ ./pmu/ebb/cpu_event_pinned_vs_ebb_test test: cpu_event_pinned_vs_ebb tags: git_version:v5.12-rc5-93-gf28c3125acd3-dirty Binding to cpu 8 EBB Handler is at 0x100050c8 read error on event 0x7fffe6bd4040! PM_RUN_INST_CMPL: result 9872 running/enabled 37930432 success: cpu_event_pinned_vs_ebb
This bug was hidden by other logic until commit 1908dc911792 (perf:
Tweak perf_event_attr::exclusive semantics).
--- arch/powerpc/perf/isa207-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/perf/isa207-common.c +2 -2
@@ -359,8 +359,8 @@ ebb_bhrb:* EBB events are pinned & exclusive, so this should never actually * hit, but we leave it as a fallback in case. */ - mask |=CNST_EBB_VAL (ebb); - value |=CNST_EBB_MASK ; + mask |=CNST_EBB_MASK ; + value |=CNST_EBB_VAL (ebb); *maskp = mask; *valp = value;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 261/425 powerpc: iommu: fix build when neither PCI or IBMVIO is set
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit b27dadecdf9102838331b9a0b41ffc1cfe288154 ]
When neither CONFIG_PCI nor CONFIG_IBMVIO is set/enabled, iommu.c has a build error. The fault injection code is not useful in that kernel config, so make the FAIL_IOMMU option depend on PCI || IBMVIO.
Prevents this build error (warning escalated to error):../arch/powerpc/kernel/iommu.c:178:30: error: 'fail_iommu_bus_notifier' defined but not used [-Werror=unused-variable]
178 | static struct notifier_block fail_iommu_bus_notifier = {
--- arch/powerpc/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/Kconfig.debug +1 -0
@@ -350,6 +350,7 @@ config PPC_EARLY_DEBUG_CPM_ADDR config FAIL_IOMMU bool "Fault-injection capability for IOMMU" depends on FAULT_INJECTION + depends on PCI || IBMVIO help Provide fault-injection capability for IOMMU. Each device can be selectively enabled via the fail_iommu property.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 262/425 mac80211: bail out if cipher schemes are invalid
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit db878e27a98106a70315d264cc92230d84009e72 ]
If any of the cipher schemes specified by the driver are invalid, bail out and fail the registration rather than just warning. Otherwise, we might later crash when we try to use the invalid cipher scheme, e.g. if the hdr_len is (significantly) less than the pn_offs + pn_len, we'd have an out-of-bounds access in RX validation.
--- net/mac80211/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/mac80211/main.c +5 -2
@@ -1080,8 +1080,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)if (local->hw.wiphy->max_scan_ie_len) local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; -WARN_ON (!ieee80211_cs_list_valid (local->hw.cipher_schemes, - local->hw.n_cipher_schemes)); +if (WARN_ON (!ieee80211_cs_list_valid (local->hw.cipher_schemes, + local->hw.n_cipher_schemes))) { + result = -EINVAL ; + goto fail_workqueue; + } result =ieee80211_init_cipher_suites (local);if (result <0 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 263/425 mt7601u: fix always true expression
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 87fce88658ba047ae62e83497d3f3c5dc22fa6f9 ]
Currently the expression ~nic_conf1 is always true because nic_conf1 is a u16 and according to 6.5.3.3 of the C standard the ~ operator promotes the u16 to an integer before flipping all the bits. Thus the top 16 bits of the integer result are all set so the expression is always true. If the intention was to flip all the bits of nic_conf1 then casting the integer result back to a u16 is a suitabel fix.
Interestingly static analyzers seem to thing a bitwise ! should be used instead of ~ for this scenario, so I think the original intent of the expression may need some extra consideration.
Addresses-Coverity: ("Logical vs. bitwise operator")
--- drivers/net/wireless/mediatek/mt7601u/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/eeprom.c +1 -1
@@ -107,7 +107,7 @@ mt7601u_has_tssi(struct mt7601u_dev *dev, u8 *eeprom) {u16 nic_conf1 =get_unaligned_le16 (eeprom +MT_EE_NIC_CONF_1 ); -return ~nic_conf1 && (nic_conf1 &MT_EE_NIC_CONF_1_TX_ALC_EN ); +return (u16 )~nic_conf1 && (nic_conf1 &MT_EE_NIC_CONF_1_TX_ALC_EN ); } static void
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 264/425 IB/hfi1: Fix error return code in parse_platform_config()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 4c7d9c69adadfc31892c7e8e134deb3546552106 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/hw/hfi1/firmware.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/hfi1/firmware.c +1 -0
@@ -1924,6 +1924,7 @@ int parse_platform_config(struct hfi1_devdata *dd)dd_dev_err (dd,"%s: Failed CRC check at offset %ld\n" , __func__, (ptr - (u32 *)dd->platform_config.data)); + ret = -EINVAL ; goto bail; }/* Jump the CRC DWORD */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 265/425 net: thunderx: Fix unintentional sign extension issue
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit e701a25840360706fe4cf5de0015913ca19c274b ]
The shifting of the u8 integers rq->caching by 26 bits to the left will be promoted to a 32 bit signed int and then sign-extended to a u64. In the event that rq->caching is greater than 0x1f then all then all the upper 32 bits of the u64 end up as also being set because of the int sign-extension. Fix this by casting the u8 values to a u64 before the 26 bit left shift.
Addresses-Coverity: ("Unintended sign extension")
--- drivers/net/ethernet/cavium/thunder/nicvf_queues.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/nicvf_queues.c +1 -1
@@ -779,7 +779,7 @@ static void nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs, mbx.rq.msg =NIC_MBOX_MSG_RQ_CFG ; mbx.rq.qs_num = qs->vnic_id; mbx.rq.rq_num = qidx; - mbx.rq.cfg = (rq->caching <<26 ) | (rq->cq_qs <<19 ) | + mbx.rq.cfg = ((u64 )rq->caching <<26 ) | (rq->cq_qs <<19 ) | (rq->cq_idx <<16 ) | (rq->cont_rbdr_qs <<9 ) | (rq->cont_qs_rbdr_idx <<8 ) | (rq->start_rbdr_qs <<1 ) | (rq->start_qs_rbdr_idx);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 266/425 RDMA/srpt: Fix error return code in srpt_cm_req_recv()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 6bc950beff0c440ac567cdc4e7f4542a9920953d ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -0
@@ -2301,6 +2301,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,pr_info ("rejected SRP_LOGIN_REQ because target %s_%d is not enabled\n" , sdev->device->name, port_num);mutex_unlock (&sport->mutex); + ret = -EINVAL ; goto reject; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 267/425 i2c: cadence: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 5581c2c5d02bc63a0edb53e061c8e97cd490646e ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-cadence.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-cadence.c +4 -1
@@ -906,7 +906,10 @@ static int cdns_i2c_probe(struct platform_device *pdev)if (IS_ERR (id->membase))return PTR_ERR (id->membase); - id->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) +return ret; + id->irq = ret; id->adap.owner =THIS_MODULE ; id->adap.dev.of_node = pdev->dev.of_node;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 268/425 i2c: emev2: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit bb6129c32867baa7988f7fd2066cf18ed662d240 ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-emev2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-emev2.c +4 -1
@@ -397,7 +397,10 @@ static int em_i2c_probe(struct platform_device *pdev)em_i2c_reset (&priv->adap); - priv->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto err_clk; + priv->irq = ret; ret =devm_request_irq (&pdev->dev, priv->irq, em_i2c_irq_handler,0 ,"em_i2c" , priv);if (ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 269/425 i2c: jz4780: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit c5e5f7a8d931fb4beba245bdbc94734175fda9de ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-jz4780.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-jz4780.c +4 -1
@@ -760,7 +760,10 @@ static int jz4780_i2c_probe(struct platform_device *pdev)jz4780_i2c_writew (i2c,JZ4780_I2C_INTM ,0x0 ); - i2c->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto err; + i2c->irq = ret; ret =devm_request_irq (&pdev->dev, i2c->irq, jz4780_i2c_irq,0 ,dev_name (&pdev->dev), i2c);if (ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 270/425 i2c: sh7760: add IRQ check
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit e5b2e3e742015dd2aa6bc7bcef2cb59b2de1221c ]
The driver neglects to check the result of platform_get_irq()'s call and blithely passes the negative error codes to devm_request_irq() (which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original error code. Stop calling devm_request_irq() with invalid IRQ #s.
--- drivers/i2c/busses/i2c-sh7760.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-sh7760.c +4 -1
@@ -471,7 +471,10 @@ static int sh7760_i2c_probe(struct platform_device *pdev) goto out2; } - id->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) +return ret; + id->irq = ret; id->adap.nr = pdev->id; id->adap.algo = &sh7760_i2c_algo;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 271/425 ASoC: ak5558: correct reset polarity
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 0b93bbc977af55fd10687f2c96c807cba95cb927 ]
Reset (aka power off) happens when the reset gpio is made active. The reset gpio is GPIO_ACTIVE_LOW
--- sound/soc/codecs/ak5558.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/ak5558.c +2 -2
@@ -271,7 +271,7 @@ static void ak5558_power_off(struct ak5558_priv *ak5558)if (!ak5558->reset_gpiod)return ; -gpiod_set_value_cansleep (ak5558->reset_gpiod,0 ); +gpiod_set_value_cansleep (ak5558->reset_gpiod,1 );usleep_range (1000 ,2000 ); }
@@ -280,7 +280,7 @@ static void ak5558_power_on(struct ak5558_priv *ak5558)if (!ak5558->reset_gpiod)return ; -gpiod_set_value_cansleep (ak5558->reset_gpiod,1 ); +gpiod_set_value_cansleep (ak5558->reset_gpiod,0 );usleep_range (1000 ,2000 ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 272/425 drm/i915/gvt: Fix error code in intel_gvt_init_device()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 329328ec6a87f2c1275f50d979d55513de458409 ]
The intel_gvt_init_vgpu_type_groups() function is only called from intel_gvt_init_device(). If it fails then the intel_gvt_init_device() prints the error code and propagates it back again. That's a bug because false is zero/success. The fix is to modify it to return zero or negative error codes and make everything consistent.
--- drivers/gpu/drm/i915/gvt/gvt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.c +4 -4
@@ -128,7 +128,7 @@ static bool intel_get_gvt_attrs(struct attribute ***type_attrs,return true; } -static bool intel_gvt_init_vgpu_type_groups (struct intel_gvt *gvt) +static int intel_gvt_init_vgpu_type_groups (struct intel_gvt *gvt) {int i, j;struct intel_vgpu_type *type;
@@ -146,7 +146,7 @@ static bool intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt) gvt_vgpu_type_groups[i] = group; } -return true; +return 0 ; unwind:for (j =0 ; j < i; j++) {
@@ -154,7 +154,7 @@ unwind:kfree (group); } -return false; +return -ENOMEM ; }static void intel_gvt_cleanup_vgpu_type_groups (struct intel_gvt *gvt)
@@ -416,7 +416,7 @@ int intel_gvt_init_device(struct drm_i915_private *dev_priv) goto out_clean_thread; ret =intel_gvt_init_vgpu_type_groups (gvt); -if (ret == false) { +if (ret) {gvt_err ("failed to init vgpu type groups: %d\n" , ret); goto out_clean_types; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 273/425 MIPS: pci-legacy: stop using of_pci_range_to_resource
In reply to Greg Kroah-HartmanFrom: Ilya Lipnitskiy <[email protected]>
[ Upstream commit 3ecb9dc1581eebecaee56decac70e35365260866 ]
Mirror commit aeba3731b150 ("powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change").
Most MIPS platforms do not define PCI_IOBASE, nor implement pci_address_to_pio(). Moreover, IO_SPACE_LIMIT is 0xffff for most MIPS platforms. of_pci_range_to_resource passes the _start address_ of the IO range into pci_address_to_pio, which then checks it against IO_SPACE_LIMIT and fails, because for MIPS platforms that use pci-legacy (pci-lantiq, pci-rt3883, pci-mt7620), IO ranges start much higher than 0xffff.
In fact, pci-mt7621 in staging already works around this problem, see commit 09dd629eeabb ("staging: mt7621-pci: fix io space and properly set resource limits")
So just stop using of_pci_range_to_resource, which does not work for MIPS.
Fixes PCI errors like:
pci_bus 0000:00: root bus resource [io 0xffffffff]
--- arch/mips/pci/pci-legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/pci/pci-legacy.c +7 -2
@@ -169,8 +169,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) res = hose->mem_resource;break ; } -if (res !=NULL ) -of_pci_range_to_resource (&range, node, res); +if (res !=NULL ) { + res->name = node->full_name; + res->flags = range.flags; + res->start = range.cpu_addr; + res->end = range.cpu_addr + range.size -1 ; + res->parent = res->child = res->sibling =NULL ; + } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 274/425 powerpc/pseries: extract host bridge from pci_bus prior to bus removal
In reply to Greg Kroah-HartmanFrom: Tyrel Datwyler <[email protected]>
[ Upstream commit 38d0b1c9cec71e6d0f3bddef0bbce41d05a3e796 ]
The pci_bus->bridge reference may no longer be valid after pci_bus_remove() resulting in passing a bad value to device_unregister() for the associated bridge device.
Store the host_bridge reference in a separate variable prior to pci_bus_remove().
--- arch/powerpc/platforms/pseries/pci_dlpar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/pci_dlpar.c +3 -1
@@ -66,6 +66,7 @@ EXPORT_SYMBOL_GPL(init_phb_dynamic);int remove_phb_dynamic (struct pci_controller *phb) {struct pci_bus *b = phb->bus; +struct pci_host_bridge *host_bridge =to_pci_host_bridge (b->bridge);struct resource *res;int rc, i;
@@ -92,7 +93,8 @@ int remove_phb_dynamic(struct pci_controller *phb)/* Remove the PCI bus and unregister the bridge device from sysfs */ phb->bus =NULL ;pci_remove_bus (b); -device_unregister (b->bridge); + host_bridge->bus =NULL ; +device_unregister (&host_bridge->dev);/* Now release the IO resource */ if (res->flags &IORESOURCE_IO )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 275/425 rtlwifi: 8821ae: upgrade PHY and RF parameters
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 18fb0bedb5fc2fddc057dbe48b7360a6ffda34b3 ]
The signal strength of 5G is quite low, so user can't connect to an AP far away. New parameters with new format and its parser are updated by the commit 84d26fda52e2 ("rtlwifi: Update 8821ae new phy parameters and its parser."), but some parameters are missing. Use this commit to update to the novel parameters that use new format.
--- .../realtek/rtlwifi/rtl8821ae/table.c | 500 +++++++++++++----- 1 file changed, 370 insertions(+), 130 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/table.c +370 -130
@@ -272,7 +272,7 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = {0x824 ,0x00030FE0 ,0x828 ,0x00000000 ,0x82C ,0x002081DD , -0x830 ,0x2AAA8E24 , +0x830 ,0x2AAAEEC8 ,0x834 ,0x0037A706 ,0x838 ,0x06489B44 , 0x83C, 0x0000095B,
@@ -347,10 +347,10 @@ u32 RTL8821AE_PHY_REG_ARRAY[] = {0x9D8 ,0x00000000 ,0x9DC ,0x00000000 ,0x9E0 ,0x00005D00 , -0x9E4 ,0x00000002 , +0x9E4 ,0x00000003 ,0x9E8 ,0x00000001 ,0xA00 ,0x00D047C8 , -0xA04 ,0x01FF000C , +0xA04 ,0x01FF800C ,0xA08 ,0x8C8A8300 ,0xA0C ,0x2E68000F , 0xA10, 0x9500BB78,
@@ -1343,7 +1343,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x083 ,0x00021800 ,0x084 ,0x00028000 ,0x085 ,0x00048000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 , +0x086 ,0x0009483A , +0xA0000000 ,0x00000000 ,0x086 ,0x00094838 , +0xB0000000 ,0x00000000 ,0x087 ,0x00044980 ,0x088 ,0x00048000 , 0x089, 0x0000D480,
@@ -1432,36 +1436,32 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x03C ,0x000CA000 ,0x0EF ,0x00000000 ,0x0EF ,0x00001100 , -0xFF0F0104 ,0xABCD , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0004ADF3 ,0x034 ,0x00049DF0 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0004ADF3 ,0x034 ,0x00049DF0 , -0xFF0F0404 ,0xCDEF , -0x034 ,0x0004ADF3 , -0x034 ,0x00049DF0 , -0xFF0F0200 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0004ADF5 ,0x034 ,0x00049DF2 , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0004A0F3 , +0x034 ,0x000490B1 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0004A0F3 ,0x034 ,0x000490B1 , -0xCDCDCDCD ,0xCDCD , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0004ADF5 , +0x034 ,0x00049DF2 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0004ADF3 , +0x034 ,0x00049DF0 , +0xA0000000 ,0x00000000 ,0x034 ,0x0004ADF7 ,0x034 ,0x00049DF3 , -0xFF0F0104 ,0xDEAD , -0xFF0F0104 ,0xABCD , -0x034 ,0x00048DED , -0x034 ,0x00047DEA , -0x034 ,0x00046DE7 , -0x034 ,0x00045CE9 , -0x034 ,0x00044CE6 , -0x034 ,0x000438C6 , -0x034 ,0x00042886 , -0x034 ,0x00041486 , -0x034 ,0x00040447 , -0xFF0F0204 ,0xCDEF , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00048DED ,0x034 ,0x00047DEA , 0x034, 0x00046DE7,
@@ -1471,7 +1471,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00042886 ,0x034 ,0x00041486 ,0x034 ,0x00040447 , -0xFF0F0404 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00048DED ,0x034 ,0x00047DEA , 0x034, 0x00046DE7,
@@ -1481,7 +1481,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00042886 ,0x034 ,0x00041486 ,0x034 ,0x00040447 , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x000480AE , +0x034 ,0x000470AB , +0x034 ,0x0004608B , +0x034 ,0x00045069 , +0x034 ,0x00044048 , +0x034 ,0x00043045 , +0x034 ,0x00042026 , +0x034 ,0x00041023 , +0x034 ,0x00040002 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x000480AE ,0x034 ,0x000470AB , 0x034, 0x0004608B,
@@ -1491,7 +1501,17 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00042026 ,0x034 ,0x00041023 ,0x034 ,0x00040002 , -0xCDCDCDCD ,0xCDCD , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x00048DED , +0x034 ,0x00047DEA , +0x034 ,0x00046DE7 , +0x034 ,0x00045CE9 , +0x034 ,0x00044CE6 , +0x034 ,0x000438C6 , +0x034 ,0x00042886 , +0x034 ,0x00041486 , +0x034 ,0x00040447 , +0xA0000000 ,0x00000000 ,0x034 ,0x00048DEF ,0x034 ,0x00047DEC , 0x034, 0x00046DE9,
@@ -1501,38 +1521,36 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x0004248A ,0x034 ,0x0004108D ,0x034 ,0x0004008A , -0xFF0F0104 ,0xDEAD , -0xFF0F0200 ,0xABCD , +0xB0000000 ,0x00000000 , +0x80000210 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0002ADF4 , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0002A0F3 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0002A0F3 , -0xCDCDCDCD ,0xCDCD , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0002ADF4 , +0xA0000000 ,0x00000000 ,0x034 ,0x0002ADF7 , -0xFF0F0200 ,0xDEAD , -0xFF0F0104 ,0xABCD , -0x034 ,0x00029DF4 , -0xFF0F0204 ,0xCDEF , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00029DF4 , -0xFF0F0404 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00029DF4 , -0xFF0F0200 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00029DF1 , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x000290F0 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x000290F0 , -0xCDCDCDCD ,0xCDCD , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x00029DF1 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x00029DF4 , +0xA0000000 ,0x00000000 ,0x034 ,0x00029DF2 , -0xFF0F0104 ,0xDEAD , -0xFF0F0104 ,0xABCD , -0x034 ,0x00028DF1 , -0x034 ,0x00027DEE , -0x034 ,0x00026DEB , -0x034 ,0x00025CEC , -0x034 ,0x00024CE9 , -0x034 ,0x000238CA , -0x034 ,0x00022889 , -0x034 ,0x00021489 , -0x034 ,0x0002044A , -0xFF0F0204 ,0xCDEF , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00028DF1 ,0x034 ,0x00027DEE , 0x034, 0x00026DEB,
@@ -1542,7 +1560,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00022889 ,0x034 ,0x00021489 ,0x034 ,0x0002044A , -0xFF0F0404 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00028DF1 ,0x034 ,0x00027DEE , 0x034, 0x00026DEB,
@@ -1552,7 +1570,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00022889 ,0x034 ,0x00021489 ,0x034 ,0x0002044A , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x000280AF ,0x034 ,0x000270AC , 0x034, 0x0002608B,
@@ -1562,7 +1580,27 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00022026 ,0x034 ,0x00021023 ,0x034 ,0x00020002 , -0xCDCDCDCD ,0xCDCD , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x000280AF , +0x034 ,0x000270AC , +0x034 ,0x0002608B , +0x034 ,0x00025069 , +0x034 ,0x00024048 , +0x034 ,0x00023045 , +0x034 ,0x00022026 , +0x034 ,0x00021023 , +0x034 ,0x00020002 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x00028DF1 , +0x034 ,0x00027DEE , +0x034 ,0x00026DEB , +0x034 ,0x00025CEC , +0x034 ,0x00024CE9 , +0x034 ,0x000238CA , +0x034 ,0x00022889 , +0x034 ,0x00021489 , +0x034 ,0x0002044A , +0xA0000000 ,0x00000000 ,0x034 ,0x00028DEE ,0x034 ,0x00027DEB , 0x034, 0x00026CCD,
@@ -1572,27 +1610,24 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00022849 ,0x034 ,0x00021449 ,0x034 ,0x0002004D , -0xFF0F0104 ,0xDEAD , -0xFF0F02C0 ,0xABCD , +0xB0000000 ,0x00000000 , +0x8000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0000A0D7 , +0x034 ,0x000090D3 , +0x034 ,0x000080B1 , +0x034 ,0x000070AE , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0000A0D7 ,0x034 ,0x000090D3 ,0x034 ,0x000080B1 ,0x034 ,0x000070AE , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x034 ,0x0000ADF7 ,0x034 ,0x00009DF4 ,0x034 ,0x00008DF1 ,0x034 ,0x00007DEE , -0xFF0F02C0 ,0xDEAD , -0xFF0F0104 ,0xABCD , -0x034 ,0x00006DEB , -0x034 ,0x00005CEC , -0x034 ,0x00004CE9 , -0x034 ,0x000038CA , -0x034 ,0x00002889 , -0x034 ,0x00001489 , -0x034 ,0x0000044A , -0xFF0F0204 ,0xCDEF , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00006DEB ,0x034 ,0x00005CEC , 0x034, 0x00004CE9,
@@ -1600,7 +1635,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00002889 ,0x034 ,0x00001489 ,0x034 ,0x0000044A , -0xFF0F0404 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x00006DEB ,0x034 ,0x00005CEC , 0x034, 0x00004CE9,
@@ -1608,7 +1643,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00002889 ,0x034 ,0x00001489 ,0x034 ,0x0000044A , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 ,0x034 ,0x0000608D ,0x034 ,0x0000506B , 0x034, 0x0000404A,
@@ -1616,7 +1651,23 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00002044 ,0x034 ,0x00001025 ,0x034 ,0x00000004 , -0xCDCDCDCD ,0xCDCD , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x0000608D , +0x034 ,0x0000506B , +0x034 ,0x0000404A , +0x034 ,0x00003047 , +0x034 ,0x00002044 , +0x034 ,0x00001025 , +0x034 ,0x00000004 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x034 ,0x00006DEB , +0x034 ,0x00005CEC , +0x034 ,0x00004CE9 , +0x034 ,0x000038CA , +0x034 ,0x00002889 , +0x034 ,0x00001489 , +0x034 ,0x0000044A , +0xA0000000 ,0x00000000 ,0x034 ,0x00006DCD ,0x034 ,0x00005CCD , 0x034, 0x00004CCA,
@@ -1624,11 +1675,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x034 ,0x00002888 ,0x034 ,0x00001488 ,0x034 ,0x00000486 , -0xFF0F0104 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x0EF ,0x00000000 ,0x018 ,0x0001712A ,0x0EF ,0x00000040 , -0xFF0F0104 ,0xABCD , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x035 ,0x00000187 ,0x035 ,0x00008187 , 0x035, 0x00010187,
@@ -1638,7 +1689,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x035 ,0x00040188 ,0x035 ,0x00048188 ,0x035 ,0x00050188 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x035 ,0x00000187 ,0x035 ,0x00008187 , 0x035, 0x00010187,
@@ -1648,7 +1699,37 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x035 ,0x00040188 ,0x035 ,0x00048188 ,0x035 ,0x00050188 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 , +0x035 ,0x00000128 , +0x035 ,0x00008128 , +0x035 ,0x00010128 , +0x035 ,0x000201C8 , +0x035 ,0x000281C8 , +0x035 ,0x000301C8 , +0x035 ,0x000401C8 , +0x035 ,0x000481C8 , +0x035 ,0x000501C8 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x035 ,0x00000145 , +0x035 ,0x00008145 , +0x035 ,0x00010145 , +0x035 ,0x00020196 , +0x035 ,0x00028196 , +0x035 ,0x00030196 , +0x035 ,0x000401C7 , +0x035 ,0x000481C7 , +0x035 ,0x000501C7 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x035 ,0x00000128 , +0x035 ,0x00008128 , +0x035 ,0x00010128 , +0x035 ,0x000201C8 , +0x035 ,0x000281C8 , +0x035 ,0x000301C8 , +0x035 ,0x000401C8 , +0x035 ,0x000481C8 , +0x035 ,0x000501C8 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x035 ,0x00000187 ,0x035 ,0x00008187 , 0x035, 0x00010187,
@@ -1658,7 +1739,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x035 ,0x00040188 ,0x035 ,0x00048188 ,0x035 ,0x00050188 , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x035 ,0x00000145 ,0x035 ,0x00008145 , 0x035, 0x00010145,
@@ -1668,11 +1749,11 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x035 ,0x000401C7 ,0x035 ,0x000481C7 ,0x035 ,0x000501C7 , -0xFF0F0104 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x0EF ,0x00000000 ,0x018 ,0x0001712A ,0x0EF ,0x00000010 , -0xFF0F0104 ,0xABCD , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x036 ,0x00085733 ,0x036 ,0x0008D733 , 0x036, 0x00095733,
@@ -1685,7 +1766,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x036 ,0x000CE4B4 ,0x036 ,0x000D64B4 ,0x036 ,0x000DE4B4 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x036 ,0x00085733 ,0x036 ,0x0008D733 , 0x036, 0x00095733,
@@ -1698,7 +1779,46 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x036 ,0x000CE4B4 ,0x036 ,0x000D64B4 ,0x036 ,0x000DE4B4 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 , +0x036 ,0x000063B5 , +0x036 ,0x0000E3B5 , +0x036 ,0x000163B5 , +0x036 ,0x0001E3B5 , +0x036 ,0x000263B5 , +0x036 ,0x0002E3B5 , +0x036 ,0x000363B5 , +0x036 ,0x0003E3B5 , +0x036 ,0x000463B5 , +0x036 ,0x0004E3B5 , +0x036 ,0x000563B5 , +0x036 ,0x0005E3B5 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x036 ,0x000056B3 , +0x036 ,0x0000D6B3 , +0x036 ,0x000156B3 , +0x036 ,0x0001D6B3 , +0x036 ,0x00026634 , +0x036 ,0x0002E634 , +0x036 ,0x00036634 , +0x036 ,0x0003E634 , +0x036 ,0x000467B4 , +0x036 ,0x0004E7B4 , +0x036 ,0x000567B4 , +0x036 ,0x0005E7B4 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x036 ,0x000063B5 , +0x036 ,0x0000E3B5 , +0x036 ,0x000163B5 , +0x036 ,0x0001E3B5 , +0x036 ,0x000263B5 , +0x036 ,0x0002E3B5 , +0x036 ,0x000363B5 , +0x036 ,0x0003E3B5 , +0x036 ,0x000463B5 , +0x036 ,0x0004E3B5 , +0x036 ,0x000563B5 , +0x036 ,0x0005E3B5 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x036 ,0x00085733 ,0x036 ,0x0008D733 , 0x036, 0x00095733,
@@ -1711,7 +1831,7 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x036 ,0x000CE4B4 ,0x036 ,0x000D64B4 ,0x036 ,0x000DE4B4 , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x036 ,0x000056B3 ,0x036 ,0x0000D6B3 , 0x036, 0x000156B3,
@@ -1724,103 +1844,162 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x036 ,0x0004E7B4 ,0x036 ,0x000567B4 ,0x036 ,0x0005E7B4 , -0xFF0F0104 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x0EF ,0x00000000 ,0x0EF ,0x00000008 , -0xFF0F0104 ,0xABCD , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x000001C8 ,0x03C ,0x00000492 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x000001C8 ,0x03C ,0x00000492 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 , +0x03C ,0x000001B6 , +0x03C ,0x00000492 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x03C ,0x0000022A , +0x03C ,0x00000594 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x03C ,0x000001B6 , +0x03C ,0x00000492 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x000001C8 ,0x03C ,0x00000492 , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x03C ,0x0000022A ,0x03C ,0x00000594 , -0xFF0F0104 ,0xDEAD , -0xFF0F0104 ,0xABCD , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x00000800 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x00000800 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x00000800 , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 ,0x03C ,0x00000820 , -0xCDCDCDCD ,0xCDCD , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x03C ,0x00000820 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x03C ,0x00000800 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x03C ,0x00000800 , +0xA0000000 ,0x00000000 ,0x03C ,0x00000900 , -0xFF0F0104 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x0EF ,0x00000000 ,0x018 ,0x0001712A ,0x0EF ,0x00000002 , -0xFF0F0104 ,0xABCD , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x008 ,0x0004E400 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x008 ,0x0004E400 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 , +0x008 ,0x00002000 , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x008 ,0x00002000 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x008 ,0x00002000 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x008 ,0x00002000 , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x008 ,0x0004E400 , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x008 ,0x00002000 , -0xFF0F0104 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x0EF ,0x00000000 ,0x0DF ,0x000000C0 , -0x01F ,0x00040064 , -0xFF0F0104 ,0xABCD , +0x01F ,0x00000064 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x058 ,0x000A7284 ,0x059 ,0x000600EC , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x058 ,0x000A7284 ,0x059 ,0x000600EC , -0xFF0F0404 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x058 ,0x00081184 , +0x059 ,0x0006016C , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x058 ,0x00081184 , +0x059 ,0x0006016C , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x058 ,0x00081184 , +0x059 ,0x0006016C , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x058 ,0x000A7284 ,0x059 ,0x000600EC , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x058 ,0x00081184 ,0x059 ,0x0006016C , -0xFF0F0104 ,0xDEAD , -0xFF0F0104 ,0xABCD , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x061 ,0x000E8D73 ,0x062 ,0x00093FC5 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x061 ,0x000E8D73 ,0x062 ,0x00093FC5 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 , +0x061 ,0x000EFD83 , +0x062 ,0x00093FCC , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x061 ,0x000EAD53 , +0x062 ,0x00093BC4 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x061 ,0x000EFD83 , +0x062 ,0x00093FCC , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x061 ,0x000E8D73 ,0x062 ,0x00093FC5 , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x061 ,0x000EAD53 ,0x062 ,0x00093BC4 , -0xFF0F0104 ,0xDEAD , -0xFF0F0104 ,0xABCD , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 ,0x063 ,0x000110E9 , -0xFF0F0204 ,0xCDEF , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 ,0x063 ,0x000110E9 , -0xFF0F0404 ,0xCDEF , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 , +0x063 ,0x000110EB , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 ,0x063 ,0x000110E9 , -0xFF0F0200 ,0xCDEF , -0x063 ,0x000710E9 , -0xFF0F02C0 ,0xCDEF , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x063 ,0x000110E9 , -0xCDCDCDCD ,0xCDCD , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x063 ,0x000110EB , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 , +0x063 ,0x000110E9 , +0xA0000000 ,0x00000000 ,0x063 ,0x000714E9 , -0xFF0F0104 ,0xDEAD , -0xFF0F0104 ,0xABCD , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 , +0x064 ,0x0001C27C , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 , +0x064 ,0x0001C27C , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 ,0x064 ,0x0001C27C , -0xFF0F0204 ,0xCDEF , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x064 ,0x0001C67C , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 ,0x064 ,0x0001C27C , -0xFF0F0404 ,0xCDEF , +0x90000410 ,0x00000000 ,0x40000000 ,0x00000000 ,0x064 ,0x0001C27C , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x064 ,0x0001C67C , -0xFF0F0104 ,0xDEAD , -0xFF0F0200 ,0xABCD , +0xB0000000 ,0x00000000 , +0x80000111 ,0x00000000 ,0x40000000 ,0x00000000 , +0x065 ,0x00091016 , +0x90000110 ,0x00000000 ,0x40000000 ,0x00000000 , +0x065 ,0x00091016 , +0x90000210 ,0x00000000 ,0x40000000 ,0x00000000 ,0x065 ,0x00093016 , -0xFF0F02C0 ,0xCDEF , +0x9000020c ,0x00000000 ,0x40000000 ,0x00000000 ,0x065 ,0x00093015 , -0xCDCDCDCD ,0xCDCD , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 , +0x065 ,0x00093015 , +0x90000200 ,0x00000000 ,0x40000000 ,0x00000000 , +0x065 ,0x00093016 , +0xA0000000 ,0x00000000 ,0x065 ,0x00091016 , -0xFF0F0200 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x018 ,0x00000006 ,0x0EF ,0x00002000 , 0x03B, 0x0003824B,
@@ -1918,9 +2097,10 @@ u32 RTL8821AE_RADIOA_ARRAY[] = {0x0B4 ,0x0001214C ,0x0B7 ,0x0003000C ,0x01C ,0x000539D2 , +0x0C4 ,0x000AFE00 ,0x018 ,0x0001F12A , -0x0FE ,0x00000000 , -0x0FE ,0x00000000 , +0xFFE ,0x00000000 , +0xFFE ,0x00000000 , 0x018, 0x0001712A, };
@@ -2040,6 +2220,7 @@ u32 RTL8812AE_MAC_REG_ARRAY[] = {u32 RTL8812AE_MAC_1T_ARRAYLEN =ARRAY_SIZE (RTL8812AE_MAC_REG_ARRAY );u32 RTL8821AE_MAC_REG_ARRAY [] = { +0x421 ,0x0000000F ,0x428 ,0x0000000A ,0x429 ,0x00000010 ,0x430 ,0x00000000 ,
@@ -2508,7 +2689,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {0x81C ,0xA6360001 ,0x81C ,0xA5380001 ,0x81C ,0xA43A0001 , -0x81C ,0xA33C0001 , +0x81C ,0x683C0001 ,0x81C ,0x673E0001 ,0x81C ,0x66400001 , 0x81C, 0x65420001,
@@ -2542,7 +2723,66 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {0x81C ,0x017A0001 ,0x81C ,0x017C0001 ,0x81C ,0x017E0001 , -0xFF0F02C0 ,0xABCD , +0x8000020c ,0x00000000 ,0x40000000 ,0x00000000 , +0x81C ,0xFB000101 , +0x81C ,0xFA020101 , +0x81C ,0xF9040101 , +0x81C ,0xF8060101 , +0x81C ,0xF7080101 , +0x81C ,0xF60A0101 , +0x81C ,0xF50C0101 , +0x81C ,0xF40E0101 , +0x81C ,0xF3100101 , +0x81C ,0xF2120101 , +0x81C ,0xF1140101 , +0x81C ,0xF0160101 , +0x81C ,0xEF180101 , +0x81C ,0xEE1A0101 , +0x81C ,0xED1C0101 , +0x81C ,0xEC1E0101 , +0x81C ,0xEB200101 , +0x81C ,0xEA220101 , +0x81C ,0xE9240101 , +0x81C ,0xE8260101 , +0x81C ,0xE7280101 , +0x81C ,0xE62A0101 , +0x81C ,0xE52C0101 , +0x81C ,0xE42E0101 , +0x81C ,0xE3300101 , +0x81C ,0xA5320101 , +0x81C ,0xA4340101 , +0x81C ,0xA3360101 , +0x81C ,0x87380101 , +0x81C ,0x863A0101 , +0x81C ,0x853C0101 , +0x81C ,0x843E0101 , +0x81C ,0x69400101 , +0x81C ,0x68420101 , +0x81C ,0x67440101 , +0x81C ,0x66460101 , +0x81C ,0x49480101 , +0x81C ,0x484A0101 , +0x81C ,0x474C0101 , +0x81C ,0x2A4E0101 , +0x81C ,0x29500101 , +0x81C ,0x28520101 , +0x81C ,0x27540101 , +0x81C ,0x26560101 , +0x81C ,0x25580101 , +0x81C ,0x245A0101 , +0x81C ,0x235C0101 , +0x81C ,0x055E0101 , +0x81C ,0x04600101 , +0x81C ,0x03620101 , +0x81C ,0x02640101 , +0x81C ,0x01660101 , +0x81C ,0x01680101 , +0x81C ,0x016A0101 , +0x81C ,0x016C0101 , +0x81C ,0x016E0101 , +0x81C ,0x01700101 , +0x81C ,0x01720101 , +0x9000040c ,0x00000000 ,0x40000000 ,0x00000000 ,0x81C ,0xFB000101 ,0x81C ,0xFA020101 , 0x81C, 0xF9040101,
@@ -2601,7 +2841,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {0x81C ,0x016E0101 ,0x81C ,0x01700101 ,0x81C ,0x01720101 , -0xCDCDCDCD ,0xCDCD , +0xA0000000 ,0x00000000 ,0x81C ,0xFF000101 ,0x81C ,0xFF020101 , 0x81C, 0xFE040101,
@@ -2660,7 +2900,7 @@ u32 RTL8821AE_AGC_TAB_ARRAY[] = {0x81C ,0x046E0101 ,0x81C ,0x03700101 ,0x81C ,0x02720101 , -0xFF0F02C0 ,0xDEAD , +0xB0000000 ,0x00000000 ,0x81C ,0x01740101 ,0x81C ,0x01760101 , 0x81C, 0x01780101,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 276/425 i2c: sh7760: fix IRQ error path
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 92dfb27240fea2776f61c5422472cb6defca7767 ]
While adding the invalid IRQ check after calling platform_get_irq(), I managed to overlook that the driver has a complex error path in its probe() method, thus a simple *return* couldn't be used. Use a proper *goto* instead!
--- drivers/i2c/busses/i2c-sh7760.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-sh7760.c +1 -1
@@ -473,7 +473,7 @@ static int sh7760_i2c_probe(struct platform_device *pdev) ret =platform_get_irq (pdev,0 );if (ret <0 ) -return ret; + goto out3; id->irq = ret; id->adap.nr = pdev->id;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 277/425 mwl8k: Fix a double Free in mwl8k_probe_hw
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit a8e083ee8e2a6c94c29733835adae8bf5b832748 ]
In mwl8k_probe_hw, hw->priv->txq is freed at the first time by dma_free_coherent() in the call chain:
if(!priv->ap_fw)->mwl8k_init_txqs(hw)->mwl8k_txq_init(hw, i).
Then in err_free_queues of mwl8k_probe_hw, hw->priv->txq is freed at the second time by mwl8k_txq_deinit(hw, i)->dma_free_coherent().
My patch set txq->txd to NULL after the first free to avoid the double free.
--- drivers/net/wireless/marvell/mwl8k.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/marvell/mwl8k.c +1 -0
@@ -1469,6 +1469,7 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) txq->skb =kcalloc (MWL8K_TX_DESCS ,sizeof (*txq->skb),GFP_KERNEL );if (txq->skb ==NULL ) {pci_free_consistent (priv->pdev, size, txq->txd, txq->txd_dma); + txq->txd =NULL ;return -ENOMEM ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 278/425 vsock/vmci: log once the failed queue pair allocation
In reply to Greg Kroah-HartmanFrom: Stefano Garzarella <[email protected]>
[ Upstream commit e16edc99d658cd41c60a44cc14d170697aa3271f ]
VMCI feature is not supported in conjunction with the vSphere Fault Tolerance (FT) feature.
VMware Tools can repeatedly try to create a vsock connection. If FT is enabled the kernel logs is flooded with the following messages:
qp_alloc_hypercall result = -20
Could not attach to queue pair with -20
"qp_alloc_hypercall result = -20" was hidden by commit e8266c4c3307 ("VMCI: Stop log spew when qp allocation isn't possible"), but "Could not attach to queue pair with -20" is still there flooding the log.
Since the error message can be useful in some cases, print it only once.
--- net/vmw_vsock/vmci_transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/vmw_vsock/vmci_transport.c +1 -2
@@ -584,8 +584,7 @@ vmci_transport_queue_pair_alloc(struct vmci_qp **qpair, peer, flags, VMCI_NO_PRIVILEGE_FLAGS); out:if (err <0 ) { -pr_err ("Could not attach to queue pair with %d\n" , - err); +pr_err_once ("Could not attach to queue pair with %d\n" , err); err =vmci_transport_error_to_vsock_error (err); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 279/425 RDMA/i40iw: Fix error unwinding when i40iw_hmc_sd_one fails
In reply to Greg Kroah-HartmanFrom: Sindhu Devale <[email protected]>
[ Upstream commit 783a11bf2400e5d5c42a943c3083dc0330751842 ]
When i40iw_hmc_sd_one fails, chunk is freed without the deletion of chunk entry in the PBLE info list.
Fix it by adding the chunk entry to the PBLE info list only after successful addition of SD in i40iw_hmc_sd_one.
This fixes a static checker warning reported here:
https://lore.kernel.org/linux-rdma/YHV4CFXzqTm23AOZ@mwanda/
--- drivers/infiniband/hw/i40iw/i40iw_pble.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_pble.c +2 -4
@@ -392,12 +392,9 @@ static enum i40iw_status_code add_pble_pool(struct i40iw_sc_dev *dev,i40iw_debug (dev,I40IW_DEBUG_PBLE ,"next_fpm_addr = %llx chunk_size[%u] = 0x%x\n" , pble_rsrc->next_fpm_addr, chunk->size, chunk->size); pble_rsrc->unallocated_pble -= (chunk->size >>3 ); -list_add (&chunk->list, &pble_rsrc->pinfo.clist); sd_reg_val = (sd_entry_type ==I40IW_SD_TYPE_PAGED ) ? sd_entry->u.pd_table.pd_page_addr.pa : sd_entry->u.bp.addr.pa; -if (sd_entry->valid) -return 0 ; -if (dev->is_pf) { +if (dev->is_pf && !sd_entry->valid) { ret_code =i40iw_hmc_sd_one (dev, hmc_info->hmc_fn_id, sd_reg_val, idx->sd_idx, sd_entry->entry_type, true);
@@ -408,6 +405,7 @@ static enum i40iw_status_code add_pble_pool(struct i40iw_sc_dev *dev, } sd_entry->valid = true; +list_add (&chunk->list, &pble_rsrc->pinfo.clist);return 0 ; error:kfree (chunk);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 280/425 ALSA: usb: midi: dont return -ENOMEM when usb_urb_ep_type_check fails
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit cfd577acb769301b19c31361d45ae1f145318b7a ]
Currently when the call to usb_urb_ep_type_check fails (returning -EINVAL) the error return path returns -ENOMEM via the exit label "error". Other uses of the same error exit label set the err variable to -ENOMEM but this is not being used. I believe the original intent was for the error exit path to return the value in err rather than the hard coded -ENOMEM, so return this rather than the hard coded -ENOMEM.
Addresses-Coverity: ("Unused value")
--- sound/usb/midi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/midi.c +1 -1
@@ -1333,7 +1333,7 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi *umidi, error:snd_usbmidi_in_endpoint_delete (ep); -return -ENOMEM ; +return err; }/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 281/425 net: davinci_emac: Fix incorrect masking of tx and rx error channel
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit d83b8aa5207d81f9f6daec9888390f079cc5db3f ]
The bit-masks used for the TXERRCH and RXERRCH (tx and rx error channels) are incorrect and always lead to a zero result. The mask values are currently the incorrect post-right shifted values, fix this by setting them to the currect values.
(I double checked these against the TMS320TCI6482 data sheet, section 5.30, page 127 to ensure I had the correct mask values for the TXERRCH and RXERRCH fields in the MACSTATUS register).
Addresses-Coverity: ("Operands don't affect result")
--- drivers/net/ethernet/ti/davinci_emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +2 -2
@@ -183,11 +183,11 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1";/* EMAC mac_status register */ #define EMAC_MACSTATUS_TXERRCODE_MASK (0xF00000)#define EMAC_MACSTATUS_TXERRCODE_SHIFT (20) -#define EMAC_MACSTATUS_TXERRCH_MASK (0x7) +#define EMAC_MACSTATUS_TXERRCH_MASK (0x70000)#define EMAC_MACSTATUS_TXERRCH_SHIFT (16)#define EMAC_MACSTATUS_RXERRCODE_MASK (0xF000)#define EMAC_MACSTATUS_RXERRCODE_SHIFT (12) -#define EMAC_MACSTATUS_RXERRCH_MASK (0x7) +#define EMAC_MACSTATUS_RXERRCH_MASK (0x700)#define EMAC_MACSTATUS_RXERRCH_SHIFT (8)/* EMAC RX register masks */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 282/425 ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 7dd9a40fd6e0d0f1fd8e1931c007e080801dfdce ]
When the error check in ath9k_hw_read_revisions() was added, it checked for -EIO which is what ath9k_regread() in the ath9k_htc driver uses. However, for plain ath9k, the register read function uses ioread32(), which just returns -1 on error. So if such a read fails, it still gets passed through and ends up as a weird mac revision in the log output.
Fix this by changing ath9k_regread() to return -1 on error like ioread32() does, and fix the error check to look for that instead of -EIO.
--- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 +- drivers/net/wireless/ath/ath9k/hw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +1 -1
@@ -246,7 +246,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)if (unlikely (r)) {ath_dbg (common,WMI ,"REGISTER READ FAILED: (0x%04x, %d)\n" , reg_offset, r); -return -EIO ; +return -1 ; }return be32_to_cpu (val);
drivers/net/wireless/ath/ath9k/hw.c +1 -1
@@ -287,7 +287,7 @@ static bool ath9k_hw_read_revisions(struct ath_hw *ah) srev =REG_READ (ah,AR_SREV ); -if (srev == -EIO ) { +if (srev ==-1 ) {ath_err (ath9k_hw_common (ah),"Failed to read SREV register" );return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 283/425 ath10k: Fix ath10k_wmi_tlv_op_pull_peer_stats_info() unlock without lock
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
[ Upstream commit eaaf52e4b866f265eb791897d622961293fd48c1 ]
ath10k_wmi_tlv_op_pull_peer_stats_info() could try to unlock RCU lock winthout locking it first when peer reason doesn't match the valid cases for this function.
Add a default case to return without unlocking.
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +3 -0
@@ -465,6 +465,9 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb)GFP_ATOMIC );break ; +default : +kfree (tb); +return ; } exit:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 284/425 powerpc/52xx: Fix an invalid ASM expression (addi used instead of add)
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 8a87a507714386efc39c3ae6fa24d4f79846b522 ]
AS arch/powerpc/platforms/52xx/lite5200_sleep.oarch/powerpc/platforms/52xx/lite5200_sleep.S: Assembler messages:arch/powerpc/platforms/52xx/lite5200_sleep.S:184: Warning: invalid register expression
In the following code, 'addi' is wrong, has to be 'add'
/* local udelay in sram is needed */ udelay: /* r11 - tb_ticks_per_usec, r12 - usecs, overwrites r13 */ mullw r12, r12, r11 mftb r13 /* start */ addi r12, r13, r12 /* end */
--- arch/powerpc/platforms/52xx/lite5200_sleep.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/52xx/lite5200_sleep.S +1 -1
@@ -181,7 +181,7 @@ sram_code: udelay: /* r11 - tb_ticks_per_usec, r12 - usecs, overwrites r13 */ mullw r12, r12, r11 mftb r13 /* start */ - addi r12, r13, r12 /* end */ + add r12, r13, r12 /* end */ 1: mftb r13 /* current */ cmp cr0, r13, r12
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 285/425 bnxt_en: fix ternary sign extension bug in bnxt_show_temp()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 27537929f30d3136a71ef29db56127a33c92dad7 ]
The problem is that bnxt_show_temp() returns long but "rc" is an int and "len" is a u32. With ternary operations the type promotion is quite tricky. The negative "rc" is first promoted to u32 and then to long so it ends up being a high positive value instead of a a negative as we intended.
Fix this by removing the ternary.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -1
@@ -6851,7 +6851,9 @@ static ssize_t bnxt_show_temp(struct device *dev,if (!rc) len =sprintf (buf,"%u\n" , resp->temp *1000 );/* display millidegree */ mutex_unlock (&bp->hwrm_cmd_lock); -return rc ?: len; +if (rc) +return rc; +return len; } static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 286/425 ARM: dts: uniphier: Change phy-mode to RGMII-ID to enable delay pins for RTL8211E
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit 9ba585cc5b56ea14a453ba6be9bdb984ed33471a ]
UniPhier PXs2 boards have RTL8211E ethernet phy, and the phy have the RX/TX delays of RGMII interface using pull-ups on the RXDLY and TXDLY pins.
After the commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx delay config"), the delays are working correctly, however, "rgmii" means no delay and the phy doesn't work. So need to set the phy-mode to "rgmii-id" to show that RX/TX delays are enabled.
--- arch/arm/boot/dts/uniphier-pxs2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/uniphier-pxs2.dtsi +1 -1
@@ -513,7 +513,7 @@ clocks = <&sys_clk 6>; reset-names = "ether"; resets = <&sys_rst 6>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; local-mac-address = [00 00 00 00 00 00]; socionext,syscon-phy-mode = <&soc_glue 0>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 287/425 arm64: dts: uniphier: Change phy-mode to RGMII-ID to enable delay pins for RTL8211E
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit dcabb06bf127b3e0d3fbc94a2b65dd56c2725851 ]
UniPhier LD20 and PXs3 boards have RTL8211E ethernet phy, and the phy have the RX/TX delays of RGMII interface using pull-ups on the RXDLY and TXDLY pins.
After the commit bbc4d71d6354 ("net: phy: realtek: fix rtl8211e rx/tx delay config"), the delays are working correctly, however, "rgmii" means no delay and the phy doesn't work. So need to set the phy-mode to "rgmii-id" to show that RX/TX delays are enabled.
--- arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi | 2 +- arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi +1 -1
@@ -610,7 +610,7 @@ clocks = <&sys_clk 6>; reset-names = "ether"; resets = <&sys_rst 6>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; local-mac-address = [00 00 00 00 00 00]; socionext,syscon-phy-mode = <&soc_glue 0>;
arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi +2 -2
@@ -416,7 +416,7 @@ clocks = <&sys_clk 6>; reset-names = "ether"; resets = <&sys_rst 6>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; local-mac-address = [00 00 00 00 00 00]; socionext,syscon-phy-mode = <&soc_glue 0>;
@@ -437,7 +437,7 @@ clocks = <&sys_clk 7>; reset-names = "ether"; resets = <&sys_rst 7>; - phy-mode = "rgmii"; + phy-mode = "rgmii-id"; local-mac-address = [00 00 00 00 00 00]; socionext,syscon-phy-mode = <&soc_glue 1>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 288/425 net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
In reply to Greg Kroah-HartmanFrom: Phillip Potter <[email protected]>
[ Upstream commit d13f048dd40e8577260cd43faea8ec9b77520197 ]
Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes two kernel selftest failures introduced by the commit introducing the checks:
IPv4 over geneve6: PMTU exceptions
IPv4 over geneve6: PMTU exceptions - nexthop objects
It does this by correctly accounting for the fact that IPv4 packets may transit over geneve IPv6 tunnels (and vice versa), and still fixes the uninit-value bug fixed by the original commit.
--- drivers/net/geneve.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/geneve.c +2 -2
@@ -839,7 +839,7 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,__be16 df;int err; -if (!pskb_network_may_pull (skb,sizeof (struct iphdr ))) +if (!pskb_inet_may_pull (skb))return -EINVAL ; sport =udp_flow_src_port (geneve->net, skb,1 ,USHRT_MAX , true);
@@ -885,7 +885,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,__be16 sport;int err; -if (!pskb_network_may_pull (skb,sizeof (struct ipv6hdr ))) +if (!pskb_inet_may_pull (skb))return -EINVAL ; sport =udp_flow_src_port (geneve->net, skb,1 ,USHRT_MAX , true);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 289/425 net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 6d72e7c767acbbdd44ebc7d89c6690b405b32b57 ]
In emac_mac_tx_buf_send, it calls emac_tx_fill_tpd(..,skb,..).
If some error happens in emac_tx_fill_tpd(), the skb will be freed via dev_kfree_skb(skb) in error branch of emac_tx_fill_tpd().
But the freed skb is still used via skb->len by netdev_sent_queue(,skb->len).
As i observed that emac_tx_fill_tpd() haven't modified the value of skb->len, thus my patch assigns skb->len to 'len' before the possible free and use 'len' instead of skb->len later.
--- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/emac/emac-mac.c +3 -1
@@ -1449,6 +1449,7 @@ int emac_mac_tx_buf_send(struct emac_adapter *adpt, struct emac_tx_queue *tx_q, {struct emac_tpd tpd;u32 prod_idx; +int len;memset (&tpd,0 ,sizeof (tpd));
@@ -1468,9 +1469,10 @@ int emac_mac_tx_buf_send(struct emac_adapter *adpt, struct emac_tx_queue *tx_q,if (skb_network_offset (skb) !=ETH_HLEN )TPD_TYP_SET (&tpd,1 ); + len = skb->len;emac_tx_fill_tpd (adpt, tx_q, skb, &tpd); -netdev_sent_queue (adpt->netdev, skb->len); +netdev_sent_queue (adpt->netdev, len);/* Make sure the are enough free descriptors to hold one * maximum-sized SKB. We need one desc for each fragment,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 290/425 RDMA/bnxt_re: Fix a double free in bnxt_qplib_alloc_res
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 34b39efa5ae82fc0ad0acc27653c12a56328dbbe ]
In bnxt_qplib_alloc_res, it calls bnxt_qplib_alloc_dpi_tbl(). Inside bnxt_qplib_alloc_dpi_tbl, dpit->dbr_bar_reg_iomem is freed via pci_iounmap() in unmap_io error branch. After the callee returns err code, bnxt_qplib_alloc_res calls bnxt_qplib_free_res()->bnxt_qplib_free_dpi_tbl() in the fail branch. Then dpit->dbr_bar_reg_iomem is freed in the second time by pci_iounmap().
My patch set dpit->dbr_bar_reg_iomem to NULL after it is freed by pci_iounmap() in the first time, to avoid the double free.
--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/qplib_res.c +1 -0
@@ -725,6 +725,7 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res, unmap_io:pci_iounmap (res->pdev, dpit->dbr_bar_reg_iomem); + dpit->dbr_bar_reg_iomem =NULL ;return -ENOMEM ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 291/425 net:nfc:digital: Fix a double free in digital_tg_recv_dep_req
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 75258586793efc521e5dd52a5bf6c7a4cf7002be ]
In digital_tg_recv_dep_req, it calls nfc_tm_data_received(..,resp). If nfc_tm_data_received() failed, the callee will free the resp via kfree_skb() and return error. But in the exit branch, the resp will be freed again.
My patch sets resp to NULL if nfc_tm_data_received() failed, to avoid the double free.
--- net/nfc/digital_dep.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/digital_dep.c +2 -0
@@ -1285,6 +1285,8 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, } rc =nfc_tm_data_received (ddev->nfc_dev, resp); +if (rc) + resp =NULL ; exit:kfree_skb (ddev->chaining_skb);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 292/425 kfifo: fix ternary sign extension bugs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 926ee00ea24320052b46745ef4b00d91c05bd03d ]
The intent with this code was to return negative error codes but instead it returns positives.
The problem is how type promotion works with ternary operations. These functions return long, "ret" is an int and "copied" is a u32. The negative error code is first cast to u32 so it becomes a high positive and then cast to long where it's still a positive.
We could fix this by declaring "ret" as a ssize_t but let's just get rid of the ternaries instead.
--- samples/kfifo/bytestream-example.c | 8 ++++++-- samples/kfifo/inttype-example.c | 8 ++++++-- samples/kfifo/record-example.c | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-)
samples/kfifo/bytestream-example.c +6 -2
@@ -124,8 +124,10 @@ static ssize_t fifo_write(struct file *file, const char __user *buf, ret =kfifo_from_user (&test, buf, count, &copied);mutex_unlock (&write_lock); +if (ret) +return ret; -return ret ? ret : copied; +return copied; } static ssize_t fifo_read(struct file *file, char __user *buf,
@@ -140,8 +142,10 @@ static ssize_t fifo_read(struct file *file, char __user *buf, ret =kfifo_to_user (&test, buf, count, &copied);mutex_unlock (&read_lock); +if (ret) +return ret; -return ret ? ret : copied; +return copied; }static const struct file_operations fifo_fops = {
samples/kfifo/inttype-example.c +6 -2
@@ -117,8 +117,10 @@ static ssize_t fifo_write(struct file *file, const char __user *buf, ret =kfifo_from_user (&test, buf, count, &copied);mutex_unlock (&write_lock); +if (ret) +return ret; -return ret ? ret : copied; +return copied; } static ssize_t fifo_read(struct file *file, char __user *buf,
@@ -133,8 +135,10 @@ static ssize_t fifo_read(struct file *file, char __user *buf, ret =kfifo_to_user (&test, buf, count, &copied);mutex_unlock (&read_lock); +if (ret) +return ret; -return ret ? ret : copied; +return copied; }static const struct file_operations fifo_fops = {
samples/kfifo/record-example.c +6 -2
@@ -131,8 +131,10 @@ static ssize_t fifo_write(struct file *file, const char __user *buf, ret =kfifo_from_user (&test, buf, count, &copied);mutex_unlock (&write_lock); +if (ret) +return ret; -return ret ? ret : copied; +return copied; } static ssize_t fifo_read(struct file *file, char __user *buf,
@@ -147,8 +149,10 @@ static ssize_t fifo_read(struct file *file, char __user *buf, ret =kfifo_to_user (&test, buf, count, &copied);mutex_unlock (&read_lock); +if (ret) +return ret; -return ret ? ret : copied; +return copied; }static const struct file_operations fifo_fops = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 293/425 mm/sparse: add the missing sparse_buffer_fini() in error branch
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 2284f47fe9fe2ed2ef619e5474e155cfeeebd569 ]
sparse_buffer_init() and sparse_buffer_fini() should appear in pair, or a WARN issue would be through the next time sparse_buffer_init() runs.
Add the missing sparse_buffer_fini() in error branch.
--- mm/sparse.c | 1 + 1 file changed, 1 insertion(+)
mm/sparse.c +1 -0
@@ -467,6 +467,7 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,pr_err ("%s: node[%d] memory map backing failed. Some memory will not be available." , __func__, nid); pnum_begin = pnum; +sparse_buffer_fini (); goto failed; }check_usemap_section_nr (nid, usemap);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 294/425 mm/memory-failure: unnecessary amount of unmapping
In reply to Greg Kroah-HartmanFrom: Jane Chu <[email protected]>
[ Upstream commit 4d75136be8bf3ae01b0bc3e725b2cdc921e103bd ]
It appears that unmap_mapping_range() actually takes a 'size' as its third argument rather than a location, the current calling fashion causes unnecessary amount of unmapping to occur.
--- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-failure.c +1 -1
@@ -1220,7 +1220,7 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags,* communicated in siginfo, see kill_proc() */ start = (page->index <<PAGE_SHIFT ) & ~(size -1 ); -unmap_mapping_range (page->mapping, start, start + size,0 ); +unmap_mapping_range (page->mapping, start, size,0 ); }kill_procs (&tokill, flags &MF_MUST_KILL , !unmap_success, pfn, flags); rc =0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 295/425 net: Only allow init netns to set default tcp cong to a restricted algo
In reply to Greg Kroah-HartmanFrom: Jonathon Reinhart <[email protected]>
commit 8d432592f30fcc34ef5a10aac4887b4897884493 upstream.
tcp_set_default_congestion_control() is netns-safe in that it writes to &net->ipv4.tcp_congestion_control, but it also sets ca->flags |= TCP_CONG_NON_RESTRICTED which is not namespaced. This has the unintended side-effect of changing the global net.ipv4.tcp_allowed_congestion_control sysctl, despite the fact that it is read-only: 97684f0970f6 ("net: Make tcp_allowed_congestion_control readonly in non-init netns")
Resolve this netns "leak" by only allowing the init netns to set the default algorithm to one that is restricted. This restriction could be removed if tcp_allowed_congestion_control were namespace-ified in the future.
This bug was uncovered with
https://github.com/JonathonReinhart/linux-netns-sysctl-verify
--- net/ipv4/tcp_cong.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/tcp_cong.c +4 -0
@@ -228,6 +228,10 @@ int tcp_set_default_congestion_control(s ret = -ENOENT ; }else if (!try_module_get (ca->owner)) { ret = -EBUSY ; + }else if (!net_eq (net, &init_net) && + !(ca->flags &TCP_CONG_NON_RESTRICTED )) { +/* Only init netns can set default to a restricted algorithm */ + ret = -EPERM ; }else { prev =xchg (&net->ipv4.tcp_congestion_control, ca);if (prev)
Greg Kroah-Hartman
maintainerPATCH 296/425 smp: Fix smp_call_function_single_async prototype
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 1139aeb1c521eb4a050920ce6c64c36c4f2a3ab7 upstream.
As of commit 966a967116e6 ("smp: Avoid using two cache lines for struct call_single_data"), the smp code prefers 32-byte aligned call_single_data objects for performance reasons, but the block layer includes an instance of this structure in the main 'struct request' that is more senstive to size than to performance here, see 4ccafe032005 ("block: unalign call_single_data in struct request").
The result is a violation of the calling conventions that clang correctly points out:
block/blk-mq.c:630:39: warning: passing 8-byte aligned argument to 32-byte aligned parameter 2 of 'smp_call_function_single_async' may result in an unaligned pointer access [-Walign-mismatch]
smp_call_function_single_async(cpu, &rq->csd);
It does seem that the usage of the call_single_data without cache line alignment should still be allowed by the smp code, so just change the function prototype so it accepts both, but leave the default alignment unchanged for the other users. This seems better to me than adding a local hack to shut up an otherwise correct warning in the caller.
--- include/linux/smp.h | 2 +- kernel/smp.c | 10 +++++----- kernel/up.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
include/linux/smp.h +1 -1
@@ -53,7 +53,7 @@ void on_each_cpu_cond(bool (*cond_func)( smp_call_func_t func, void *info, bool wait, gfp_t gfp_flags); -int smp_call_function_single_async (int cpu,call_single_data_t *csd); +int smp_call_function_single_async (int cpu,struct __call_single_data *csd);#ifdef CONFIG_SMP
kernel/smp.c +5 -5
@@ -103,12 +103,12 @@ void __init call_function_init(void)* previous function call. For multi-cpu calls its even more interesting * as we'll have to ensure no other cpu is observing our csd. */ -static __always_inline void csd_lock_wait(call_single_data_t *csd) +static __always_inline void csd_lock_wait(struct __call_single_data *csd) {smp_cond_load_acquire (&csd->flags, !(VAL &CSD_FLAG_LOCK )); } -static __always_inline void csd_lock(call_single_data_t *csd) +static __always_inline void csd_lock(struct __call_single_data *csd) {csd_lock_wait (csd); csd->flags |=CSD_FLAG_LOCK ;
@@ -121,7 +121,7 @@ static __always_inline void csd_lock(calsmp_wmb (); } -static __always_inline void csd_unlock(call_single_data_t *csd) +static __always_inline void csd_unlock(struct __call_single_data *csd) {WARN_ON (!(csd->flags &CSD_FLAG_LOCK ));
@@ -138,7 +138,7 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(cal* for execution on the given CPU. data must already have * ->func, ->info, and ->flags set. */ -static int generic_exec_single (int cpu,call_single_data_t *csd, +static int generic_exec_single (int cpu,struct __call_single_data *csd,smp_call_func_t func,void *info) {if (cpu ==smp_processor_id ()) {
@@ -323,7 +323,7 @@ EXPORT_SYMBOL(smp_call_function_single);* NOTE: Be careful, there is unfortunately no current debugging facility to * validate the correctness of this serialization. */ -int smp_call_function_single_async (int cpu,call_single_data_t *csd) +int smp_call_function_single_async (int cpu,struct __call_single_data *csd) {int err =0 ;
kernel/up.c +1 -1
@@ -23,7 +23,7 @@ int smp_call_function_single(int cpu, vo }EXPORT_SYMBOL (smp_call_function_single); -int smp_call_function_single_async (int cpu,call_single_data_t *csd) +int smp_call_function_single_async (int cpu,struct __call_single_data *csd) {unsigned long flags;
Greg Kroah-Hartman
maintainerPATCH 297/425 Revert "net/sctp: fix race condition in sctp_destroy_sock"
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
commit 01bfe5e8e428b475982a98a46cca5755726f3f7f upstream.
This reverts commit b166a20b07382b8bc1dcee2a448715c9c2c81b5b.
This one has to be reverted as it introduced a dead lock, as syzbot reported:
CPU0 CPU1
---- ----
lock(&net->sctp.addr_wq_lock);
lock(slock-AF_INET6);
lock(&net->sctp.addr_wq_lock); lock(slock-AF_INET6);
CPU0 is the thread of sctp_addr_wq_timeout_handler(), and CPU1 is that of sctp_close().
The original issue this commit fixed will be fixed in the next patch.
--- net/sctp/socket.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/sctp/socket.c +8 -5
@@ -1569,9 +1569,11 @@ static void sctp_close(struct sock *sk,/* Supposedly, no process has access to the socket, but * the net layers still may. +* Also, sctp_destroy_sock() needs to be called with addr_wq_lock +* held and that should be grabbed before socket lock. */ -local_bh_disable (); -bh_lock_sock (sk); +spin_lock_bh (&net->sctp.addr_wq_lock); +bh_lock_sock_nested (sk);/* Hold the sock, since sk_common_release() will put sock_put() * and we have just a little more cleanup.
@@ -1580,7 +1582,7 @@ static void sctp_close(struct sock *sk,sk_common_release (sk);bh_unlock_sock (sk); -local_bh_enable (); +spin_unlock_bh (&net->sctp.addr_wq_lock);sock_put (sk);
@@ -4774,6 +4776,9 @@ static int sctp_init_sock(struct sock *ssk_sockets_allocated_inc (sk);sock_prot_inuse_add (net, sk->sk_prot,1 ); +/* Nothing can fail after this block, otherwise +* sctp_destroy_sock() will be called without addr_wq_lock held +*/ if (net->sctp.default_auto_asconf) {spin_lock (&sock_net (sk)->sctp.addr_wq_lock); list_add_tail(&sp->auto_asconf_list,
@@ -4808,9 +4813,7 @@ static void sctp_destroy_sock(struct socif (sp->do_auto_asconf) { sp->do_auto_asconf =0 ; -spin_lock_bh (&sock_net (sk)->sctp.addr_wq_lock);list_del (&sp->auto_asconf_list); -spin_unlock_bh (&sock_net (sk)->sctp.addr_wq_lock); }sctp_endpoint_free (sp->ep);local_bh_disable ();
Greg Kroah-Hartman
maintainerPATCH 298/425 sctp: delay auto_asconf init until binding the first addr
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
commit 34e5b01186858b36c4d7c87e1a025071e8e2401f upstream.
As Or Cohen described:
If sctp_destroy_sock is called without sock_net(sk)->sctp.addr_wq_lock held and sp->do_auto_asconf is true, then an element is removed from the auto_asconf_splist without any proper locking.
This can happen in the following functions:
1. In sctp_accept, if sctp_sock_migrate fails.
2. In inet_create or inet6_create, if there is a bpf program attached to BPF_CGROUP_INET_SOCK_CREATE which denies creation of the sctp socket.
This patch is to fix it by moving the auto_asconf init out of sctp_init_sock(), by which inet_create()/inet6_create() won't need to operate it in sctp_destroy_sock() when calling sk_common_release().
It also makes more sense to do auto_asconf init while binding the first addr, as auto_asconf actually requires an ANY addr bind, see it in sctp_addr_wq_timeout_handler().
This addresses CVE-2021-23133.
--- net/sctp/socket.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
net/sctp/socket.c +17 -14
@@ -375,6 +375,18 @@ static struct sctp_af *sctp_sockaddr_af(return af; } +static void sctp_auto_asconf_init (struct sctp_sock *sp) +{ +struct net *net =sock_net (&sp->inet.sk); + +if (net->sctp.default_auto_asconf) { +spin_lock (&net->sctp.addr_wq_lock); +list_add_tail (&sp->auto_asconf_list, &net->sctp.auto_asconf_splist); +spin_unlock (&net->sctp.addr_wq_lock); + sp->do_auto_asconf =1 ; + } +} +/* Bind a local address either to an endpoint or to an association. */ static int sctp_do_bind (struct sock *sk,union sctp_addr *addr,int len) {
@@ -437,8 +449,10 @@ static int sctp_do_bind(struct sock *sk, }/* Refresh ephemeral port. */ -if (!bp->port) +if (!bp->port) { bp->port =inet_sk (sk)->inet_num; +sctp_auto_asconf_init (sp); + }/* Add the address to the bind address list. * Use GFP_ATOMIC since BHs will be disabled.
@@ -4776,19 +4790,6 @@ static int sctp_init_sock(struct sock *ssk_sockets_allocated_inc (sk);sock_prot_inuse_add (net, sk->sk_prot,1 ); -/* Nothing can fail after this block, otherwise -* sctp_destroy_sock() will be called without addr_wq_lock held -*/ -if (net->sctp.default_auto_asconf) { -spin_lock (&sock_net (sk)->sctp.addr_wq_lock); -list_add_tail (&sp->auto_asconf_list, - &net->sctp.auto_asconf_splist); - sp->do_auto_asconf =1 ; -spin_unlock (&sock_net (sk)->sctp.addr_wq_lock); - }else { - sp->do_auto_asconf =0 ; - } -local_bh_enable ();return 0 ;
@@ -8848,6 +8849,8 @@ static void sctp_sock_migrate(struct socsctp_bind_addr_dup (&newsp->ep->base.bind_addr, &oldsp->ep->base.bind_addr,GFP_KERNEL ); +sctp_auto_asconf_init (newsp); +/* Move any messages in the old socket's receive queue that are for the * peeled off association to the new socket's receive queue. */
Greg Kroah-Hartman
maintainerPATCH 299/425 Revert "of/fdt: Make sure no-map does not remove already reserved regions"
In reply to Greg Kroah-HartmanFrom: Quentin Perret <[email protected]>
This reverts commit 74f2678aab60c9915daa83e6e23d31a896932d9d. It is not really a fix, and the backport misses dependencies, which breaks existing platforms.
--- drivers/of/fdt.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/of/fdt.c +1 -9
@@ -1172,16 +1172,8 @@ int __init __weak early_init_dt_mark_hotint __init __weak early_init_dt_reserve_memory_arch (phys_addr_t base,phys_addr_t size,bool nomap) { -if (nomap) { -/* -* If the memory is already reserved (by another region), we -* should not allow it to be marked nomap. -*/ -if (memblock_is_region_reserved (base, size)) -return -EBUSY ; - +if (nomap)return memblock_mark_nomap (base, size); - }return memblock_reserve (base, size); }
Greg Kroah-Hartman
maintainerPATCH 300/425 Revert "fdt: Properly handle "no-map" field in the memory region"
In reply to Greg Kroah-HartmanFrom: Quentin Perret <[email protected]>
This reverts commit 03972d6b1bbac1620455589e0367f6f69ff7b2df. It is not really a fix, and the backport misses dependencies, which breaks existing platforms.
--- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/fdt.c +1 -1
@@ -1173,7 +1173,7 @@ int __init __weak early_init_dt_reserve_ phys_addr_t size, bool nomap) { if (nomap) - return memblock_mark_nomap(base, size); + return memblock_remove(base, size);return memblock_reserve (base, size); }
Greg Kroah-Hartman
maintainerPATCH 301/425 tpm: fix error return code in tpm2_get_cc_attrs_tbl()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
commit 1df83992d977355177810c2b711afc30546c81ce upstream.
If the total number of commands queried through TPM2_CAP_COMMANDS is different from that queried through TPM2_CC_GET_CAPABILITY, it indicates an unknown error. In this case, an appropriate error code -EFAULT should be returned. However, we currently do not explicitly assign this error code to 'rc'. As a result, 0 was incorrectly returned.
--- drivers/char/tpm/tpm2-cmd.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/tpm/tpm2-cmd.c +1 -0
@@ -960,6 +960,7 @@ static int tpm2_get_cc_attrs_tbl(structif (nr_commands !=be32_to_cpup ((__be32 *)&buf.data[TPM_HEADER_SIZE +5 ])) { + rc = -EFAULT ;tpm_buf_destroy (&buf); goto out; }
Greg Kroah-Hartman
maintainerPATCH 302/425 fs: dlm: fix debugfs dump
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 92c48950b43f4a767388cf87709d8687151a641f ]
This patch fixes the following message which randomly pops up during glocktop call:
seq_file: buggy .next function table_seq_next did not update position index
The issue is that seq_read_iter() in fs/seq_file.c also needs an increment of the index in an non next record case as well which this patch fixes otherwise seq_read_iter() will print out the above message.
--- fs/dlm/debug_fs.c | 1 + 1 file changed, 1 insertion(+)
fs/dlm/debug_fs.c +1 -0
@@ -544,6 +544,7 @@ static void *table_seq_next(struct seq_file *seq, void *iter_ptr, loff_t *pos)if (bucket >= ls->ls_rsbtbl_size) {kfree (ri); + ++*pos;return NULL ; } tree = toss ? &ls->ls_rsbtbl[bucket].toss : &ls->ls_rsbtbl[bucket].keep;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 303/425 tipc: convert dest nodes address to network order
In reply to Greg Kroah-HartmanFrom: Hoang Le <[email protected]>
[ Upstream commit 1980d37565061ab44bdc2f9e4da477d3b9752e81 ]
(struct tipc_link_info)->dest is in network order (__be32), so we must convert the value to network order before assigning. The problem detected by sparse:
net/tipc/netlink_compat.c:699:24: warning: incorrect type in assignment (different base types)net/tipc/netlink_compat.c:699:24: expected restricted __be32 [usertype] destnet/tipc/netlink_compat.c:699:24: got int
--- net/tipc/netlink_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/netlink_compat.c +1 -1
@@ -671,7 +671,7 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,if (err)return err; - link_info.dest =nla_get_flag (link[TIPC_NLA_LINK_DEST ]); + link_info.dest =htonl (nla_get_flag (link[TIPC_NLA_LINK_DEST ])); link_info.up =htonl (nla_get_flag (link[TIPC_NLA_LINK_UP ]));nla_strlcpy (link_info.str, link[TIPC_NLA_LINK_NAME ],TIPC_MAX_LINK_NAME );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 304/425 ASoC: Intel: bytcr_rt5640: Enable jack-detect support on Asus T100TAF
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit b7c7203a1f751348f35fc4bcb157572d303f7573 ]
The Asus T100TAF uses the same jack-detect settings as the T100TA, this has been confirmed on actual hardware.
Add these settings to the T100TAF quirks to enable jack-detect support on the T100TAF.
--- sound/soc/intel/boards/bytcr_rt5640.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +3 -0
@@ -473,6 +473,9 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100TAF"), }, .driver_data = (void *)(BYT_RT5640_IN1_MAP | + BYT_RT5640_JD_SRC_JD2_IN4N | + BYT_RT5640_OVCD_TH_2000UA | + BYT_RT5640_OVCD_SF_0P75 | BYT_RT5640_MONO_SPEAKER | BYT_RT5640_DIFF_MIC | BYT_RT5640_SSP0_AIF2 |
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 305/425 net: stmmac: Set FIFO sizes for ipq806x
In reply to Greg Kroah-HartmanFrom: Jonathan McDowell <[email protected]>
[ Upstream commit e127906b68b49ddb3ecba39ffa36a329c48197d3 ]
Commit eaf4fac47807 ("net: stmmac: Do not accept invalid MTU values") started using the TX FIFO size to verify what counts as a valid MTU request for the stmmac driver. This is unset for the ipq806x variant. Looking at older patches for this it seems the RX + TXs buffers can be up to 8k, so set appropriately.
(I sent this as an RFC patch in June last year, but received no replies. I've been running with this on my hardware (a MikroTik RB3011) since then with larger MTUs to support both the internal qca8k switch and VLANs with no problems. Without the patch it's impossible to set the larger MTU required to support this.)
--- drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +2 -0
@@ -351,6 +351,8 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) plat_dat->bsp_priv = gmac; plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed; plat_dat->multicast_filter_bins =0 ; + plat_dat->tx_fifo_size =8192 ; + plat_dat->rx_fifo_size =8192 ; err =stmmac_dvr_probe (&pdev->dev, plat_dat, &stmmac_res);if (err)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 306/425 i2c: bail out early when RDWR parameters are wrong
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 71581562ee36032d2d574a9b23ad4af6d6a64cf7 ]
The buggy parameters currently get caught later, but emit a noisy WARN. Userspace should not be able to trigger this, so add similar checks much earlier. Also avoids some unneeded code paths, of course. Apply kernel coding stlye to a comment while here.
--- drivers/i2c/i2c-dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/i2c/i2c-dev.c +7 -2
@@ -448,8 +448,13 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) sizeof(rdwr_arg)))return -EFAULT ; -/* Put an arbitrary limit on the number of messages that can -* be sent at once */ +if (!rdwr_arg.msgs || rdwr_arg.nmsgs ==0 ) +return -EINVAL ; + +/* +* Put an arbitrary limit on the number of messages that can +* be sent at once +*/ if (rdwr_arg.nmsgs >I2C_RDWR_IOCTL_MAX_MSGS )return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 307/425 ALSA: hdsp: dont disable if not enabled
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit 507cdb9adba006a7798c358456426e1aea3d9c4f ]
hdsp wants to disable a not enabled pci device, which makes kernel throw a warning. Make sure the device is enabled before calling disable.
[ 1.758292] snd_hdsp 0000:00:03.0: disabling already-disabled device [ 1.758327] WARNING: CPU: 0 PID: 180 at drivers/pci/pci.c:2146 pci_disable_device+0x91/0xb0 [ 1.766985] Call Trace: [ 1.767121] snd_hdsp_card_free+0x94/0xf0 [snd_hdsp] [ 1.767388] release_card_device+0x4b/0x80 [snd] [ 1.767639] device_release+0x3b/0xa0 [ 1.767838] kobject_put+0x94/0x1b0 [ 1.768027] put_device+0x13/0x20 [ 1.768207] snd_card_free+0x61/0x90 [snd] [ 1.768430] snd_hdsp_probe+0x524/0x5e0 [snd_hdsp]
--- sound/pci/rme9652/hdsp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/rme9652/hdsp.c +2 -1
@@ -5343,7 +5343,8 @@ static int snd_hdsp_free(struct hdsp *hdsp)if (hdsp->port)pci_release_regions (hdsp->pci); -pci_disable_device (hdsp->pci); +if (pci_is_enabled (hdsp->pci)) +pci_disable_device (hdsp->pci);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 308/425 ALSA: hdspm: dont disable if not enabled
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit 790f5719b85e12e10c41753b864e74249585ed08 ]
hdspm wants to disable a not enabled pci device, which makes kernel throw a warning. Make sure the device is enabled before calling disable.
[ 1.786391] snd_hdspm 0000:00:03.0: disabling already-disabled device [ 1.786400] WARNING: CPU: 0 PID: 182 at drivers/pci/pci.c:2146 pci_disable_device+0x91/0xb0 [ 1.795181] Call Trace: [ 1.795320] snd_hdspm_card_free+0x58/0xa0 [snd_hdspm] [ 1.795595] release_card_device+0x4b/0x80 [snd] [ 1.795860] device_release+0x3b/0xa0 [ 1.796072] kobject_put+0x94/0x1b0 [ 1.796260] put_device+0x13/0x20 [ 1.796438] snd_card_free+0x61/0x90 [snd] [ 1.796659] snd_hdspm_probe+0x97b/0x1440 [snd_hdspm]
--- sound/pci/rme9652/hdspm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/rme9652/hdspm.c +2 -1
@@ -6913,7 +6913,8 @@ static int snd_hdspm_free(struct hdspm * hdspm)if (hdspm->port)pci_release_regions (hdspm->pci); -pci_disable_device (hdspm->pci); +if (pci_is_enabled (hdspm->pci)) +pci_disable_device (hdspm->pci);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 309/425 ALSA: rme9652: dont disable if not enabled
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit f57a741874bb6995089020e97a1dcdf9b165dcbe ]
rme9652 wants to disable a not enabled pci device, which makes kernel throw a warning. Make sure the device is enabled before calling disable.
[ 1.751595] snd_rme9652 0000:00:03.0: disabling already-disabled device [ 1.751605] WARNING: CPU: 0 PID: 174 at drivers/pci/pci.c:2146 pci_disable_device+0x91/0xb0 [ 1.759968] Call Trace: [ 1.760145] snd_rme9652_card_free+0x76/0xa0 [snd_rme9652] [ 1.760434] release_card_device+0x4b/0x80 [snd] [ 1.760679] device_release+0x3b/0xa0 [ 1.760874] kobject_put+0x94/0x1b0 [ 1.761059] put_device+0x13/0x20 [ 1.761235] snd_card_free+0x61/0x90 [snd] [ 1.761454] snd_rme9652_probe+0x3be/0x700 [snd_rme9652]
--- sound/pci/rme9652/rme9652.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/rme9652/rme9652.c +2 -1
@@ -1761,7 +1761,8 @@ static int snd_rme9652_free(struct snd_rme9652 *rme9652)if (rme9652->port)pci_release_regions (rme9652->pci); -pci_disable_device (rme9652->pci); +if (pci_is_enabled (rme9652->pci)) +pci_disable_device (rme9652->pci);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 310/425 Bluetooth: Set CONF_NOT_COMPLETE as l2cap_chan default
In reply to Greg Kroah-HartmanFrom: Archie Pusaka <[email protected]>
[ Upstream commit 3a9d54b1947ecea8eea9a902c0b7eb58a98add8a ]
Currently l2cap_chan_set_defaults() reset chan->conf_state to zero. However, there is a flag CONF_NOT_COMPLETE which is set when creating the l2cap_chan. It is suggested that the flag should be cleared when l2cap_chan is ready, but when l2cap_chan_set_defaults() is called, l2cap_chan is not yet ready. Therefore, we must set this flag as the default.
Example crash call trace:
__dump_stack lib/dump_stack.c:15 [inline] dump_stack+0xc4/0x118 lib/dump_stack.c:56 panic+0x1c6/0x38b kernel/panic.c:117 __warn+0x170/0x1b9 kernel/panic.c:471 warn_slowpath_fmt+0xc7/0xf8 kernel/panic.c:494 debug_print_object+0x175/0x193 lib/debugobjects.c:260 debug_object_assert_init+0x171/0x1bf lib/debugobjects.c:614 debug_timer_assert_init kernel/time/timer.c:629 [inline] debug_assert_init kernel/time/timer.c:677 [inline] del_timer+0x7c/0x179 kernel/time/timer.c:1034 try_to_grab_pending+0x81/0x2e5 kernel/workqueue.c:1230 cancel_delayed_work+0x7c/0x1c4 kernel/workqueue.c:2929 l2cap_clear_timer+0x1e/0x41 include/net/bluetooth/l2cap.h:834 l2cap_chan_del+0x2d8/0x37e net/bluetooth/l2cap_core.c:640 l2cap_chan_close+0x532/0x5d8 net/bluetooth/l2cap_core.c:756 l2cap_sock_shutdown+0x806/0x969 net/bluetooth/l2cap_sock.c:1174 l2cap_sock_release+0x64/0x14d net/bluetooth/l2cap_sock.c:1217 __sock_release+0xda/0x217 net/socket.c:580 sock_close+0x1b/0x1f net/socket.c:1039 __fput+0x322/0x55c fs/file_table.c:208 ____fput+0x17/0x19 fs/file_table.c:244 task_work_run+0x19b/0x1d3 kernel/task_work.c:115 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0xe4c/0x204a kernel/exit.c:766 do_group_exit+0x291/0x291 kernel/exit.c:891 get_signal+0x749/0x1093 kernel/signal.c:2396 do_signal+0xa5/0xcdb arch/x86/kernel/signal.c:737 exit_to_usermode_loop arch/x86/entry/common.c:243 [inline] prepare_exit_to_usermode+0xed/0x235 arch/x86/entry/common.c:277 syscall_return_slowpath+0x3a7/0x3b3 arch/x86/entry/common.c:348 int_ret_from_sys_call+0x25/0xa3
--- net/bluetooth/l2cap_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/l2cap_core.c +2 -0
@@ -510,7 +510,9 @@ void l2cap_chan_set_defaults(struct l2cap_chan *chan) chan->flush_to =L2CAP_DEFAULT_FLUSH_TO ; chan->retrans_timeout =L2CAP_DEFAULT_RETRANS_TO ; chan->monitor_timeout =L2CAP_DEFAULT_MONITOR_TO ; + chan->conf_state =0 ; +set_bit (CONF_NOT_COMPLETE , &chan->conf_state);set_bit (FLAG_FORCE_ACTIVE , &chan->flags); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 311/425 Bluetooth: initialize skb_queue_head at l2cap_chan_create()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit be8597239379f0f53c9710dd6ab551bbf535bec6 ]
syzbot is hitting "INFO: trying to register non-static key." message [1], for "struct l2cap_chan"->tx_q.lock spinlock is not yet initialized when l2cap_chan_del() is called due to e.g. timeout.
Since "struct l2cap_chan"->lock mutex is initialized at l2cap_chan_create() immediately after "struct l2cap_chan" is allocated using kzalloc(), let's as well initialize "struct l2cap_chan"->{tx_q,srej_q}.lock spinlocks there.
[1] https://syzkaller.appspot.com/bug?extid=fadfba6a911f6bf71842
--- net/bluetooth/l2cap_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/l2cap_core.c +2 -0
@@ -445,6 +445,8 @@ struct l2cap_chan *l2cap_chan_create(void)if (!chan)return NULL ; +skb_queue_head_init (&chan->tx_q); +skb_queue_head_init (&chan->srej_q);mutex_init (&chan->lock);/* Set default lock nesting level */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 312/425 net: bridge: when suppression is enabled exclude RARP packets
In reply to Greg Kroah-HartmanFrom: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 0353b4a96b7a9f60fe20d1b3ebd4931a4085f91c ]
Recently we had an interop issue where RARP packets got suppressed with bridge neigh suppression enabled, but the check in the code was meant to suppress GARP. Exclude RARP packets from it which would allow some VMWare setups to work, to quote the report:
"Those RARP packets usually get generated by vMware to notify physical switches when vMotion occurs. vMware may use random sip/tip or just use sip=tip=0. So the RARP packet sometimes get properly flooded by the vtep and other times get dropped by the logic"
--- net/bridge/br_arp_nd_proxy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bridge/br_arp_nd_proxy.c +3 -1
@@ -158,7 +158,9 @@ void br_do_proxy_suppress_arp(struct sk_buff *skb, struct net_bridge *br,if (br->neigh_suppress_enabled) {if (p && (p->flags &BR_NEIGH_SUPPRESS ))return ; -if (ipv4_is_zeronet (sip) || sip == tip) { +if (parp->ar_op !=htons (ARPOP_RREQUEST ) && + parp->ar_op !=htons (ARPOP_RREPLY ) && + (ipv4_is_zeronet (sip) || sip == tip)) {/* prevent flooding to neigh suppress ports */ BR_INPUT_SKB_CB (skb)->proxyarp_replied = true;return ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 313/425 Bluetooth: check for zapped sk before connecting
In reply to Greg Kroah-HartmanFrom: Archie Pusaka <[email protected]>
[ Upstream commit 3af70b39fa2d415dc86c370e5b24ddb9fdacbd6f ]
There is a possibility of receiving a zapped sock on l2cap_sock_connect(). This could lead to interesting crashes, one such case is tearing down an already tore l2cap_sock as is happened with this call trace:
__dump_stack lib/dump_stack.c:15 [inline] dump_stack+0xc4/0x118 lib/dump_stack.c:56 register_lock_class kernel/locking/lockdep.c:792 [inline] register_lock_class+0x239/0x6f6 kernel/locking/lockdep.c:742 __lock_acquire+0x209/0x1e27 kernel/locking/lockdep.c:3105 lock_acquire+0x29c/0x2fb kernel/locking/lockdep.c:3599 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:137 [inline] _raw_spin_lock_bh+0x38/0x47 kernel/locking/spinlock.c:175 spin_lock_bh include/linux/spinlock.h:307 [inline] lock_sock_nested+0x44/0xfa net/core/sock.c:2518 l2cap_sock_teardown_cb+0x88/0x2fb net/bluetooth/l2cap_sock.c:1345 l2cap_chan_del+0xa3/0x383 net/bluetooth/l2cap_core.c:598 l2cap_chan_close+0x537/0x5dd net/bluetooth/l2cap_core.c:756 l2cap_chan_timeout+0x104/0x17e net/bluetooth/l2cap_core.c:429 process_one_work+0x7e3/0xcb0 kernel/workqueue.c:2064 worker_thread+0x5a5/0x773 kernel/workqueue.c:2196 kthread+0x291/0x2a6 kernel/kthread.c:211 ret_from_fork+0x4e/0x80 arch/x86/entry/entry_64.S:604
--- net/bluetooth/l2cap_sock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/bluetooth/l2cap_sock.c +8 -0
@@ -179,9 +179,17 @@ static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,struct l2cap_chan *chan =l2cap_pi (sk)->chan;struct sockaddr_l2 la;int len, err =0 ; +bool zapped;BT_DBG ("sk %p" , sk); +lock_sock (sk); + zapped =sock_flag (sk,SOCK_ZAPPED ); +release_sock (sk); + +if (zapped) +return -EINVAL ; + if (!addr || alen < offsetofend(struct sockaddr, sa_family) || addr->sa_family !=AF_BLUETOOTH )return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 314/425 ip6_vti: proper dev_{hold|put} in ndo_[un]init methods
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 40cb881b5aaa0b69a7d93dec8440d5c62dae299f ]
After adopting CONFIG_PCPU_DEV_REFCNT=n option, syzbot was able to trigger a warning [1]
Issue here is that:
- all dev_put() should be paired with a corresponding prior dev_hold().
- A driver doing a dev_put() in its ndo_uninit() MUST also do a dev_hold() in its ndo_init(), only when ndo_init() is returning 0.
Otherwise, register_netdevice() would call ndo_uninit() in its error path and release a refcount too soon.
Therefore, we need to move dev_hold() call fromvti6_tnl_create2() to vti6_dev_init_gen()
[1]
WARNING: CPU: 0 PID: 15951 at lib/refcount.c:31 refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31 Modules linked in: CPU: 0 PID: 15951 Comm: syz-executor.3 Not tainted 5.12.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0xbf/0x1e0 lib/refcount.c:31 Code: 1d 6a 5a e8 09 31 ff 89 de e8 8d 1a ab fd 84 db 75 e0 e8 d4 13 ab fd 48 c7 c7 a0 e1 c1 89 c6 05 4a 5a e8 09 01 e8 2e 36 fb 04 <0f> 0b eb c4 e8 b8 13 ab fd 0f b6 1d 39 5a e8 09 31 ff 89 de e8 58 RSP: 0018:ffffc90001eaef28 EFLAGS: 00010282 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000040000 RSI: ffffffff815c51f5 RDI: fffff520003d5dd7 RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff815bdf8e R11: 0000000000000000 R12: ffff88801bb1c568 R13: ffff88801f69e800 R14: 00000000ffffffff R15: ffff888050889d40 FS: 00007fc79314e700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f1c1ff47108 CR3: 0000000020fd5000 CR4: 00000000001506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __refcount_dec include/linux/refcount.h:344 [inline] refcount_dec include/linux/refcount.h:359 [inline] dev_put include/linux/netdevice.h:4135 [inline] vti6_dev_uninit+0x31a/0x360 net/ipv6/ip6_vti.c:297 register_netdevice+0xadf/0x1500 net/core/dev.c:10308 vti6_tnl_create2+0x1b5/0x400 net/ipv6/ip6_vti.c:190 vti6_newlink+0x9d/0xd0 net/ipv6/ip6_vti.c:1020 __rtnl_newlink+0x1062/0x1710 net/core/rtnetlink.c:3443 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3491 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:674 ____sys_sendmsg+0x331/0x810 net/socket.c:2350 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404 __sys_sendmmsg+0x195/0x470 net/socket.c:2490 __do_sys_sendmmsg net/socket.c:2519 [inline] __se_sys_sendmmsg net/socket.c:2516 [inline] __x64_sys_sendmmsg+0x99/0x100 net/socket.c:2516
--- net/ipv6/ip6_vti.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_vti.c +1 -1
@@ -196,7 +196,6 @@ static int vti6_tnl_create2(struct net_device *dev)strcpy (t->parms.name, dev->name); -dev_hold (dev);vti6_tnl_link (ip6n, t);return 0 ;
@@ -925,6 +924,7 @@ static inline int vti6_dev_init_gen(struct net_device *dev) dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);if (!dev->tstats)return -ENOMEM ; +dev_hold (dev);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 315/425 ASoC: Intel: bytcr_rt5640: Add quirk for the Chuwi Hi8 tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 875c40eadf6ac6644c0f71842a4f30dd9968d281 ]
The Chuwi Hi8 tablet is using an analog mic on IN1 and has its jack-detect connected to JD2_IN4N, instead of using the default IN3 for its internal mic and JD1_IN4P for jack-detect.
It also only has 1 speaker.
Add a quirk applying the correct settings for this configuration.
--- sound/soc/intel/boards/bytcr_rt5640.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +17 -0
@@ -509,6 +509,23 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF1 | BYT_RT5640_MCLK_EN), }, + { +/* Chuwi Hi8 (CWI509) */ + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Hampoo" ), +DMI_MATCH (DMI_BOARD_NAME ,"BYT-PA03C" ), +DMI_MATCH (DMI_SYS_VENDOR ,"ilife" ), + DMI_MATCH(DMI_PRODUCT_NAME, "S806"), + }, + .driver_data = (void *)(BYT_RT5640_IN1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_MONO_SPEAKER | +BYT_RT5640_DIFF_MIC | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 316/425 i2c: Add I2C_AQ_NO_REP_START adapter quirk
In reply to Greg Kroah-HartmanFrom: Bence Csókás <[email protected]>
[ Upstream commit aca01415e076aa96cca0f801f4420ee5c10c660d ]
This quirk signifies that the adapter cannot do a repeated START, it always issues a STOP condition after transfers.
--- include/linux/i2c.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/i2c.h +2 -0
@@ -662,6 +662,8 @@ struct i2c_adapter_quirks {#define I2C_AQ_NO_ZERO_LEN_READ BIT(5)#define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6)#define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE) +/* adapter cannot do repeated START */ +#define I2C_AQ_NO_REP_START BIT(7)/* * i2c_adapter is the structure used to identify a physical i2c bus along
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 317/425 mac80211: clear the beacons CRC after channel switch
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit d6843d1ee283137723b4a8c76244607ce6db1951 ]
After channel switch, we should consider any beacon with a CSA IE as a new switch. If the CSA IE is a leftover from before the switch that the AP forgot to remove, we'll get a CSA-to-Self.
This caused issues in iwlwifi where the firmware saw a beacon with a CSA-to-Self with mode = 1 on the new channel after a switch. The firmware considered this a new switch and closed its queues. Since the beacon didn't change between before and after the switch, we wouldn't handle it (the CRC is the same) and we wouldn't let the firmware open its queues again or disconnect if the CSA IE stays for too long.
Clear the CRC valid state after we switch to make sure that we handle the beacon and handle the CSA IE as required.
--- net/mac80211/mlme.c | 5 +++++ 1 file changed, 5 insertions(+)
net/mac80211/mlme.c +5 -0
@@ -1185,6 +1185,11 @@ static void ieee80211_chswitch_post_beacon(struct ieee80211_sub_if_data *sdata) sdata->vif.csa_active = false; ifmgd->csa_waiting_bcn = false; +/* +* If the CSA IE is still present on the beacon after the switch, +* we need to consider it as a new CSA (possibly to self). +*/ + ifmgd->beacon_crc_valid = false; ret =drv_post_channel_switch (sdata);if (ret) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 318/425 pinctrl: samsung: use int for register masks in Exynos
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit fa0c10a5f3a49130dd11281aa27e7e1c8654abc7 ]
The Special Function Registers on all Exynos SoC, including ARM64, are 32-bit wide, so entire driver uses matching functions like readl() or writel(). On 64-bit ARM using unsigned long for register masks:
1. makes little sense as immediately after bitwise operation it will be cast to 32-bit value when calling writel(),
2. is actually error-prone because it might promote other operands to 64-bit.
Addresses-Coverity: Unintentional integer overflow
--- drivers/pinctrl/samsung/pinctrl-exynos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pinctrl/samsung/pinctrl-exynos.c +5 -5
@@ -55,7 +55,7 @@ static void exynos_irq_mask(struct irq_data *irqd)struct exynos_irq_chip *our_chip =to_exynos_irq_chip (chip);struct samsung_pin_bank *bank =irq_data_get_irq_chip_data (irqd);unsigned long reg_mask = our_chip->eint_mask + bank->eint_offset; -unsigned long mask; +unsigned int mask;unsigned long flags;spin_lock_irqsave (&bank->slock, flags);
@@ -83,7 +83,7 @@ static void exynos_irq_unmask(struct irq_data *irqd)struct exynos_irq_chip *our_chip =to_exynos_irq_chip (chip);struct samsung_pin_bank *bank =irq_data_get_irq_chip_data (irqd);unsigned long reg_mask = our_chip->eint_mask + bank->eint_offset; -unsigned long mask; +unsigned int mask;unsigned long flags;/*
@@ -482,7 +482,7 @@ static void exynos_irq_eint0_15(struct irq_desc *desc)chained_irq_exit (chip, desc); } -static inline void exynos_irq_demux_eint (unsigned long pend, +static inline void exynos_irq_demux_eint (unsigned int pend,struct irq_domain *domain) {unsigned int irq;
@@ -499,8 +499,8 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc);struct exynos_muxed_weint_data *eintd =irq_desc_get_handler_data (desc); -unsigned long pend; -unsigned long mask; +unsigned int pend; +unsigned int mask;int i;chained_irq_enter (chip, desc);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 319/425 cuse: prevent clone
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
[ Upstream commit 8217673d07256b22881127bf50dce874d0e51653 ]
For cloned connections cuse_channel_release() will be called more than once, resulting in use after free.
Prevent device cloning for CUSE, which does not make sense at this point, and highly unlikely to be used in real life.
--- fs/fuse/cuse.c | 2 ++ 1 file changed, 2 insertions(+)
fs/fuse/cuse.c +2 -0
@@ -621,6 +621,8 @@ static int __init cuse_init(void) cuse_channel_fops.owner =THIS_MODULE ; cuse_channel_fops.open = cuse_channel_open; cuse_channel_fops.release = cuse_channel_release; +/* CUSE is not prepared for FUSE_DEV_IOC_CLONE */ + cuse_channel_fops.unlocked_ioctl =NULL ; cuse_class =class_create (THIS_MODULE ,"cuse" );if (IS_ERR (cuse_class))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 320/425 selftests: Set CC to clang in lib.mk if LLVM is set
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 26e6dd1072763cd5696b75994c03982dde952ad9 ]
selftests/bpf/Makefile includes lib.mk. With the following command
make -j60 LLVM=1 LLVM_IAS=1 <=== compile kernel
make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1 V=1
some files are still compiled with gcc. This patch fixed lib.mk issue which sets CC to gcc in all cases.
--- tools/testing/selftests/lib.mk | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/lib.mk +4 -0
@@ -1,6 +1,10 @@ # This mimics the top-level Makefile. We do it explicitly here so that this # Makefile can operate with or without the kbuild infrastructure. +ifneq ($(LLVM),) +CC := clang +else CC := $(CROSS_COMPILE)gcc +endif ifeq (0,$(MAKELEVEL)) OUTPUT := $(shell pwd)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 321/425 kconfig: nconf: stop endless search loops
In reply to Greg Kroah-HartmanFrom: Mihai Moldovan <[email protected]>
[ Upstream commit 8c94b430b9f6213dec84e309bb480a71778c4213 ]
If the user selects the very first entry in a page and performs a search-up operation, or selects the very last entry in a page and performs a search-down operation that will not succeed (e.g., via [/]asdfzzz[Up Arrow]), nconf will never terminate searching the page.
The reason is that in this case, the starting point will be set to -1 or n, which is then translated into (n - 1) (i.e., the last entry of the page) or 0 (i.e., the first entry of the page) and finally the search begins. This continues to work fine until the index reaches 0 or (n - 1), at which point it will be decremented to -1 or incremented to n, but not checked against the starting point right away. Instead, it's wrapped around to the bottom or top again, after which the starting point check occurs... and naturally fails.
My original implementation added another check for -1 before wrapping the running index variable around, but Masahiro Yamada pointed out that the actual issue is that the comparison point (starting point) exceeds bounds (i.e., the [0,n-1] interval) in the first place and that, instead, the starting point should be fixed.
This has the welcome side-effect of also fixing the case where the starting point was n while searching down, which also lead to an infinite loop.
OTOH, this code is now essentially all his work.
Amazingly, nobody seems to have been hit by this for 11 years - or at the very least nobody bothered to debug and fix this.
--- scripts/kconfig/nconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/nconf.c +1 -1
@@ -504,8 +504,8 @@ static int get_mext_match(const char *match_str, match_f flag)else if (flag ==FIND_NEXT_MATCH_UP ) --match_start; + match_start = (match_start + items_num) % items_num; index = match_start; - index = (index + items_num) % items_num;while (true) {char *str = k_menu_items[index].str;if (strcasestr (str, match_str) !=NULL )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 322/425 sctp: Fix out-of-bounds warning in sctp_process_asconf_param()
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit e5272ad4aab347dde5610c0aedb786219e3ff793 ]
Fix the following out-of-bounds warning:
net/sctp/sm_make_chunk.c:3150:4: warning: 'memcpy' offset [17, 28] from the object at 'addr' is out of the bounds of referenced subobject 'v4' with type 'struct sockaddr_in' at offset 0 [-Warray-bounds]
This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy().
--- net/sctp/sm_make_chunk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/sm_make_chunk.c +1 -1
@@ -3148,7 +3148,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,* primary. */ if (af->is_any (&addr)) -memcpy (&addr.v4,sctp_source (asconf),sizeof (addr)); +memcpy (&addr,sctp_source (asconf),sizeof (addr)); if (security_sctp_bind_connect(asoc->ep->base.sk, SCTP_PARAM_SET_PRIMARY,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 323/425 powerpc/smp: Set numa node before updating mask
In reply to Greg Kroah-HartmanFrom: Srikar Dronamraju <[email protected]>
[ Upstream commit 6980d13f0dd189846887bbbfa43793d9a41768d3 ]
Geethika reported a trace when doing a dlpar CPU add.
------------[ cut here ]------------ WARNING: CPU: 152 PID: 1134 at kernel/sched/topology.c:2057 CPU: 152 PID: 1134 Comm: kworker/152:1 Not tainted 5.12.0-rc5-master #5 Workqueue: events cpuset_hotplug_workfn NIP: c0000000001cfc14 LR: c0000000001cfc10 CTR: c0000000007e3420 REGS: c0000034a08eb260 TRAP: 0700 Not tainted (5.12.0-rc5-master+) MSR: 8000000000029033 <SF,EE,ME,IR,DR,RI,LE> CR: 28828422 XER: 00000020
CFAR: c0000000001fd888 IRQMASK: 0 #012GPR00: c0000000001cfc10 c0000034a08eb500 c000000001f35400 0000000000000027 #012GPR04:c0000035abaa8010 c0000035abb30a00 0000000000000027 c0000035abaa8018 #012GPR08: 0000000000000023 c0000035abaaef48 00000035aa540000 c0000035a49dffe8 #012GPR12: 0000000028828424 c0000035bf1a1c80 0000000000000497 0000000000000004 #012GPR16: c00000000347a258 0000000000000140 c00000000203d468 c000000001a1a490 #012GPR20:c000000001f9c160 c0000034adf70920 c0000034aec9fd20 0000000100087bd3 #012GPR24: 0000000100087bd3 c0000035b3de09f8 0000000000000030 c0000035b3de09f8 #012GPR28: 0000000000000028 c00000000347a280 c0000034aefe0b00 c0000000010a2a68
NIP [c0000000001cfc14] build_sched_domains+0x6a4/0x1500 LR [c0000000001cfc10] build_sched_domains+0x6a0/0x1500
Call Trace: [c0000034a08eb500] [c0000000001cfc10] build_sched_domains+0x6a0/0x1500 (unreliable) [c0000034a08eb640] [c0000000001d1e6c] partition_sched_domains_locked+0x3ec/0x530 [c0000034a08eb6e0] [c0000000002936d4] rebuild_sched_domains_locked+0x524/0xbf0 [c0000034a08eb7e0] [c000000000296bb0] rebuild_sched_domains+0x40/0x70 [c0000034a08eb810] [c000000000296e74] cpuset_hotplug_workfn+0x294/0xe20 [c0000034a08ebc30] [c000000000178dd0] process_one_work+0x300/0x670 [c0000034a08ebd10] [c0000000001791b8] worker_thread+0x78/0x520 [c0000034a08ebda0] [c000000000185090] kthread+0x1a0/0x1b0 [c0000034a08ebe10] [c00000000000ccec] ret_from_kernel_thread+0x5c/0x70 Instruction dump: 7d2903a6 4e800421 e8410018 7f67db78 7fe6fb78 7f45d378 7f84e378 7c681b78 3c62ff1a 3863c6f8 4802dc35 60000000 <0fe00000> 3920fff4 f9210070 e86100a0 ---[ end trace 532d9066d3d4d7ec ]---
Some of the per-CPU masks use cpu_cpu_mask as a filter to limit the search for related CPUs. On a dlpar add of a CPU, update cpu_cpu_mask before updating the per-CPU masks. This will ensure the cpu_cpu_mask is updated correctly before its used in setting the masks. Setting the numa_node will ensure that when cpu_cpu_mask() gets called, the correct node number is used. This code movement helped fix the above call trace.
--- arch/powerpc/kernel/smp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/smp.c +3 -3
@@ -1032,6 +1032,9 @@ void start_secondary(void *unused)vdso_getcpu_init ();#endif +set_numa_node (numa_cpu_lookup_table[cpu]); +set_numa_mem (local_memory_node (numa_cpu_lookup_table[cpu])); +/* Update topology CPU masks */ add_cpu_to_masks (cpu);
@@ -1042,9 +1045,6 @@ void start_secondary(void *unused)if (!cpumask_equal (cpu_l2_cache_mask (cpu),cpu_sibling_mask (cpu))) shared_caches = true; -set_numa_node (numa_cpu_lookup_table[cpu]); -set_numa_mem (local_memory_node (numa_cpu_lookup_table[cpu])); -smp_wmb ();notify_cpu_starting (cpu);set_cpu_online (cpu, true);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 324/425 ASoC: rt286: Generalize support for ALC3263 codec
In reply to Greg Kroah-HartmanFrom: David Ward <[email protected]>
[ Upstream commit aa2f9c12821e6a4ba1df4fb34a3dbc6a2a1ee7fe ]
The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350 and Venue 11 Pro 7140. They require the same handling for the combo jack to work with a headset: GPIO pin 6 must be set.
The HDA driver always sets this pin on the ALC3263, which it distinguishes by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028 (Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to determine if Dell is the system vendor.
--- sound/soc/codecs/rt286.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
sound/soc/codecs/rt286.c +10 -10
@@ -1118,12 +1118,11 @@ static const struct dmi_system_id force_combo_jack_table[] = { { } }; -static const struct dmi_system_id dmi_dell_dino[] = { +static const struct dmi_system_id dmi_dell[] = { { - .ident ="Dell Dino" , + .ident ="Dell" , .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"Dell Inc." ), -DMI_MATCH (DMI_PRODUCT_NAME ,"XPS 13 9343" ) } }, { }
@@ -1134,7 +1133,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c, {struct rt286_platform_data *pdata =dev_get_platdata (&i2c->dev);struct rt286_priv *rt286; -int i, ret, val; +int i, ret, vendor_id; rt286 =devm_kzalloc (&i2c->dev,sizeof (*rt286),GFP_KERNEL );
@@ -1150,14 +1149,15 @@ static int rt286_i2c_probe(struct i2c_client *i2c, } ret =regmap_read (rt286->regmap, -RT286_GET_PARAM (AC_NODE_ROOT ,AC_PAR_VENDOR_ID ), &val); +RT286_GET_PARAM (AC_NODE_ROOT ,AC_PAR_VENDOR_ID ), &vendor_id);if (ret !=0 ) {dev_err (&i2c->dev,"I2C error %d\n" , ret);return ret; } -if (val !=RT286_VENDOR_ID && val !=RT288_VENDOR_ID ) { +if (vendor_id !=RT286_VENDOR_ID && vendor_id !=RT288_VENDOR_ID ) {dev_err (&i2c->dev, -"Device with ID register %#x is not rt286\n" , val); +"Device with ID register %#x is not rt286\n" , + vendor_id);return -ENODEV ; }
@@ -1181,8 +1181,8 @@ static int rt286_i2c_probe(struct i2c_client *i2c,if (pdata) rt286->pdata = *pdata; -if (dmi_check_system (force_combo_jack_table) || -dmi_check_system (dmi_dell_dino)) +if ((vendor_id ==RT288_VENDOR_ID &&dmi_check_system (dmi_dell)) || +dmi_check_system (force_combo_jack_table)) rt286->pdata.cbj_en = true;regmap_write (rt286->regmap,RT286_SET_AUDIO_POWER ,AC_PWRST_D3 );
@@ -1221,7 +1221,7 @@ static int rt286_i2c_probe(struct i2c_client *i2c,regmap_update_bits (rt286->regmap,RT286_DEPOP_CTRL3 ,0xf777 ,0x4737 );regmap_update_bits (rt286->regmap,RT286_DEPOP_CTRL4 ,0x00ff ,0x003f ); -if (dmi_check_system (dmi_dell_dino)) { +if (vendor_id ==RT288_VENDOR_ID &&dmi_check_system (dmi_dell)) {regmap_update_bits (rt286->regmap,RT286_SET_GPIO_MASK ,0x40 ,0x40 ); regmap_update_bits(rt286->regmap,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 325/425 ethtool: ioctl: Fix out-of-bounds warning in store_link_ksettings_for_user()
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit c1d9e34e11281a8ba1a1c54e4db554232a461488 ]
Fix the following out-of-bounds warning:
net/ethtool/ioctl.c:492:2: warning: 'memcpy' offset [49, 84] from the object at 'link_usettings' is out of the bounds of referenced subobject 'base' with type 'struct ethtool_link_settings' at offset 0 [-Warray-bounds]
The problem is that the original code is trying to copy data into a some struct members adjacent to each other in a single call to memcpy(). This causes a legitimate compiler warning because memcpy() overruns the length of &link_usettings.base. Fix this by directly using &link_usettings and _from_ as destination and source addresses, instead.
This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy().
--- net/core/ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/ethtool.c +1 -1
@@ -618,7 +618,7 @@ store_link_ksettings_for_user(void __user *to, {struct ethtool_link_usettings link_usettings; -memcpy (&link_usettings.base, &from->base,sizeof (link_usettings)); +memcpy (&link_usettings, from,sizeof (link_usettings));bitmap_to_arr32 (link_usettings.link_modes.supported, from->link_modes.supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 326/425 samples/bpf: Fix broken tracex1 due to kprobe argument change
In reply to Greg Kroah-HartmanFrom: Yaqi Chen <[email protected]>
[ Upstream commit 137733d08f4ab14a354dacaa9a8fc35217747605 ]
Quoted 1 line
From commit
c0bbbdc32feb("__netif_receive_skb_core: pass skb by
reference"), the first argument passed into __netif_receive_skb_core has changed to reference of a skb pointer.
This commit fixes by using bpf_probe_read_kernel.
--- samples/bpf/tracex1_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
samples/bpf/tracex1_kern.c +2 -2
@@ -20,7 +20,7 @@ SEC("kprobe/__netif_receive_skb_core")int bpf_prog1 (struct pt_regs *ctx) { -/* attaches to kprobe netif_receive_skb, +/* attaches to kprobe __netif_receive_skb_core, * looks for packets on loobpack device and prints them */ char devname[IFNAMSIZ ];
@@ -29,7 +29,7 @@ int bpf_prog1(struct pt_regs *ctx)int len;/* non-portable! works for the given kernel only */ - skb = (struct sk_buff *)PT_REGS_PARM1 (ctx); +bpf_probe_read_kernel (&skb,sizeof (skb), (void *)PT_REGS_PARM1 (ctx)); dev =_ (skb->dev); len =_ (skb->len);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 327/425 powerpc/pseries: Stop calling printk in rtas_stop_self()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit ed8029d7b472369a010a1901358567ca3b6dbb0d ]
RCU complains about us calling printk() from an offline CPU:
=============================
WARNING: suspicious RCU usage
5.12.0-rc7-02874-g7cf90e481cb8 #1 Not tainted
-----------------------------
kernel/locking/lockdep.c:3568 RCU-list traversed in non-reader section!!
other info that might help us debug this:
RCU used illegally from offline CPU!
rcu_scheduler_active = 2, debug_locks = 1
no locks held by swapper/0/0.
stack backtrace:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.12.0-rc7-02874-g7cf90e481cb8 #1
Call Trace:
dump_stack+0xec/0x144 (unreliable)
lockdep_rcu_suspicious+0x124/0x144
__lock_acquire+0x1098/0x28b0
lock_acquire+0x128/0x600
_raw_spin_lock_irqsave+0x6c/0xc0
down_trylock+0x2c/0x70
__down_trylock_console_sem+0x60/0x140
vprintk_emit+0x1a8/0x4b0
vprintk_func+0xcc/0x200
printk+0x40/0x54
pseries_cpu_offline_self+0xc0/0x120
arch_cpu_idle_dead+0x54/0x70
do_idle+0x174/0x4a0
cpu_startup_entry+0x38/0x40
rest_init+0x268/0x388
start_kernel+0x748/0x790
start_here_common+0x1c/0x614Which happens because by the time we get to rtas_stop_self() we are already offline. In addition the message can be spammy, and is not that helpful for users, so remove it.
--- arch/powerpc/platforms/pseries/hotplug-cpu.c | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/platforms/pseries/hotplug-cpu.c +0 -3
@@ -95,9 +95,6 @@ static void rtas_stop_self(void)BUG_ON (rtas_stop_self_token ==RTAS_UNKNOWN_SERVICE ); -printk ("cpu %u (hwid %u) Ready to die...\n" , -smp_processor_id (),hard_smp_processor_id ()); -rtas_call_unlocked (&args, rtas_stop_self_token,0 ,1 ,NULL );panic ("Alas, I survived.\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 328/425 wl3501_cs: Fix out-of-bounds warnings in wl3501_send_pkt
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 820aa37638a252b57967bdf4038a514b1ab85d45 ]
Fix the following out-of-bounds warnings by enclosing structure members daddr and saddr into new struct addr, in structures wl3501_md_req and wl3501_md_ind:
arch/x86/include/asm/string_32.h:182:25: warning: '__builtin_memcpy' offset [18, 23] from the object at 'sig' is out of the bounds of referenced subobject 'daddr' with type 'u8[6]' {aka 'unsigned char[6]'} at offset 11 [-Warray-bounds] arch/x86/include/asm/string_32.h:182:25: warning: '__builtin_memcpy' offset [18, 23] from the object at 'sig' is out of the bounds of referenced subobject 'daddr' with type 'u8[6]' {aka 'unsigned char[6]'} at offset 11 [-Warray-bounds]
Refactor the code, accordingly:
$ pahole -C wl3501_md_req drivers/net/wireless/wl3501_cs.o
struct wl3501_md_req {
u16 next_blk; /* 0 2 */
u8 sig_id; /* 2 1 */
u8 routing; /* 3 1 */
u16 data; /* 4 2 */
u16 size; /* 6 2 */
u8 pri; /* 8 1 */
u8 service_class; /* 9 1 */
struct {
u8 daddr[6]; /* 10 6 */
u8 saddr[6]; /* 16 6 */
} addr; /* 10 12 *//* size: 22, cachelines: 1, members: 8 */ /* last cacheline: 22 bytes */ };
$ pahole -C wl3501_md_ind drivers/net/wireless/wl3501_cs.o
struct wl3501_md_ind {
u16 next_blk; /* 0 2 */
u8 sig_id; /* 2 1 */
u8 routing; /* 3 1 */
u16 data; /* 4 2 */
u16 size; /* 6 2 */
u8 reception; /* 8 1 */
u8 pri; /* 9 1 */
u8 service_class; /* 10 1 */
struct {
u8 daddr[6]; /* 11 6 */
u8 saddr[6]; /* 17 6 */
} addr; /* 11 12 *//* size: 24, cachelines: 1, members: 9 */ /* padding: 1 */ /* last cacheline: 24 bytes */ };
The problem is that the original code is trying to copy data into a couple of arrays adjacent to each other in a single call to memcpy(). Now that a new struct _addr_ enclosing those two adjacent arrays is introduced, memcpy() doesn't overrun the length of &sig.daddr[0] and &sig.daddr, because the address of the new struct object _addr_ is used, instead.
This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy().
--- drivers/net/wireless/wl3501.h | 12 ++++++++---- drivers/net/wireless/wl3501_cs.c | 10 ++++++---- 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/net/wireless/wl3501.h +8 -4
@@ -471,8 +471,10 @@ struct wl3501_md_req {u16 size;u8 pri;u8 service_class; -u8 daddr[ETH_ALEN ]; -u8 saddr[ETH_ALEN ]; +struct { +u8 daddr[ETH_ALEN ]; +u8 saddr[ETH_ALEN ]; + } addr; };struct wl3501_md_ind {
@@ -484,8 +486,10 @@ struct wl3501_md_ind {u8 reception;u8 pri;u8 service_class; -u8 daddr[ETH_ALEN ]; -u8 saddr[ETH_ALEN ]; +struct { +u8 daddr[ETH_ALEN ]; +u8 saddr[ETH_ALEN ]; + } addr; };struct wl3501_md_confirm {
drivers/net/wireless/wl3501_cs.c +6 -4
@@ -468,6 +468,7 @@ static int wl3501_send_pkt(struct wl3501_card *this, u8 *data, u16 len)struct wl3501_md_req sig = { .sig_id =WL3501_SIG_MD_REQ , }; +size_t sig_addr_len =sizeof (sig.addr);u8 *pdata = (char *)data;int rc = -EIO ;
@@ -483,9 +484,9 @@ static int wl3501_send_pkt(struct wl3501_card *this, u8 *data, u16 len) goto out; } rc =0 ; -memcpy (&sig.daddr[0 ], pdata,12 ); - pktlen = len -12 ; - pdata +=12 ; +memcpy (&sig.addr, pdata, sig_addr_len); + pktlen = len - sig_addr_len; + pdata += sig_addr_len; sig.data = bf;if (((*pdata) *256 + (*(pdata +1 ))) >1500 ) {u8 addr4[ETH_ALEN ] = {
@@ -979,7 +980,8 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev, }else { skb->dev = dev;skb_reserve (skb,2 );/* IP headers on 16 bytes boundaries */ -skb_copy_to_linear_data (skb, (unsigned char *)&sig.daddr,12 ); +skb_copy_to_linear_data (skb, (unsigned char *)&sig.addr, +sizeof (sig.addr));wl3501_receive (this, skb->data, pkt_len);skb_put (skb, pkt_len); skb->protocol =eth_type_trans (skb, dev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 329/425 wl3501_cs: Fix out-of-bounds warnings in wl3501_mgmt_join
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit bb43e5718d8f1b46e7a77e7b39be3c691f293050 ]
Fix the following out-of-bounds warnings by adding a new structure wl3501_req instead of duplicating the same members in structure wl3501_join_req and wl3501_scan_confirm:
arch/x86/include/asm/string_32.h:182:25: warning: '__builtin_memcpy' offset [39, 108] from the object at 'sig' is out of the bounds of referenced subobject 'beacon_period' with type 'short unsigned int' at offset 36 [-Warray-bounds] arch/x86/include/asm/string_32.h:182:25: warning: '__builtin_memcpy' offset [25, 95] from the object at 'sig' is out of the bounds of referenced subobject 'beacon_period' with type 'short unsigned int' at offset 22 [-Warray-bounds]
Refactor the code, accordingly:
$ pahole -C wl3501_req drivers/net/wireless/wl3501_cs.o
struct wl3501_req {
u16 beacon_period; /* 0 2 */
u16 dtim_period; /* 2 2 */
u16 cap_info; /* 4 2 */
u8 bss_type; /* 6 1 */
u8 bssid[6]; /* 7 6 */
struct iw_mgmt_essid_pset ssid; /* 13 34 */
struct iw_mgmt_ds_pset ds_pset; /* 47 3 */
struct iw_mgmt_cf_pset cf_pset; /* 50 8 */
struct iw_mgmt_ibss_pset ibss_pset; /* 58 4 */
struct iw_mgmt_data_rset bss_basic_rset; /* 62 10 */ /* size: 72, cachelines: 2, members: 10 */
/* last cacheline: 8 bytes */
};$ pahole -C wl3501_join_req drivers/net/wireless/wl3501_cs.o
struct wl3501_join_req {
u16 next_blk; /* 0 2 */
u8 sig_id; /* 2 1 */
u8 reserved; /* 3 1 */
struct iw_mgmt_data_rset operational_rset; /* 4 10 */
u16 reserved2; /* 14 2 */
u16 timeout; /* 16 2 */
u16 probe_delay; /* 18 2 */
u8 timestamp[8]; /* 20 8 */
u8 local_time[8]; /* 28 8 */
struct wl3501_req req; /* 36 72 */ /* size: 108, cachelines: 2, members: 10 */
/* last cacheline: 44 bytes */
};$ pahole -C wl3501_scan_confirm drivers/net/wireless/wl3501_cs.o
struct wl3501_scan_confirm {
u16 next_blk; /* 0 2 */
u8 sig_id; /* 2 1 */
u8 reserved; /* 3 1 */
u16 status; /* 4 2 */
char timestamp[8]; /* 6 8 */
char localtime[8]; /* 14 8 */
struct wl3501_req req; /* 22 72 */
/* --- cacheline 1 boundary (64 bytes) was 30 bytes ago --- */
u8 rssi; /* 94 1 */ /* size: 96, cachelines: 2, members: 8 */
/* padding: 1 */
/* last cacheline: 32 bytes */
};The problem is that the original code is trying to copy data into a bunch of struct members adjacent to each other in a single call to memcpy(). Now that a new struct wl3501_req enclosing all those adjacent members is introduced, memcpy() doesn't overrun the length of &sig.beacon_period and &this->bss_set[i].beacon_period, because the address of the new struct object _req_ is used as the destination, instead.
This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy().
--- drivers/net/wireless/wl3501.h | 35 +++++++++++-------------- drivers/net/wireless/wl3501_cs.c | 44 +++++++++++++++++--------------- 2 files changed, 38 insertions(+), 41 deletions(-)
drivers/net/wireless/wl3501.h +15 -20
@@ -379,16 +379,7 @@ struct wl3501_get_confirm {u8 mib_value[100 ]; }; -struct wl3501_join_req { -u16 next_blk; -u8 sig_id; -u8 reserved; -struct iw_mgmt_data_rset operational_rset; -u16 reserved2; -u16 timeout; -u16 probe_delay; -u8 timestamp[8 ]; -u8 local_time[8 ]; +struct wl3501_req {u16 beacon_period;u16 dtim_period;u16 cap_info;
@@ -401,6 +392,19 @@ struct wl3501_join_req {struct iw_mgmt_data_rset bss_basic_rset; }; +struct wl3501_join_req { +u16 next_blk; +u8 sig_id; +u8 reserved; +struct iw_mgmt_data_rset operational_rset; +u16 reserved2; +u16 timeout; +u16 probe_delay; +u8 timestamp[8 ]; +u8 local_time[8 ]; +struct wl3501_req req; +}; +struct wl3501_join_confirm {u16 next_blk;u8 sig_id;
@@ -443,16 +447,7 @@ struct wl3501_scan_confirm {u16 status;char timestamp[8 ];char localtime[8 ]; -u16 beacon_period; -u16 dtim_period; -u16 cap_info; -u8 bss_type; -u8 bssid[ETH_ALEN ]; -struct iw_mgmt_essid_pset ssid; -struct iw_mgmt_ds_pset ds_pset; -struct iw_mgmt_cf_pset cf_pset; -struct iw_mgmt_ibss_pset ibss_pset; -struct iw_mgmt_data_rset bss_basic_rset; +struct wl3501_req req;u8 rssi; };
drivers/net/wireless/wl3501_cs.c +23 -21
121 lines not on this page · raw message
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 330/425 powerpc/iommu: Annotate nested lock for lockdep
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit cc7130bf119add37f36238343a593b71ef6ecc1e ]
The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks which triggers a false negative warning in lockdep (below).
This fixes it by annotating the large pool's spinlock as a nest lock which makes lockdep not complaining when locking nested locks if the nest lock is locked already.
===
WARNING: possible recursive locking detected 5.11.0-le_syzkaller_a+fstn1 #100 Not tainted
--------------------------------------------
qemu-system-ppc/4129 is trying to acquire lock:c0000000119bddb0 (&(p->lock)/1){....}-{2:2}, at: iommu_take_ownership+0xac/0x1e0
but task is already holding lock:c0000000119bdd30 (&(p->lock)/1){....}-{2:2}, at: iommu_take_ownership+0xac/0x1e0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(&(p->lock)/1);
lock(&(p->lock)/1);
===
--- arch/powerpc/kernel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/iommu.c +2 -2
@@ -1030,7 +1030,7 @@ int iommu_take_ownership(struct iommu_table *tbl)spin_lock_irqsave (&tbl->large_pool.lock, flags);for (i =0 ; i < tbl->nr_pools; i++) -spin_lock (&tbl->pools[i].lock); +spin_lock_nest_lock (&tbl->pools[i].lock, &tbl->large_pool.lock);if (tbl->it_offset ==0 )clear_bit (0 , tbl->it_map);
@@ -1059,7 +1059,7 @@ void iommu_release_ownership(struct iommu_table *tbl)spin_lock_irqsave (&tbl->large_pool.lock, flags);for (i =0 ; i < tbl->nr_pools; i++) -spin_lock (&tbl->pools[i].lock); +spin_lock_nest_lock (&tbl->pools[i].lock, &tbl->large_pool.lock);memset (tbl->it_map,0 , sz);
Signature · 1 line
2.30.2