4.19.88-stable review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 148/321 xfs: Fix bulkstat compat ioctls on x32 userspace.
In reply to Greg Kroah-HartmanFrom: Nick Bowler <[email protected]>
[ Upstream commit 7ca860e3c1a74ad6bd8949364073ef1044cad758 ]
The bulkstat family of ioctls are problematic on x32, because there is a mixup of native 32-bit and 64-bit conventions. The xfs_fsop_bulkreq struct contains pointers and 32-bit integers so that matches the native 32-bit layout, and that means the ioctl implementation goes into the regular compat path on x32.
However, the 'ubuffer' member of that struct in turn refers to either struct xfs_inogrp or xfs_bstat (or an array of these). On x32, those structures match the native 64-bit layout. The compat implementation writes out the 32-bit version of these structures. This is not the expected format for x32 userspace, causing problems.
Fortunately the functions which actually output these xfs_inogrp and xfs_bstat structures have an easy way to select which output format is required, so we just need a little tweak to select the right format on x32.
--- fs/xfs/xfs_ioctl32.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
fs/xfs/xfs_ioctl32.c +30 -4
@@ -241,6 +241,32 @@ xfs_compat_ioc_bulkstat(int done;int error; +/* +* Output structure handling functions. Depending on the command, +* either the xfs_bstat and xfs_inogrp structures are written out +* to userpace memory via bulkreq.ubuffer. Normally the compat +* functions and structure size are the correct ones to use ... +*/ +inumbers_fmt_pf inumbers_func = xfs_inumbers_fmt_compat; +bulkstat_one_pf bs_one_func = xfs_bulkstat_one_compat; +size_t bs_one_size =sizeof (struct compat_xfs_bstat ); + +#ifdef CONFIG_X86_X32 +if (in_x32_syscall ()) { +/* +* ... but on x32 the input xfs_fsop_bulkreq has pointers +* which must be handled in the "compat" (32-bit) way, while +* the xfs_bstat and xfs_inogrp structures follow native 64- +* bit layout convention. So adjust accordingly, otherwise +* the data written out in compat layout will not match what +* x32 userspace expects. +*/ + inumbers_func = xfs_inumbers_fmt; + bs_one_func = xfs_bulkstat_one; + bs_one_size =sizeof (struct xfs_bstat ); + } +#endif +/* done = 1 if there are more stats to get and if bulkstat */ /* should be called again (unused here, but used in dmapi) */
@@ -272,15 +298,15 @@ xfs_compat_ioc_bulkstat(if (cmd ==XFS_IOC_FSINUMBERS_32 ) { error =xfs_inumbers (mp, &inlast, &count, - bulkreq.ubuffer, xfs_inumbers_fmt_compat); + bulkreq.ubuffer, inumbers_func); }else if (cmd ==XFS_IOC_FSBULKSTAT_SINGLE_32 ) {int res; - error =xfs_bulkstat_one_compat (mp, inlast, bulkreq.ubuffer, -sizeof (compat_xfs_bstat_t),NULL , &res); + error =bs_one_func (mp, inlast, bulkreq.ubuffer, + bs_one_size,NULL , &res); }else if (cmd ==XFS_IOC_FSBULKSTAT_32 ) { error =xfs_bulkstat (mp, &inlast, &count, - xfs_bulkstat_one_compat,sizeof (compat_xfs_bstat_t), + bs_one_func, bs_one_size, bulkreq.ubuffer, &done); }else error = -EINVAL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 149/321 IB/qib: Fix an error code in qib_sdma_verbs_send()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 5050ae5fa3d54c8e83e1e447cc7e3591110a7f57 ]
We accidentally return success on this error path.
--- drivers/infiniband/hw/qib/qib_sdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qib/qib_sdma.c +3 -1
@@ -576,8 +576,10 @@ retry: dw = (len +3 ) >>2 ; addr =dma_map_single (&ppd->dd->pcidev->dev, sge->vaddr, dw <<2 ,DMA_TO_DEVICE ); -if (dma_mapping_error (&ppd->dd->pcidev->dev, addr)) +if (dma_mapping_error (&ppd->dd->pcidev->dev, addr)) { + ret = -ENOMEM ; goto unmap; + } sdmadesc[0 ] =0 ;make_sdma_desc (ppd, sdmadesc, (u64 ) addr, dw, dwoffset);/* SDmaUseLargeBuf has to be set in every descriptor */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 150/321 clocksource/drivers/fttmr010: Fix invalid interrupt register access
In reply to Greg Kroah-HartmanFrom: Tao Ren <[email protected]>
[ Upstream commit 86fe57fc47b17b3528fa5497fc57e158d846c4ea ]
TIMER_INTR_MASK register (Base Address of Timer + 0x38) is not designed for masking interrupts on ast2500 chips, and it's not even listed in ast2400 datasheet, so it's not safe to access TIMER_INTR_MASK on aspeed chips.
Similarly, TIMER_INTR_STATE register (Base Address of Timer + 0x34) is not interrupt status register on ast2400 and ast2500 chips. Although there is no side effect to reset the register in fttmr010_common_init(), it's just misleading to do so.
Besides, "count_down" is renamed to "is_aspeed" in "fttmr010" structure, and more comments are added so the code is more readble.
--- drivers/clocksource/timer-fttmr010.c | 73 ++++++++++++++++------------ 1 file changed, 42 insertions(+), 31 deletions(-)
drivers/clocksource/timer-fttmr010.c +42 -31
@@ -21,7 +21,7 @@#include <linux/delay.h> /* -* Register definitions for the timers +* Register definitions common for all the timer variants. */ #define TIMER1_COUNT (0x00)#define TIMER1_LOAD (0x04)
@@ -36,9 +36,10 @@#define TIMER3_MATCH1 (0x28)#define TIMER3_MATCH2 (0x2c)#define TIMER_CR (0x30) -#define TIMER_INTR_STATE (0x34) -#define TIMER_INTR_MASK (0x38) +/* +* Control register (TMC30) bit fields for fttmr010/gemini/moxart timers. +*/ #define TIMER_1_CR_ENABLE BIT(0)#define TIMER_1_CR_CLOCK BIT(1)#define TIMER_1_CR_INT BIT(2)
@@ -53,8 +54,9 @@#define TIMER_3_CR_UPDOWN BIT(11)/* -* The Aspeed AST2400 moves bits around in the control register -* and lacks bits for setting the timer to count upwards. +* Control register (TMC30) bit fields for aspeed ast2400/ast2500 timers. +* The aspeed timers move bits around in the control register and lacks +* bits for setting the timer to count upwards. */ #define TIMER_1_CR_ASPEED_ENABLE BIT(0)#define TIMER_1_CR_ASPEED_CLOCK BIT(1)
@@ -66,6 +68,18 @@#define TIMER_3_CR_ASPEED_CLOCK BIT(9)#define TIMER_3_CR_ASPEED_INT BIT(10) +/* +* Interrupt status/mask register definitions for fttmr010/gemini/moxart +* timers. +* The registers don't exist and they are not needed on aspeed timers +* because: +* - aspeed timer overflow interrupt is controlled by bits in Control +* Register (TMC30). +* - aspeed timers always generate interrupt when either one of the +* Match registers equals to Status register. +*/ +#define TIMER_INTR_STATE (0x34) +#define TIMER_INTR_MASK (0x38)#define TIMER_1_INT_MATCH1 BIT(0)#define TIMER_1_INT_MATCH2 BIT(1)#define TIMER_1_INT_OVERFLOW BIT(2)
@@ -80,7 +94,7 @@struct fttmr010 {void __iomem *base;unsigned int tick_rate; -bool count_down; +bool is_aspeed;u32 t1_enable_val;struct clock_event_device clkevt;#ifdef CONFIG_ARM
@@ -130,7 +144,7 @@ static int fttmr010_timer_set_next_event(unsigned long cycles, cr &= ~fttmr010->t1_enable_val;writel (cr, fttmr010->base +TIMER_CR ); -if (fttmr010->count_down) { +if (fttmr010->is_aspeed) {/* * ASPEED Timer Controller will load TIMER1_LOAD register * into TIMER1_COUNT register when the timer is re-enabled.
@@ -175,16 +189,17 @@ static int fttmr010_timer_set_oneshot(struct clock_event_device *evt)/* Setup counter start from 0 or ~0 */ writel (0 , fttmr010->base +TIMER1_COUNT ); -if (fttmr010->count_down) +if (fttmr010->is_aspeed) {writel (~0 , fttmr010->base +TIMER1_LOAD ); -else + }else {writel (0 , fttmr010->base +TIMER1_LOAD ); -/* Enable interrupt */ - cr =readl (fttmr010->base +TIMER_INTR_MASK ); - cr &= ~(TIMER_1_INT_OVERFLOW |TIMER_1_INT_MATCH2 ); - cr |=TIMER_1_INT_MATCH1 ; -writel (cr, fttmr010->base +TIMER_INTR_MASK ); +/* Enable interrupt */ + cr =readl (fttmr010->base +TIMER_INTR_MASK ); + cr &= ~(TIMER_1_INT_OVERFLOW |TIMER_1_INT_MATCH2 ); + cr |=TIMER_1_INT_MATCH1 ; +writel (cr, fttmr010->base +TIMER_INTR_MASK ); + }return 0 ; }
@@ -201,9 +216,8 @@ static int fttmr010_timer_set_periodic(struct clock_event_device *evt)writel (cr, fttmr010->base +TIMER_CR );/* Setup timer to fire at 1/HZ intervals. */ -if (fttmr010->count_down) { +if (fttmr010->is_aspeed) {writel (period, fttmr010->base +TIMER1_LOAD ); -writel (0 , fttmr010->base +TIMER1_MATCH1 ); }else { cr =0xffffffff - (period -1 );writel (cr, fttmr010->base +TIMER1_COUNT );
@@ -281,23 +295,21 @@ static int __init fttmr010_common_init(struct device_node *np, bool is_aspeed) }/* -* The Aspeed AST2400 moves bits around in the control register, -* otherwise it works the same. +* The Aspeed timers move bits around in the control register. */ if (is_aspeed) { fttmr010->t1_enable_val =TIMER_1_CR_ASPEED_ENABLE |TIMER_1_CR_ASPEED_INT ; -/* Downward not available */ - fttmr010->count_down = true; + fttmr010->is_aspeed = true; }else { fttmr010->t1_enable_val =TIMER_1_CR_ENABLE |TIMER_1_CR_INT ; - } -/* -* Reset the interrupt mask and status -*/ -writel (TIMER_INT_ALL_MASK , fttmr010->base +TIMER_INTR_MASK ); -writel (0 , fttmr010->base +TIMER_INTR_STATE ); +/* +* Reset the interrupt mask and status +*/ +writel (TIMER_INT_ALL_MASK , fttmr010->base +TIMER_INTR_MASK ); +writel (0 , fttmr010->base +TIMER_INTR_STATE ); + }/* * Enable timer 1 count up, timer 2 count up, except on Aspeed,
@@ -306,9 +318,8 @@ static int __init fttmr010_common_init(struct device_node *np, bool is_aspeed)if (is_aspeed) val =TIMER_2_CR_ASPEED_ENABLE ;else { - val =TIMER_2_CR_ENABLE ; -if (!fttmr010->count_down) - val |=TIMER_1_CR_UPDOWN |TIMER_2_CR_UPDOWN ; + val =TIMER_2_CR_ENABLE |TIMER_1_CR_UPDOWN | +TIMER_2_CR_UPDOWN ; }writel (val, fttmr010->base +TIMER_CR );
@@ -321,7 +332,7 @@ static int __init fttmr010_common_init(struct device_node *np, bool is_aspeed)writel (0 , fttmr010->base +TIMER2_MATCH1 );writel (0 , fttmr010->base +TIMER2_MATCH2 ); -if (fttmr010->count_down) { +if (fttmr010->is_aspeed) {writel (~0 , fttmr010->base +TIMER2_LOAD ); clocksource_mmio_init(fttmr010->base + TIMER2_COUNT, "FTTMR010-TIMER2",
@@ -371,7 +382,7 @@ static int __init fttmr010_common_init(struct device_node *np, bool is_aspeed)#ifdef CONFIG_ARM /* Also use this timer for delays */ -if (fttmr010->count_down) +if (fttmr010->is_aspeed) fttmr010->delay_timer.read_current_timer = fttmr010_read_current_timer_down;else
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 151/321 vxlan: Fix error path in __vxlan_dev_create()
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 6db9246871394b3a136cd52001a0763676563840 ]
When a failure occurs in rtnl_configure_link(), the current code calls unregister_netdevice() to roll back the earlier call to register_netdevice(), and jumps to errout, which calls vxlan_fdb_destroy().
However unregister_netdevice() calls transitively ndo_uninit, which is vxlan_uninit(), and that already takes care of deleting the default FDB entry by calling vxlan_fdb_delete_default(). Since the entry added earlier in __vxlan_dev_create() is exactly the default entry, the cleanup code in the errout block always leads to double free and thus a panic.
Besides, since vxlan_fdb_delete_default() always destroys the FDB entry with notification enabled, the deletion of the default entry is notified even before the addition was notified.
Instead, move the unregister_netdevice() call after the manual destroy, which solves both problems.
--- drivers/net/vxlan.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/vxlan.c +10 -3
@@ -3213,6 +3213,7 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,struct vxlan_net *vn =net_generic (net, vxlan_net_id);struct vxlan_dev *vxlan =netdev_priv (dev);struct vxlan_fdb *f =NULL ; +bool unregister = false;int err; err =vxlan_dev_configure (net, dev, conf, false, extack);
@@ -3238,12 +3239,11 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev, err =register_netdevice (dev);if (err) goto errout; + unregister = true; err =rtnl_configure_link (dev,NULL ); -if (err) { -unregister_netdevice (dev); +if (err) goto errout; - }/* notify default fdb entry */ if (f)
@@ -3251,9 +3251,16 @@ static int __vxlan_dev_create(struct net *net, struct net_device *dev,list_add (&vxlan->next, &vn->vxlan_list);return 0 ; + errout: +/* unregister_netdevice() destroys the default FDB entry with deletion +* notification. But the addition notification was not sent yet, so +* destroy the entry by hand here. +*/ if (f)vxlan_fdb_destroy (vxlan, f, false); +if (unregister) +unregister_netdevice (dev);return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 152/321 powerpc/book3s/32: fix number of bats in p/v_block_mapped()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit e93ba1b7eb5b188c749052df7af1c90821c5f320 ]
This patch fixes the loop in p_block_mapped() and v_block_mapped() to scan the entire bat_addrs[] array.
--- arch/powerpc/mm/ppc_mmu_32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/ppc_mmu_32.c +2 -2
@@ -52,7 +52,7 @@ struct batrange { /* stores address ranges mapped by BATs */phys_addr_t v_block_mapped (unsigned long va) {int b; -for (b =0 ; b <4 ; ++b) +for (b =0 ; b <ARRAY_SIZE (bat_addrs); ++b)if (va >= bat_addrs[b].start && va < bat_addrs[b].limit)return bat_addrs[b].phys + (va - bat_addrs[b].start);return 0 ;
@@ -64,7 +64,7 @@ phys_addr_t v_block_mapped(unsigned long va)unsigned long p_block_mapped (phys_addr_t pa) {int b; -for (b =0 ; b <4 ; ++b) +for (b =0 ; b <ARRAY_SIZE (bat_addrs); ++b)if (pa >= bat_addrs[b].phys && pa < (bat_addrs[b].limit-bat_addrs[b].start) +bat_addrs[b].phys)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 153/321 powerpc/xmon: fix dump_segments()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 32c8c4c621897199e690760c2d57054f8b84b6e6 ]
mfsrin() takes segment num from bits 31-28 (IBM bits 0-3).
--- arch/powerpc/xmon/xmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/xmon/xmon.c +1 -1
@@ -3493,7 +3493,7 @@ void dump_segments(void)printf ("sr0-15 =" );for (i =0 ; i <16 ; ++i) -printf (" %x" ,mfsrin (i)); +printf (" %x" ,mfsrin (i <<28 )); printf("\n"); }#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 154/321 drivers/regulator: fix a missing check of return value
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit 966e927bf8cc6a44f8b72582a1d6d3ffc73b12ad ]
If palmas_smps_read() fails, we should not use the read data in "reg" which may contain random value. The fix inserts a check for the return value of palmas_smps_read(): If it fails, we return the error code upstream and stop using "reg".
--- drivers/regulator/palmas-regulator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/regulator/palmas-regulator.c +4 -1
@@ -443,13 +443,16 @@ static int palmas_ldo_write(struct palmas *palmas, unsigned int reg,static int palmas_set_mode_smps (struct regulator_dev *dev,unsigned int mode) {int id =rdev_get_id (dev); +int ret;struct palmas_pmic *pmic =rdev_get_drvdata (dev);struct palmas_pmic_driver_data *ddata = pmic->palmas->pmic_ddata;struct palmas_regs_info *rinfo = &ddata->palmas_regs_info[id];unsigned int reg;bool rail_enable = true; -palmas_smps_read (pmic->palmas, rinfo->ctrl_addr, ®); + ret =palmas_smps_read (pmic->palmas, rinfo->ctrl_addr, ®); +if (ret) +return ret; reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 155/321 Bluetooth: hci_bcm: Handle specific unknown packets after firmware loading
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
[ Upstream commit 22bba80500fdf624a7cfbb65fdfa97a038ae224d ]
The Broadcom controller on aries S5PV210 boards sends out a couple of unknown packets after the firmware is loaded. This will cause logging of errors such as:
Bluetooth: hci0: Frame reassembly failed (-84)
This is probably also the case with other boards, as there are related Android userspace patches for custom ROMs such as
https://review.lineageos.org/#/c/LineageOS/android_system_bt/+/142721/
Since this appears to be intended behaviour, treated them as diagnostic packets.
Note that this is another variant of commit 01d5e44ace8a ("Bluetooth: hci_bcm: Handle empty packet after firmware loading")
--- drivers/bluetooth/hci_bcm.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/bluetooth/hci_bcm.c +22 -0
@@ -51,6 +51,12 @@#define BCM_LM_DIAG_PKT 0x07#define BCM_LM_DIAG_SIZE 63 +#define BCM_TYPE49_PKT 0x31 +#define BCM_TYPE49_SIZE 0 + +#define BCM_TYPE52_PKT 0x34 +#define BCM_TYPE52_SIZE 0 +#define BCM_AUTOSUSPEND_DELAY 5000/* default autosleep delay */ /**
@@ -564,12 +570,28 @@ finalize: .lsize = 0, \ .maxlen = BCM_NULL_SIZE +#define BCM_RECV_TYPE49 \ + .type = BCM_TYPE49_PKT, \ + .hlen = BCM_TYPE49_SIZE, \ + .loff = 0, \ + .lsize = 0, \ + .maxlen = BCM_TYPE49_SIZE + +#define BCM_RECV_TYPE52 \ + .type = BCM_TYPE52_PKT, \ + .hlen = BCM_TYPE52_SIZE, \ + .loff = 0, \ + .lsize = 0, \ + .maxlen = BCM_TYPE52_SIZE +static const struct h4_recv_pkt bcm_recv_pkts[] = { {H4_RECV_ACL , .recv = hci_recv_frame }, {H4_RECV_SCO , .recv = hci_recv_frame }, {H4_RECV_EVENT , .recv = hci_recv_frame }, {BCM_RECV_LM_DIAG , .recv = hci_recv_diag }, {BCM_RECV_NULL , .recv = hci_recv_diag }, + {BCM_RECV_TYPE49 , .recv = hci_recv_diag }, + {BCM_RECV_TYPE52 , .recv = hci_recv_diag }, };static int bcm_recv (struct hci_uart *hu,const void *data,int count)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 156/321 serial: max310x: Fix tx_empty() callback
In reply to Greg Kroah-HartmanFrom: Alexander Shiyan <[email protected]>
[ Upstream commit a8da3c7873ea57acb8f9cea58c0af477522965aa ]
Function max310x_tx_empty() accesses the IRQSTS register, which is cleared by IC when reading, so if there is an interrupt status, we will lose it. This patch implement the transmitter check only by the current FIFO level.
--- drivers/tty/serial/max310x.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/tty/serial/max310x.c +2 -5
@@ -844,12 +844,9 @@ static void max310x_wq_proc(struct work_struct *ws)static unsigned int max310x_tx_empty (struct uart_port *port) { -unsigned int lvl, sts; +u8 lvl =max310x_port_read (port,MAX310X_TXFIFOLVL_REG ); - lvl =max310x_port_read (port,MAX310X_TXFIFOLVL_REG ); - sts =max310x_port_read (port,MAX310X_IRQSTS_REG ); - -return ((sts &MAX310X_IRQ_TXEMPTY_BIT ) && !lvl) ?TIOCSER_TEMT :0 ; +return lvl ?0 :TIOCSER_TEMT ; }static unsigned int max310x_get_mctrl (struct uart_port *port)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 157/321 openrisc: Fix broken paths to arch/or32
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 57ce8ba0fd3a95bf29ed741df1c52bd591bf43ff ]
OpenRISC was mainlined as "openrisc", not "or32". vmlinux.lds is generated from vmlinux.lds.S.
--- arch/openrisc/kernel/entry.S | 2 +- arch/openrisc/kernel/head.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/openrisc/kernel/entry.S +1 -1
@@ -240,7 +240,7 @@ handler: ;\ * occured. in fact they never do. if you need them use * values saved on stack (for SPR_EPC, SPR_ESR) or content * of r4 (for SPR_EEAR). for details look at EXCEPTION_HANDLE() - * in 'arch/or32/kernel/head.S' + * in 'arch/openrisc/kernel/head.S' */ /* =====================================================[ exceptions] === */
arch/openrisc/kernel/head.S +1 -1
@@ -1728,7 +1728,7 @@ _string_nl: /* * .data section should be page aligned - * (look into arch/or32/kernel/vmlinux.lds) + * (look into arch/openrisc/kernel/vmlinux.lds.S) */ .section .data,"aw" .align 8192
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 158/321 RDMA/srp: Propagate ib_post_send() failures to the SCSI mid-layer
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 2ee00f6a98c36f7e4ba07cc33f24cc5a69060cc9 ]
This patch avoids that the SCSI mid-layer keeps retrying forever if ib_post_send() fails. This was discovered while testing immediate data support and passing a too large num_sge value to ib_post_send().
--- drivers/infiniband/ulp/srp/ib_srp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/srp/ib_srp.c +1 -0
@@ -2357,6 +2357,7 @@ static int srp_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd)if (srp_post_send (ch, iu, len)) {shost_printk (KERN_ERR , target->scsi_host,PFX "Send failed\n" ); + scmnd->result =DID_ERROR <<16 ; goto err_unmap; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 159/321 scsi: qla2xxx: deadlock by configfs_depend_item
In reply to Greg Kroah-HartmanFrom: Anatoliy Glagolev <[email protected]>
[ Upstream commit 17b18eaa6f59044a5172db7d07149e31ede0f920 ]
The intent of invoking configfs_depend_item in commit 7474f52a82d51 ("tcm_qla2xxx: Perform configfs depend/undepend for base_tpg") was to prevent a physical Fibre Channel port removal when virtual (NPIV) ports announced through that physical port are active. The change does not work as expected: it makes enabled physical port dependent on target configfs subsystem (the port's parent), something the configfs guarantees anyway.
Besides, scheduling work in a worker thread and waiting for the work's completion is not really a valid workaround for the requirement not to call configfs_depend_item from a configfs callback: the call occasionally deadlocks.
Thus, removing configfs_depend_item calls does not break anything and fixes the deadlock problem.
--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 48 +++++------------------------- drivers/scsi/qla2xxx/tcm_qla2xxx.h | 3 -- 2 files changed, 8 insertions(+), 43 deletions(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +8 -40
@@ -926,38 +926,14 @@ static ssize_t tcm_qla2xxx_tpg_enable_show(struct config_item *item, atomic_read(&tpg->lport_tpg_enabled)); } -static void tcm_qla2xxx_depend_tpg (struct work_struct *work) -{ -struct tcm_qla2xxx_tpg *base_tpg =container_of (work, - struct tcm_qla2xxx_tpg, tpg_base_work); -struct se_portal_group *se_tpg = &base_tpg->se_tpg; -struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; - -if (!target_depend_item (&se_tpg->tpg_group.cg_item)) { -atomic_set (&base_tpg->lport_tpg_enabled,1 ); -qlt_enable_vha (base_vha); - } -complete (&base_tpg->tpg_base_comp); -} - -static void tcm_qla2xxx_undepend_tpg (struct work_struct *work) -{ -struct tcm_qla2xxx_tpg *base_tpg =container_of (work, - struct tcm_qla2xxx_tpg, tpg_base_work); -struct se_portal_group *se_tpg = &base_tpg->se_tpg; -struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; - -if (!qlt_stop_phase1 (base_vha->vha_tgt.qla_tgt)) { -atomic_set (&base_tpg->lport_tpg_enabled,0 ); -target_undepend_item (&se_tpg->tpg_group.cg_item); - } -complete (&base_tpg->tpg_base_comp); -} -static ssize_t tcm_qla2xxx_tpg_enable_store (struct config_item *item,const char *page,size_t count) {struct se_portal_group *se_tpg =to_tpg (item); +struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; +struct tcm_qla2xxx_lport *lport =container_of (se_wwn, + struct tcm_qla2xxx_lport, lport_wwn); +struct scsi_qla_host *vha = lport->qla_vha;struct tcm_qla2xxx_tpg *tpg =container_of (se_tpg, struct tcm_qla2xxx_tpg, se_tpg);unsigned long op;
@@ -976,24 +952,16 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,if (atomic_read (&tpg->lport_tpg_enabled))return -EEXIST ; -INIT_WORK (&tpg->tpg_base_work, tcm_qla2xxx_depend_tpg); +atomic_set (&tpg->lport_tpg_enabled,1 ); +qlt_enable_vha (vha); }else {if (!atomic_read (&tpg->lport_tpg_enabled))return count; -INIT_WORK (&tpg->tpg_base_work, tcm_qla2xxx_undepend_tpg); +atomic_set (&tpg->lport_tpg_enabled,0 ); +qlt_stop_phase1 (vha->vha_tgt.qla_tgt); } -init_completion (&tpg->tpg_base_comp); -schedule_work (&tpg->tpg_base_work); -wait_for_completion (&tpg->tpg_base_comp); -if (op) { -if (!atomic_read (&tpg->lport_tpg_enabled)) -return -ENODEV ; - }else { -if (atomic_read (&tpg->lport_tpg_enabled)) -return -EPERM ; - }return count; }
drivers/scsi/qla2xxx/tcm_qla2xxx.h +0 -3
@@ -48,9 +48,6 @@ struct tcm_qla2xxx_tpg {struct tcm_qla2xxx_tpg_attrib tpg_attrib;/* Returned by tcm_qla2xxx_make_tpg() */ struct se_portal_group se_tpg; -/* Items for dealing with configfs_depend_item */ -struct completion tpg_base_comp; -struct work_struct tpg_base_work; };struct tcm_qla2xxx_fc_loopid {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 160/321 scsi: csiostor: fix incorrect dma device in case of vport
In reply to Greg Kroah-HartmanFrom: Varun Prakash <[email protected]>
[ Upstream commit 9934613edcb40b92a216122876cd3b7e76d08390 ]
In case of ->vport_create() call scsi_add_host_with_dma() instead of scsi_add_host() to pass correct dma device.
--- drivers/scsi/csiostor/csio_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_init.c +1 -1
@@ -649,7 +649,7 @@ csio_shost_init(struct csio_hw *hw, struct device *dev,if (csio_lnode_init (ln, hw, pln)) goto err_shost_put; -if (scsi_add_host (shost, dev)) +if (scsi_add_host_with_dma (shost, dev, &hw->pdev->dev)) goto err_lnode_exit;return ln;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 161/321 brcmfmac: Fix access point mode
In reply to Greg Kroah-HartmanFrom: Stefan Wahren <[email protected]>
[ Upstream commit 861cb5eb467f5e38dce1aabe4e8db379255bd89b ]
Since commit 1204aa17f3b4 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag") the Raspberry Pi 3 A+ (BCM43455) isn't able to operate in AP mode with hostapd (device_ap_sme=1 use_monitor=0):
brcmfmac: brcmf_cfg80211_stop_ap: setting AP mode failed -52
So add the missing mgmt_stypes for AP mode to fix this.
--- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +10 -0
@@ -6314,6 +6314,16 @@ brcmf_txrx_stypes[NUM_NL80211_IFTYPES] = { .tx = 0xffff, .rx =BIT (IEEE80211_STYPE_ACTION >>4 ) |BIT (IEEE80211_STYPE_PROBE_REQ >>4 ) + }, + [NL80211_IFTYPE_AP] = { + .tx = 0xffff, + .rx =BIT (IEEE80211_STYPE_ASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_REASSOC_REQ >>4 ) | +BIT (IEEE80211_STYPE_PROBE_REQ >>4 ) | +BIT (IEEE80211_STYPE_DISASSOC >>4 ) | +BIT (IEEE80211_STYPE_AUTH >>4 ) | +BIT (IEEE80211_STYPE_DEAUTH >>4 ) | + BIT(IEEE80211_STYPE_ACTION >> 4) } };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 162/321 ath6kl: Only use match sets when firmware supports it
In reply to Greg Kroah-HartmanFrom: Kyle Roeschley <[email protected]>
[ Upstream commit fb376a495fbdb886f38cfaf5a3805401b9e46f13 ]
Commit dd45b7598f1c ("ath6kl: Include match ssid list in scheduled scan") merged the probed and matched SSID lists before sending them to the firmware. In the process, it assumed match set support is always available in ath6kl_set_probed_ssids, which breaks scans for hidden SSIDs. Now, check that the firmware supports matching SSIDs in scheduled scans before setting MATCH_SSID_FLAG.
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +1 -1
@@ -939,7 +939,7 @@ static int ath6kl_set_probed_ssids(struct ath6kl *ar,else ssid_list[i].flag =ANY_SSID_FLAG ; -if (n_match_ssid ==0 ) +if (ar->wiphy->max_match_sets !=0 && n_match_ssid ==0 ) ssid_list[i].flag |=MATCH_SSID_FLAG ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 163/321 ath6kl: Fix off by one error in scan completion
In reply to Greg Kroah-HartmanFrom: Kyle Roeschley <[email protected]>
[ Upstream commit 5803c12816c43bd09e5f4247dd9313c2d9a2c41b ]
When ath6kl was reworked to share code between regular and scheduled scans in commit 3b8ffc6a22ba ("ath6kl: Configure probed SSID list consistently"), probed SSID entry changed from 1-index to 0-indexed. However, ath6kl_cfg80211_scan_complete_event() was missed in that change. Fix its indexing so that we correctly clear out the probed SSID list.
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/cfg80211.c +1 -1
@@ -1093,7 +1093,7 @@ void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted)if (vif->scan_req->n_ssids && vif->scan_req->ssids[0 ].ssid_len) {for (i =0 ; i < vif->scan_req->n_ssids; i++) {ath6kl_wmi_probedssid_cmd (ar->wmi, vif->fw_vif_idx, - i +1 ,DISABLE_SSID_FLAG , + i,DISABLE_SSID_FLAG ,0 ,NULL ); } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 164/321 powerpc/perf: Fix unit_sel/cache_sel checks
In reply to Greg Kroah-HartmanFrom: Madhavan Srinivasan <[email protected]>
[ Upstream commit 2d46d4877b1afd14059393a48bdb8ce27955174c ]
Raw event code has couple of fields "unit" and "cache" in it, to capture the "unit" to monitor for a given pmcxsel and cache reload qualifier to program in MMCR1.
isa207_get_constraint() refers "unit" field to update the MMCRC (L2/L3) Event bus control fields with "cache" bits of the raw event code. These are power8 specific and not supported by PowerISA v3.0 pmu. So wrap the checks to be power8 specific. Also, "cache" bit field is referred to update MMCR1[16:17] and this check can be power8 specific.
--- arch/powerpc/perf/isa207-common.c | 25 ++++++++++++++++++------- arch/powerpc/perf/isa207-common.h | 4 ++-- 2 files changed, 20 insertions(+), 9 deletions(-)
arch/powerpc/perf/isa207-common.c +18 -7
@@ -148,6 +148,14 @@ static bool is_thresh_cmp_valid(u64 event)return true; } +static unsigned int dc_ic_rld_quad_l1_sel (u64 event) +{ +unsigned int cache; + + cache = (event >>EVENT_CACHE_SEL_SHIFT ) &MMCR1_DC_IC_QUAL_MASK ; +return cache; +} +static inline u64 isa207_find_source (u64 idx,u32 sub_idx) {u64 ret =PERF_MEM_NA ;
@@ -288,10 +296,10 @@ int isa207_get_constraint(u64 event, unsigned long *maskp, unsigned long *valp)* have a cache selector of zero. The bank selector (bit 3) is * irrelevant, as long as the rest of the value is 0. */ -if (cache &0x7 ) +if (!cpu_has_feature (CPU_FTR_ARCH_300 ) && (cache &0x7 ))return -1 ; - }else if (event &EVENT_IS_L1 ) { + }else if (cpu_has_feature (CPU_FTR_ARCH_300 ) || (event &EVENT_IS_L1 )) { mask |=CNST_L1_QUAL_MASK ; value |=CNST_L1_QUAL_VAL (cache); }
@@ -394,11 +402,14 @@ int isa207_compute_mmcr(u64 event[], int n_ev,/* In continuous sampling mode, update SDAR on TLB miss */ mmcra_sdar_mode (event[i], &mmcra); -if (event[i] &EVENT_IS_L1 ) { - cache = event[i] >>EVENT_CACHE_SEL_SHIFT ; - mmcr1 |= (cache &1 ) <<MMCR1_IC_QUAL_SHIFT ; - cache >>=1 ; - mmcr1 |= (cache &1 ) <<MMCR1_DC_QUAL_SHIFT ; +if (cpu_has_feature (CPU_FTR_ARCH_300 )) { + cache =dc_ic_rld_quad_l1_sel (event[i]); + mmcr1 |= (cache) <<MMCR1_DC_IC_QUAL_SHIFT ; + }else { +if (event[i] &EVENT_IS_L1 ) { + cache =dc_ic_rld_quad_l1_sel (event[i]); + mmcr1 |= (cache) <<MMCR1_DC_IC_QUAL_SHIFT ; + } }if (is_event_marked (event[i])) {
arch/powerpc/perf/isa207-common.h +2 -2
@@ -163,8 +163,8 @@#define MMCR1_COMBINE_SHIFT (pmc) (35 - ((pmc) - 1))#define MMCR1_PMCSEL_SHIFT (pmc) (24 - (((pmc) - 1)) * 8)#define MMCR1_FAB_SHIFT 36 -#define MMCR1_DC_QUAL_SHIFT 47 -#define MMCR1_IC_QUAL_SHIFT 46 +#define MMCR1_DC_IC_QUAL_MASK 0x3 +#define MMCR1_DC_IC_QUAL_SHIFT 46/* MMCR1 Combine bits macro for power9 */ #define p9_MMCR1_COMBINE_SHIFT (pmc) (38 - ((pmc - 1) * 2))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 165/321 powerpc/32: Avoid unsupported flags with clang
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit 72e7bcc2cdf82bf03caaa5e6c9b0134c2fc2ee7d ]
When building for ppc32 with clang these flags are unsupported:
-ffixed-r2 and -mmultiple
llvm's lib/Target/PowerPC/PPCRegisterInfo.cpp marks r2 as reserved on when building for SVR4ABI and !ppc64:
// The SVR4 ABI reserves r2 and r13
if (Subtarget.isSVR4ABI()) {
// We only reserve r2 if we need to use the TOC pointer. If we have no
// explicit uses of the TOC pointer (meaning we're a leaf function with
// no constant-pool loads, etc.) and we have no potential uses inside an
// inline asm block, then we can treat r2 has an ordinary callee-saved
// register.
const PPCFunctionInfo *FuncInfo = MF.getInfo<PPCFunctionInfo>();
if (!TM.isPPC64() || FuncInfo->usesTOCBasePtr() || MF.hasInlineAsm())
markSuperRegs(Reserved, PPC::R2); // System-reserved register
markSuperRegs(Reserved, PPC::R13); // Small Data Area pointer register}
This means we can safely omit -ffixed-r2 when building for 32-bit targets.
The -mmultiple/-mno-multiple flags are not supported by clang, so platforms that might support multiple miss out on using multiple word instructions.
We wrap these flags in cc-option so that when Clang gains support the kernel will be able use these flags.
Clang 8 can then build a ppc44x_defconfig which boots in Qemu:
make CC=clang-8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu- ppc44x_defconfig ./scripts/config -e CONFIG_DEVTMPFS -d DEVTMPFS_MOUNT
make CC=clang-8 ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-
qemu-system-ppc -M bamboo \ -kernel arch/powerpc/boot/zImage \ -dtb arch/powerpc/boot/dts/bamboo.dtb \ -initrd ~/ppc32-440-rootfs.cpio \ -nographic -serial stdio -monitor pty -append "console=ttyS0"
--- arch/powerpc/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/powerpc/Makefile +8 -1
@@ -145,7 +145,14 @@ endif CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) -CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD) +# Clang unconditionally reserves r2 on ppc32 and does not support the flag +# https://bugs.llvm.org/show_bug.cgi?id=39555 +CFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2) + +# Clang doesn't support -mmultiple / -mno-multiple +# https://bugs.llvm.org/show_bug.cgi?id=39556 +CFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD)) + CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata) ifdef CONFIG_PPC_BOOK3S_64
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 166/321 powerpc/prom: fix early DEBUG messages
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit b18f0ae92b0a1db565c3e505fa87b6971ad3b641 ]
This patch fixes early DEBUG messages in prom.c:
- Use %px instead of %p to see the addresses
- Cast memblock_phys_mem_size() with (unsigned long long) to avoid build failure when phys_addr_t is not 64 bits.
--- arch/powerpc/kernel/prom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/prom.c +3 -3
@@ -129,7 +129,7 @@ static void __init move_device_tree(void) p =__va (memblock_alloc (size,PAGE_SIZE ));memcpy (p, initial_boot_params, size); initial_boot_params = p; -DBG ("Moved device tree to 0x%p\n" , p); +DBG ("Moved device tree to 0x%px\n" , p); }DBG ("<- move_device_tree\n" );
@@ -689,7 +689,7 @@ void __init early_init_devtree(void *params) {phys_addr_t limit; -DBG (" -> early_init_devtree(%p)\n" , params); +DBG (" -> early_init_devtree(%px)\n" , params);/* Too early to BUG_ON(), do it by hand */ if (!early_init_dt_verify (params))
@@ -749,7 +749,7 @@ void __init early_init_devtree(void *params)memblock_allow_resize ();memblock_dump_all (); -DBG ("Phys. mem: %llx\n" ,memblock_phys_mem_size ()); +DBG ("Phys. mem: %llx\n" , (unsigned long long )memblock_phys_mem_size ());/* We may need to relocate the flat tree, do it now. * FIXME .. and the initrd too? */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 167/321 powerpc/mm: Make NULL pointer deferences explicit on bad page faults.
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 49a502ea23bf9dec47f8f3c3960909ff409cd1bb ]
As several other arches including x86, this patch makes it explicit that a bad page fault is a NULL pointer dereference when the fault address is lower than PAGE_SIZE
In the mean time, this page makes all bad_page_fault() messages shorter so that they remain on one single line. And it prefixes them by "BUG: " so that they get easily grepped.
--- arch/powerpc/mm/fault.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
arch/powerpc/mm/fault.c +9 -8
@@ -633,21 +633,22 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)switch (TRAP (regs)) {case 0x300 :case 0x380 : -printk (KERN_ALERT "Unable to handle kernel paging request for " -"data at address 0x%08lx\n" , regs->dar); +pr_alert ("BUG: %s at 0x%08lx\n" , + regs->dar <PAGE_SIZE ?"Kernel NULL pointer dereference" : +"Unable to handle kernel data access" , regs->dar);break ;case 0x400 :case 0x480 : -printk (KERN_ALERT "Unable to handle kernel paging request for " -"instruction fetch\n" ); +pr_alert ("BUG: Unable to handle kernel instruction fetch%s" , + regs->nip <PAGE_SIZE ?" (NULL pointer?)\n" :"\n" );break ;case 0x600 : -printk (KERN_ALERT "Unable to handle kernel paging request for " -"unaligned access at address 0x%08lx\n" , regs->dar); +pr_alert ("BUG: Unable to handle kernel unaligned access at 0x%08lx\n" , + regs->dar);break ;default : -printk (KERN_ALERT "Unable to handle kernel paging request for " -"unknown fault\n" ); +pr_alert ("BUG: Unable to handle unknown paging fault at 0x%08lx\n" , + regs->dar);break ; } printk(KERN_ALERT "Faulting instruction address: 0x%08lx\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 168/321 powerpc/44x/bamboo: Fix PCI range
In reply to Greg Kroah-HartmanFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit 3cfb9ebe906b51f2942b1e251009bb251efd2ba6 ]
The bamboo dts has a bug: it uses a non-naturally aligned range for PCI memory space. This isnt' supported by the code, thus causing PCI to break on this system.
This is due to the fact that while the chip memory map has 1G reserved for PCI memory, it's only 512M aligned. The code doesn't know how to split that into 2 different PMMs and fails, so limit the region to 512M.
--- arch/powerpc/boot/dts/bamboo.dts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/boot/dts/bamboo.dts +3 -1
@@ -268,8 +268,10 @@ /* Outbound ranges, one memory and one IO, * later cannot be changed. Chip supports a second * IO range but we don't use it for now + * The chip also supports a larger memory range but + * it's not naturally aligned, so our code will break */ - ranges = <0x02000000 0x00000000 0xa0000000 0x00000000 0xa0000000 0x00000000 0x40000000 + ranges = <0x02000000 0x00000000 0xa0000000 0x00000000 0xa0000000 0x00000000 0x20000000 0x02000000 0x00000000 0x00000000 0x00000000 0xe0000000 0x00000000 0x00100000 0x01000000 0x00000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 169/321 vfio/spapr_tce: Get rid of possible infinite loop
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit 517ad4ae8aa93dccdb9a88c27257ecb421c9e848 ]
As a part of cleanup, the SPAPR TCE IOMMU subdriver releases preregistered memory. If there is a bug in memory release, the loop in tce_iommu_release() becomes infinite; this actually happened to me.
This makes the loop finite and prints a warning on every failure to make the code more bug prone.
--- drivers/vfio/vfio_iommu_spapr_tce.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/vfio/vfio_iommu_spapr_tce.c +3 -7
@@ -371,6 +371,7 @@ static void tce_iommu_release(void *iommu_data) {struct tce_container *container = iommu_data;struct tce_iommu_group *tcegrp; +struct tce_iommu_prereg *tcemem, *tmtmp;long i;while (tce_groups_attached (container)) {
@@ -393,13 +394,8 @@ static void tce_iommu_release(void *iommu_data)tce_iommu_free_table (container, tbl); } -while (!list_empty (&container->prereg_list)) { -struct tce_iommu_prereg *tcemem; - - tcemem =list_first_entry (&container->prereg_list, - struct tce_iommu_prereg, next); -WARN_ON_ONCE (tce_iommu_prereg_free (container, tcemem)); - } +list_for_each_entry_safe (tcemem, tmtmp, &container->prereg_list, next) +WARN_ON (tce_iommu_prereg_free (container, tcemem));tce_iommu_disable (container);if (container->mm)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 170/321 powerpc/powernv/eeh/npu: Fix uninitialized variables in opal_pci_eeh_freeze_status
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
[ Upstream commit c20577014f85f36d4e137d3d52a1f61225b4a3d2 ]
The current implementation of the OPAL_PCI_EEH_FREEZE_STATUS call in skiboot's NPU driver does not touch the pci_error_type parameter so it might have garbage but the powernv code analyzes it nevertheless.
This initializes pcierr and fstate to zero in all call sites.
--- arch/powerpc/platforms/powernv/eeh-powernv.c | 8 ++++---- arch/powerpc/platforms/powernv/pci-ioda.c | 4 ++-- arch/powerpc/platforms/powernv/pci.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
arch/powerpc/platforms/powernv/eeh-powernv.c +4 -4
@@ -578,8 +578,8 @@ static void pnv_eeh_get_phb_diag(struct eeh_pe *pe)static int pnv_eeh_get_phb_state (struct eeh_pe *pe) {struct pnv_phb *phb = pe->phb->private_data; -u8 fstate; -__be16 pcierr; +u8 fstate =0 ; +__be16 pcierr =0 ;s64 rc;int result =0 ;
@@ -617,8 +617,8 @@ static int pnv_eeh_get_phb_state(struct eeh_pe *pe)static int pnv_eeh_get_pe_state (struct eeh_pe *pe) {struct pnv_phb *phb = pe->phb->private_data; -u8 fstate; -__be16 pcierr; +u8 fstate =0 ; +__be16 pcierr =0 ;s64 rc;int result;
arch/powerpc/platforms/powernv/pci-ioda.c +2 -2
@@ -605,8 +605,8 @@ static int pnv_ioda_unfreeze_pe(struct pnv_phb *phb, int pe_no, int opt)static int pnv_ioda_get_pe_state (struct pnv_phb *phb,int pe_no) {struct pnv_ioda_pe *slave, *pe; -u8 fstate, state; -__be16 pcierr; +u8 fstate =0 , state; +__be16 pcierr =0 ;s64 rc;/* Sanity check on PE number */
arch/powerpc/platforms/powernv/pci.c +2 -2
@@ -602,8 +602,8 @@ static void pnv_pci_handle_eeh_config(struct pnv_phb *phb, u32 pe_no)static void pnv_pci_config_check_eeh (struct pci_dn *pdn) {struct pnv_phb *phb = pdn->phb->private_data; -u8 fstate; -__be16 pcierr; +u8 fstate =0 ; +__be16 pcierr =0 ;unsigned int pe_no;s64 rc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 171/321 drbd: ignore "all zero" peer volume sizes in handshake
In reply to Greg Kroah-HartmanFrom: Lars Ellenberg <[email protected]>
[ Upstream commit 94c43a13b8d6e3e0dd77b3536b5e04a84936b762 ]
During handshake, if we are diskless ourselves, we used to accept any size presented by the peer.
Which could be zero if that peer was just brought up and connected to us without having a disk attached first, in which case both peers would just "flip" their volume sizes.
Now, even a diskless node will ignore "zero" sizes presented by a diskless peer.
Also a currently Diskless Primary will refuse to shrink during handshake:
it may be frozen, and waiting for a "suitable" local disk or peer to re-appear (on-no-data-accessible suspend-io). If the peer is smaller than what we used to be, it is not suitable.
The logic for a diskless node during handshake is now supposed to be:
believe the peer, if
- I don't have a current size myself
- we agree on the size anyways
- I do have a current size, am Secondary, and he has the only disk
- I do have a current size, am Primary, and he has the only disk, which is larger than my current size
--- drivers/block/drbd/drbd_receiver.c | 33 +++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
drivers/block/drbd/drbd_receiver.c +30 -3
@@ -3980,6 +3980,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_infostruct o_qlim *o = (connection->agreed_features &DRBD_FF_WSAME ) ? p->qlim :NULL ;enum determine_dev_size dd =DS_UNCHANGED ;sector_t p_size, p_usize, p_csize, my_usize; +sector_t new_size, cur_size;int ldsc =0 ;/* local disk size changed */ enum dds_flags ddsf;
@@ -3987,6 +3988,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_infoif (!peer_device)return config_unknown_volume (connection, pi); device = peer_device->device; + cur_size =drbd_get_capacity (device->this_bdev); p_size =be64_to_cpu (p->d_size); p_usize =be64_to_cpu (p->u_size);
@@ -3997,7 +3999,6 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info device->p_size = p_size;if (get_ldev (device)) { -sector_t new_size, cur_size;rcu_read_lock (); my_usize =rcu_dereference (device->ldev->disk_conf)->disk_size;rcu_read_unlock ();
@@ -4015,7 +4016,6 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info/* Never shrink a device with usable data during connect. But allow online shrinking if we are connected. */ new_size =drbd_new_dev_size (device, device->ldev, p_usize,0 ); - cur_size =drbd_get_capacity (device->this_bdev);if (new_size < cur_size && device->state.disk >=D_OUTDATED && device->state.conn <C_CONNECTED ) {
@@ -4080,9 +4080,36 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info* * However, if he sends a zero current size, * take his (user-capped or) backing disk size anyways. +* +* Unless of course he does not have a disk himself. +* In which case we ignore this completely. */ +sector_t new_size = p_csize ?: p_usize ?: p_size;drbd_reconsider_queue_parameters (device,NULL , o); -drbd_set_my_capacity (device, p_csize ?: p_usize ?: p_size); +if (new_size ==0 ) { +/* Ignore, peer does not know nothing. */ + }else if (new_size == cur_size) { +/* nothing to do */ + }else if (cur_size !=0 && p_size ==0 ) { +drbd_warn (device,"Ignored diskless peer device size (peer:%llu != me:%llu sectors)!\n" , + (unsigned long long )new_size, (unsigned long long )cur_size); + }else if (new_size < cur_size && device->state.role ==R_PRIMARY ) { +drbd_err (device,"The peer's device size is too small! (%llu < %llu sectors); demote me first!\n" , + (unsigned long long )new_size, (unsigned long long )cur_size); +conn_request_state (peer_device->connection,NS (conn,C_DISCONNECTING ),CS_HARD ); +return -EIO ; + }else { +/* I believe the peer, if +* - I don't have a current size myself +* - we agree on the size anyways +* - I do have a current size, am Secondary, +* and he has the only disk +* - I do have a current size, am Primary, +* and he has the only disk, +* which is larger than my current size +*/ +drbd_set_my_capacity (device, new_size); + } }if (get_ldev (device)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 172/321 drbd: reject attach of unsuitable uuids even if connected
In reply to Greg Kroah-HartmanFrom: Lars Ellenberg <[email protected]>
[ Upstream commit fe43ed97bba3b11521abd934b83ed93143470e4f ]
Multiple failure scenario:
a) all good
Connected Primary/Secondary UpToDate/UpToDate
b) lose disk on Primary,
Connected Primary/Secondary Diskless/UpToDate
c) continue to write to the device,
changes only make it to the Secondary storage.
d) lose disk on Secondary,
Connected Primary/Secondary Diskless/Diskless
e) now try to re-attach on Primary
This would have succeeded before, even though that is clearly the wrong data set to attach to (missing the modifications from c). Because we only compared our "effective" and the "to-be-attached" data generation uuid tags if (device->state.conn < C_CONNECTED).
Fix: change that constraint to (device->state.pdsk != D_UP_TO_DATE) compare the uuids, and reject the attach.
This patch also tries to improve the reverse scenario:
first lose Secondary, then Primary disk,
then try to attach the disk on Secondary.
Before this patch, the attach on the Secondary succeeds, but since commit
drbd: disconnect, if the wrong UUIDs are attached on a connected peer the Primary will notice unsuitable data, and drop the connection hard.
Though unfortunately at a point in time during the handshake where we cannot easily abort the attach on the peer without more refactoring of the handshake.
We now reject any attach to "unsuitable" uuids,
as long as we can see a Primary role,
unless we already have access to "good" data.
--- drivers/block/drbd/drbd_nl.c | 6 +++--- drivers/block/drbd/drbd_receiver.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-)
drivers/block/drbd/drbd_nl.c +3 -3
@@ -1935,9 +1935,9 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info) } } -if (device->state.conn <C_CONNECTED && - device->state.role ==R_PRIMARY && device->ed_uuid && - (device->ed_uuid & ~((u64 )1 )) != (nbc->md.uuid[UI_CURRENT ] & ~((u64 )1 ))) { +if (device->state.pdsk !=D_UP_TO_DATE && device->ed_uuid && + (device->state.role ==R_PRIMARY || device->state.peer ==R_PRIMARY ) && + (device->ed_uuid & ~((u64 )1 )) != (nbc->md.uuid[UI_CURRENT ] & ~((u64 )1 ))) {drbd_err (device,"Can only attach to data with current UUID=%016llX\n" , (unsigned long long )device->ed_uuid); retcode =ERR_DATA_NOT_CURRENT ;
drivers/block/drbd/drbd_receiver.c +19 -0
@@ -4395,6 +4395,25 @@ static int receive_state(struct drbd_connection *connection, struct packet_infoif (peer_state.conn ==C_AHEAD ) ns.conn =C_BEHIND ; +/* TODO: +* if (primary and diskless and peer uuid != effective uuid) +* abort attach on peer; +* +* If this node does not have good data, was already connected, but +* the peer did a late attach only now, trying to "negotiate" with me, +* AND I am currently Primary, possibly frozen, with some specific +* "effective" uuid, this should never be reached, really, because +* we first send the uuids, then the current state. +* +* In this scenario, we already dropped the connection hard +* when we received the unsuitable uuids (receive_uuids(). +* +* Should we want to change this, that is: not drop the connection in +* receive_uuids() already, then we would need to add a branch here +* that aborts the attach of "unsuitable uuids" on the peer in case +* this node is currently Diskless Primary. +*/ +if (device->p_uuid && peer_state.disk >=D_NEGOTIATING &&get_ldev_if_state (device,D_NEGOTIATING )) {int cr;/* consider resync */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 173/321 drbd: do not block when adjusting "disk-options" while IO is frozen
In reply to Greg Kroah-HartmanFrom: Lars Ellenberg <[email protected]>
[ Upstream commit f708bd08ecbdc23d03aaedf5b3311ebe44cfdb50 ]
"suspending" IO is overloaded.
It can mean "do not allow new requests" (obviously), but it also may mean "must not complete pending IO", for example while the fencing handlers do their arbitration.
When adjusting disk options, we suspend io (disallow new requests), then wait for the activity-log to become unused (drain all IO completions), and possibly replace it with a new activity log of different size.
If the other "suspend IO" aspect is active, pending IO completions won't happen, and we would block forever (unkillable drbdsetup process).
Fix this by skipping the activity log adjustment if the "al-extents" setting did not change. Also, in case it did change, fail early without blocking if it looks like we would block forever.
--- drivers/block/drbd/drbd_nl.c | 37 ++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
drivers/block/drbd/drbd_nl.c +29 -8
@@ -1515,6 +1515,30 @@ static void sanitize_disk_conf(struct drbd_device *device, struct disk_conf *dis } } +static int disk_opts_check_al_size (struct drbd_device *device,struct disk_conf *dc) +{ +int err = -EBUSY ; + +if (device->act_log && + device->act_log->nr_elements == dc->al_extents) +return 0 ; + +drbd_suspend_io (device); +/* If IO completion is currently blocked, we would likely wait +* "forever" for the activity log to become unused. So we don't. */ +if (atomic_read (&device->ap_bio_cnt)) + goto out; + +wait_event (device->al_wait,lc_try_lock (device->act_log)); +drbd_al_shrink (device); + err =drbd_check_al_size (device, dc); +lc_unlock (device->act_log); +wake_up (&device->al_wait); +out: +drbd_resume_io (device); +return err; +} +int drbd_adm_disk_opts (struct sk_buff *skb,struct genl_info *info) {struct drbd_config_context adm_ctx;
@@ -1577,15 +1601,12 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) } } -drbd_suspend_io (device); -wait_event (device->al_wait,lc_try_lock (device->act_log)); -drbd_al_shrink (device); - err =drbd_check_al_size (device, new_disk_conf); -lc_unlock (device->act_log); -wake_up (&device->al_wait); -drbd_resume_io (device); - + err =disk_opts_check_al_size (device, new_disk_conf);if (err) { +/* Could be just "busy". Ignore? +* Introduce dedicated error code? */ +drbd_msg_put_info (adm_ctx.reply_skb, +"Try again without changing current al-extents setting" ); retcode =ERR_NOMEM ; goto fail_unlock; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 174/321 drbd: fix print_st_err()s prototype to match the definition
In reply to Greg Kroah-HartmanFrom: Luc Van Oostenryck <[email protected]>
[ Upstream commit 2c38f035117331eb78d0504843c79ea7c7fabf37 ]
print_st_err() is defined with its 4th argument taking an 'enum drbd_state_rv' but its prototype use an int for it.
Fix this by using 'enum drbd_state_rv' in the prototype too.
--- drivers/block/drbd/drbd_state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/drbd/drbd_state.h +1 -1
@@ -131,7 +131,7 @@ extern enum drbd_state_rv _drbd_set_state(struct drbd_device *, union drbd_state enum chg_state_flags, struct completion *done);extern void print_st_err (struct drbd_device *,union drbd_state , -union drbd_state ,int ); +union drbd_state ,enum drbd_state_rv ); enum drbd_state_rv _conn_request_state(struct drbd_connection *connection, union drbd_state mask, union drbd_state val,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 175/321 IB/rxe: Make counters thread safe
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit d5108e69fe013ff47ab815b849caba9cc33ca1e5 ]
Current rxe device counters are not thread safe. When multiple QPs are used, they can be racy. Make them thread safe by making it atomic64.
--- drivers/infiniband/sw/rxe/rxe_hw_counters.c | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_hw_counters.c +1 -1
@@ -59,7 +59,7 @@ int rxe_ib_get_hw_stats(struct ib_device *ibdev,return -EINVAL ;for (cnt =0 ; cnt <ARRAY_SIZE (rxe_counter_name); cnt++) - stats->value[cnt] = dev->stats_counters[cnt]; + stats->value[cnt] =atomic64_read (&dev->stats_counters[cnt]);return ARRAY_SIZE (rxe_counter_name); }
drivers/infiniband/sw/rxe/rxe_verbs.h +3 -3
@@ -409,16 +409,16 @@ struct rxe_dev {spinlock_t mmap_offset_lock;/* guard mmap_offset */ int mmap_offset; -u64 stats_counters[RXE_NUM_OF_COUNTERS ]; +atomic64_t stats_counters[RXE_NUM_OF_COUNTERS ];struct rxe_port port;struct list_head list;struct crypto_shash *tfm; }; -static inline void rxe_counter_inc (struct rxe_dev *rxe,enum rxe_counters cnt) +static inline void rxe_counter_inc (struct rxe_dev *rxe,enum rxe_counters index) { - rxe->stats_counters[cnt]++; +atomic64_inc (&rxe->stats_counters[index]); }static inline struct rxe_dev *to_rdev (struct ib_device *dev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 176/321 bpf/cpumap: make sure frame_size for build_skb is aligned if headroom isnt
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 77ea5f4cbe2084db9ab021ba73fb7eadf1610884 ]
The frame_size passed to build_skb must be aligned, else it is possible that the embedded struct skb_shared_info gets unaligned.
For correctness make sure that xdpf->headroom in included in the alignment. No upstream drivers can hit this, as all XDP drivers provide an aligned headroom. This was discovered when playing with implementing XDP support for mvneta, which have a 2 bytes DSA header, and this Marvell ARM64 platform didn't like doing atomic operations on an unaligned skb_shinfo(skb)->dataref addresses.
--- kernel/bpf/cpumap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/cpumap.c +1 -1
@@ -183,7 +183,7 @@ static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu,* is not at a fixed memory location, with mixed length * packets, which is bad for cache-line hotness. */ - frame_size =SKB_DATA_ALIGN (xdpf->len) + xdpf->headroom + + frame_size =SKB_DATA_ALIGN (xdpf->len + xdpf->headroom) +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); pkt_data_start = xdpf->data - xdpf->headroom;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 177/321 regulator: tps65910: fix a missing check of return value
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit cd07e3701fa6a4c68f8493ee1d12caa18d46ec6a ]
tps65910_reg_set_bits() may fail. The fix checks if it fails, and if so, returns with its error code.
--- drivers/regulator/tps65910-regulator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/regulator/tps65910-regulator.c +3 -1
@@ -1102,8 +1102,10 @@ static int tps65910_probe(struct platform_device *pdev)platform_set_drvdata (pdev, pmic);/* Give control of all register to control port */ -tps65910_reg_set_bits (pmic->mfd,TPS65910_DEVCTRL , + err =tps65910_reg_set_bits (pmic->mfd,TPS65910_DEVCTRL ,DEVCTRL_SR_CTL_I2C_SEL_MASK ); +if (err <0 ) +return err;switch (tps65910_chip_id (tps65910)) {case TPS65910 :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 178/321 powerpc/83xx: handle machine check caused by watchdog timer
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 0deae39cec6dab3a66794f3e9e83ca4dc30080f1 ]
When the watchdog timer is set in interrupt mode, it causes a machine check when it times out. The purpose of this mode is to ease debugging, not to crash the kernel and reboot the machine.
This patch implements a special handling for that, in order to not crash the kernel if the watchdog times out while in interrupt or within the idle task.
--- arch/powerpc/include/asm/cputable.h | 1 + arch/powerpc/include/asm/reg.h | 2 ++ arch/powerpc/kernel/cputable.c | 10 ++++++---- arch/powerpc/platforms/83xx/misc.c | 17 +++++++++++++++++ 4 files changed, 26 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/cputable.h +1 -0
@@ -44,6 +44,7 @@ extern int machine_check_e500(struct pt_regs *regs);extern int machine_check_e200 (struct pt_regs *regs);extern int machine_check_47x (struct pt_regs *regs);int machine_check_8xx (struct pt_regs *regs); +int machine_check_83xx (struct pt_regs *regs);extern void cpu_down_flush_e500v2 (void );extern void cpu_down_flush_e500mc (void );
arch/powerpc/include/asm/reg.h +2 -0
@@ -768,6 +768,8 @@#define SRR1_PROGTRAP 0x00020000/* Trap */ #define SRR1_PROGADDR 0x00010000/* SRR0 contains subsequent addr */ +#define SRR1_MCE_MCP 0x00080000/* Machine check signal caused interrupt */ +#define SPRN_HSRR0 0x13A/* Save/Restore Register 0 */ #define SPRN_HSRR1 0x13B/* Save/Restore Register 1 */ #define HSRR1_DENORM 0x00100000/* Denorm exception */
arch/powerpc/kernel/cputable.c +6 -4
@@ -1141,6 +1141,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .machine_check = machine_check_generic, .platform = "ppc603", }, +#ifdef CONFIG_PPC_83xx {/* e300c1 (a 603e core, plus some) on 83xx */ .pvr_mask = 0x7fff0000, .pvr_value = 0x00830000,
@@ -1151,7 +1152,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .icache_bsize = 32, .dcache_bsize = 32, .cpu_setup = __setup_cpu_603, - .machine_check = machine_check_generic, + .machine_check = machine_check_83xx, .platform = "ppc603", }, {/* e300c2 (an e300c1 core, plus some, minus FPU) on 83xx */
@@ -1165,7 +1166,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .icache_bsize = 32, .dcache_bsize = 32, .cpu_setup = __setup_cpu_603, - .machine_check = machine_check_generic, + .machine_check = machine_check_83xx, .platform = "ppc603", }, {/* e300c3 (e300c1, plus one IU, half cache size) on 83xx */
@@ -1179,7 +1180,7 @@ static struct cpu_spec __initdata cpu_specs[] = { .icache_bsize = 32, .dcache_bsize = 32, .cpu_setup = __setup_cpu_603, - .machine_check = machine_check_generic, + .machine_check = machine_check_83xx, .num_pmcs = 4, .oprofile_cpu_type = "ppc/e300", .oprofile_type = PPC_OPROFILE_FSL_EMB,
@@ -1196,12 +1197,13 @@ static struct cpu_spec __initdata cpu_specs[] = { .icache_bsize = 32, .dcache_bsize = 32, .cpu_setup = __setup_cpu_603, - .machine_check = machine_check_generic, + .machine_check = machine_check_83xx, .num_pmcs = 4, .oprofile_cpu_type = "ppc/e300", .oprofile_type = PPC_OPROFILE_FSL_EMB, .platform = "ppc603", }, +#endif {/* default match, we assume split I/D cache & TB (non-601)... */ .pvr_mask = 0x00000000, .pvr_value = 0x00000000,
arch/powerpc/platforms/83xx/misc.c +17 -0
@@ -14,6 +14,7 @@#include <linux/of_platform.h> #include <linux/pci.h> +#include <asm/debug.h> #include <asm/io.h> #include <asm/hw_irq.h> #include <asm/ipic.h>
@@ -150,3 +151,19 @@ void __init mpc83xx_setup_arch(void)mpc83xx_setup_pci (); } + +int machine_check_83xx (struct pt_regs *regs) +{ +u32 mask =1 << (31 -IPIC_MCP_WDT ); + +if (!(regs->msr &SRR1_MCE_MCP ) || !(ipic_get_mcp_status () & mask)) +return machine_check_generic (regs); +ipic_clear_mcp_status (mask); + +if (debugger_fault_handler (regs)) +return 1 ; + +die ("Watchdog NMI Reset" , regs,0 ); + +return 1 ; +}
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 179/321 powerpc/pseries: Fix node leak in update_lmb_associativity_index()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 47918bc68b7427e961035949cc1501a864578a69 ]
In update_lmb_associativity_index() we lookup dr_node using of_find_node_by_path() which takes a reference for us. In the non-error case we forget to drop the reference. Note that find_aa_index() does modify properties of the node, but doesn't need an extra reference held once it's returned.
--- arch/powerpc/platforms/pseries/hotplug-memory.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -0
@@ -202,6 +202,7 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb) aa_index =find_aa_index (dr_node, ala_prop, lmb_assoc); +of_node_put (dr_node);dlpar_free_cc_nodes (lmb_node);if (aa_index <0 ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 180/321 powerpc: Fix HMIs on big-endian with CONFIG_RELOCATABLE=y
In reply to Greg Kroah-HartmanFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit 505a314fb28ce122091691c51426fa85c084e115 ]
HMIs will crash the kernel due to
BRANCH_LINK_TO_FAR(hmi_exception_realmode)
Calling into the OPD instead of the actual code.
--- arch/powerpc/kernel/exceptions-64s.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/exceptions-64s.S +1 -1
@@ -1123,7 +1123,7 @@ TRAMP_REAL_BEGIN(hmi_exception_early) EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN) EXCEPTION_PROLOG_COMMON_3(0xe60) addi r3,r1,STACK_FRAME_OVERHEAD - BRANCH_LINK_TO_FAR(hmi_exception_realmode) /* Function call ABI */ + BRANCH_LINK_TO_FAR(DOTSYM(hmi_exception_realmode)) /* Function call ABI */ cmpdi cr0,r3,0 /* Windup the stack. */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 181/321 crypto: mxc-scc - fix build warnings on ARM64
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 2326828ee40357b3d2b1359b8ca7526af201495b ]
The following build warnings are seen when building for ARM64 allmodconfig:
drivers/crypto/mxc-scc.c:181:20: warning: format '%d' expects argument of type 'int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Wformat=] drivers/crypto/mxc-scc.c:186:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=] drivers/crypto/mxc-scc.c:277:21: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=] drivers/crypto/mxc-scc.c:339:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] drivers/crypto/mxc-scc.c:340:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
Fix them by using the %zu specifier to print a size_t variable and using a plain %x to print the result of a readl().
--- drivers/crypto/mxc-scc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/mxc-scc.c +6 -6
@@ -178,12 +178,12 @@ static int mxc_scc_get_data(struct mxc_scc_ctx *ctx,else from = scc->black_memory; -dev_dbg (scc->dev,"pcopy: from 0x%p %d bytes\n" , from, +dev_dbg (scc->dev,"pcopy: from 0x%p %zu bytes\n" , from, ctx->dst_nents *8 ); len =sg_pcopy_from_buffer (ablkreq->dst, ctx->dst_nents, from, ctx->size, ctx->offset);if (!len) { -dev_err (scc->dev,"pcopy err from 0x%p (len=%d)\n" , from, len); +dev_err (scc->dev,"pcopy err from 0x%p (len=%zu)\n" , from, len);return -EINVAL ; }
@@ -274,7 +274,7 @@ static int mxc_scc_put_data(struct mxc_scc_ctx *ctx, len =sg_pcopy_to_buffer (req->src, ctx->src_nents, to, len, ctx->offset);if (!len) { -dev_err (scc->dev,"pcopy err to 0x%p (len=%d)\n" , to, len); +dev_err (scc->dev,"pcopy err to 0x%p (len=%zu)\n" , to, len);return -EINVAL ; }
@@ -335,9 +335,9 @@ static void mxc_scc_ablkcipher_next(struct mxc_scc_ctx *ctx,return ; } -dev_dbg (scc->dev,"Start encryption (0x%p/0x%p)\n" , - (void *)readl (scc->base +SCC_SCM_RED_START ), - (void *)readl (scc->base +SCC_SCM_BLACK_START )); +dev_dbg (scc->dev,"Start encryption (0x%x/0x%x)\n" , +readl (scc->base +SCC_SCM_RED_START ), +readl (scc->base +SCC_SCM_BLACK_START ));/* clear interrupt control registers */ writel(SCC_SCM_INTR_CTRL_CLR_INTR,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 182/321 pwm: clps711x: Fix period calculation
In reply to Greg Kroah-HartmanFrom: Alexander Shiyan <[email protected]>
[ Upstream commit b0f17570b8203c22f139459c86cfbaa0311313ed ]
Commit e39c0df1be5a ("pwm: Introduce the pwm_args concept") has changed the variable for the period for clps711x-pwm driver, so now pwm_get/set_period() works with pwm->state.period variable instead of pwm->args.period.
This patch changes the period variable in other places where it is used.
--- drivers/pwm/pwm-clps711x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-clps711x.c +2 -2
@@ -48,7 +48,7 @@ static void clps711x_pwm_update_val(struct clps711x_chip *priv, u32 n, u32 v)static unsigned int clps711x_get_duty (struct pwm_device *pwm,unsigned int v) {/* Duty cycle 0..15 max */ -return DIV_ROUND_CLOSEST (v *0xf ,pwm_get_period (pwm)); +return DIV_ROUND_CLOSEST (v *0xf , pwm->args.period); }static int clps711x_pwm_request (struct pwm_chip *chip,struct pwm_device *pwm)
@@ -71,7 +71,7 @@ static int clps711x_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,struct clps711x_chip *priv =to_clps711x_chip (chip);unsigned int duty; -if (period_ns !=pwm_get_period (pwm)) +if (period_ns != pwm->args.period)return -EINVAL ; duty =clps711x_get_duty (pwm, duty_ns);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 183/321 net/netlink_compat: Fix a missing check of nla_parse_nested
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 89dfd0083751d00d5d7ead36f6d8b045bf89c5e1 ]
In tipc_nl_compat_sk_dump(), if nla_parse_nested() fails, it could return an error. To be consistent with other invocations of the function call, on error, the fix passes the return value upstream.
--- net/tipc/netlink_compat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/tipc/netlink_compat.c +5 -2
@@ -1030,8 +1030,11 @@ static int tipc_nl_compat_sk_dump(struct tipc_nl_compat_msg *msg,u32 node;struct nlattr *con[TIPC_NLA_CON_MAX +1 ]; -nla_parse_nested (con,TIPC_NLA_CON_MAX , - sock[TIPC_NLA_SOCK_CON ],NULL ,NULL ); + err =nla_parse_nested (con,TIPC_NLA_CON_MAX , + sock[TIPC_NLA_SOCK_CON ],NULL ,NULL ); + +if (err) +return err; node =nla_get_u32 (con[TIPC_NLA_CON_NODE ]); tipc_tlv_sprintf(msg->rep, " connected to <%u.%u.%u:%u>",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 184/321 net/net_namespace: Check the return value of register_pernet_subsys()
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 0eb987c874dc93f9c9d85a6465dbde20fdd3884c ]
In net_ns_init(), register_pernet_subsys() could fail while registering network namespace subsystems. The fix checks the return value and sends a panic() on failure.
--- net/core/net_namespace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/net_namespace.c +2 -1
@@ -913,7 +913,8 @@ static int __init net_ns_init(void) init_net_initialized = true;up_write (&pernet_ops_rwsem); -register_pernet_subsys (&net_ns_ops); +if (register_pernet_subsys (&net_ns_ops)) +panic ("Could not register network namespace subsystems" );rtnl_register (PF_UNSPEC ,RTM_NEWNSID , rtnl_net_newid,NULL ,RTNL_FLAG_DOIT_UNLOCKED );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 185/321 f2fs: fix block address for __check_sit_bitmap
In reply to Greg Kroah-HartmanFrom: Qiuyang Sun <[email protected]>
[ Upstream commit 9249dded7b5cb539a8c8698b25d08a3c15261470 ]
Should use lstart (logical start address) instead of start (in dev) here. This fixes a bug in multi-device scenarios.
--- fs/f2fs/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.c +1 -1
@@ -1103,7 +1103,7 @@ submit:list_move_tail (&dc->list, wait_list);/* sanity check on discard range */ -__check_sit_bitmap (sbi, start, start + len); +__check_sit_bitmap (sbi, lstart, lstart + len); bio->bi_private = dc; bio->bi_end_io = f2fs_submit_discard_endio;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 186/321 f2fs: fix to dirty inode synchronously
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit b32e019049e959ee10ec359893c9dd5d057dad55 ]
If user change inode's i_flags via ioctl, let's add it into global dirty list, so that checkpoint can guarantee its persistence before fsync, it can make checkpoint keeping strong consistency.
--- fs/f2fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/file.c +1 -1
@@ -1667,7 +1667,7 @@ static int __f2fs_ioc_setflags(struct inode *inode, unsigned int flags) inode->i_ctime =current_time (inode);f2fs_set_inode_flags (inode); -f2fs_mark_inode_dirty_sync (inode, false); +f2fs_mark_inode_dirty_sync (inode, true);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 187/321 um: Include sys/uio.h to have writev()
In reply to Greg Kroah-HartmanFrom: Richard Weinberger <[email protected]>
[ Upstream commit 0053102a869f1b909904b1b85ac282e2744deaab ]
sys/uio.h gives us writev(), otherwise the build might fail on some systems.
--- arch/um/drivers/vector_user.c | 1 + 1 file changed, 1 insertion(+)
arch/um/drivers/vector_user.c +1 -0
@@ -30,6 +30,7 @@#include <stdlib.h> #include <os.h> #include <um_malloc.h> +#include <sys/uio.h> #include "vector_user.h" #define ID_GRE 0
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 188/321 um: Make GCOV depend on !KCOV
In reply to Greg Kroah-HartmanFrom: Richard Weinberger <[email protected]>
[ Upstream commit 550ed0e2036663b35cec12374b835444f9c60454 ]
Both do more or less the same thing and are mutually exclusive. If both are enabled the build will fail.
Sooner or later we can kill UML's GCOV.
--- arch/um/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
arch/um/Kconfig.debug +1 -0
@@ -16,6 +16,7 @@ config GPROF config GCOV bool "Enable gcov support" depends on DEBUG_INFO + depends on !KCOV help This option allows developers to retrieve coverage data from a UML session.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 189/321 net: (cpts) fix a missing check of clk_prepare
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit 2d822f2dbab7f4c820f72eb8570aacf3f35855bd ]
clk_prepare() could fail, so let's check its status, and if it fails, return its error code upstream.
--- drivers/net/ethernet/ti/cpts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpts.c +3 -1
@@ -572,7 +572,9 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs,return ERR_CAST (cpts->refclk); } -clk_prepare (cpts->refclk); + ret =clk_prepare (cpts->refclk); +if (ret) +return ERR_PTR (ret); cpts->cc.read = cpts_systim_read; cpts->cc.mask =CLOCKSOURCE_MASK (32 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 190/321 net: stmicro: fix a missing check of clk_prepare
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit f86a3b83833e7cfe558ca4d70b64ebc48903efec ]
clk_prepare() could fail, so let's check its status, and if it fails, return its error code upstream.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +3 -1
@@ -59,7 +59,9 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) gmac->clk_enabled =1 ; }else {clk_set_rate (gmac->tx_clk,SUN7I_GMAC_MII_RATE ); -clk_prepare (gmac->tx_clk); + ret =clk_prepare (gmac->tx_clk); +if (ret) +return ret; }return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 191/321 net: dsa: bcm_sf2: Propagate error value from mdio_write
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit e49505f7255be8ced695919c08a29bf2c3d79616 ]
Both bcm_sf2_sw_indir_rw and mdiobus_write_nested could fail, so let's return their error codes upstream.
--- drivers/net/dsa/bcm_sf2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/dsa/bcm_sf2.c +3 -4
@@ -309,11 +309,10 @@ static int bcm_sf2_sw_mdio_write(struct mii_bus *bus, int addr, int regnum,* send them to our master MDIO bus controller */ if (addr ==BRCM_PSEUDO_PHY_ADDR && priv->indir_phy_mask &BIT (addr)) -bcm_sf2_sw_indir_rw (priv,0 , addr, regnum, val); +return bcm_sf2_sw_indir_rw (priv,0 , addr, regnum, val);else -mdiobus_write_nested (priv->master_mii_bus, addr, regnum, val); - -return 0 ; +return mdiobus_write_nested (priv->master_mii_bus, addr, + regnum, val); }static irqreturn_t bcm_sf2_switch_0_isr (int irq,void *dev_id)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 192/321 atl1e: checking the status of atl1e_write_phy_reg
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit ff07d48d7bc0974d4f96a85a4df14564fb09f1ef ]
atl1e_write_phy_reg() could fail. The fix issues an error message when it fails.
--- drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/atheros/atl1e/atl1e_main.c +3 -1
@@ -473,7 +473,9 @@ static void atl1e_mdio_write(struct net_device *netdev, int phy_id, {struct atl1e_adapter *adapter =netdev_priv (netdev); -atl1e_write_phy_reg (&adapter->hw, reg_num &MDIO_REG_ADDR_MASK , val); +if (atl1e_write_phy_reg (&adapter->hw, + reg_num &MDIO_REG_ADDR_MASK , val)) +netdev_err (netdev,"write phy register failed\n" ); } static int atl1e_mii_ioctl(struct net_device *netdev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 193/321 tipc: fix a missing check of genlmsg_put
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit 46273cf7e009231d2b6bc10a926e82b8928a9fb2 ]
genlmsg_put could fail. The fix inserts a check of its return value, and if it fails, returns -EMSGSIZE.
--- net/tipc/netlink_compat.c | 2 ++ 1 file changed, 2 insertions(+)
net/tipc/netlink_compat.c +2 -0
@@ -983,6 +983,8 @@ static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) hdr =genlmsg_put (args,0 ,0 , &tipc_genl_family,NLM_F_MULTI ,TIPC_NL_PUBL_GET ); +if (!hdr) +return -EMSGSIZE ; nest =nla_nest_start (args,TIPC_NLA_SOCK );if (!nest) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 194/321 net: marvell: fix a missing check of acpi_match_device
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit 92ee77d148bf06d8c52664be4d1b862583fd5c0e ]
When acpi_match_device fails, its return value is NULL. Directly using the return value without a check may result in a NULL-pointer dereference. The fix checks if acpi_match_device fails, and if so, returns -EINVAL.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +2 -0
@@ -5132,6 +5132,8 @@ static int mvpp2_probe(struct platform_device *pdev)if (has_acpi_companion (&pdev->dev)) { acpi_id =acpi_match_device (pdev->dev.driver->acpi_match_table, &pdev->dev); +if (!acpi_id) +return -EINVAL ; priv->hw_version = (unsigned long )acpi_id->driver_data; }else { priv->hw_version =
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 195/321 net/wan/fsl_ucc_hdlc: Avoid double free in ucc_hdlc_probe()
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
[ Upstream commit 40752b3eae29f8ca2378e978a02bd6dbeeb06d16 ]
This patch fixes potential double frees if register_hdlc_device() fails.
--- drivers/net/wan/fsl_ucc_hdlc.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wan/fsl_ucc_hdlc.c +0 -1
@@ -1113,7 +1113,6 @@ static int ucc_hdlc_probe(struct platform_device *pdev)if (register_hdlc_device (dev)) { ret = -ENOBUFS ;pr_err ("ucc_hdlc: unable to register hdlc device\n" ); -free_netdev (dev); goto free_dev; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 196/321 ocfs2: clear journal dirty flag after shutdown journal
In reply to Greg Kroah-HartmanFrom: Junxiao Bi <[email protected]>
[ Upstream commit d85400af790dba2aa294f0a77e712f166681f977 ]
Dirty flag of the journal should be cleared at the last stage of umount, if do it before jbd2_journal_destroy(), then some metadata in uncommitted transaction could be lost due to io error, but as dirty flag of journal was already cleared, we can't find that until run a full fsck. This may cause system panic or other corruption.
--- fs/ocfs2/journal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ocfs2/journal.c +2 -4
@@ -1018,7 +1018,8 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)mlog_errno (status); } -if (status ==0 ) { +/* Shutdown the kernel journal system */ +if (!jbd2_journal_destroy (journal->j_journal) && !status) {/* * Do not toggle if flush was unsuccessful otherwise * will leave dirty metadata in a "clean" journal
@@ -1027,9 +1028,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb)if (status <0 )mlog_errno (status); } - -/* Shutdown the kernel journal system */ -jbd2_journal_destroy (journal->j_journal); journal->j_journal =NULL ;OCFS2_I (inode)->ip_open_count--;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 197/321 vmscan: return NODE_RECLAIM_NOSCAN in node_reclaim() when CONFIG_NUMA is n
In reply to Greg Kroah-HartmanFrom: Wei Yang <[email protected]>
[ Upstream commit 8b09549c2bfd9f3f8f4cdad74107ef4f4ff9cdd7 ]
Commit fa5e084e43eb ("vmscan: do not unconditionally treat zones that fail zone_reclaim() as full") changed the return value of node_reclaim(). The original return value 0 means NODE_RECLAIM_SOME after this commit.
While the return value of node_reclaim() when CONFIG_NUMA is n is not changed. This will leads to call zone_watermark_ok() again.
This patch fixes the return value by adjusting to NODE_RECLAIM_NOSCAN. Since node_reclaim() is only called in page_alloc.c, move it to mm/internal.h.
--- include/linux/swap.h | 6 ------ mm/internal.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 6 deletions(-)
include/linux/swap.h +0 -6
@@ -371,14 +371,8 @@ extern unsigned long vm_total_pages;extern int node_reclaim_mode;extern int sysctl_min_unmapped_ratio;extern int sysctl_min_slab_ratio; -extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int );#else #define node_reclaim_mode 0 -static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, -unsigned int order) -{ -return 0 ; -}#endif extern int page_evictable (struct page *page);
mm/internal.h +10 -0
@@ -444,6 +444,16 @@ static inline void mminit_validate_memmodel_limits(unsigned long *start_pfn,#define NODE_RECLAIM_SOME 0#define NODE_RECLAIM_SUCCESS 1 +#ifdef CONFIG_NUMA +extern int node_reclaim (struct pglist_data *,gfp_t ,unsigned int ); +#else +static inline int node_reclaim (struct pglist_data *pgdat,gfp_t mask, +unsigned int order) +{ +return NODE_RECLAIM_NOSCAN ; +} +#endif +extern int hwpoison_filter (struct page *p);extern u32 hwpoison_filter_dev_major;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 198/321 mm/page_alloc.c: free order-0 pages through PCP in page_frag_free()
In reply to Greg Kroah-HartmanFrom: Aaron Lu <[email protected]>
[ Upstream commit 65895b67ad27df0f62bfaf82dd5622f95ea29196 ]
page_frag_free() calls __free_pages_ok() to free the page back to Buddy. This is OK for high order page, but for order-0 pages, it misses the optimization opportunity of using Per-Cpu-Pages and can cause zone lock contention when called frequently.
Pawel Staszewski recently shared his result of 'how Linux kernel handles normal traffic'[1] and from perf data, Jesper Dangaard Brouer found the lock contention comes from page allocator:
mlx5e_poll_tx_cq
|
--16.34%--napi_consume_skb
|
|--12.65%--__free_pages_ok
| |
| --11.86%--free_one_page
| |
| |--10.10%--queued_spin_lock_slowpath
| |
| --0.65%--_raw_spin_lock
|
|--1.55%--page_frag_free
|
--1.44%--skb_release_dataJesper explained how it happened: mlx5 driver RX-page recycle mechanism is not effective in this workload and pages have to go through the page allocator. The lock contention happens during mlx5 DMA TX completion cycle. And the page allocator cannot keep up at these speeds.[2]
I thought that __free_pages_ok() are mostly freeing high order pages and thought this is an lock contention for high order pages but Jesper explained in detail that __free_pages_ok() here are actually freeing order-0 pages because mlx5 is using order-0 pages to satisfy its page pool allocation request.[3]
The free path as pointed out by Jesper is:skb_free_head()
-> skb_free_frag()
-> page_frag_free()
And the pages being freed on this path are order-0 pages.
Fix this by doing similar things as in __page_frag_cache_drain() - send the being freed page to PCP if it's an order-0 page, or directly to Buddy if it is a high order page.
With this change, Paweł hasn't noticed lock contention yet in his workload and Jesper has noticed a 7% performance improvement using a micro benchmark and lock contention is gone. Ilias' test on a 'low' speed 1Gbit interface on an cortex-a53 shows ~11% performance boost testing with 64byte packets and __free_pages_ok() disappeared from perf top.
[1]: https://www.spinics.net/lists/netdev/msg531362.html
[2]: https://www.spinics.net/lists/netdev/msg531421.html
[3]: https://www.spinics.net/lists/netdev/msg531556.html
--- mm/page_alloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
mm/page_alloc.c +8 -2
@@ -4581,8 +4581,14 @@ void page_frag_free(void *addr) {struct page *page =virt_to_head_page (addr); -if (unlikely (put_page_testzero (page))) -__free_pages_ok (page,compound_order (page)); +if (unlikely (put_page_testzero (page))) { +unsigned int order =compound_order (page); + +if (order ==0 )/* Via pcp? */ +free_unref_page (page); +else +__free_pages_ok (page, order); + } }EXPORT_SYMBOL (page_frag_free);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 199/321 mm/page_alloc.c: use a single function to free page
In reply to Greg Kroah-HartmanFrom: Aaron Lu <[email protected]>
[ Upstream commit 742aa7fb52c56fb3b307e704f93e67b698959cc2 ]
There are multiple places of freeing a page, they all do the same things so a common function can be used to reduce code duplicate.
It also avoids bug fixed in one function but left in another.
--- mm/page_alloc.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
mm/page_alloc.c +14 -23
@@ -4451,16 +4451,19 @@ unsigned long get_zeroed_page(gfp_t gfp_mask) }EXPORT_SYMBOL (get_zeroed_page); -void __free_pages (struct page *page,unsigned int order) +static inline void free_the_page (struct page *page,unsigned int order) { -if (put_page_testzero (page)) { -if (order ==0 ) -free_unref_page (page); -else -__free_pages_ok (page, order); - } +if (order ==0 )/* Via pcp? */ +free_unref_page (page); +else +__free_pages_ok (page, order); } +void __free_pages (struct page *page,unsigned int order) +{ +if (put_page_testzero (page)) +free_the_page (page, order); +}EXPORT_SYMBOL (__free_pages);void free_pages (unsigned long addr,unsigned int order)
@@ -4509,14 +4512,8 @@ void __page_frag_cache_drain(struct page *page, unsigned int count) {VM_BUG_ON_PAGE (page_ref_count (page) ==0 , page); -if (page_ref_sub_and_test (page, count)) { -unsigned int order =compound_order (page); - -if (order ==0 ) -free_unref_page (page); -else -__free_pages_ok (page, order); - } +if (page_ref_sub_and_test (page, count)) +free_the_page (page,compound_order (page)); }EXPORT_SYMBOL (__page_frag_cache_drain);
@@ -4581,14 +4578,8 @@ void page_frag_free(void *addr) {struct page *page =virt_to_head_page (addr); -if (unlikely (put_page_testzero (page))) { -unsigned int order =compound_order (page); - -if (order ==0 )/* Via pcp? */ -free_unref_page (page); -else -__free_pages_ok (page, order); - } +if (unlikely (put_page_testzero (page))) +free_the_page (page,compound_order (page)); }EXPORT_SYMBOL (page_frag_free);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 200/321 mm/page_alloc.c: deduplicate __memblock_free_early() and memblock_free()
In reply to Greg Kroah-HartmanFrom: Wentao Wang <[email protected]>
[ Upstream commit d31cfe7bff9109476da92c245b56083e9b48d60a ]
--- mm/memblock.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
mm/memblock.c +1 -6
@@ -1537,12 +1537,7 @@ void * __init memblock_virt_alloc_try_nid(*/ void __init __memblock_free_early (phys_addr_t base,phys_addr_t size) { -phys_addr_t end = base + size -1 ; - -memblock_dbg ("%s: [%pa-%pa] %pF\n" , - __func__, &base, &end, (void *)_RET_IP_); -kmemleak_free_part_phys (base, size); -memblock_remove_range (&memblock.reserved, base, size); +memblock_free (base, size); }/**
Signature · 1 line
2.20.1
Re: [PATCH 4.19 200/321] mm/page_alloc.c: deduplicate __memblock_free_early() and memblock_free()
Hi!
Quoted 7 lines · Greg Kroah-Hartman
From: Wentao Wang <[email protected]>
[ Upstream commit
d31cfe7bff9109476da92c245b56083e9b48d60a]mm/memblock.c +0
-0@@ -1537,12 +1537,7 @@ void * __init memblock_virt_alloc_try_nid(*/
mm/memblock.c void * __init memblock_virt_alloc_try_nid( · line 1541
Quoted 10 lines
mm/memblock.c +1
-6void __init __memblock_free_early (phys_addr_t base,phys_addr_t size) { -phys_addr_t end = base + size -1 ; - -memblock_dbg ("%s: [%pa-%pa] %pF\n" , - __func__, &base, &end, (void *)_RET_IP_); -kmemleak_free_part_phys (base, size); -memblock_remove_range (&memblock.reserved, base, size); +memblock_free (base, size); }
This makes the memblock_dbg() less useful: _RET_IP_ will now be one of __memblock_free_early(), not of the original caller.
That may be okay, but I guess it should be mentioned in changelog, and I don't really see why it is queued for -stable.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 200/321] mm/page_alloc.c: deduplicate __memblock_free_early() and memblock_free()
Quoted 23 lines · Pavel Machek
Hi!
Quoted 7 lines · Greg Kroah-Hartman
From: Wentao Wang <[email protected]>
[ Upstream commit
d31cfe7bff9109476da92c245b56083e9b48d60a]mm/memblock.c +0
-0@@ -1537,12 +1537,7 @@ void * __init memblock_virt_alloc_try_nid(*/ mm/memblock.c void * __init memblock_virt_alloc_try_nid( · line 1541
Quoted 10 lines
mm/memblock.c +1
-6void __init __memblock_free_early (phys_addr_t base,phys_addr_t size) { -phys_addr_t end = base + size -1 ; - -memblock_dbg ("%s: [%pa-%pa] %pF\n" , - __func__, &base, &end, (void *)_RET_IP_); -kmemleak_free_part_phys (base, size); -memblock_remove_range (&memblock.reserved, base, size); +memblock_free (base, size); }This makes the
memblock_dbg()less useful: _RET_IP_ will now be one of__memblock_free_early(), not of the original caller.
Quoted 2 lines
That may be okay, but I guess it should be mentioned in changelog, and I don't really see why it is queued for -stable.
Not sure why this one was picked for -stable, but in upstream there is a followup commit 4d72868c8f7c ("memblock: replace usage of __memblock_free_early() with memblock_free()") that completely eliminates __memblock_free_early(). IMHO it would make sense to either to take both or to drop both.
Quoted 5 lines
Best regards,
PavelSignature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Signature · 2 lines
Sincerely yours, Mike.
A message that is not in the archive (sent off-list or not yet received): CACzRS4cYJkJAhOdm+qf55H7O4S5HiQEe_fguJGx-mZYJzz62ug@mail.gmail.com
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 200/321] mm/page_alloc.c: deduplicate __memblock_free_early() and memblock_free()
Quoted 36 lines · 王文涛
Yes, Mike's follow up fix should be picked too with this change.
Quoted 32 lines · Mike Rapoport
Quoted 23 lines · Pavel Machek
Hi!
Quoted 7 lines · Greg Kroah-Hartman
From: Wentao Wang <[email protected]>
[ Upstream commit
d31cfe7bff9109476da92c245b56083e9b48d60a]mm/memblock.c +0
-0@@ -1537,12 +1537,7 @@ void * __init memblock_virt_alloc_try_nid(*/ mm/memblock.c void * __init memblock_virt_alloc_try_nid( · line 1541
Quoted 10 lines
mm/memblock.c +1
-6void __init __memblock_free_early (phys_addr_t base,phys_addr_t size) { -phys_addr_t end = base + size -1 ; - -memblock_dbg ("%s: [%pa-%pa] %pF\n" , - __func__, &base, &end, (void *)_RET_IP_); -kmemleak_free_part_phys (base, size); -memblock_remove_range (&memblock.reserved, base, size); +memblock_free (base, size); }This makes the
memblock_dbg()less useful: _RET_IP_ will now be one of__memblock_free_early(), not of the original caller.Quoted 2 lines
That may be okay, but I guess it should be mentioned in changelog, and I don't really see why it is queued for -stable.
Not sure why this one was picked for -stable, but in upstream there is a followup commit
4d72868c8f7c("memblock: replace usage of__memblock_free_early()withmemblock_free()") that completely eliminates__memblock_free_early(). IMHO it would make sense to either to take both or to drop both.
This commit does not apply to the 4.19.y tree :(
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 200/321] mm/page_alloc.c: deduplicate __memblock_free_early() and memblock_free()
In reply to Mike RapoportQuoted 24 lines · Mike Rapoport
Quoted 23 lines · Pavel Machek
Hi!
Quoted 7 lines · Greg Kroah-Hartman
From: Wentao Wang <[email protected]>
[ Upstream commit
d31cfe7bff9109476da92c245b56083e9b48d60a]mm/memblock.c +0
-0@@ -1537,12 +1537,7 @@ void * __init memblock_virt_alloc_try_nid(*/ mm/memblock.c void * __init memblock_virt_alloc_try_nid( · line 1541
Quoted 10 lines
mm/memblock.c +1
-6void __init __memblock_free_early (phys_addr_t base,phys_addr_t size) { -phys_addr_t end = base + size -1 ; - -memblock_dbg ("%s: [%pa-%pa] %pF\n" , - __func__, &base, &end, (void *)_RET_IP_); -kmemleak_free_part_phys (base, size); -memblock_remove_range (&memblock.reserved, base, size); +memblock_free (base, size); }This makes the
memblock_dbg()less useful: _RET_IP_ will now be one of__memblock_free_early(), not of the original caller.
Quoted 8 lines
Quoted 2 lines
That may be okay, but I guess it should be mentioned in changelog, and I don't really see why it is queued for -stable.
Not sure why this one was picked for -stable, but in upstream there is a followup commit
4d72868c8f7c("memblock: replace usage of__memblock_free_early()withmemblock_free()") that completely eliminates__memblock_free_early(). IMHO it would make sense to either to take both or to drop both.
Ok, I'll try, but that commit does not apply cleanly to 5.0, so it might take a bit of time...
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 201/321 tools/vm/page-types.c: fix "kpagecount returned fewer pages than expected" failures
In reply to Greg Kroah-HartmanFrom: Anthony Yznaga <[email protected]>
[ Upstream commit b6fb87b8e3ff1ef6bcf68470f24a97c984554d5a ]
Because kpagecount_read() fakes success if map counts are not being collected, clamp the page count passed to it by walk_pfn() to the pages value returned by the preceding call to kpageflags_read().
--- tools/vm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/vm/page-types.c +1 -1
@@ -701,7 +701,7 @@ static void walk_pfn(unsigned long voffset,if (kpagecgroup_read (cgi, index, pages) != pages)fatal ("kpagecgroup returned fewer pages than expected" ); -if (kpagecount_read (cnt, index, batch) != pages) +if (kpagecount_read (cnt, index, pages) != pages)fatal ("kpagecount returned fewer pages than expected" );for (i =0 ; i < pages; i++)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 202/321 netfilter: nf_tables: fix a missing check of nla_put_failure
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit eb8950861c1bfd3eecc8f6faad213e3bca0dc395 ]
If nla_nest_start() may fail. The fix checks its return value and goes to nla_put_failure if it fails.
--- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nf_tables_api.c +2 -0
@@ -5737,6 +5737,8 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net, goto nla_put_failure; nest =nla_nest_start (skb,NFTA_FLOWTABLE_HOOK ); +if (!nest) + goto nla_put_failure;if (nla_put_be32 (skb,NFTA_FLOWTABLE_HOOK_NUM ,htonl (flowtable->hooknum)) ||nla_put_be32 (skb,NFTA_FLOWTABLE_HOOK_PRIORITY ,htonl (flowtable->priority))) goto nla_put_failure;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 203/321 xprtrdma: Prevent leak of rpcrdma_rep objects
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 07e10308ee5da8e6132e0b737ece1c99dd651fb6 ]
If a reply has been processed but the RPC is later retransmitted anyway, the req->rl_reply field still contains the only pointer to the old rpcrdma rep. When the next reply comes in, the reply handler will stomp on the rl_reply field, leaking the old rep.
A trace event is added to capture such leaks.
This problem seems to be worsened by the restructuring of the RPC Call path in v4.20. Fully addressing this issue will require at least a re-architecture of the disconnect logic, which is not appropriate during -rc.
--- include/trace/events/rpcrdma.h | 28 ++++++++++++++++++++++++++++ net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++++ 2 files changed, 32 insertions(+)
include/trace/events/rpcrdma.h +28 -0
@@ -917,6 +917,34 @@ TRACE_EVENT(xprtrdma_cb_setup,DEFINE_CB_EVENT (xprtrdma_cb_call);DEFINE_CB_EVENT (xprtrdma_cb_reply); +TRACE_EVENT (xprtrdma_leaked_rep, +TP_PROTO ( + const struct rpc_rqst *rqst, + const struct rpcrdma_rep *rep + ), + +TP_ARGS (rqst, rep), + +TP_STRUCT__entry ( + __field(unsigned int, task_id) + __field(unsigned int, client_id) + __field(u32, xid) + __field(const void *, rep) + ), + +TP_fast_assign ( + __entry->task_id = rqst->rq_task->tk_pid; + __entry->client_id = rqst->rq_task->tk_client->cl_clid; + __entry->xid = be32_to_cpu(rqst->rq_xid); + __entry->rep = rep; + ), + +TP_printk ("task:%u@%u xid=0x%08x rep=%p" , + __entry->task_id, __entry->client_id, __entry->xid, + __entry->rep + ) +); +/** ** Server-side RPC/RDMA events **/
net/sunrpc/xprtrdma/rpc_rdma.c +4 -0
@@ -1360,6 +1360,10 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep)spin_unlock (&xprt->recv_lock); req =rpcr_to_rdmar (rqst); +if (req->rl_reply) { +trace_xprtrdma_leaked_rep (rqst, req->rl_reply); +rpcrdma_recv_buffer_put (req->rl_reply); + } req->rl_reply = rep; rep->rr_rqst = rqst;clear_bit (RPCRDMA_REQ_F_PENDING , &req->rl_flags);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 204/321 infiniband: bnxt_re: qplib: Check the return value of send_message
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 94edd87a1c59f3efa6fdf4e98d6d492e6cec6173 ]
In bnxt_qplib_map_tc2cos(), bnxt_qplib_rcfw_send_message() can return an error value but it is lost. Propagate this error to the callers.
--- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_sp.c +2 -3
@@ -775,9 +775,8 @@ int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids) req.cos0 =cpu_to_le16 (cids[0 ]); req.cos1 =cpu_to_le16 (cids[1 ]); -bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp,NULL , -0 ); -return 0 ; +return bnxt_qplib_rcfw_send_message (rcfw, (void *)&req, (void *)&resp, +NULL ,0 ); } int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 205/321 infiniband/qedr: Potential null ptr dereference of qp
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 9c6260de505b63638dd86fcc33849b17f6146d94 ]
idr_find() may fail and return a NULL pointer. The fix checks the return value of the function and returns an error in case of NULL.
--- drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/qedr/qedr_iw_cm.c +2 -0
@@ -492,6 +492,8 @@ int qedr_iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)int i; qp =idr_find (&dev->qpidr.idr, conn_param->qpn); +if (unlikely (!qp)) +return -EINVAL ; laddr = (struct sockaddr_in *)&cm_id->m_local_addr; raddr = (struct sockaddr_in *)&cm_id->m_remote_addr;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 206/321 firmware: arm_sdei: fix wrong of_node_put() in init function
In reply to Greg Kroah-HartmanFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit c3790b3799f8d75d93d26f6fd7bb569fc8c8b0cb ]
After finding a "firmware" dt node arm_sdei tries to match it's compatible string with it. To do so it's calling of_find_matching_node() which already takes care of decreasing the refcount on the "firmware" node. We are then incorrectly decreasing the refcount on that node again.
This patch removes the unwarranted call to of_node_put().
--- drivers/firmware/arm_sdei.c | 1 - 1 file changed, 1 deletion(-)
drivers/firmware/arm_sdei.c +0 -1
@@ -1017,7 +1017,6 @@ static bool __init sdei_present_dt(void)return false; np =of_find_matching_node (fw_np, sdei_of_match); -of_node_put (fw_np);if (!np)return false;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 207/321 firmware: arm_sdei: Fix DT platform device creation
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
[ Upstream commit acafce48b07bf5f9994a38e7fe237193d43d092e ]
It turns out the dt-probing part of this wasn't tested properly after it was merged. commit 3aa0582fdb82 ("of: platform: populate /firmware/ node from of_platform_default_populate_init()") changed the core-code to generate the platform devices, meaning the driver's attempt fails, and it bails out.
Fix this by removing the manual platform-device creation for DT systems, core code has always done this for us.
--- drivers/firmware/arm_sdei.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/firmware/arm_sdei.c +0 -5
@@ -1009,7 +1009,6 @@ static struct platform_driver sdei_driver = {static bool __init sdei_present_dt (void ) { -struct platform_device *pdev;struct device_node *np, *fw_np; fw_np =of_find_node_by_name (NULL ,"firmware" );
@@ -1019,11 +1018,7 @@ static bool __init sdei_present_dt(void) np =of_find_matching_node (fw_np, sdei_of_match);if (!np)return false; - - pdev =of_platform_device_create (np, sdei_driver.driver.name,NULL );of_node_put (np); -if (!pdev) -return false;return true; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 208/321 lib/genalloc.c: fix allocation of aligned buffer from non-aligned chunk
In reply to Greg Kroah-HartmanFrom: Alexey Skidanov <[email protected]>
[ Upstream commit 52fbf1134d479234d7e64ba9dcbaea23405f229e ]
gen_pool_alloc_algo() uses different allocation functions implementing different allocation algorithms. With gen_pool_first_fit_align() allocation function, the returned address should be aligned on the requested boundary.
If chunk start address isn't aligned on the requested boundary, the returned address isn't aligned too. The only way to get properly aligned address is to initialize the pool with chunks aligned on the requested boundary. If want to have an ability to allocate buffers aligned on different boundaries (for example, 4K, 1MB, ...), the chunk start address should be aligned on the max possible alignment.
This happens because gen_pool_first_fit_align() looks for properly aligned memory block without taking into account the chunk start address alignment.
To fix this, we provide chunk start address to gen_pool_first_fit_align() and change its implementation such that it starts looking for properly aligned block with appropriate offset (exactly as is done in CMA).
--- include/linux/genalloc.h | 13 +++++++------ lib/genalloc.c | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-)
include/linux/genalloc.h +7 -6
@@ -51,7 +51,8 @@ typedef unsigned long (*genpool_algo_t)(unsigned long *map,unsigned long size, unsigned long start, unsigned int nr, - void *data, struct gen_pool *pool); + void *data, struct gen_pool *pool, + unsigned long start_addr);/* * General purpose special memory pool descriptor.
@@ -131,24 +132,24 @@ extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,extern unsigned long gen_pool_first_fit (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, -struct gen_pool *pool); +struct gen_pool *pool,unsigned long start_addr);extern unsigned long gen_pool_fixed_alloc (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr, -void *data,struct gen_pool *pool); +void *data,struct gen_pool *pool,unsigned long start_addr);extern unsigned long gen_pool_first_fit_align (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr, -void *data,struct gen_pool *pool); +void *data,struct gen_pool *pool,unsigned long start_addr);extern unsigned long gen_pool_first_fit_order_align (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr, -void *data,struct gen_pool *pool); +void *data,struct gen_pool *pool,unsigned long start_addr);extern unsigned long gen_pool_best_fit (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, -struct gen_pool *pool); +struct gen_pool *pool,unsigned long start_addr); extern struct gen_pool *devm_gen_pool_create(struct device *dev,
lib/genalloc.c +12 -8
@@ -311,7 +311,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, end_bit =chunk_size (chunk) >> order; retry: start_bit =algo (chunk->bits, end_bit, start_bit, - nbits, data, pool); + nbits, data, pool, chunk->start_addr);if (start_bit >= end_bit)continue ; remain =bitmap_set_ll (chunk->bits, start_bit, nbits);
@@ -525,7 +525,7 @@ EXPORT_SYMBOL(gen_pool_set_algo);*/ unsigned long gen_pool_first_fit (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, -struct gen_pool *pool) +struct gen_pool *pool,unsigned long start_addr) {return bitmap_find_next_zero_area (map, size, start, nr,0 ); }
@@ -543,16 +543,19 @@ EXPORT_SYMBOL(gen_pool_first_fit);*/ unsigned long gen_pool_first_fit_align (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, -struct gen_pool *pool) +struct gen_pool *pool,unsigned long start_addr) {struct genpool_data_align *alignment; -unsigned long align_mask; +unsigned long align_mask, align_off;int order; alignment = data; order = pool->min_alloc_order; align_mask = ((alignment->align + (1UL << order) -1 ) >> order) -1 ; -return bitmap_find_next_zero_area (map, size, start, nr, align_mask); + align_off = (start_addr & (alignment->align -1 )) >> order; + +return bitmap_find_next_zero_area_off (map, size, start, nr, + align_mask, align_off); }EXPORT_SYMBOL (gen_pool_first_fit_align);
@@ -567,7 +570,7 @@ EXPORT_SYMBOL(gen_pool_first_fit_align);*/ unsigned long gen_pool_fixed_alloc (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, -struct gen_pool *pool) +struct gen_pool *pool,unsigned long start_addr) {struct genpool_data_fixed *fixed_data;int order;
@@ -601,7 +604,8 @@ EXPORT_SYMBOL(gen_pool_fixed_alloc);*/ unsigned long gen_pool_first_fit_order_align (unsigned long *map,unsigned long size,unsigned long start, -unsigned int nr,void *data,struct gen_pool *pool) +unsigned int nr,void *data,struct gen_pool *pool, +unsigned long start_addr) {unsigned long align_mask =roundup_pow_of_two (nr) -1 ;
@@ -624,7 +628,7 @@ EXPORT_SYMBOL(gen_pool_first_fit_order_align);*/ unsigned long gen_pool_best_fit (unsigned long *map,unsigned long size,unsigned long start,unsigned int nr,void *data, -struct gen_pool *pool) +struct gen_pool *pool,unsigned long start_addr) {unsigned long start_bit = size;unsigned long len = size +1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 209/321 lib/genalloc.c: use vzalloc_node() to allocate the bitmap
In reply to Greg Kroah-HartmanFrom: Huang Shijie <[email protected]>
[ Upstream commit 6862d2fc81859f88c1f3f660886427893f2b4f3f ]
Some devices may have big memory on chip, such as over 1G. In some cases, the nbytes maybe bigger then 4M which is the bounday of the memory buddy system (4K default).
So use vzalloc_node() to allocate the bitmap. Also use vfree to free it.
--- lib/genalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/genalloc.c +2 -2
@@ -187,7 +187,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phyint nbytes =sizeof (struct gen_pool_chunk ) +BITS_TO_LONGS (nbits) *sizeof (long ); - chunk =kzalloc_node (nbytes,GFP_KERNEL , nid); + chunk =vzalloc_node (nbytes, nid);if (unlikely (chunk ==NULL ))return -ENOMEM ;
@@ -251,7 +251,7 @@ void gen_pool_destroy(struct gen_pool *pool) bit =find_next_bit (chunk->bits, end_bit,0 );BUG_ON (bit < end_bit); -kfree (chunk); +vfree (chunk); }kfree_const (pool->name);kfree (pool);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 210/321 fork: fix some -Wmissing-prototypes warnings
In reply to Greg Kroah-HartmanFrom: Yi Wang <[email protected]>
[ Upstream commit fb5bf31722d0805a3f394f7d59f2e8cd07acccb7 ]
We get a warning when building kernel with W=1:
kernel/fork.c:167:13: warning: no previous prototype for arch_release_thread_stack' [-Wmissing-prototypes] kernel/fork.c:779:13: warning: no previous prototype for fork_init' [-Wmissing-prototypes]
Add the missing declaration in head file to fix this.
Also, remove arch_release_thread_stack() completely because no arch seems to implement it since bb9d81264 (arch: remove tile port).
--- include/linux/sched/task.h | 2 ++ init/main.c | 1 - kernel/fork.c | 5 ----- 3 files changed, 2 insertions(+), 6 deletions(-)
include/linux/sched/task.h +2 -0
@@ -39,6 +39,8 @@ void __noreturn do_task_dead(void);extern void proc_caches_init (void ); +extern void fork_init (void ); +extern void release_task (struct task_struct * p);#ifdef CONFIG_HAVE_COPY_THREAD_TLS
init/main.c +0 -1
@@ -105,7 +105,6 @@static int kernel_init (void *);extern void init_IRQ (void ); -extern void fork_init (void );extern void radix_tree_init (void );/*
kernel/fork.c +0 -5
@@ -163,10 +163,6 @@ static inline void free_task_struct(struct task_struct *tsk) }#endif -void __weak arch_release_thread_stack (unsigned long *stack) -{ -} -#ifndef CONFIG_ARCH_THREAD_STACK_ALLOCATOR /*
@@ -376,7 +372,6 @@ static void release_task_stack(struct task_struct *tsk)return ;/* Better to leak the stack than to free prematurely */ account_kernel_stack (tsk,-1 ); -arch_release_thread_stack (tsk->stack);free_thread_stack (tsk); tsk->stack =NULL ;#ifdef CONFIG_VMAP_STACK
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 211/321 drivers/base/platform.c: kmemleak ignore a known leak
In reply to Greg Kroah-HartmanFrom: Qian Cai <[email protected]>
[ Upstream commit 967d3010df8b6f6f9aa95c198edc5fe3646ebf36 ]
unreferenced object 0xffff808ec6dc5a80 (size 128):
comm "swapper/0", pid 1, jiffies 4294938063 (age 2560.530s) hex dump (first 32 bytes):
ff ff ff ff 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b ........kkkkkkkk 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
backtrace:
[<00000000476dcf8c>] kmem_cache_alloc_trace+0x430/0x500
[<000000004f708d37>] platform_device_register_full+0xbc/0x1e8
[<000000006c2a7ec7>] acpi_create_platform_device+0x370/0x450
[<00000000ef135642>] acpi_default_enumeration+0x34/0x78
[<000000003bd9a052>] acpi_bus_attach+0x2dc/0x3e0
[<000000003cf4f7f2>] acpi_bus_attach+0x108/0x3e0
[<000000003cf4f7f2>] acpi_bus_attach+0x108/0x3e0
[<000000002968643e>] acpi_bus_scan+0xb0/0x110
[<0000000010dd0bd7>] acpi_scan_init+0x1a8/0x410
[<00000000965b3c5a>] acpi_init+0x408/0x49c
[<00000000ed4b9fe2>] do_one_initcall+0x178/0x7f4
[<00000000a5ac5a74>] kernel_init_freeable+0x9d4/0xa9c
[<0000000070ea6c15>] kernel_init+0x18/0x138
[<00000000fb8fff06>] ret_from_fork+0x10/0x1c
[<0000000041273a0d>] 0xffffffffffffffffThen, faddr2line pointed out this line,
/*
* This memory isn't freed when the device is put,
* I don't have a nice idea for that though. Conceptually
* dma_mask in struct device should not be a pointer.
* See http://thread.gmane.org/gmane.linux.kernel.pci/9081
*/pdev->dev.dma_mask =
kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
Since this leak has existed for more than 8 years and it does not reference other parts of the memory, let kmemleak ignore it, so users don't need to waste time reporting this in the future.
--- drivers/base/platform.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/platform.c +3 -0
@@ -26,6 +26,7 @@#include <linux/clk/clk-conf.h> #include <linux/limits.h> #include <linux/property.h> +#include <linux/kmemleak.h> #include "base.h" #include "power/power.h"
@@ -525,6 +526,8 @@ struct platform_device *platform_device_register_full(if (!pdev->dev.dma_mask) goto err; +kmemleak_ignore (pdev->dev.dma_mask); + *pdev->dev.dma_mask = pdevinfo->dma_mask; pdev->dev.coherent_dma_mask = pdevinfo->dma_mask; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 212/321 lib/genalloc.c: include vmalloc.h
In reply to Greg Kroah-HartmanFrom: Olof Johansson <[email protected]>
[ Upstream commit 35004f2e55807a1a1491db24ab512dd2f770a130 ]
Fixes build break on most ARM/ARM64 defconfigs:
lib/genalloc.c: In function 'gen_pool_add_virt':
lib/genalloc.c:190:10: error: implicit declaration of function 'vzalloc_node'; did you mean 'kzalloc_node'? lib/genalloc.c:190:8: warning: assignment to 'struct gen_pool_chunk *' from 'int' makes pointer from integer without a cast [-Wint-conversion] lib/genalloc.c: In function 'gen_pool_destroy':
lib/genalloc.c:254:3: error: implicit declaration of function 'vfree'; did you mean 'kfree'?
--- lib/genalloc.c | 1 + 1 file changed, 1 insertion(+)
lib/genalloc.c +1 -0
@@ -35,6 +35,7 @@#include <linux/interrupt.h> #include <linux/genalloc.h> #include <linux/of_device.h> +#include <linux/vmalloc.h> static inline size_t chunk_size (const struct gen_pool_chunk *chunk) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 213/321 mtd: Check add_mtd_device() ret code
In reply to Greg Kroah-HartmanFrom: Boris Brezillon <[email protected]>
[ Upstream commit 2b6f0090a3335b7bdd03ca520c35591159463041 ]
add_mtd_device() can fail. We should always check its return value and gracefully handle the failure case. Fix the call sites where this not done (in mtdpart.c) and add a __must_check attribute to the prototype to avoid this kind of mistakes.
--- drivers/mtd/mtdcore.h | 2 +- drivers/mtd/mtdpart.c | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-)
drivers/mtd/mtdcore.h +1 -1
@@ -7,7 +7,7 @@extern struct mutex mtd_table_mutex;struct mtd_info *__mtd_next_device (int i); -int add_mtd_device (struct mtd_info *mtd); +int __must_check add_mtd_device (struct mtd_info *mtd);int del_mtd_device (struct mtd_info *mtd);int add_mtd_partitions (struct mtd_info *,const struct mtd_partition *,int );int del_mtd_partitions (struct mtd_info *);
drivers/mtd/mtdpart.c +31 -5
@@ -612,10 +612,22 @@ int mtd_add_partition(struct mtd_info *parent, const char *name,list_add (&new->list, &mtd_partitions);mutex_unlock (&mtd_partitions_mutex); -add_mtd_device (&new->mtd); + ret =add_mtd_device (&new->mtd); +if (ret) + goto err_remove_part;mtd_add_partition_attrs (new); +return 0 ; + +err_remove_part: +mutex_lock (&mtd_partitions_mutex); +list_del (&new->list); +mutex_unlock (&mtd_partitions_mutex); + +free_partition (new); +pr_info ("%s:%i\n" , __func__, __LINE__); +return ret; }EXPORT_SYMBOL_GPL (mtd_add_partition);
@@ -706,22 +718,31 @@ int add_mtd_partitions(struct mtd_info *master, {struct mtd_part *slave;uint64_t cur_offset =0 ; -int i; +int i, ret;printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n" , nbparts, master->name);for (i =0 ; i < nbparts; i++) { slave =allocate_partition (master, parts + i, i, cur_offset);if (IS_ERR (slave)) { -del_mtd_partitions (master); -return PTR_ERR (slave); + ret =PTR_ERR (slave); + goto err_del_partitions; }mutex_lock (&mtd_partitions_mutex);list_add (&slave->list, &mtd_partitions);mutex_unlock (&mtd_partitions_mutex); -add_mtd_device (&slave->mtd); + ret =add_mtd_device (&slave->mtd); +if (ret) { +mutex_lock (&mtd_partitions_mutex); +list_del (&slave->list); +mutex_unlock (&mtd_partitions_mutex); + +free_partition (slave); + goto err_del_partitions; + } +mtd_add_partition_attrs (slave);/* Look for subpartitions */ parse_mtd_partitions (&slave->mtd, parts[i].types,NULL );
@@ -730,6 +751,11 @@ int add_mtd_partitions(struct mtd_info *master, }return 0 ; + +err_del_partitions: +del_mtd_partitions (master); + +return ret; }static DEFINE_SPINLOCK (part_parser_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 214/321 tipc: fix memory leak in tipc_nl_compat_publ_dump
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit f87d8ad9233f115db92c6c087d58403b0009ed36 ]
There is a memory leak in case genlmsg_put fails.
Fix this by freeing *args* before return.
Addresses-Coverity-ID: 1476406 ("Resource leak")
--- net/tipc/netlink_compat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/netlink_compat.c +3 -1
@@ -983,8 +983,10 @@ static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock) hdr =genlmsg_put (args,0 ,0 , &tipc_genl_family,NLM_F_MULTI ,TIPC_NL_PUBL_GET ); -if (!hdr) +if (!hdr) { +kfree_skb (args);return -EMSGSIZE ; + } nest =nla_nest_start (args,TIPC_NLA_SOCK );if (!nest) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 215/321 net/core/neighbour: tell kmemleak about hash tables
In reply to Greg Kroah-HartmanFrom: Konstantin Khlebnikov <[email protected]>
[ Upstream commit 85704cb8dcfd88d351bfc87faaeba1c8214f3177 ]
This fixes false-positive kmemleak reports about leaked neighbour entries:
unreferenced object 0xffff8885c6e4d0a8 (size 1024):
comm "softirq", pid 0, jiffies 4294922664 (age 167640.804s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 20 2c f3 83 ff ff ff ff ........ ,......
08 c0 ef 5f 84 88 ff ff 01 8c 7d 02 01 00 00 00 ..._......}.....
backtrace:
[<00000000748509fe>] ip6_finish_output2+0x887/0x1e40
[<0000000036d7a0d8>] ip6_output+0x1ba/0x600
[<0000000027ea7dba>] ip6_send_skb+0x92/0x2f0
[<00000000d6e2111d>] udp_v6_send_skb.isra.24+0x680/0x15e0
[<000000000668a8be>] udpv6_sendmsg+0x18c9/0x27a0
[<000000004bd5fa90>] sock_sendmsg+0xb3/0xf0
[<000000008227b29f>] ___sys_sendmsg+0x745/0x8f0
[<000000008698009d>] __sys_sendmsg+0xde/0x170
[<00000000889dacf1>] do_syscall_64+0x9b/0x400
[<0000000081cdb353>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[<000000005767ed39>] 0xffffffffffffffff--- net/core/neighbour.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/core/neighbour.c +9 -4
@@ -18,6 +18,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/slab.h> +#include <linux/kmemleak.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -363,12 +364,14 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift) ret =kmalloc (sizeof (*ret),GFP_ATOMIC );if (!ret)return NULL ; -if (size <=PAGE_SIZE ) +if (size <=PAGE_SIZE ) { buckets =kzalloc (size,GFP_ATOMIC ); -else + }else { buckets = (struct neighbour __rcu **)__get_free_pages (GFP_ATOMIC | __GFP_ZERO,get_order (size)); +kmemleak_alloc (buckets, size,0 ,GFP_ATOMIC ); + }if (!buckets) {kfree (ret);return NULL ;
@@ -388,10 +391,12 @@ static void neigh_hash_free_rcu(struct rcu_head *head)size_t size = (1 << nht->hash_shift) *sizeof (struct neighbour *);struct neighbour __rcu **buckets = nht->hash_buckets; -if (size <=PAGE_SIZE ) +if (size <=PAGE_SIZE ) {kfree (buckets); -else + }else { +kmemleak_free (buckets);free_pages ((unsigned long )buckets,get_order (size)); + }kfree (nht); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 216/321 ata: ahci: mvebu: do Armada 38x configuration only on relevant SoCs
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
[ Upstream commit 96dbcb40e4b1a387cdb9b21f43638c759aebb5a4 ]
At the beginning, only Armada 38x SoCs where supported by the ahci_mvebu.c driver. Commit 15d3ce7b63bd ("ata: ahci_mvebu: add support for Armada 3700 variant") introduced Armada 3700 support. As opposed to Armada 38x SoCs, the 3700 variants do not have to configure mbus and the regret option. This patch took care of avoiding such configuration when not needed in the probe function, but failed to do the same in the resume path. While doing so looks harmless by experience, let's clean the driver logic and avoid doing this useless configuration with Armada 3700 SoCs.
Because the logic is very similar between these two places, it has been decided to factorize this code and put it in a "Armada 38x configuration function". This function is part of a new (per-compatible) platform data structure, so that the addition of such configuration function for Armada 3700 will be eased.
--- drivers/ata/ahci_mvebu.c | 68 ++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 17 deletions(-)
drivers/ata/ahci_mvebu.c +51 -17
@@ -28,6 +28,10 @@#define AHCI_WINDOW_BASE (win) (0x64 + ((win) << 4))#define AHCI_WINDOW_SIZE (win) (0x68 + ((win) << 4)) +struct ahci_mvebu_plat_data { +int (*plat_config)(struct ahci_host_priv *hpriv); +}; +static void ahci_mvebu_mbus_config (struct ahci_host_priv *hpriv,const struct mbus_dram_target_info *dram) {
@@ -62,6 +66,22 @@ static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv)writel (0x80 , hpriv->mmio +AHCI_VENDOR_SPECIFIC_0_DATA ); } +static int ahci_mvebu_armada_380_config (struct ahci_host_priv *hpriv) +{ +const struct mbus_dram_target_info *dram; +int rc =0 ; + + dram =mv_mbus_dram_info (); +if (dram) +ahci_mvebu_mbus_config (hpriv, dram); +else + rc = -ENODEV ; + +ahci_mvebu_regret_option (hpriv); + +return rc; +} +/** * ahci_mvebu_stop_engine *
@@ -126,13 +146,10 @@ static int ahci_mvebu_resume(struct platform_device *pdev) {struct ata_host *host =platform_get_drvdata (pdev);struct ahci_host_priv *hpriv = host->private_data; -const struct mbus_dram_target_info *dram; +const struct ahci_mvebu_plat_data *pdata = hpriv->plat_data; - dram =mv_mbus_dram_info (); -if (dram) -ahci_mvebu_mbus_config (hpriv, dram); - -ahci_mvebu_regret_option (hpriv); +if (pdata->plat_config) + pdata->plat_config (hpriv);return ahci_platform_resume_host (&pdev->dev); }
@@ -154,28 +171,31 @@ static struct scsi_host_template ahci_platform_sht = {static int ahci_mvebu_probe (struct platform_device *pdev) { +const struct ahci_mvebu_plat_data *pdata;struct ahci_host_priv *hpriv; -const struct mbus_dram_target_info *dram;int rc; + pdata =of_device_get_match_data (&pdev->dev); +if (!pdata) +return -EINVAL ; + hpriv =ahci_platform_get_resources (pdev,0 );if (IS_ERR (hpriv))return PTR_ERR (hpriv); + hpriv->plat_data = (void *)pdata; + rc =ahci_platform_enable_resources (hpriv);if (rc)return rc; hpriv->stop_engine = ahci_mvebu_stop_engine; -if (of_device_is_compatible (pdev->dev.of_node, -"marvell,armada-380-ahci" )) { - dram =mv_mbus_dram_info (); -if (!dram) -return -ENODEV ; - -ahci_mvebu_mbus_config (hpriv, dram); -ahci_mvebu_regret_option (hpriv); + pdata = hpriv->plat_data; +if (pdata->plat_config) { + rc = pdata->plat_config (hpriv); +if (rc) + goto disable_resources; } rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info,
@@ -190,9 +210,23 @@ disable_resources:return rc; } +static const struct ahci_mvebu_plat_data ahci_mvebu_armada_380_plat_data = { + .plat_config = ahci_mvebu_armada_380_config, +}; + +static const struct ahci_mvebu_plat_data ahci_mvebu_armada_3700_plat_data = { + .plat_config =NULL , +}; +static const struct of_device_id ahci_mvebu_of_match[] = { - { .compatible ="marvell,armada-380-ahci" , }, - { .compatible ="marvell,armada-3700-ahci" , }, + { + .compatible ="marvell,armada-380-ahci" , + .data = &ahci_mvebu_armada_380_plat_data, + }, + { + .compatible ="marvell,armada-3700-ahci" , + .data = &ahci_mvebu_armada_3700_plat_data, + }, { }, };MODULE_DEVICE_TABLE (of, ahci_mvebu_of_match);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 217/321 PCI/MSI: Return -ENOSPC from pci_alloc_irq_vectors_affinity()
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 77f88abd4a6f73a1a68dbdc0e3f21575fd508fc3 ]
The API of pci_alloc_irq_vectors_affinity() says it returns -ENOSPC if fewer than @min_vecs interrupt vectors are available for @dev.
However, if a device supports MSI-X but not MSI and a caller requests @min_vecs that can't be satisfied by MSI-X, we previously returned -EINVAL (from the failed attempt to enable MSI), not -ENOSPC.
When -ENOSPC is returned, callers may reduce the number IRQs they request and try again. Most callers can use the @min_vecs and @max_vecs parameters to avoid this retry loop, but that doesn't work when using IRQ affinity "nr_sets" because rebalancing the sets is driver-specific.
This return value bug has been present since pci_alloc_irq_vectors() was added in v4.10 by aff171641d18 ("PCI: Provide sensible IRQ vector alloc/free routines"), but it wasn't an issue because @min_vecs/@max_vecs removed the need for callers to iteratively reduce the number of IRQs requested and retry the allocation, so they didn't need to distinguish -ENOSPC from -EINVAL.
In v5.0, 6da4b3ab9a6e ("genirq/affinity: Add support for allocating interrupt sets") added IRQ sets to the interface, which reintroduced the need to check for -ENOSPC and possibly reduce the number of IRQs requested and retry the allocation.
--- drivers/pci/msi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/pci/msi.c +13 -9
@@ -1155,7 +1155,8 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, const struct irq_affinity *affd) {static const struct irq_affinity msi_default_affd; -int vecs = -ENOSPC ; +int msix_vecs = -ENOSPC ; +int msi_vecs = -ENOSPC ;if (flags &PCI_IRQ_AFFINITY ) {if (!affd)
@@ -1166,16 +1167,17 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, }if (flags &PCI_IRQ_MSIX ) { - vecs =__pci_enable_msix_range (dev,NULL , min_vecs, max_vecs, - affd); -if (vecs >0 ) -return vecs; + msix_vecs =__pci_enable_msix_range (dev,NULL , min_vecs, + max_vecs, affd); +if (msix_vecs >0 ) +return msix_vecs; }if (flags &PCI_IRQ_MSI ) { - vecs =__pci_enable_msi_range (dev, min_vecs, max_vecs, affd); -if (vecs >0 ) -return vecs; + msi_vecs =__pci_enable_msi_range (dev, min_vecs, max_vecs, + affd); +if (msi_vecs >0 ) +return msi_vecs; }/* use legacy irq if allowed */
@@ -1186,7 +1188,9 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, } } -return vecs; +if (msix_vecs == -ENOSPC ) +return -ENOSPC ; +return msi_vecs; }EXPORT_SYMBOL (pci_alloc_irq_vectors_affinity);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 218/321 net/core/neighbour: fix kmemleak minimal reference count for hash tables
In reply to Greg Kroah-HartmanFrom: Konstantin Khlebnikov <[email protected]>
[ Upstream commit 01b833ab44c9e484060aad72267fc7e71beb559b ]
This should be 1 for normal allocations, 0 disables leak reporting.
--- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/neighbour.c +1 -1
@@ -370,7 +370,7 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift) buckets = (struct neighbour __rcu **)__get_free_pages (GFP_ATOMIC | __GFP_ZERO,get_order (size)); -kmemleak_alloc (buckets, size,0 ,GFP_ATOMIC ); +kmemleak_alloc (buckets, size,1 ,GFP_ATOMIC ); }if (!buckets) {kfree (ret);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 219/321 serial: 8250: Fix serial8250 initialization crash
In reply to Greg Kroah-HartmanFrom: He Zhe <[email protected]>
[ Upstream commit 352c4cf40c4a7d439fa5d30aa2160f54b394da82 ]
The initialization code of interrupt backoff work might reference NULL pointer and cause the following crash, if no port was found.
[ 10.017727] CPU 0 Unable to handle kernel paging request at virtual address 000001b0, epc == 807088e0, ra == 8070863c ---- snip ---- [ 11.704470] [<807088e0>] serial8250_register_8250_port+0x318/0x4ac [ 11.747251] [<80708d74>] serial8250_probe+0x148/0x1c0 [ 11.789301] [<80728450>] platform_drv_probe+0x40/0x94 [ 11.830515] [<807264f8>] really_probe+0xf8/0x318 [ 11.870876] [<80726b7c>] __driver_attach+0x110/0x12c [ 11.910960] [<80724374>] bus_for_each_dev+0x78/0xcc [ 11.951134] [<80725958>] bus_add_driver+0x200/0x234 [ 11.989756] [<807273d8>] driver_register+0x84/0x148 [ 12.029832] [<80d72f84>] serial8250_init+0x138/0x198 [ 12.070447] [<80100e6c>] do_one_initcall+0x5c/0x2a0 [ 12.110104] [<80d3a208>] kernel_init_freeable+0x370/0x484 [ 12.150722] [<80a49420>] kernel_init+0x10/0xf8 [ 12.191517] [<8010756c>] ret_from_kernel_thread+0x14/0x1c
This patch makes sure the initialization code can be reached only if a port is found.
--- drivers/tty/serial/8250/8250_core.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_core.c +9 -8
@@ -1074,15 +1074,16 @@ int serial8250_register_8250_port(struct uart_8250_port *up) ret =0 ; } - } -/* Initialise interrupt backoff work if required */ -if (up->overrun_backoff_time_ms >0 ) { - uart->overrun_backoff_time_ms = up->overrun_backoff_time_ms; -INIT_DELAYED_WORK (&uart->overrun_backoff, - serial_8250_overrun_backoff_work); - }else { - uart->overrun_backoff_time_ms =0 ; +/* Initialise interrupt backoff work if required */ +if (up->overrun_backoff_time_ms >0 ) { + uart->overrun_backoff_time_ms = + up->overrun_backoff_time_ms; +INIT_DELAYED_WORK (&uart->overrun_backoff, + serial_8250_overrun_backoff_work); + }else { + uart->overrun_backoff_time_ms =0 ; + } }mutex_unlock (&serial_mutex);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 220/321 gpu: ipu-v3: pre: dont trigger update if buffer address doesnt change
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit eb0200a4357da100064971689d3a0e9e3cf57f33 ]
On a NOP double buffer update where current buffer address is the same as the next buffer address, the SDW_UPDATE bit clears too late. As we are now using this bit to determine when it is safe to signal flip completion to userspace this will delay completion of atomic commits where one plane doesn't change the buffer by a whole frame period.
Fix this by remembering the last buffer address and just skip the double buffer update if it would not change the buffer address.
--- drivers/gpu/ipu-v3/ipu-pre.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/ipu-v3/ipu-pre.c +6 -0
@@ -106,6 +106,7 @@ struct ipu_pre {void *buffer_virt;bool in_use;unsigned int safe_window_end; +unsigned int last_bufaddr; };static DEFINE_MUTEX (ipu_pre_list_mutex);
@@ -185,6 +186,7 @@ void ipu_pre_configure(struct ipu_pre *pre, unsigned int width,writel (bufaddr, pre->regs +IPU_PRE_CUR_BUF );writel (bufaddr, pre->regs +IPU_PRE_NEXT_BUF ); + pre->last_bufaddr = bufaddr; val =IPU_PRE_PREF_ENG_CTRL_INPUT_PIXEL_FORMAT (0 ) | IPU_PRE_PREF_ENG_CTRL_INPUT_ACTIVE_BPP(active_bpp) |
@@ -242,7 +244,11 @@ void ipu_pre_update(struct ipu_pre *pre, unsigned int bufaddr)unsigned short current_yblock;u32 val; +if (bufaddr == pre->last_bufaddr) +return ; +writel (bufaddr, pre->regs +IPU_PRE_NEXT_BUF ); + pre->last_bufaddr = bufaddr; do { if (time_after(jiffies, timeout)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 221/321 sfc: suppress duplicate nvmem partition types in efx_ef10_mtd_probe
In reply to Greg Kroah-HartmanFrom: Edward Cree <[email protected]>
[ Upstream commit 3366463513f544c12c6b88c13da4462ee9e7a1a1 ]
Use a bitmap to keep track of which partition types we've already seen;
for duplicates, return -EEXIST from efx_ef10_mtd_probe_partition() and thus skip adding that partition.
Duplicate partitions occur because of the A/B backup scheme used by newer
sfc NICs. Prior to this patch they cause sysfs_warn_dup errors because they have the same name, causing us not to expose any MTDs at all.
--- drivers/net/ethernet/sfc/ef10.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/net/ethernet/sfc/ef10.c +21 -8
@@ -6042,22 +6042,25 @@ static const struct efx_ef10_nvram_type_info efx_ef10_nvram_types[] = { { NVRAM_PARTITION_TYPE_LICENSE, 0, 0, "sfc_license" }, { NVRAM_PARTITION_TYPE_PHY_MIN, 0xff, 0, "sfc_phy_fw" }, }; +#define EF10_NVRAM_PARTITION_COUNT ARRAY_SIZE(efx_ef10_nvram_types)static int efx_ef10_mtd_probe_partition (struct efx_nic *efx,struct efx_mcdi_mtd_partition *part, -unsigned int type) +unsigned int type, +unsigned long *found) {MCDI_DECLARE_BUF (inbuf,MC_CMD_NVRAM_METADATA_IN_LEN );MCDI_DECLARE_BUF (outbuf,MC_CMD_NVRAM_METADATA_OUT_LENMAX );const struct efx_ef10_nvram_type_info *info;size_t size, erase_size, outlen; +int type_idx =0 ;bool protected;int rc; -for (info = efx_ef10_nvram_types; ; info++) { -if (info == - efx_ef10_nvram_types +ARRAY_SIZE (efx_ef10_nvram_types)) +for (type_idx =0 ; ; type_idx++) { +if (type_idx ==EF10_NVRAM_PARTITION_COUNT )return -ENODEV ; + info = efx_ef10_nvram_types + type_idx;if ((type & ~info->type_mask) == info->type)break ; }
@@ -6070,6 +6073,13 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx,if (protected)return -ENODEV ;/* hide it */ +/* If we've already exposed a partition of this type, hide this +* duplicate. All operations on MTDs are keyed by the type anyway, +* so we can't act on the duplicate. +*/ +if (__test_and_set_bit (type_idx, found)) +return -EEXIST ; + part->nvram_type = type;MCDI_SET_DWORD (inbuf,NVRAM_METADATA_IN_TYPE , type);
@@ -6098,6 +6108,7 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx,static int efx_ef10_mtd_probe (struct efx_nic *efx) {MCDI_DECLARE_BUF (outbuf,MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX ); +DECLARE_BITMAP (found,EF10_NVRAM_PARTITION_COUNT );struct efx_mcdi_mtd_partition *parts;size_t outlen, n_parts_total, i, n_parts;unsigned int type;
@@ -6126,11 +6137,13 @@ static int efx_ef10_mtd_probe(struct efx_nic *efx)for (i =0 ; i < n_parts_total; i++) { type =MCDI_ARRAY_DWORD (outbuf,NVRAM_PARTITIONS_OUT_TYPE_ID , i); - rc =efx_ef10_mtd_probe_partition (efx, &parts[n_parts], type); -if (rc ==0 ) - n_parts++; -else if (rc != -ENODEV ) + rc =efx_ef10_mtd_probe_partition (efx, &parts[n_parts], type, + found); +if (rc == -EEXIST || rc == -ENODEV ) +continue ; +if (rc) goto fail; + n_parts++; } rc =efx_mtd_add (efx, &parts[0 ].common, n_parts,sizeof (*parts));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 222/321 ip_tunnel: Make none-tunnel-dst tunnel port work with lwtunnel
In reply to Greg Kroah-HartmanFrom: wenxu <[email protected]>
[ Upstream commit d71b57532d70c03f4671dd04e84157ac6bf021b0 ]
ip l add dev tun type gretap key 1000
ip a a dev tun 10.0.0.1/24
Packets with tun-id 1000 can be recived by tun dev. But packet can't be sent through dev tun for non-tunnel-dst
With this patch: tunnel-dst can be get through lwtunnel like beflow:
ip r a 10.0.0.7 encap ip dst 172.168.0.11 dev tun
--- net/ipv4/ip_tunnel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/ip_tunnel.c +7 -1
@@ -644,13 +644,19 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, dst = tnl_params->daddr;if (dst ==0 ) {/* NBMA tunnel */ +struct ip_tunnel_info *tun_info;if (!skb_dst (skb)) { dev->stats.tx_fifo_errors++; goto tx_error; } -if (skb->protocol ==htons (ETH_P_IP )) { + tun_info =skb_tunnel_info (skb); +if (tun_info && (tun_info->mode &IP_TUNNEL_INFO_TX ) && +ip_tunnel_info_af (tun_info) ==AF_INET && + tun_info->key.u.ipv4.dst) + dst = tun_info->key.u.ipv4.dst; +else if (skb->protocol ==htons (ETH_P_IP )) { rt =skb_rtable (skb); dst =rt_nexthop (rt, inner_iph->daddr); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 223/321 decnet: fix DN_IFREQ_SIZE
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 50c2936634bcb1db78a8ca63249236810c11a80f ]
Digging through the ioctls with Al because of the previous patches, we found that on 64-bit decnet's dn_dev_ioctl() is wrong, because struct ifreq::ifr_ifru is actually 24 bytes (not 16 as expected from struct sockaddr) due to the ifru_map and ifru_settings members.
Clearly, decnet expects the ioctl to be called with a struct like
struct ifreq_dn {
char ifr_name[IFNAMSIZ];
struct sockaddr_dn ifr_addr;};
since it does
struct ifreq *ifr = ...;
struct sockaddr_dn *sdn = (struct sockaddr_dn *)&ifr->ifr_addr;
This means that DN_IFREQ_SIZE is too big for what it wants on 64-bit, as it is
sizeof(struct ifreq) - sizeof(struct sockaddr) + sizeof(struct sockaddr_dn)
This assumes that sizeof(struct sockaddr) is the size of ifr_ifru but that isn't true.
Fix this to use offsetof(struct ifreq, ifr_ifru).
This indeed doesn't really matter much - the result is that we copy in/out 8 bytes more than we should on 64-bit platforms. In case the "struct ifreq_dn" lands just on the end of a page though it might lead to faults.
As far as I can tell, it has been like this forever, so it seems very likely that nobody cares.
--- net/decnet/dn_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/decnet/dn_dev.c +1 -1
@@ -56,7 +56,7 @@#include <net/dn_neigh.h> #include <net/dn_fib.h> -#define DN_IFREQ_SIZE (sizeof(struct ifreq) - sizeof(struct sockaddr) + sizeof(struct sockaddr_dn)) +#define DN_IFREQ_SIZE (offsetof(struct ifreq, ifr_ifru) + sizeof(struct sockaddr_dn))static char dn_rt_all_end_mcast[ETH_ALEN ] = {0xAB ,0x00 ,0x00 ,0x04 ,0x00 ,0x00 };static char dn_rt_all_rt_mcast[ETH_ALEN ] = {0xAB ,0x00 ,0x00 ,0x03 ,0x00 ,0x00 };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 224/321 net/smc: prevent races between smc_lgr_terminate() and smc_conn_free()
In reply to Greg Kroah-HartmanFrom: Karsten Graul <[email protected]>
[ Upstream commit 77f838ace755d2f466536c44dac6c856f62cd901 ]
To prevent races between smc_lgr_terminate() and smc_conn_free() add an extra check of the lgr field before accessing it, and cancel a delayed free_work when a new smc connection is created.
This fixes the problem that free_work cleared the lgr variable but smc_lgr_terminate() or smc_conn_free() still access it in parallel.
--- net/smc/smc_core.c | 4 ++++ 1 file changed, 4 insertions(+)
net/smc/smc_core.c +4 -0
@@ -128,6 +128,8 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn) {struct smc_link_group *lgr = conn->lgr; +if (!lgr) +return ;write_lock_bh (&lgr->conns_lock);if (conn->alert_token_local) {__smc_lgr_unregister_conn (conn);
@@ -612,6 +614,8 @@ int smc_conn_create(struct smc_sock *smc, bool is_smcd, int srv_first_contact, local_contact =SMC_REUSE_CONTACT ; conn->lgr = lgr;smc_lgr_register_conn (conn);/* add smc conn to lgr */ +if (delayed_work_pending (&lgr->free_work)) +cancel_delayed_work (&lgr->free_work);write_unlock_bh (&lgr->conns_lock);break ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 225/321 net/smc: dont wait for send buffer space when data was already sent
In reply to Greg Kroah-HartmanFrom: Karsten Graul <[email protected]>
[ Upstream commit 6889b36da78a21a312d8b462c1fa25a03c2ff192 ]
When there is no more send buffer space and at least 1 byte was already sent then return to user space. The wait is only done when no data was sent by the sendmsg() call.
This fixes smc_tx_sendmsg() which tried to always send all user data and started to wait for free send buffer space when needed. During this wait the user space program was blocked in the sendmsg() call and hence not able to receive incoming data. When both sides were in such a situation then the connection stalled forever.
--- net/smc/smc_tx.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/smc/smc_tx.c +3 -4
@@ -163,12 +163,11 @@ int smc_tx_sendmsg(struct smc_sock *smc, struct msghdr *msg, size_t len) conn->local_tx_ctrl.prod_flags.urg_data_pending =1 ;if (!atomic_read (&conn->sndbuf_space) || conn->urg_tx_pend) { +if (send_done) +return send_done; rc =smc_tx_wait (smc, msg->msg_flags); -if (rc) { -if (send_done) -return send_done; +if (rc) goto out_err; - }continue ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 226/321 mm/hotplug: invalid PFNs from pfn_to_online_page()
In reply to Greg Kroah-HartmanFrom: Qian Cai <[email protected]>
[ Upstream commit b13bc35193d9e7a8c050a24928ca5c9e7c9a009b ]
On an arm64 ThunderX2 server, the first kmemleak scan would crash [1] with CONFIG_DEBUG_VM_PGFLAGS=y due to page_to_nid() found a pfn that is not directly mapped (MEMBLOCK_NOMAP). Hence, the page->flags is uninitialized.
This is due to the commit 9f1eb38e0e11 ("mm, kmemleak: little optimization while scanning") starts to use pfn_to_online_page() instead of pfn_valid(). However, in the CONFIG_MEMORY_HOTPLUG=y case, pfn_to_online_page() does not call memblock_is_map_memory() while pfn_valid() does.
Historically, the commit 68709f45385a ("arm64: only consider memblocks with NOMAP cleared for linear mapping") causes pages marked as nomap being no long reassigned to the new zone in memmap_init_zone() by calling __init_single_page().
Since the commit 2d070eab2e82 ("mm: consider zone which is not fully populated to have holes") introduced pfn_to_online_page() and was designed to return a valid pfn only, but it is clearly broken on arm64.
Therefore, let pfn_to_online_page() call pfn_valid_within(), so it can handle nomap thanks to the commit f52bb98f5ade ("arm64: mm: always enable CONFIG_HOLES_IN_ZONE"), while it will be optimized away on architectures where have no HOLES_IN_ZONE.
[1]
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000006
Mem abort info:
ESR = 0x96000005
Exception class = DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000005
CM = 0, WnR = 0
Internal error: Oops: 96000005 [#1] SMP
CPU: 60 PID: 1408 Comm: kmemleak Not tainted 5.0.0-rc2+ #8
pstate: 60400009 (nZCv daif +PAN -UAO)
pc : page_mapping+0x24/0x144
lr : __dump_page+0x34/0x3dc
sp : ffff00003a5cfd10
x29: ffff00003a5cfd10 x28: 000000000000802f
x27: 0000000000000000 x26: 0000000000277d00
x25: ffff000010791f56 x24: ffff7fe000000000
x23: ffff000010772f8b x22: ffff00001125f670
x21: ffff000011311000 x20: ffff000010772f8b
x19: fffffffffffffffe x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000000
x15: 0000000000000000 x14: ffff802698b19600
x13: ffff802698b1a200 x12: ffff802698b16f00
x11: ffff802698b1a400 x10: 0000000000001400
x9 : 0000000000000001 x8 : ffff00001121a000
x7 : 0000000000000000 x6 : ffff0000102c53b8
x5 : 0000000000000000 x4 : 0000000000000003
x3 : 0000000000000100 x2 : 0000000000000000
x1 : ffff000010772f8b x0 : ffffffffffffffff
Process kmemleak (pid: 1408, stack limit = 0x(____ptrval____))
Call trace:
page_mapping+0x24/0x144
__dump_page+0x34/0x3dc
dump_page+0x28/0x4c
kmemleak_scan+0x4ac/0x680
kmemleak_scan_thread+0xb4/0xdc
kthread+0x12c/0x13c
ret_from_fork+0x10/0x18
Code: d503201f f9400660 36000040 d1000413 (f9400661)
---[ end trace 4d4bd7f573490c8e ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: disabled
CPU features: 0x002,20000c38
Memory Limit: none
---[ end Kernel panic - not syncing: Fatal exception ]------ include/linux/memory_hotplug.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
include/linux/memory_hotplug.h +10 -8
@@ -21,14 +21,16 @@ struct vmem_altmap;* walkers which rely on the fully initialized page->flags and others * should use this rather than pfn_valid && pfn_to_page */ -#define pfn_to_online_page (pfn) \ -({ \ - struct page *___page = NULL; \ - unsigned long ___nr = pfn_to_section_nr(pfn); \ - \ - if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr))\ - ___page = pfn_to_page(pfn); \ - ___page; \ +#define pfn_to_online_page (pfn) \ +({ \ + struct page *___page = NULL; \ + unsigned long ___pfn = pfn; \ + unsigned long ___nr = pfn_to_section_nr(___pfn); \ + \ + if (___nr < NR_MEM_SECTIONS && online_section_nr(___nr) && \ + pfn_valid_within(___pfn)) \ + ___page = pfn_to_page(___pfn); \ + ___page; \ })/*
Signature · 1 line
2.20.1
Re: [PATCH 4.19 226/321] mm/hotplug: invalid PFNs from pfn_to_online_page()
Hi!
Quoted 5 lines
This is due to the commit
9f1eb38e0e11("mm, kmemleak: little optimization while scanning") starts to usepfn_to_online_page()instead ofpfn_valid(). However, in theCONFIG_MEMORY_HOTPLUG=ycase,pfn_to_online_page()does not callmemblock_is_map_memory()whilepfn_valid()does.
...
Quoted 1 line
Fixes 9f1eb38e0e11 ("mm, kmemleak: little optimization while scanning")
Commit 9f1eb38e0e11 does not seem to be in v4.19-stable tree. Is this commit still neccessary/good idea?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 226/321] mm/hotplug: invalid PFNs from pfn_to_online_page()
Quoted 7 lines · Pavel Machek
Hi!
Quoted 5 lines
This is due to the commit
9f1eb38e0e11("mm, kmemleak: little optimization while scanning") starts to usepfn_to_online_page()instead ofpfn_valid(). However, in theCONFIG_MEMORY_HOTPLUG=ycase,pfn_to_online_page()does not callmemblock_is_map_memory()whilepfn_valid()does.
Quoted 5 lines
...
Quoted 1 line
Fixes 9f1eb38e0e11 ("mm, kmemleak: little optimization while scanning")Commit
9f1eb38e0e11does not seem to be in v4.19-stable tree. Is this commit still neccessary/good idea?
Good catch.
Sasha, should this be reverted? How did your scripts pick this?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 227/321 xfs: end sync buffer I/O properly on shutdown error
In reply to Greg Kroah-HartmanFrom: Brian Foster <[email protected]>
[ Upstream commit 465fa17f4a303d9fdff9eac4d45f91ece92e96ca ]
As of commit e339dd8d8b ("xfs: use sync buffer I/O for sync delwri queue submission"), the delwri submission code uses sync buffer I/O for sync delwri I/O. Instead of waiting on async I/O to unlock the buffer, it uses the underlying sync I/O completion mechanism.
If delwri buffer submission fails due to a shutdown scenario, an error is set on the buffer and buffer completion never occurs. This can cause xfs_buf_delwri_submit() to deadlock waiting on a completion event.
We could check the error state before waiting on such buffers, but that doesn't serialize against the case of an error set via a racing I/O completion. Instead, invoke I/O completion in the shutdown case regardless of buffer I/O type.
--- fs/xfs/xfs_buf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/xfs/xfs_buf.c +1 -2
@@ -1506,8 +1506,7 @@ __xfs_buf_submit(xfs_buf_ioerror (bp, -EIO ); bp->b_flags &= ~XBF_DONE ;xfs_buf_stale (bp); -if (bp->b_flags &XBF_ASYNC ) -xfs_buf_ioend (bp); +xfs_buf_ioend (bp);return -EIO ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 228/321 net/smc: fix sender_free computation
In reply to Greg Kroah-HartmanFrom: Ursula Braun <[email protected]>
[ Upstream commit b8649efad879c69c7ab1f19ce8814fcabef1f72b ]
In some scenarios a separate consumer cursor update is necessary. The decision is made in smc_tx_consumer_cursor_update(). The sender_free computation could be wrong:
The rx confirmed cursor is always smaller than or equal to the rx producer cursor. The parameters in the smc_curs_diff() call have to be exchanged, otherwise sender_free might even be negative.
And if more data arrives local_rx_ctrl.prod might be updated, enabling a cursor difference between local_rx_ctrl.prod and rx confirmed cursor larger than the RMB size. This case is not covered by smc_curs_diff(). Thus function smc_curs_diff_large() is introduced here.
If a recvmsg() is processed in parallel, local_tx_ctrl.cons might change during smc_cdc_msg_send. Make sure rx_curs_confirmed is updated with the actually sent local_tx_ctrl.cons value.
--- net/smc/smc_cdc.c | 5 +++-- net/smc/smc_cdc.h | 26 +++++++++++++++++++++++++- net/smc/smc_tx.c | 3 ++- 3 files changed, 30 insertions(+), 4 deletions(-)
net/smc/smc_cdc.c +3 -2
@@ -96,6 +96,7 @@ int smc_cdc_msg_send(struct smc_connection *conn,struct smc_wr_buf *wr_buf, struct smc_cdc_tx_pend *pend) { + union smc_host_cursor cfed;struct smc_link *link;int rc;
@@ -107,10 +108,10 @@ int smc_cdc_msg_send(struct smc_connection *conn, conn->local_tx_ctrl.seqno = conn->tx_cdc_seq;smc_host_msg_to_cdc ((struct smc_cdc_msg *)wr_buf, &conn->local_tx_ctrl, conn); +smc_curs_copy (&cfed, &((struct smc_host_cdc_msg *)wr_buf)->cons, conn); rc =smc_wr_tx_send (link, (struct smc_wr_tx_pend_priv *)pend);if (!rc) -smc_curs_copy (&conn->rx_curs_confirmed, - &conn->local_tx_ctrl.cons, conn); +smc_curs_copy (&conn->rx_curs_confirmed, &cfed, conn);return rc; }
net/smc/smc_cdc.h +25 -1
@@ -135,7 +135,9 @@ static inline void smc_curs_copy_net(union smc_cdc_cursor *tgt,#endif } -/* calculate cursor difference between old and new, where old <= new */ +/* calculate cursor difference between old and new, where old <= new and +* difference cannot exceed size +*/ static inline int smc_curs_diff (unsigned int size,union smc_host_cursor *old,union smc_host_cursor *new)
@@ -160,6 +162,28 @@ static inline int smc_curs_comp(unsigned int size,return smc_curs_diff (size, old, new); } +/* calculate cursor difference between old and new, where old <= new and +* difference may exceed size +*/ +static inline int smc_curs_diff_large (unsigned int size, +union smc_host_cursor *old, +union smc_host_cursor *new) +{ +if (old->wrap < new->wrap) +return min_t (int, + (size - old->count) + new->count + + (new->wrap - old->wrap -1 ) * size, + size); + +if (old->wrap > new->wrap)/* wrap has switched from 0xffff to 0x0000 */ +return min_t (int, + (size - old->count) + new->count + + (new->wrap +0xffff - old->wrap) * size, + size); + +return max_t (int,0 , (new->count - old->count)); +} +static inline void smc_host_cursor_to_cdc (union smc_cdc_cursor *peer,union smc_host_cursor *local,struct smc_connection *conn)
net/smc/smc_tx.c +2 -1
@@ -595,7 +595,8 @@ void smc_tx_consumer_update(struct smc_connection *conn, bool force)if (to_confirm > conn->rmbe_update_limit) {smc_curs_copy (&prod, &conn->local_rx_ctrl.prod, conn); sender_free = conn->rmb_desc->len - -smc_curs_diff (conn->rmb_desc->len, &prod, &cfed); +smc_curs_diff_large (conn->rmb_desc->len, + &cfed, &prod); } if (conn->local_rx_ctrl.prod_flags.cons_curs_upd_req ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 229/321 blktrace: Show requests without sector
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 0803de78049fe1b0baf44bcddc727b036fb9139b ]
Currently, blktrace will not show requests that don't have any data as rq->__sector is initialized to -1 which is out of device range and thus discarded by act_log_check(). This is most notably the case for cache flush requests sent to the device. Fix the problem by making blk_rq_trace_sector() return 0 for requests without initialized sector.
--- include/linux/blktrace_api.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/linux/blktrace_api.h +7 -1
@@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);static inline sector_t blk_rq_trace_sector (struct request *rq) { -return blk_rq_is_passthrough (rq) ?0 :blk_rq_pos (rq); +/* +* Tracing should ignore starting sector for passthrough requests and +* requests where starting sector didn't get set. +*/ +if (blk_rq_is_passthrough (rq) ||blk_rq_pos (rq) == (sector_t)-1 ) +return 0 ; +return blk_rq_pos (rq); }static inline unsigned int blk_rq_trace_nr_sectors (struct request *rq)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 230/321 net/smc: fix byte_order for rx_curs_confirmed
In reply to Greg Kroah-HartmanFrom: Ursula Braun <[email protected]>
[ Upstream commit ccc8ca9b90acb45a3309f922b2591b07b4e070ec ]
The recent change in the rx_curs_confirmed assignment disregards byte order, which causes problems on little endian architectures. This patch fixes it.
--- net/smc/smc_cdc.c | 4 +--- net/smc/smc_cdc.h | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-)
net/smc/smc_cdc.c +1 -3
@@ -106,9 +106,7 @@ int smc_cdc_msg_send(struct smc_connection *conn, conn->tx_cdc_seq++; conn->local_tx_ctrl.seqno = conn->tx_cdc_seq; -smc_host_msg_to_cdc ((struct smc_cdc_msg *)wr_buf, - &conn->local_tx_ctrl, conn); -smc_curs_copy (&cfed, &((struct smc_host_cdc_msg *)wr_buf)->cons, conn); +smc_host_msg_to_cdc ((struct smc_cdc_msg *)wr_buf, conn, &cfed); rc =smc_wr_tx_send (link, (struct smc_wr_tx_pend_priv *)pend);if (!rc)smc_curs_copy (&conn->rx_curs_confirmed, &cfed, conn);
net/smc/smc_cdc.h +10 -9
@@ -186,26 +186,27 @@ static inline int smc_curs_diff_large(unsigned int size,static inline void smc_host_cursor_to_cdc (union smc_cdc_cursor *peer,union smc_host_cursor *local, +union smc_host_cursor *save,struct smc_connection *conn) { -union smc_host_cursor temp; - -smc_curs_copy (&temp, local, conn); - peer->count =htonl (temp.count); - peer->wrap =htons (temp.wrap); +smc_curs_copy (save, local, conn); + peer->count =htonl (save->count); + peer->wrap =htons (save->wrap);/* peer->reserved = htons(0); must be ensured by caller */ }static inline void smc_host_msg_to_cdc (struct smc_cdc_msg *peer, -struct smc_host_cdc_msg *local, -struct smc_connection *conn) +struct smc_connection *conn, +union smc_host_cursor *save) { +struct smc_host_cdc_msg *local = &conn->local_tx_ctrl; + peer->common.type = local->common.type; peer->len = local->len; peer->seqno =htons (local->seqno); peer->token =htonl (local->token); -smc_host_cursor_to_cdc (&peer->prod, &local->prod, conn); -smc_host_cursor_to_cdc (&peer->cons, &local->cons, conn); +smc_host_cursor_to_cdc (&peer->prod, &local->prod, save, conn); +smc_host_cursor_to_cdc (&peer->cons, &local->cons, save, conn); peer->prod_flags = local->prod_flags; peer->conn_state_flags = local->conn_state_flags; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 231/321 tipc: fix skb may be leaky in tipc_link_input
In reply to Greg Kroah-HartmanFrom: Hoang Le <[email protected]>
[ Upstream commit 7384b538d3aed2ed49d3575483d17aeee790fb06 ]
When we free skb at tipc_data_input, we return a 'false' boolean. Then, skb passed to subcalling tipc_link_input in tipc_link_rcv,
<snip>
1303 int tipc_link_rcv:
...
1354 if (!tipc_data_input(l, skb, l->inputq))
1355 rc |= tipc_link_input(l, skb, l->inputq);
</snip>
Fix it by simple changing to a 'true' boolean when skb is being free-ed. Then, tipc_link_rcv will bypassed to subcalling tipc_link_input as above condition.
--- net/tipc/link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/link.c +1 -1
@@ -1114,7 +1114,7 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,default :pr_warn ("Dropping received illegal msg type\n" );kfree_skb (skb); -return false; +return true; }; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 232/321 ASoC: samsung: i2s: Fix prescaler setting for the secondary DAI
In reply to Greg Kroah-HartmanFrom: Sylwester Nawrocki <[email protected]>
[ Upstream commit 323fb7b947b265753de34703dbbf8acc8ea3a4de ]
Make sure i2s->rclk_srcrate is properly initialized also during playback through the secondary DAI.
--- sound/soc/samsung/i2s.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/samsung/i2s.c +7 -1
@@ -604,6 +604,7 @@ static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) {struct i2s_dai *i2s =to_info (dai); +struct i2s_dai *other =get_other_dai (i2s);int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave;u32 mod, tmp =0 ;unsigned long flags;
@@ -661,7 +662,8 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,* CLK_I2S_RCLK_SRC clock is not exposed so we ensure any * clock configuration assigned in DT is not overwritten. */ -if (i2s->rclk_srcrate ==0 && i2s->clk_data.clks ==NULL ) +if (i2s->rclk_srcrate ==0 && i2s->clk_data.clks ==NULL && + other->clk_data.clks ==NULL )i2s_set_sysclk (dai,SAMSUNG_I2S_RCLKSRC_0 ,0 ,SND_SOC_CLOCK_IN );break ;
@@ -699,6 +701,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct i2s_dai *i2s = to_info(dai); +struct i2s_dai *other =get_other_dai (i2s);u32 mod, mask =0 , val =0 ;struct clk *rclksrc;unsigned long flags;
@@ -784,6 +787,9 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, i2s->frmclk =params_rate (params); rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC ]; +if (!rclksrc ||IS_ERR (rclksrc)) + rclksrc = other->clk_table[CLK_I2S_RCLK_SRC ]; +if (rclksrc && !IS_ERR (rclksrc)) i2s->rclk_srcrate =clk_get_rate (rclksrc);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 233/321 sfc: initialise found bitmap in efx_ef10_mtd_probe
In reply to Greg Kroah-HartmanFrom: Bert Kenward <[email protected]>
[ Upstream commit c65285428b6e7797f1bb063f33b0ae7e93397b7b ]
The bitmap of found partitions in efx_ef10_mtd_probe was not initialised, causing partitions to be suppressed based off whatever value was in the bitmap at the start.
--- drivers/net/ethernet/sfc/ef10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sfc/ef10.c +1 -1
@@ -6108,7 +6108,7 @@ static int efx_ef10_mtd_probe_partition(struct efx_nic *efx,static int efx_ef10_mtd_probe (struct efx_nic *efx) {MCDI_DECLARE_BUF (outbuf,MC_CMD_NVRAM_PARTITIONS_OUT_LENMAX ); -DECLARE_BITMAP (found,EF10_NVRAM_PARTITION_COUNT ); + DECLARE_BITMAP(found, EF10_NVRAM_PARTITION_COUNT) = { 0 };struct efx_mcdi_mtd_partition *parts;size_t outlen, n_parts_total, i, n_parts;unsigned int type;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 234/321 geneve: change NET_UDP_TUNNEL dependency to select
In reply to Greg Kroah-HartmanFrom: Matteo Croce <[email protected]>
[ Upstream commit a7603ac1fc8ce1409f8ff70e6ce505f308b2c002 ]
Due to the depends on NET_UDP_TUNNEL, at the moment it is impossible to compile GENEVE if no other protocol depending on NET_UDP_TUNNEL is selected.
Fix this changing the depends to a select, and drop NET_IP_TUNNEL from the select list, as it already depends on NET_UDP_TUNNEL.
--- drivers/net/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/Kconfig +2 -2
@@ -197,9 +197,9 @@ config VXLAN config GENEVE tristate "Generic Network Virtualization Encapsulation" - depends on INET && NET_UDP_TUNNEL + depends on INET depends on IPV6 || !IPV6 - select NET_IP_TUNNEL + select NET_UDP_TUNNEL select GRO_CELLS ---help--- This allows one to create geneve virtual interfaces that provide
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 235/321 net: fix possible overflow in __sk_mem_raise_allocated()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5bf325a53202b8728cf7013b72688c46071e212e ]
With many active TCP sockets, fat TCP sockets could fool __sk_mem_raise_allocated() thanks to an overflow.
They would increase their share of the memory, instead of decreasing it.
--- include/net/sock.h | 2 +- net/core/sock.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/sock.h +1 -1
@@ -1272,7 +1272,7 @@ static inline void sk_sockets_allocated_inc(struct sock *sk)percpu_counter_inc (sk->sk_prot->sockets_allocated); } -static inline int +static inline u64 sk_sockets_allocated_read_positive (struct sock *sk) {return percpu_counter_read_positive (sk->sk_prot->sockets_allocated);
net/core/sock.c +1 -1
@@ -2435,7 +2435,7 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind) }if (sk_has_memory_pressure (sk)) { -int alloc; +u64 alloc;if (!sk_under_memory_pressure (sk))return 1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 236/321 net: ip_gre: do not report erspan_ver for gre or gretap
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 2bdf700e538828d6456150b9319e5f689b062d54 ]
Report erspan version field to userspace in ipgre_fill_info just for erspan tunnels. The issue can be triggered with the following reproducer:
$ip link add name gre1 type gre local 192.168.0.1 remote 192.168.1.1
$ip link set dev gre1 up
$ip -d link sh gre1
13: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1476 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/gre 192.168.0.1 peer 192.168.1.1 promiscuity 0 minmtu 0 maxmtu 0
gre remote 192.168.1.1 local 192.168.0.1 ttl inherit erspan_ver 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1--- net/ipv4/ip_gre.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
net/ipv4/ip_gre.c +17 -16
@@ -1466,9 +1466,23 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)struct ip_tunnel_parm *p = &t->parms;__be16 o_flags = p->o_flags; -if ((t->erspan_ver ==1 || t->erspan_ver ==2 ) && - !t->collect_md) - o_flags |=TUNNEL_KEY ; +if (t->erspan_ver ==1 || t->erspan_ver ==2 ) { +if (!t->collect_md) + o_flags |=TUNNEL_KEY ; + +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , t->erspan_ver)) + goto nla_put_failure; + +if (t->erspan_ver ==1 ) { +if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , t->index)) + goto nla_put_failure; + }else { +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , t->dir)) + goto nla_put_failure; +if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , t->hwid)) + goto nla_put_failure; + } + }if (nla_put_u32 (skb,IFLA_GRE_LINK , p->link) || nla_put_be16(skb, IFLA_GRE_IFLAGS,
@@ -1504,19 +1518,6 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev) goto nla_put_failure; } -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , t->erspan_ver)) - goto nla_put_failure; - -if (t->erspan_ver ==1 ) { -if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , t->index)) - goto nla_put_failure; - }else if (t->erspan_ver ==2 ) { -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , t->dir)) - goto nla_put_failure; -if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , t->hwid)) - goto nla_put_failure; - } -return 0 ; nla_put_failure:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 237/321 net: ip6_gre: do not report erspan_ver for ip6gre or ip6gretap
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 103d0244d29fcaf38f1339d4538919bbbc051490 ]
Report erspan version field to userspace in ip6gre_fill_info just for erspan_v6 tunnels. Moreover report IFLA_GRE_ERSPAN_INDEX only for erspan version 1.
The issue can be triggered with the following reproducer:
$ip link add name gre6 type ip6gre local 2001::1 remote 2002::2
$ip link set gre6 up
$ip -d link sh gre6
14: grep6@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1448 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/gre6 2001::1 peer 2002::2 promiscuity 0 minmtu 0 maxmtu 0
ip6gre remote 2002::2 local 2001::1 hoplimit 64 encaplimit 4 tclass 0x00 flowlabel 0x00000 erspan_index 0 erspan_ver 0 addrgenmode eui64--- net/ipv6/ip6_gre.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
net/ipv6/ip6_gre.c +18 -18
@@ -2135,9 +2135,23 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)struct __ip6_tnl_parm *p = &t->parms;__be16 o_flags = p->o_flags; -if ((p->erspan_ver ==1 || p->erspan_ver ==2 ) && - !p->collect_md) - o_flags |=TUNNEL_KEY ; +if (p->erspan_ver ==1 || p->erspan_ver ==2 ) { +if (!p->collect_md) + o_flags |=TUNNEL_KEY ; + +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , p->erspan_ver)) + goto nla_put_failure; + +if (p->erspan_ver ==1 ) { +if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , p->index)) + goto nla_put_failure; + }else { +if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , p->dir)) + goto nla_put_failure; +if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , p->hwid)) + goto nla_put_failure; + } + }if (nla_put_u32 (skb,IFLA_GRE_LINK , p->link) || nla_put_be16(skb, IFLA_GRE_IFLAGS,
@@ -2152,8 +2166,7 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)nla_put_u8 (skb,IFLA_GRE_ENCAP_LIMIT , p->encap_limit) ||nla_put_be32 (skb,IFLA_GRE_FLOWINFO , p->flowinfo) ||nla_put_u32 (skb,IFLA_GRE_FLAGS , p->flags) || -nla_put_u32 (skb,IFLA_GRE_FWMARK , p->fwmark) || - nla_put_u32(skb, IFLA_GRE_ERSPAN_INDEX, p->index)) + nla_put_u32(skb, IFLA_GRE_FWMARK, p->fwmark)) goto nla_put_failure; if (nla_put_u16(skb, IFLA_GRE_ENCAP_TYPE,
@@ -2171,19 +2184,6 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev) goto nla_put_failure; } -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_VER , p->erspan_ver)) - goto nla_put_failure; - -if (p->erspan_ver ==1 ) { -if (nla_put_u32 (skb,IFLA_GRE_ERSPAN_INDEX , p->index)) - goto nla_put_failure; - }else if (p->erspan_ver ==2 ) { -if (nla_put_u8 (skb,IFLA_GRE_ERSPAN_DIR , p->dir)) - goto nla_put_failure; -if (nla_put_u16 (skb,IFLA_GRE_ERSPAN_HWID , p->hwid)) - goto nla_put_failure; - } -return 0 ; nla_put_failure:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 238/321 sctp: dont compare hb_timer expire date before starting it
In reply to Greg Kroah-HartmanFrom: Maciej Kwiecien <[email protected]>
[ Upstream commit d1f20c03f48102e52eb98b8651d129b83134cae4 ]
hb_timer might not start at all for a particular transport because its start is conditional. In a result a node is not sending heartbeats.
Function sctp_transport_reset_hb_timer has two roles:
- initial start of hb_timer for a given transport,
- update expire date of hb_timer for a given transport.
The function is optimized to update timer's expire only if it is before a new calculated one but this comparison is invalid for a timer which has not yet started. Such a timer has expire == 0 and if a new expire value is bigger than (MAX_JIFFIES / 2 + 2) then "time_before" macro will fail and timer will not start resulting in no heartbeat packets send by the node.
This was found when association was initialized within first 5 mins after system boot due to jiffies init value which is near to MAX_JIFFIES.
Test kernel version: 4.9.154 (ARCH=arm)
hb_timer.expire = 0; //initialized, not started timernew_expire = MAX_JIFFIES / 2 + 2; //or moretime_before(hb_timer.expire, new_expire) == false
--- net/sctp/transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sctp/transport.c +2 -1
@@ -207,7 +207,8 @@ void sctp_transport_reset_hb_timer(struct sctp_transport *transport)/* When a data chunk is sent, reset the heartbeat interval. */ expires = jiffies +sctp_transport_timeout (transport); -if (time_before (transport->hb_timer.expires, expires) && +if ((time_before (transport->hb_timer.expires, expires) || + !timer_pending (&transport->hb_timer)) && !mod_timer (&transport->hb_timer, expires +prandom_u32_max (transport->rto)))sctp_transport_hold (transport);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 239/321 bpf: decrease usercnt if bpf_map_new_fd() fails in bpf_map_get_fd_by_id()
In reply to Greg Kroah-HartmanFrom: Peng Sun <[email protected]>
[ Upstream commit 781e62823cb81b972dc8652c1827205cda2ac9ac ]
In bpf/syscall.c, bpf_map_get_fd_by_id() use bpf_map_inc_not_zero() to increase the refcount, both map->refcnt and map->usercnt. Then, if bpf_map_new_fd() fails, should handle map->usercnt too.
--- kernel/bpf/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/syscall.c +1 -1
@@ -1887,7 +1887,7 @@ static int bpf_map_get_fd_by_id(const union bpf_attr *attr) fd =bpf_map_new_fd (map, f_flags);if (fd <0 ) -bpf_map_put (map); +bpf_map_put_with_uref (map);return fd; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 240/321 mmc: core: align max segment size with logical block size
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit c53336c8f5f29043fded57912cc06c24e12613d7 ]
Logical block size is the lowest possible block size that the storage device can address. Max segment size is often related with controller's DMA capability. And it is reasonable to align max segment size with logical block size.
SDHCI sets un-aligned max segment size, and causes ADMA error, so fix it by aligning max segment size with logical block size.
--- drivers/mmc/core/block.c | 6 ------ drivers/mmc/core/queue.c | 9 ++++++++- 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/mmc/core/block.c +0 -6
@@ -2384,12 +2384,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,snprintf (md->disk->disk_name,sizeof (md->disk->disk_name),"mmcblk%u%s" , card->host->index, subname ? subname :"" ); -if (mmc_card_mmc (card)) -blk_queue_logical_block_size (md->queue.queue, - card->ext_csd.data_sector_size); -else -blk_queue_logical_block_size (md->queue.queue,512 ); -set_capacity (md->disk, size);if (mmc_host_cmd23 (card->host)) {
drivers/mmc/core/queue.c +8 -1
@@ -355,6 +355,7 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card) {struct mmc_host *host = card->host;u64 limit =BLK_BOUNCE_HIGH ; +unsigned block_size =512 ;if (mmc_dev (host)->dma_mask && *mmc_dev (host)->dma_mask) limit = (u64 )dma_max_pfn (mmc_dev (host)) <<PAGE_SHIFT ;
@@ -368,7 +369,13 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)blk_queue_max_hw_sectors (mq->queue,min (host->max_blk_count, host->max_req_size /512 ));blk_queue_max_segments (mq->queue, host->max_segs); -blk_queue_max_segment_size (mq->queue, host->max_seg_size); + +if (mmc_card_mmc (card)) + block_size = card->ext_csd.data_sector_size; + +blk_queue_logical_block_size (mq->queue, block_size); +blk_queue_max_segment_size (mq->queue, +round_down (host->max_seg_size, block_size));INIT_WORK (&mq->recovery_work, mmc_mq_recovery_handler);INIT_WORK (&mq->complete_work, mmc_blk_mq_complete_work);
Signature · 1 line
2.20.1
Re: [PATCH 4.19 240/321] mmc: core: align max segment size with logical block size
Hi!
Quoted 11 lines
From: Ming Lei <[email protected]>
[ Upstream commit
c53336c8f5f29043fded57912cc06c24e12613d7]Logical block size is the lowest possible block size that the storage device can address. Max segment size is often related with controller's DMA capability. And it is reasonable to align max segment size with logical block size.
SDHCI sets un-aligned max segment size, and causes ADMA error, so fix it by aligning max segment size with logical block size.
If un-aligned max segment sizes are problem, should we add checks to prevent setting them?
At least these set unaligned problems; is that a problem?
drivers/block/nbd.c: blk_queue_max_segment_size(disk->queue, UINT_MAX);drivers/block/virtio_blk.c: blk_queue_max_segment_size(q, -1U);drivers/block/rbd.c: blk_queue_max_segment_size(q, UINT_MAX);
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 240/321] mmc: core: align max segment size with logical block size
Quoted 14 lines · Pavel Machek
Hi!
Quoted 11 lines
From: Ming Lei <[email protected]>
[ Upstream commit
c53336c8f5f29043fded57912cc06c24e12613d7]Logical block size is the lowest possible block size that the storage device can address. Max segment size is often related with controller's DMA capability. And it is reasonable to align max segment size with logical block size.
SDHCI sets un-aligned max segment size, and causes ADMA error, so fix it by aligning max segment size with logical block size.
Quoted 8 lines
If un-aligned max segment sizes are problem, should we add checks to prevent setting them?
At least these set unaligned problems; is that a problem?
drivers/block/nbd.c:blk_queue_max_segment_size(disk->queue, UINT_MAX);drivers/block/virtio_blk.c:blk_queue_max_segment_size(q, -1U);drivers/block/rbd.c:blk_queue_max_segment_size(q, UINT_MAX);
In theory, all segment size should be aligned, however the above MAX value just means the queue hasn't max segment size limit, so it won't be applied actually.
Thanks,
Ming
Greg Kroah-Hartman
maintainerPATCH 241/321 net: dev: Use unsigned integer as an argument to left-shift
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit f4d7b3e23d259c44f1f1c39645450680fcd935d6 ]
1 << 31 is Undefined Behaviour according to the C standard. Use U type modifier to avoid theoretical overflow.
--- include/linux/netdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/netdevice.h +1 -1
@@ -3790,7 +3790,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)if (debug_value ==0 )/* no output */ return 0 ;/* set low N bits */ -return (1 << debug_value) -1 ; +return (1U << debug_value) -1 ; }static inline void __netif_tx_lock (struct netdev_queue *txq,int cpu)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 242/321 kvm: properly check debugfs dentry before using it
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 8ed0579c12b2fe56a1fac2f712f58fc26c1dc49b ]
debugfs can now report an error code if something went wrong instead of just NULL. So if the return value is to be used as a "real" dentry, it needs to be checked if it is an error before dereferencing it.
This is now happening because of ff9fb72bc077 ("debugfs: return error values, not NULL"). syzbot has found a way to trigger multiple debugfs files attempting to be created, which fails, and then the error code gets passed to dentry_path_raw() which obviously does not like it.
--- virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/kvm_main.c +1 -1
@@ -3990,7 +3990,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) }add_uevent_var (env,"PID=%d" , kvm->userspace_pid); -if (kvm->debugfs_dentry) { +if (!IS_ERR_OR_NULL (kvm->debugfs_dentry)) {char *tmp, *p =kmalloc (PATH_MAX ,GFP_KERNEL );if (p) {
Signature · 1 line
2.20.1
Re: [PATCH 4.19 242/321] kvm: properly check debugfs dentry before using it
Hi!
Quoted 4 lines
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit
8ed0579c12b2fe56a1fac2f712f58fc26c1dc49b]
Quoted 8 lines
debugfs can now report an error code if something went wrong instead of just NULL. So if the return value is to be used as a "real" dentry, it needs to be checked if it is an error before dereferencing it.
This is now happening because of
ff9fb72bc077("debugfs: return error values, not NULL"). syzbot has found a way to trigger multiple debugfs files attempting to be created, which fails, and then the error code gets passed todentry_path_raw()which obviously does not like it.
4.19-stable does not contain patch ff9fb72bc077, so is this still good idea? It should not break anything, as it still uses IS_ERR_OR_NULL, but...
Best regards,
Pavel
Quoted 10 lines
+++
b/virt/kvm/kvm_main.cvirt/kvm/kvm_main.c +1
-1@@ -3990,7 +3990,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) }add_uevent_var (env,"PID=%d" , kvm->userspace_pid); -if (kvm->debugfs_dentry) { +if (!IS_ERR_OR_NULL (kvm->debugfs_dentry)) {char *tmp, *p =kmalloc (PATH_MAX ,GFP_KERNEL );if (p) {
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 242/321] kvm: properly check debugfs dentry before using it
Quoted 10 lines · Pavel Machek
Hi!
Quoted 8 lines
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit
8ed0579c12b2fe56a1fac2f712f58fc26c1dc49b]debugfs can now report an error code if something went wrong instead of just NULL. So if the return value is to be used as a "real" dentry, it needs to be checked if it is an error before dereferencing it.
Quoted 8 lines
Quoted 4 lines
This is now happening because of
ff9fb72bc077("debugfs: return error values, not NULL"). syzbot has found a way to trigger multiple debugfs files attempting to be created, which fails, and then the error code gets passed todentry_path_raw()which obviously does not like it.4.19-stable does not contain patch
ff9fb72bc077, so is this still good idea? It should not break anything, as it still usesIS_ERR_OR_NULL, but...
Yes it should as just testing for NULL was incorrect in the first place.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 243/321 bpf: drop refcount if bpf_map_new_fd() fails in map_create()
In reply to Greg Kroah-HartmanFrom: Peng Sun <[email protected]>
[ Upstream commit 352d20d611414715353ee65fc206ee57ab1a6984 ]
In bpf/syscall.c, map_create() first set map->usercnt to 1, a file descriptor is supposed to return to userspace. When bpf_map_new_fd() fails, drop the refcount.
--- kernel/bpf/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/syscall.c +2 -2
@@ -559,12 +559,12 @@ static int map_create(union bpf_attr *attr) err =bpf_map_new_fd (map, f_flags);if (err <0 ) {/* failed to allocate fd. -* bpf_map_put() is needed because the above +* bpf_map_put_with_uref() is needed because the above * bpf_map_alloc_id() has published the map * to the userspace and the userspace may * have refcnt-ed it through BPF_MAP_GET_FD_BY_ID. */ -bpf_map_put (map); +bpf_map_put_with_uref (map);return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 244/321 net: hns3: Change fw error code NOT_EXEC to NOT_SUPPORTED
In reply to Greg Kroah-HartmanFrom: Yunsheng Lin <[email protected]>
[ Upstream commit 4a402f47cfce904051cd8b31bef4fe2910d9dce9 ]
According to firmware error code definition, the error code of 2 means NOT_SUPPORTED, this patch changes it to NOT_SUPPORTED.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 2 ++ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +2 -0
@@ -260,6 +260,8 @@ int hclge_cmd_send(struct hclge_hw *hw, struct hclge_desc *desc, int num)if (desc_ret ==HCLGE_CMD_EXEC_SUCCESS ) retval =0 ; +else if (desc_ret ==HCLGE_CMD_NOT_SUPPORTED ) + retval = -EOPNOTSUPP ;else retval = -EIO ; hw->cmq.last_status = desc_ret;
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +1 -1
@@ -39,7 +39,7 @@ struct hclge_cmq_ring {enum hclge_cmd_return_status {HCLGE_CMD_EXEC_SUCCESS =0 ,HCLGE_CMD_NO_AUTH =1 , -HCLGE_CMD_NOT_EXEC =2 , +HCLGE_CMD_NOT_SUPPORTED =2 ,HCLGE_CMD_QUEUE_FULL =3 , };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 245/321 net: hns3: fix PFC not setting problem for DCB module
In reply to Greg Kroah-HartmanFrom: Yunsheng Lin <[email protected]>
[ Upstream commit d3ad430ac531e65f29c9737f86744c425c9173ef ]
The PFC enabling is based on user priority, currently it is based on TC, which may cause PFC not setting correctly when pri to TC mapping is not one to one relation.
This patch adds pfc_en in tm_info to fix it.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 7 ++++--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +4 -3
@@ -245,6 +245,9 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE)return -EINVAL ; +if (pfc->pfc_en == hdev->tm_info.pfc_en) +return 0 ; + prio_tc = hdev->tm_info.prio_tc; pfc_map =0 ;
@@ -257,10 +260,8 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc) } } -if (pfc_map == hdev->tm_info.hw_pfc_map) -return 0 ; - hdev->tm_info.hw_pfc_map = pfc_map; + hdev->tm_info.pfc_en = pfc->pfc_en;return hclge_pause_setup_hw (hdev); }
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +1 -0
@@ -249,6 +249,7 @@ struct hclge_tm_info {struct hclge_tc_info tc_info[HNAE3_MAX_TC ];enum hclge_fc_mode fc_mode;u8 hw_pfc_map;/* Allow for packet drop or not on this TC */ +u8 pfc_en;/* PFC enabled or not for user priority */ };struct hclge_comm_stats_str {
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +1 -1
@@ -1162,7 +1162,7 @@ static int hclge_pfc_setup_hw(struct hclge_dev *hdev)HCLGE_RX_MAC_PAUSE_EN_MSK ;return hclge_pfc_pause_en_cfg (hdev, enable_bitmap, - hdev->tm_info.hw_pfc_map); + hdev->tm_info.pfc_en); }/* Each Tc has a 1024 queue sets to backpress, it divides to
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 246/321 net: hns3: fix an issue for hclgevf_ae_get_hdev
In reply to Greg Kroah-HartmanFrom: Peng Li <[email protected]>
[ Upstream commit eed9535f9f716a532ec0c5d6cc7a48584acdf435 ]
HNS3 VF driver support NIC and Roce, hdev stores NIC handle and Roce handle, should use correct parameter for container_of.
--- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +6 -1
@@ -26,7 +26,12 @@ MODULE_DEVICE_TABLE(pci, ae_algovf_pci_tbl);static inline struct hclgevf_dev *hclgevf_ae_get_hdev (struct hnae3_handle *handle) { - return container_of(handle, struct hclgevf_dev, nic); +if (!handle->client) + return container_of(handle, struct hclgevf_dev, nic); +else if (handle->client->type ==HNAE3_CLIENT_ROCE ) + return container_of(handle, struct hclgevf_dev, roce); +else + return container_of(handle, struct hclgevf_dev, nic); }static int hclgevf_tqps_update_stats (struct hnae3_handle *handle)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 247/321 net: hns3: fix an issue for hns3_update_new_int_gl
In reply to Greg Kroah-HartmanFrom: Peng Li <[email protected]>
[ Upstream commit 6241e71e7207102ffc733991f7a00f74098d7da0 ]
HNS3 supports setting rx-usecs|tx-usecs as 0, but it will not update dynamically when adaptive-tx or adaptive-rx is enable. This patch removes the Redundant check.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +1 -1
@@ -2366,7 +2366,7 @@ static bool hns3_get_new_int_gl(struct hns3_enet_ring_group *ring_group)u32 time_passed_ms;u16 new_int_gl; -if (!ring_group->coal.int_gl || !tqp_vector->last_jiffies) +if (!tqp_vector->last_jiffies)return false;if (ring_group->total_packets ==0 ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 248/321 iommu/amd: Fix NULL dereference bug in match_hid_uid
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
[ Upstream commit bb6bccba390c7d743c1e4427de4ef284c8cc6869 ]
Add a non-NULL check to fix potential NULL pointer dereference Cleanup code to call function once.
--- drivers/iommu/amd_iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iommu/amd_iommu.c +6 -2
@@ -139,10 +139,14 @@ static struct lock_class_key reserved_rbtree_key;static inline int match_hid_uid (struct device *dev,struct acpihid_map_entry *entry) { +struct acpi_device *adev =ACPI_COMPANION (dev);const char *hid, *uid; - hid =acpi_device_hid (ACPI_COMPANION (dev)); - uid =acpi_device_uid (ACPI_COMPANION (dev)); +if (!adev) +return -ENODEV ; + + hid =acpi_device_hid (adev); + uid =acpi_device_uid (adev);if (!hid || !(*hid))return -ENODEV ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 249/321 apparmor: delete the dentry in aafs_remove() to avoid a leak
In reply to Greg Kroah-HartmanFrom: Chris Coulson <[email protected]>
[ Upstream commit 201218e4d3dfa1346e30997f48725acce3f26d01 ]
Although the apparmorfs dentries are always dropped from the dentry cache when the usage count drops to zero, there is no guarantee that this will happen in aafs_remove(), as another thread might still be using it. In this scenario, this means that the dentry will temporarily continue to appear in the results of lookups, even after the call to aafs_remove().
In the case of removal of a profile - it also causes simple_rmdir() on the profile directory to fail, as the directory won't be empty until the usage counts of all child dentries have decreased to zero. This results in the dentry for the profile directory leaking and appearing empty in the file system tree forever.
--- security/apparmor/apparmorfs.c | 1 + 1 file changed, 1 insertion(+)
security/apparmor/apparmorfs.c +1 -0
@@ -361,6 +361,7 @@ static void aafs_remove(struct dentry *dentry)simple_rmdir (dir, dentry); elsesimple_unlink (dir ,dentry ); +d_delete (dentry);dput (dentry); }inode_unlock (dir);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 250/321 scsi: libsas: Support SATA PHY connection rate unmatch fixing during discovery
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit cec9771d2e954650095aa37a6a97722c8194e7d2 ]
+----------+ +----------+ | | | | | |--- 3.0 G ---| |--- 6.0 G --- SAS disk | | | | | |--- 3.0 G ---| |--- 6.0 G --- SAS disk |initiator | | | | device |--- 3.0 G ---| Expander |--- 6.0 G --- SAS disk | | | | | |--- 3.0 G ---| |--- 6.0 G --- SATA disk -->failed to connect | | | | | | | |--- 6.0 G --- SATA disk -->failed to connect | | | | +----------+ +----------+
According to Serial Attached SCSI - 1.1 (SAS-1.1):
If an expander PHY attached to a SATA PHY is using a physical link rate greater than the maximum connection rate supported by the pathway from an STP initiator port, a management application client should use the SMP PHY CONTROL function (see 10.4.3.10) to set the PROGRAMMED MAXIMUM PHYSICAL LINK RATE field of the expander PHY to the maximum connection rate supported by the pathway from that STP initiator port.
Currently libsas does not support checking if this condition occurs, nor rectifying when it does.
Such a condition is not at all common, however it has been seen on some pre-silicon environments where the initiator PHY only supports a 1.5 Gbit maximum linkrate, mated with 12G expander PHYs and 3/6G SATA phy.
This patch adds support for checking and rectifying this condition during initial device discovery only.
We do support checking min pathway connection rate during revalidation phase, when new devices can be detected in the topology. However we do not support in the case of the the user reprogramming PHY linkrates, such that min pathway condition is not met/maintained.
A note on root port PHY rates:
The libsas root port PHY rates calculation is broken. Libsas sets the rates (min, max, and current linkrate) of a root port to the same linkrate of the first PHY member of that same port. In doing so, it assumes that all other PHYs which subsequently join the port to have the same negotiated linkrate, when they could actually be different.
In practice this doesn't happen, as initiator and expander PHYs are normally initialised with consistent min/max linkrates.
This has not caused an issue so far, so leave alone for now.
--- drivers/scsi/libsas/sas_expander.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/scsi/libsas/sas_expander.c +20 -0
@@ -817,6 +817,26 @@ static struct domain_device *sas_ex_discover_end_dev(#ifdef CONFIG_SCSI_SAS_ATA if ((phy->attached_tproto &SAS_PROTOCOL_STP ) || phy->attached_sata_dev) { +if (child->linkrate > parent->min_linkrate) { +struct sas_phy_linkrates rates = { + .maximum_linkrate = parent->min_linkrate, + .minimum_linkrate = parent->min_linkrate, + }; +int ret; + +pr_notice ("ex %016llx phy%02d SATA device linkrate > min pathway connection rate, attempting to lower device linkrate\n" , +SAS_ADDR (child->sas_addr), phy_id); + ret =sas_smp_phy_control (parent, phy_id, +PHY_FUNC_LINK_RESET , &rates); +if (ret) { +pr_err ("ex %016llx phy%02d SATA device could not set linkrate (%d)\n" , +SAS_ADDR (child->sas_addr), phy_id, ret); + goto out_free; + } +pr_notice ("ex %016llx phy%02d SATA device set linkrate successfully\n" , +SAS_ADDR (child->sas_addr), phy_id); + child->linkrate = child->min_linkrate; + } res =sas_get_ata_info (child, phy);if (res) goto out_free;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 251/321 ACPI / APEI: Dont wait to serialise with oops messages when panic()ing
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
[ Upstream commit 78b0b690f6558ed788dccafa45965325dd11ba89 ]
oops_begin() exists to group printk() messages with the oops message printed by die(). To reach this caller we know that platform firmware took this error first, then notified the OS via NMI with a 'panic' severity.
Don't wait for another CPU to release the die-lock before panic()ing, our only goal is to print this fatal error and panic().
This code is always called in_nmi(), and since commit 42a0bb3f7138 ("printk/nmi: generic solution for safe printk in NMI"), it has been safe to call printk() from this context. Messages are batched in a per-cpu buffer and printed via irq-work, or a call back from panic().
--- drivers/acpi/apei/ghes.c | 2 -- 1 file changed, 2 deletions(-)
drivers/acpi/apei/ghes.c +0 -2
@@ -33,7 +33,6 @@#include <linux/interrupt.h> #include <linux/timer.h> #include <linux/cper.h> -#include <linux/kdebug.h> #include <linux/platform_device.h> #include <linux/mutex.h> #include <linux/ratelimit.h>
@@ -949,7 +948,6 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs *regs) sev =ghes_severity (ghes->estatus->error_severity);if (sev >=GHES_SEV_PANIC ) { -oops_begin ();ghes_print_queued_estatus ();__ghes_panic (ghes); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 252/321 ACPI / APEI: Switch estatus pool to use vmalloc memory
In reply to Greg Kroah-HartmanFrom: James Morse <[email protected]>
[ Upstream commit 0ac234be1a9497498e57d958f4251f5257b116b4 ]
The ghes code is careful to parse and round firmware's advertised memory requirements for CPER records, up to a maximum of 64K. However when ghes_estatus_pool_expand() does its work, it splits the requested size into PAGE_SIZE granules.
This means if firmware generates 5K of CPER records, and correctly describes this in the table, __process_error() will silently fail as it is unable to allocate more than PAGE_SIZE.
Switch the estatus pool to vmalloc() memory. On x86 vmalloc() memory may fault and be fixed up by vmalloc_fault(). To prevent this call vmalloc_sync_all() before an NMI handler could discover the memory.
--- drivers/acpi/apei/ghes.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/acpi/apei/ghes.c +15 -15
@@ -170,40 +170,40 @@ static int ghes_estatus_pool_init(void)return 0 ; } -static void ghes_estatus_pool_free_chunk_page (struct gen_pool *pool, +static void ghes_estatus_pool_free_chunk (struct gen_pool *pool,struct gen_pool_chunk *chunk,void *data) { -free_page (chunk->start_addr); +vfree ((void *)chunk->start_addr); }static void ghes_estatus_pool_exit (void ) {gen_pool_for_each_chunk (ghes_estatus_pool, - ghes_estatus_pool_free_chunk_page,NULL ); + ghes_estatus_pool_free_chunk,NULL );gen_pool_destroy (ghes_estatus_pool); }static int ghes_estatus_pool_expand (unsigned long len) { -unsigned long i, pages, size, addr; -int ret; +unsigned long size, addr; ghes_estatus_pool_size_request +=PAGE_ALIGN (len); size =gen_pool_size (ghes_estatus_pool);if (size >= ghes_estatus_pool_size_request)return 0 ; - pages = (ghes_estatus_pool_size_request - size) /PAGE_SIZE ; -for (i =0 ; i < pages; i++) { - addr =__get_free_page (GFP_KERNEL ); -if (!addr) -return -ENOMEM ; - ret =gen_pool_add (ghes_estatus_pool, addr,PAGE_SIZE ,-1 ); -if (ret) -return ret; - } -return 0 ; + addr = (unsigned long )vmalloc (PAGE_ALIGN (len)); +if (!addr) +return -ENOMEM ; + +/* +* New allocation must be visible in all pgd before it can be found by +* an NMI allocating from the pool. +*/ +vmalloc_sync_all (); + +return gen_pool_add (ghes_estatus_pool, addr,PAGE_ALIGN (len),-1 ); }static int map_gen_v2 (struct ghes *ghes)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 253/321 scsi: hisi_sas: shutdown axi bus to avoid exception CQ returned
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit 5c31b0c677531c2b8b4e29b3cfb923df663f39b7 ]
When injecting 2 bit ECC error, it will cause fatal AXI interrupts. Before the recovery of SAS controller reset, the internal of SAS controller is in error. If CQ interrupts return at the time, actually it is exception CQ interrupt, and it may cause resource release in disorder.
To avoid the exception situation, shutdown AXI bus after fatal AXI interrupt. In SAS controller reset, it will restart AXI bus. For later version of v3 hw, hardware will shutdown AXI bus for this situation, so just fix current ver of v3 hw.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +12 -0
@@ -1520,6 +1520,7 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p)u32 irq_value, irq_msk;struct hisi_hba *hisi_hba = p;struct device *dev = hisi_hba->dev; +struct pci_dev *pdev = hisi_hba->pci_dev;int i; irq_msk =hisi_sas_read32 (hisi_hba,ENT_INT_SRC_MSK3 );
@@ -1551,6 +1552,17 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p) error->msg, irq_value);queue_work (hisi_hba->wq, &hisi_hba->rst_work); } + +if (pdev->revision <0x21 ) { +u32 reg_val; + + reg_val =hisi_sas_read32 (hisi_hba, +AXI_MASTER_CFG_BASE + +AM_CTRL_GLOBAL ); + reg_val |=AM_CTRL_SHUTDOWN_REQ_MSK ; +hisi_sas_write32 (hisi_hba,AXI_MASTER_CFG_BASE + +AM_CTRL_GLOBAL , reg_val); + } }if (irq_value &BIT (ENT_INT_SRC3_ITC_INT_OFF )) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 254/321 scsi: libsas: Check SMP PHY control function result
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 01929a65dfa13e18d89264ab1378854a91857e59 ]
Currently the SMP PHY control execution result is checked, however the function result for the command is not.
As such, we may be missing all potential errors, like SMP FUNCTION FAILED, INVALID REQUEST FRAME LENGTH, etc., meaning the PHY control request has failed.
In some scenarios we need to ensure the function result is accepted, so add a check for this.
--- drivers/scsi/libsas/sas_expander.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/scsi/libsas/sas_expander.c +8 -1
@@ -614,7 +614,14 @@ int sas_smp_phy_control(struct domain_device *dev, int phy_id, } res =smp_execute_task (dev, pc_req,PC_REQ_SIZE , pc_resp,PC_RESP_SIZE ); - +if (res) { +pr_err ("ex %016llx phy%02d PHY control failed: %d\n" , +SAS_ADDR (dev->sas_addr), phy_id, res); + }else if (pc_resp[2 ] !=SMP_RESP_FUNC_ACC ) { +pr_err ("ex %016llx phy%02d PHY control failed: function result 0x%x\n" , +SAS_ADDR (dev->sas_addr), phy_id, pc_resp[2 ]); + res = pc_resp[2 ]; + }kfree (pc_resp);kfree (pc_req);return res;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 255/321 RDMA/hns: Fix the bug with updating rq head pointer when flush cqe
In reply to Greg Kroah-HartmanFrom: Lijun Ou <[email protected]>
[ Upstream commit 9c6ccc035c209dda07685e8dba829a203ba17499 ]
When flush cqe with srq, the driver disable to update the rq head pointer into the hardware.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +7 -3
@@ -3503,13 +3503,16 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,roce_set_field (qpc_mask->byte_160_sq_ci_pi,V2_QPC_BYTE_160_SQ_PRODUCER_IDX_M ,V2_QPC_BYTE_160_SQ_PRODUCER_IDX_S ,0 ); -roce_set_field (context->byte_84_rq_ci_pi, + +if (!ibqp->srq) { +roce_set_field (context->byte_84_rq_ci_pi,V2_QPC_BYTE_84_RQ_PRODUCER_IDX_M ,V2_QPC_BYTE_84_RQ_PRODUCER_IDX_S , hr_qp->rq.head); -roce_set_field (qpc_mask->byte_84_rq_ci_pi, +roce_set_field (qpc_mask->byte_84_rq_ci_pi,V2_QPC_BYTE_84_RQ_PRODUCER_IDX_M ,V2_QPC_BYTE_84_RQ_PRODUCER_IDX_S ,0 ); + } }if (attr_mask &IB_QP_AV ) {
@@ -3971,7 +3974,8 @@ static void hns_roce_set_qps_to_err(struct hns_roce_dev *hr_dev, u32 qpn)if (hr_qp->ibqp.uobject) {if (hr_qp->sdb_en ==1 ) { hr_qp->sq.head = *(int *)(hr_qp->sdb.virt_addr); - hr_qp->rq.head = *(int *)(hr_qp->rdb.virt_addr); +if (hr_qp->rdb_en ==1 ) + hr_qp->rq.head = *(int *)(hr_qp->rdb.virt_addr); }else {dev_warn (hr_dev->dev,"flush cqe is unsupported in userspace!\n" );return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 256/321 RDMA/hns: Bugfix for the scene without receiver queue
In reply to Greg Kroah-HartmanFrom: Lijun Ou <[email protected]>
[ Upstream commit 4d103905eb1e4f14cb62fcf962c9d35da7005dea ]
In some application scenario, the user could not have receive queue when run rdma write or read operation.
--- drivers/infiniband/hw/hns/hns_roce_qp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_qp.c +2 -1
@@ -522,7 +522,8 @@ static int hns_roce_qp_has_sq(struct ib_qp_init_attr *attr)static int hns_roce_qp_has_rq (struct ib_qp_init_attr *attr) {if (attr->qp_type ==IB_QPT_XRC_INI || - attr->qp_type ==IB_QPT_XRC_TGT || attr->srq) + attr->qp_type ==IB_QPT_XRC_TGT || attr->srq || + !attr->cap.max_recv_wr)return 0 ;return 1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 257/321 RDMA/hns: Fix the state of rereg mr
In reply to Greg Kroah-HartmanFrom: Yixian Liu <[email protected]>
[ Upstream commit ab22bf05216a6bb4812448f3a8609489047cf311 ]
The state of mr after reregister operation should be set to valid state. Otherwise, it will keep the same as the state before reregistered.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -0
@@ -1776,6 +1776,9 @@ static int hns_roce_v2_rereg_write_mtpt(struct hns_roce_dev *hr_dev,struct hns_roce_v2_mpt_entry *mpt_entry = mb_buf;int ret =0 ; +roce_set_field (mpt_entry->byte_4_pd_hop_st,V2_MPT_BYTE_4_MPT_ST_M , +V2_MPT_BYTE_4_MPT_ST_S ,V2_MPT_ST_VALID ); +if (flags &IB_MR_REREG_PD ) {roce_set_field (mpt_entry->byte_4_pd_hop_st,V2_MPT_BYTE_4_PD_M ,V2_MPT_BYTE_4_PD_S , pdn);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 258/321 RDMA/hns: Use GFP_ATOMIC in hns_roce_v2_modify_qp
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 4e69cf1fe2c52d189acdd06c1fd99cc258aba61f ]
The the below commit, hns_roce_v2_modify_qp is called inside spinlock while using GFP_KERNEL. Change it to GFP_ATOMIC.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -1
@@ -3446,7 +3446,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,struct device *dev = hr_dev->dev;int ret = -EINVAL ; - context =kcalloc (2 ,sizeof (*context),GFP_KERNEL ); + context =kcalloc (2 ,sizeof (*context),GFP_ATOMIC );if (!context)return -ENOMEM ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 259/321 ASoC: rt5645: Headphone Jack sense inverts on the LattePanda board
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit 406dcbc55a0a20fd155be889a4a0c4b812f7c18e ]
The LattePanda board has a sound card chtrt5645, when there is nothing plugged in the headphone jack, the system thinks the headphone is plugged in, while we plug a headphone in the jack, the system thinks the headphone is unplugged.
If adding quirk=0x21 in the module parameter, the headphone jack can work well. So let us fix it via platform_data.
https://bugs.launchpad.net/bugs/182459
--- sound/soc/codecs/rt5645.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
sound/soc/codecs/rt5645.c +14 -0
@@ -3662,6 +3662,11 @@ static const struct rt5645_platform_data jd_mode3_platform_data = { .jd_mode = 3, }; +static const struct rt5645_platform_data lattepanda_board_platform_data = { + .jd_mode =2 , + .inv_jd1_1 = true +}; +static const struct dmi_system_id dmi_platform_data[] = { { .ident ="Chrome Buddy" ,
@@ -3759,6 +3764,15 @@ static const struct dmi_system_id dmi_platform_data[] = { }, .driver_data = (void *)&intel_braswell_platform_data, }, + { + .ident = "LattePanda board", + .matches = { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), + DMI_EXACT_MATCH(DMI_BOARD_VERSION, "Default string"), + }, + .driver_data = (void *)&lattepanda_board_platform_data, + }, { } };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 260/321 powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()
In reply to Greg Kroah-HartmanFrom: Gen Zhang <[email protected]>
[ Upstream commit efa9ace68e487ddd29c2b4d6dd23242158f1f607 ]
In dlpar_parse_cc_property(), 'prop->name' is allocated by kstrdup(). kstrdup() may return NULL, so it should be checked and handle error. And prop should be freed if 'prop->name' is NULL.
--- arch/powerpc/platforms/pseries/dlpar.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/dlpar.c +4 -0
@@ -63,6 +63,10 @@ static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa) name = (char *)ccwa +be32_to_cpu (ccwa->name_offset); prop->name =kstrdup (name,GFP_KERNEL ); +if (!prop->name) { +dlpar_free_cc_property (prop); +return NULL ; + } prop->length =be32_to_cpu (ccwa->prop_length); value = (char *)ccwa +be32_to_cpu (ccwa->prop_offset);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 261/321 xdp: fix cpumap redirect SKB creation bug
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 676e4a6fe703f2dae699ee9d56f14516f9ada4ea ]
We want to avoid leaking pointer info from xdp_frame (that is placed in top of frame) like commit 6dfb970d3dbd ("xdp: avoid leaking info stored in frame data on page reuse"), and followup commit 97e19cce05e5 ("bpf:
reserve xdp_frame size in xdp headroom") that reserve this headroom.
These changes also affected how cpumap constructed SKBs, as xdpf->headroom size changed, the skb data starting point were in-effect shifted with 32 bytes (sizeof xdp_frame). This was still okay, as the cpumap frame_size calculation also included xdpf->headroom which were reduced by same amount.
A bug was introduced in commit 77ea5f4cbe20 ("bpf/cpumap: make sure frame_size for build_skb is aligned if headroom isn't"), where the xdpf->headroom became part of the SKB_DATA_ALIGN rounding up. This round-up to find the frame_size is in principle still correct as it does not exceed the 2048 bytes frame_size (which is max for ixgbe and i40e), but the 32 bytes offset of pkt_data_start puts this over the 2048 bytes limit. This cause skb_shared_info to spill into next frame. It is a little hard to trigger, as the SKB need to use above 15 skb_shinfo->frags[] as far as I calculate. This does happen in practise for TCP streams when skb_try_coalesce() kicks in.
KASAN can be used to detect these wrong memory accesses, I've seen:
BUG: KASAN: use-after-free in skb_try_coalesce+0x3cb/0x760 BUG: KASAN: wild-memory-access in skb_release_data+0xe2/0x250
Driver veth also construct a SKB from xdp_frame in this way, but is not affected, as it doesn't reserve/deduct the room (used by xdp_frame) from the SKB headroom. Instead is clears the pointers via xdp_scrub_frame(), and allows SKB to use this area.
The fix in this patch is to do like veth and instead allow SKB to (re)use the area occupied by xdp_frame, by clearing via xdp_scrub_frame(). (This does kill the idea of the SKB being able to access (mem) info from this area, but I guess it was a bad idea anyhow, and it was already killed by the veth changes.)
--- kernel/bpf/cpumap.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
kernel/bpf/cpumap.c +10 -3
@@ -162,10 +162,14 @@ static void cpu_map_kthread_stop(struct work_struct *work)static struct sk_buff *cpu_map_build_skb (struct bpf_cpu_map_entry *rcpu,struct xdp_frame *xdpf) { +unsigned int hard_start_headroom;unsigned int frame_size;void *pkt_data_start;struct sk_buff *skb; +/* Part of headroom was reserved to xdpf */ + hard_start_headroom =sizeof (struct xdp_frame ) + xdpf->headroom; +/* build_skb need to place skb_shared_info after SKB end, and * also want to know the memory "truesize". Thus, need to * know the memory frame size backing xdp_buff.
@@ -183,15 +187,15 @@ static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu,* is not at a fixed memory location, with mixed length * packets, which is bad for cache-line hotness. */ - frame_size =SKB_DATA_ALIGN (xdpf->len + xdpf->headroom) + + frame_size =SKB_DATA_ALIGN (xdpf->len + hard_start_headroom) +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); - pkt_data_start = xdpf->data - xdpf->headroom; + pkt_data_start = xdpf->data - hard_start_headroom; skb =build_skb (pkt_data_start, frame_size);if (!skb)return NULL ; -skb_reserve (skb, xdpf->headroom); +skb_reserve (skb, hard_start_headroom);__skb_put (skb, xdpf->len);if (xdpf->metasize)skb_metadata_set (skb, xdpf->metasize);
@@ -205,6 +209,9 @@ static struct sk_buff *cpu_map_build_skb(struct bpf_cpu_map_entry *rcpu,* - RX ring dev queue index (skb_record_rx_queue) */ +/* Allow SKB to reuse area used by xdp_frame */ +xdp_scrub_frame (xdpf); +return skb; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 262/321 mtd: Remove a debug trace in mtdpart.c
In reply to Greg Kroah-HartmanFrom: Boris Brezillon <[email protected]>
[ Upstream commit bda2ab56356b9acdfab150f31c4bac9846253092 ]
Commit 2b6f0090a333 ("mtd: Check add_mtd_device() ret code") contained a leftover of the debug session that led to this bug fix. Remove this pr_info().
--- drivers/mtd/mtdpart.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/mtdpart.c +0 -1
@@ -626,7 +626,6 @@ err_remove_part:mutex_unlock (&mtd_partitions_mutex);free_partition (new); -pr_info ("%s:%i\n" , __func__, __LINE__);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 263/321 mm, gup: add missing refcount overflow checks on s390
In reply to Greg Kroah-HartmanFrom: Vlastimil Babka <[email protected]>
The mainline commit 8fde12ca79af ("mm: prevent get_user_pages() from overflowing page refcount") was backported to 4.19.y stable as commit d972ebbf42ba. The backport however missed that in 4.19, there are several arch-specific gup.c versions with fast gup implementations, so these do not prevent refcount overflow.
This stable-only commit fixes the s390 version, and is based on the backport in SUSE SLES/openSUSE 4.12-based kernels.
The remaining architectures with own gup.c are sparc, mips, sh. It's unlikely the known overflow scenario based on FUSE, which needs 140GB of RAM, is a problem for those architectures, and I don't feel confident enough to patch them.
--- arch/s390/mm/gup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/s390/mm/gup.c +6 -3
@@ -39,7 +39,8 @@ static inline int gup_pte_range(pmd_t *pmdp, pmd_t pmd, unsigned long addr,VM_BUG_ON (!pfn_valid (pte_pfn (pte))); page =pte_page (pte); head =compound_head (page); -if (!page_cache_get_speculative (head)) +if (unlikely (WARN_ON_ONCE (page_ref_count (head) <0 ) + || !page_cache_get_speculative (head)))return 0 ;if (unlikely (pte_val (pte) !=pte_val (*ptep))) {put_page (head);
@@ -77,7 +78,8 @@ static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr, refs++; }while (addr +=PAGE_SIZE , addr != end); -if (!page_cache_add_speculative (head, refs)) { +if (unlikely (WARN_ON_ONCE (page_ref_count (head) <0 ) + || !page_cache_add_speculative (head, refs))) { *nr -= refs;return 0 ; }
@@ -151,7 +153,8 @@ static int gup_huge_pud(pud_t *pudp, pud_t pud, unsigned long addr, refs++; }while (addr +=PAGE_SIZE , addr != end); -if (!page_cache_add_speculative (head, refs)) { +if (unlikely (WARN_ON_ONCE (page_ref_count (head) <0 ) + || !page_cache_add_speculative (head, refs))) { *nr -= refs;return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 264/321 KVM: nVMX: rename enter_vmx_non_root_mode to nested_vmx_enter_non_root_mode
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit d63907dc7dd11d98c8ffbdaf8311987e5a508744 upstream.
...to be more consistent with the nested VMX nomenclature.
--- arch/x86/kvm/vmx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/kvm/vmx.c +5 -5
@@ -12680,7 +12680,7 @@ static int check_vmentry_postreqs(struct* If exit_qual is NULL, this is being called from state restore (either RSM * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume. */ -static int enter_vmx_non_root_mode (struct kvm_vcpu *vcpu,u32 *exit_qual) +static int nested_vmx_enter_non_root_mode (struct kvm_vcpu *vcpu,u32 *exit_qual) {struct vcpu_vmx *vmx =to_vmx (vcpu);struct vmcs12 *vmcs12 =get_vmcs12 (vcpu);
@@ -12845,7 +12845,7 @@ static int nested_vmx_run(struct kvm_vcp*/ vmx->nested.nested_run_pending =1 ; - ret =enter_vmx_non_root_mode (vcpu, &exit_qual); + ret =nested_vmx_enter_non_root_mode (vcpu, &exit_qual);if (ret) {nested_vmx_entry_failure (vcpu, vmcs12, ret, exit_qual); vmx->nested.nested_run_pending =0 ;
@@ -12856,7 +12856,7 @@ static int nested_vmx_run(struct kvm_vcp vmx->vcpu.arch.l1tf_flush_l1d = true;/* -* Must happen outside of enter_vmx_non_root_mode() as it will +* Must happen outside of nested_vmx_enter_non_root_mode() as it will * also be used as part of restoring nVMX state for * snapshot restore (migration). *
@@ -14089,7 +14089,7 @@ static int vmx_pre_leave_smm(struct kvm_if (vmx->nested.smm.guest_mode) { vcpu->arch.hflags &= ~HF_SMM_MASK ; - ret =enter_vmx_non_root_mode (vcpu,NULL ); + ret =nested_vmx_enter_non_root_mode (vcpu,NULL ); vcpu->arch.hflags |=HF_SMM_MASK ;if (ret)return ret;
@@ -14300,7 +14300,7 @@ static int vmx_set_nested_state(struct kreturn -EINVAL ; vmx->nested.dirty_vmcs12 = true; - ret =enter_vmx_non_root_mode (vcpu,NULL ); + ret =nested_vmx_enter_non_root_mode (vcpu,NULL );if (ret)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 265/321 KVM: nVMX: assimilate nested_vmx_entry_failure() into nested_vmx_enter_non_root_mode()
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit a633e41e736279c6d3174f52deeb9b8b5fa85e13 upstream.
Handling all VMExits due to failed consistency checks on VMEnter in nested_vmx_enter_non_root_mode() consolidates all relevant code into a single location, and removing nested_vmx_entry_failure() eliminates a confusing function name and label. For a VMEntry, "fail" and its derivatives has a very specific meaning due to the different behavior of a VMEnter VMFail versus VMExit, i.e. it wasn't obvious that nested_vmx_entry_failure() handled VMExit scenarios.
--- arch/x86/kvm/vmx.c | 78 ++++++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 42 deletions(-)
arch/x86/kvm/vmx.c +36 -42
@@ -2065,9 +2065,6 @@ static inline bool is_nmi(u32 intr_info)static void nested_vmx_vmexit (struct kvm_vcpu *vcpu,u32 exit_reason,u32 exit_intr_info,unsigned long exit_qualification); -static void nested_vmx_entry_failure (struct kvm_vcpu *vcpu, -struct vmcs12 *vmcs12, -u32 reason,unsigned long qualification);static int __find_msr_index (struct vcpu_vmx *vmx,u32 msr) {
@@ -12676,26 +12673,29 @@ static int check_vmentry_postreqs(structreturn 0 ; } +static void load_vmcs12_host_state (struct kvm_vcpu *vcpu, +struct vmcs12 *vmcs12); +/* -* If exit_qual is NULL, this is being called from state restore (either RSM +* If from_vmentry is false, this is being called from state restore (either RSM * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume. */ -static int nested_vmx_enter_non_root_mode (struct kvm_vcpu *vcpu,u32 *exit_qual) +static int nested_vmx_enter_non_root_mode (struct kvm_vcpu *vcpu, +bool from_vmentry) {struct vcpu_vmx *vmx =to_vmx (vcpu);struct vmcs12 *vmcs12 =get_vmcs12 (vcpu); -bool from_vmentry = !!exit_qual; -u32 dummy_exit_qual;bool evaluate_pending_interrupts; -int r =0 ; +u32 exit_reason =EXIT_REASON_INVALID_STATE ; +u32 exit_qual; evaluate_pending_interrupts =vmcs_read32 (CPU_BASED_VM_EXEC_CONTROL ) & (CPU_BASED_VIRTUAL_INTR_PENDING |CPU_BASED_VIRTUAL_NMI_PENDING );if (likely (!evaluate_pending_interrupts) &&kvm_vcpu_apicv_active (vcpu)) evaluate_pending_interrupts |=vmx_has_apicv_interrupt (vcpu); -if (from_vmentry &&check_vmentry_postreqs (vcpu, vmcs12, exit_qual)) -return EXIT_REASON_INVALID_STATE ; +if (from_vmentry &&check_vmentry_postreqs (vcpu, vmcs12, &exit_qual)) + goto vmentry_fail_vmexit;enter_guest_mode (vcpu);
@@ -12710,18 +12710,17 @@ static int nested_vmx_enter_non_root_modif (vmcs12->cpu_based_vm_exec_control &CPU_BASED_USE_TSC_OFFSETING ) vcpu->arch.tsc_offset += vmcs12->tsc_offset; - r =EXIT_REASON_INVALID_STATE ; -if (prepare_vmcs02 (vcpu, vmcs12, from_vmentry ? exit_qual : &dummy_exit_qual)) +if (prepare_vmcs02 (vcpu, vmcs12, &exit_qual)) goto fail;if (from_vmentry) {nested_get_vmcs12_pages (vcpu); - r =EXIT_REASON_MSR_LOAD_FAIL ; - *exit_qual =nested_vmx_load_msr (vcpu, - vmcs12->vm_entry_msr_load_addr, - vmcs12->vm_entry_msr_load_count); -if (*exit_qual) + exit_reason =EXIT_REASON_MSR_LOAD_FAIL ; + exit_qual =nested_vmx_load_msr (vcpu, + vmcs12->vm_entry_msr_load_addr, + vmcs12->vm_entry_msr_load_count); +if (exit_qual) goto fail; }else {/*
@@ -12759,12 +12758,28 @@ static int nested_vmx_enter_non_root_mod*/ return 0 ; +/* +* A failed consistency check that leads to a VMExit during L1's +* VMEnter to L2 is a variation of a normal VMexit, as explained in +* 26.7 "VM-entry failures during or after loading guest state". +*/ fail:if (vmcs12->cpu_based_vm_exec_control &CPU_BASED_USE_TSC_OFFSETING ) vcpu->arch.tsc_offset -= vmcs12->tsc_offset;leave_guest_mode (vcpu);vmx_switch_vmcs (vcpu, &vmx->vmcs01); -return r; + +if (!from_vmentry) +return 1 ; + +vmentry_fail_vmexit: +load_vmcs12_host_state (vcpu, vmcs12); + vmcs12->vm_exit_reason = exit_reason |VMX_EXIT_REASONS_FAILED_VMENTRY ; + vmcs12->exit_qualification = exit_qual; +nested_vmx_succeed (vcpu); +if (enable_shadow_vmcs) + vmx->nested.sync_shadow_vmcs = true; +return 1 ; }/*
@@ -12776,7 +12791,6 @@ static int nested_vmx_run(struct kvm_vcpstruct vmcs12 *vmcs12;struct vcpu_vmx *vmx =to_vmx (vcpu);u32 interrupt_shadow =vmx_get_interrupt_shadow (vcpu); -u32 exit_qual;int ret;if (!nested_vmx_check_permission (vcpu))
@@ -12845,9 +12859,8 @@ static int nested_vmx_run(struct kvm_vcp*/ vmx->nested.nested_run_pending =1 ; - ret =nested_vmx_enter_non_root_mode (vcpu, &exit_qual); + ret =nested_vmx_enter_non_root_mode (vcpu, true);if (ret) { -nested_vmx_entry_failure (vcpu, vmcs12, ret, exit_qual); vmx->nested.nested_run_pending =0 ;return 1 ; }
@@ -13647,25 +13660,6 @@ static void vmx_leave_nested(struct kvm_free_nested (to_vmx (vcpu)); } -/* -* L1's failure to enter L2 is a subset of a normal exit, as explained in -* 23.7 "VM-entry failures during or after loading guest state" (this also -* lists the acceptable exit-reason and exit-qualification parameters). -* It should only be called before L2 actually succeeded to run, and when -* vmcs01 is current (it doesn't leave_guest_mode() or switch vmcss). -*/ -static void nested_vmx_entry_failure (struct kvm_vcpu *vcpu, -struct vmcs12 *vmcs12, -u32 reason,unsigned long qualification) -{ -load_vmcs12_host_state (vcpu, vmcs12); - vmcs12->vm_exit_reason = reason |VMX_EXIT_REASONS_FAILED_VMENTRY ; - vmcs12->exit_qualification = qualification; -nested_vmx_succeed (vcpu); -if (enable_shadow_vmcs) -to_vmx (vcpu)->nested.sync_shadow_vmcs = true; -} -static int vmx_check_intercept (struct kvm_vcpu *vcpu,struct x86_instruction_info *info,enum x86_intercept_stage stage)
@@ -14089,7 +14083,7 @@ static int vmx_pre_leave_smm(struct kvm_if (vmx->nested.smm.guest_mode) { vcpu->arch.hflags &= ~HF_SMM_MASK ; - ret =nested_vmx_enter_non_root_mode (vcpu,NULL ); + ret =nested_vmx_enter_non_root_mode (vcpu, false); vcpu->arch.hflags |=HF_SMM_MASK ;if (ret)return ret;
@@ -14300,7 +14294,7 @@ static int vmx_set_nested_state(struct kreturn -EINVAL ; vmx->nested.dirty_vmcs12 = true; - ret =nested_vmx_enter_non_root_mode (vcpu,NULL ); + ret =nested_vmx_enter_non_root_mode (vcpu, false);if (ret)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 266/321 clk: at91: fix update bit maps on CFG_MOR write
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
commit 263eaf8f172d9f44e15d6aca85fe40ec18d2c477 upstream.
The regmap update bits call was not selecting the proper mask, considering the bits which was updating.
Update the mask from call to also include OSCBYPASS.
Removed MOSCEN which was not updated.
--- drivers/clk/at91/clk-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/at91/clk-main.c +1 -1
@@ -162,7 +162,7 @@ at91_clk_register_main_osc(struct regmapif (bypass)regmap_update_bits (regmap,AT91_CKGR_MOR ,MOR_KEY_MASK | -AT91_PMC_MOSCEN , +AT91_PMC_OSCBYPASS ,AT91_PMC_OSCBYPASS |AT91_PMC_KEY ); hw = &osc->hw;
Greg Kroah-Hartman
maintainerPATCH 267/321 clk: at91: generated: set audio_pll_allowed in at91_clk_register_generated()
In reply to Greg Kroah-HartmanFrom: Alexandre Belloni <[email protected]>
commit c1e4580a1d0ff510d56268c1fc7fcfeec366fe70 upstream.
Set gck->audio_pll_allowed in at91_clk_register_generated. This makes it easier to do it from code that is not parsing device tree.
Also, this fixes an issue where the resulting clk_hw can be dereferenced before being tested for error.
--- drivers/clk/at91/clk-generated.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
drivers/clk/at91/clk-generated.c +10 -18
@@ -284,7 +284,7 @@ static void clk_generated_startup(structstatic struct clk_hw *__init at91_clk_register_generated (struct regmap *regmap,spinlock_t *lock,const char *name,const char **parent_names, -u8 num_parents,u8 id, +u8 num_parents,u8 id,bool pll_audio,const struct clk_range *range) {struct clk_generated *gck;
@@ -308,6 +308,7 @@ at91_clk_register_generated(struct regma gck->regmap = regmap; gck->lock = lock; gck->range = *range; + gck->audio_pll_allowed = pll_audio;clk_generated_startup (gck); hw = &gck->hw;
@@ -333,7 +334,6 @@ static void __init of_sama5d2_clk_generastruct device_node *gcknp;struct clk_range range =CLK_RANGE (0 ,0 );struct regmap *regmap; -struct clk_generated *gck; num_parents =of_clk_get_parent_count (np);if (num_parents ==0 || num_parents >GENERATED_SOURCE_MAX )
@@ -350,6 +350,8 @@ static void __init of_sama5d2_clk_generareturn ;for_each_child_of_node (np, gcknp) { +bool pll_audio = false; +if (of_property_read_u32 (gcknp,"reg" , &id))continue ;
@@ -362,24 +364,14 @@ static void __init of_sama5d2_clk_generaof_at91_get_clk_range (gcknp,"atmel,clk-output-range" , &range); +if (of_device_is_compatible (np,"atmel,sama5d2-clk-generated" ) && + (id ==GCK_ID_I2S0 || id ==GCK_ID_I2S1 || + id ==GCK_ID_CLASSD )) + pll_audio = true; + hw =at91_clk_register_generated (regmap, &pmc_pcr_lock, name, parent_names, num_parents, - id, &range); - - gck =to_clk_generated (hw); - -if (of_device_is_compatible (np, -"atmel,sama5d2-clk-generated" )) { -if (gck->id ==GCK_ID_SSC0 || gck->id ==GCK_ID_SSC1 || - gck->id ==GCK_ID_I2S0 || gck->id ==GCK_ID_I2S1 || - gck->id ==GCK_ID_CLASSD ) - gck->audio_pll_allowed = true; -else - gck->audio_pll_allowed = false; - }else { - gck->audio_pll_allowed = false; - } - + id, pll_audio, &range);if (IS_ERR (hw))continue ;
Greg Kroah-Hartman
maintainerPATCH 268/321 usb: dwc2: use a longer core rest timeout in dwc2_core_reset()
In reply to Greg Kroah-HartmanFrom: Mathias Kresin <[email protected]>
commit 6689f0f4bb14e50917ba42eb9b41c25e0184970c upstream.
Testing on different generations of Lantiq MIPS SoC based boards, showed that it takes up to 1500 us until the core reset bit is cleared.
The driver from the vendor SDK (ifxhcd) uses a 1 second timeout. Use the same timeout to fix wrong hang detections and make the driver work for Lantiq MIPS SoCs.
At least till kernel 4.14 the hanging reset only caused a warning but the driver was probed successful. With kernel 4.19 errors out with EBUSY.
--- drivers/usb/dwc2/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/core.c +1 -1
@@ -524,7 +524,7 @@ int dwc2_core_reset(struct dwc2_hsotg *h greset |=GRSTCTL_CSFTRST ;dwc2_writel (hsotg, greset,GRSTCTL ); -if (dwc2_hsotg_wait_bit_clear (hsotg,GRSTCTL ,GRSTCTL_CSFTRST ,50 )) { +if (dwc2_hsotg_wait_bit_clear (hsotg,GRSTCTL ,GRSTCTL_CSFTRST ,10000 )) {dev_warn (hsotg->dev,"%s: HANG! Soft Reset timeout GRSTCTL GRSTCTL_CSFTRST\n" , __func__);return -EBUSY ;
Greg Kroah-Hartman
maintainerPATCH 269/321 staging: rtl8192e: fix potential use after free
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
commit b7aa39a2ed0112d07fc277ebd24a08a7b2368ab9 upstream.
The variable skb is released via kfree_skb() when the return value of _rtl92e_tx is not zero. However, after that, skb is accessed again to read its length, which may result in a use after free bug. This patch fixes the bug by moving the release operation to where skb is never used later.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3 -2
@@ -1627,14 +1627,15 @@ static void _rtl92e_hard_data_xmit(strucmemcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev));skb_push (skb, priv->rtllib->tx_headroom); ret =_rtl92e_tx (dev, skb); -if (ret !=0 ) -kfree_skb (skb);if (queue_index !=MGNT_QUEUE ) { priv->rtllib->stats.tx_bytes += (skb->len - priv->rtllib->tx_headroom); priv->rtllib->stats.tx_packets++; } + +if (ret !=0 ) +kfree_skb (skb); }static int _rtl92e_hard_start_xmit (struct sk_buff *skb,struct net_device *dev)
Greg Kroah-Hartman
maintainerPATCH 270/321 staging: rtl8723bs: Drop ACPI device ids
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 2d9d2491530a156b9a5614adf9dc79285e35d55e upstream.
The driver only binds by SDIO device-ids, all the ACPI device-id does is causing the driver to load unnecessarily on devices where the DSDT contains a bogus OBDA8723 device.
--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0 -6
@@ -22,13 +22,7 @@ static const struct sdio_device_id sdio_ { SDIO_DEVICE(0x024c, 0xb723), }, { /* end: all zeroes */ }, }; -static const struct acpi_device_id acpi_ids[] = { - {"OBDA8723" ,0x0000 }, - {} -}; -MODULE_DEVICE_TABLE (sdio, sdio_ids); -MODULE_DEVICE_TABLE (acpi, acpi_ids);static int rtw_drv_init (struct sdio_func *func,const struct sdio_device_id *id);static void rtw_dev_remove (struct sdio_func *func);
Greg Kroah-Hartman
maintainerPATCH 271/321 staging: rtl8723bs: Add 024c:0525 to the list of SDIO device-ids
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 3d5f1eedbfd22ceea94b39989d6021b1958181f4 upstream.
Add 024c:0525 to the list of SDIO device-ids, based on a patch found in the Android X86 kernels. According to that patch this device id is used on the Alcatel Plus 10 device.
--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +1 -0
@@ -17,6 +17,7 @@static const struct sdio_device_id sdio_ids[] = { {SDIO_DEVICE (0x024c ,0x0523 ), }, + {SDIO_DEVICE (0x024c ,0x0525 ), }, {SDIO_DEVICE (0x024c ,0x0623 ), }, {SDIO_DEVICE (0x024c ,0x0626 ), }, {SDIO_DEVICE (0x024c ,0xb723 ), },
Greg Kroah-Hartman
maintainerPATCH 272/321 USB: serial: ftdi_sio: add device IDs for U-Blox C099-F9P
In reply to Greg Kroah-HartmanFrom: Fabio D'Urso <[email protected]>
commit c1a1f273d0825774c80896b8deb1c9ea1d0b91e3 upstream.
This device presents itself as a USB hub with three attached devices:
- An ACM serial port connected to the GPS module (not affected by this commit)
- An FTDI serial port connected to the GPS module (1546:0502)
- Another FTDI serial port connected to the ODIN-W2 radio module (1546:0503)
This commit registers U-Blox's VID and the PIDs of the second and third devices.
--- drivers/usb/serial/ftdi_sio.c | 3 +++ drivers/usb/serial/ftdi_sio_ids.h | 7 +++++++ 2 files changed, 10 insertions(+)
drivers/usb/serial/ftdi_sio.c +3 -0
@@ -1023,6 +1023,9 @@ static const struct usb_device_id id_tab/* Sienna devices */ { USB_DEVICE(FTDI_VID, FTDI_SIENNA_PID) }, { USB_DEVICE(ECHELON_VID, ECHELON_U20_PID) }, +/* U-Blox devices */ + { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) }, + { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) }, { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +7 -0
@@ -1558,3 +1558,10 @@*/ #define UNJO_VID 0x22B7#define UNJO_ISODEBUG_V1_PID 0x150D + +/* +* U-Blox products (http://www.u-blox.com). +*/ +#define UBLOX_VID 0x1546 +#define UBLOX_C099F9P_ZED_PID 0x0502 +#define UBLOX_C099F9P_ODIN_PID 0x0503
Greg Kroah-Hartman
maintainerPATCH 273/321 mei: bus: prefix device names on bus with the bus name
In reply to Greg Kroah-HartmanFrom: Alexander Usyskin <[email protected]>
commit 7a2b9e6ec84588b0be65cc0ae45a65bac431496b upstream.
Add parent device name to the name of devices on bus to avoid device names collisions for same client UUID available from different MEI heads. Namely this prevents sysfs collision under /sys/bus/mei/device/
In the device part leave just UUID other parameters that are required for device matching are not required here and are just bloating the name.
--- drivers/misc/mei/bus.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/misc/mei/bus.c +5 -4
@@ -883,15 +883,16 @@ static const struct device_type mei_cl_d/** * mei_cl_bus_set_name - set device name for me client device +* <controller>-<client device> +* Example: 0000:00:16.0-55213584-9a29-4916-badf-0fb7ed682aeb * * @cldev: me client device */ static inline void mei_cl_bus_set_name (struct mei_cl_device *cldev) { -dev_set_name (&cldev->dev,"mei:%s:%pUl:%02X" , - cldev->name, -mei_me_cl_uuid (cldev->me_cl), -mei_me_cl_ver (cldev->me_cl)); +dev_set_name (&cldev->dev,"%s-%pUl" , +dev_name (cldev->bus->dev), +mei_me_cl_uuid (cldev->me_cl)); }/**
Greg Kroah-Hartman
maintainerPATCH 274/321 mei: me: add comet point V device id
In reply to Greg Kroah-HartmanFrom: Alexander Usyskin <[email protected]>
commit 82b29b9f72afdccb40ea5f3c13c6a3cb65a597bc upstream.
Comet Point (Comet Lake) V device id.
--- drivers/misc/mei/hw-me-regs.h | 1 + drivers/misc/mei/pci-me.c | 1 + 2 files changed, 2 insertions(+)
drivers/misc/mei/hw-me-regs.h +1 -0
@@ -141,6 +141,7 @@#define MEI_DEV_ID_CMP_LP 0x02e0/* Comet Point LP */ #define MEI_DEV_ID_CMP_LP_3 0x02e4/* Comet Point LP 3 (iTouch) */ +#define MEI_DEV_ID_CMP_V 0xA3BA/* Comet Point Lake V */ #define MEI_DEV_ID_ICP_LP 0x34E0/* Ice Lake Point LP */
drivers/misc/mei/pci-me.c +1 -0
@@ -107,6 +107,7 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_V, MEI_ME_PCH12_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)},
Greg Kroah-Hartman
maintainerPATCH 275/321 thunderbolt: Power cycle the router if NVM authentication fails
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
commit 7a7ebfa85f4fac349f3ab219538c44efe18b0cf6 upstream.
On zang's Dell XPS 13 9370 after Thunderbolt NVM firmware upgrade the Thunderbolt controller did not come back as expected. Only after the system was rebooted it became available again. It is not entirely clear what happened but I suspect the new NVM firmware image authentication failed for some reason. Regardless of this the router needs to be power cycled if NVM authentication fails in order to get it fully functional again.
This modifies the driver to issue a power cycle in case the NVM authentication fails immediately when dma_port_flash_update_auth() returns. We also need to call tb_switch_set_uuid() earlier to be able to fetch possible NVM authentication failure when DMA port is added.
--- drivers/thunderbolt/switch.c | 54 +++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-)
drivers/thunderbolt/switch.c +42 -12
@@ -167,7 +167,7 @@ static int nvm_validate_and_write(structstatic int nvm_authenticate_host (struct tb_switch *sw) { -int ret; +int ret =0 ;/* * Root switch NVM upgrade requires that we disconnect the
@@ -175,6 +175,8 @@ static int nvm_authenticate_host(struct* already). */ if (!sw->safe_mode) { +u32 status; + ret =tb_domain_disconnect_all_paths (sw->tb);if (ret)return ret;
@@ -183,7 +185,16 @@ static int nvm_authenticate_host(struct* everything goes well so getting timeout is expected. */ ret =dma_port_flash_update_auth (sw->dma_port); -return ret == -ETIMEDOUT ?0 : ret; +if (!ret || ret == -ETIMEDOUT ) +return 0 ; + +/* +* Any error from update auth operation requires power +* cycling of the host router. +*/ +tb_sw_warn (sw,"failed to authenticate NVM, power cycling\n" ); +if (dma_port_flash_update_auth_status (sw->dma_port, &status) >0 ) +nvm_set_auth_status (sw, status); }/*
@@ -191,7 +202,7 @@ static int nvm_authenticate_host(struct* switch. */ dma_port_power_cycle (sw->dma_port); -return 0 ; +return ret; }static int nvm_authenticate_device (struct tb_switch *sw)
@@ -199,8 +210,16 @@ static int nvm_authenticate_device(strucint ret, retries =10 ; ret =dma_port_flash_update_auth (sw->dma_port); -if (ret && ret != -ETIMEDOUT ) +switch (ret) { +case 0 : +case -ETIMEDOUT : +case -EACCES : +case -EINVAL : +/* Power cycle is required */ +break ; +default :return ret; + }/* * Poll here for the authentication status. It takes some time
@@ -937,8 +956,6 @@ static ssize_t nvm_authenticate_store(st*/ nvm_authenticate_start (sw); ret =nvm_authenticate_host (sw); -if (ret) -nvm_authenticate_complete (sw); }else { ret =nvm_authenticate_device (sw); }
@@ -1332,13 +1349,16 @@ static int tb_switch_add_dma_port(structint ret;switch (sw->generation) { -case 3 : -break ; -case 2 :/* Only root switch can be upgraded */ if (tb_route (sw))return 0 ; + +/* fallthrough */ +case 3 : + ret =tb_switch_set_uuid (sw); +if (ret) +return ret;break ;default :
@@ -1359,6 +1379,19 @@ static int tb_switch_add_dma_port(structreturn 0 ;/* +* If there is status already set then authentication failed +* when the dma_port_flash_update_auth() returned. Power cycling +* is not needed (it was done already) so only thing we do here +* is to unblock runtime PM of the root port. +*/ +nvm_get_auth_status (sw, &status); +if (status) { +if (!tb_route (sw)) +nvm_authenticate_complete (sw); +return 0 ; + } + +/* * Check status of the previous flash authentication. If there * is one we need to power cycle the switch in any case to make * it functional again.
@@ -1373,9 +1406,6 @@ static int tb_switch_add_dma_port(structif (status) {tb_sw_info (sw,"switch flash authentication failed\n" ); - ret =tb_switch_set_uuid (sw); -if (ret) -return ret;nvm_set_auth_status (sw, status); }
Greg Kroah-Hartman
maintainerPATCH 276/321 xfrm: Fix memleak on xfrm state destroy
In reply to Greg Kroah-HartmanFrom: Steffen Klassert <[email protected]>
commit 86c6739eda7d2a03f2db30cbee67a5fb81afa8ba upstream.
We leak the page that we use to create skb page fragments when destroying the xfrm_state. Fix this by dropping a page reference if a page was assigned to the xfrm_state.
--- net/xfrm/xfrm_state.c | 2 ++ 1 file changed, 2 insertions(+)
net/xfrm/xfrm_state.c +2 -0
@@ -456,6 +456,8 @@ static void ___xfrm_state_destroy(struct x->type->destructor (x);xfrm_put_type (x->type); } +if (x->xfrag.page) +put_page (x->xfrag.page);xfrm_dev_state_free (x);security_xfrm_state_free (x);xfrm_state_free (x);
Greg Kroah-Hartman
maintainerPATCH 277/321 media: v4l2-ctrl: fix flags for DO_WHITE_BALANCE
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
commit a0816e5088baab82aa738d61a55513114a673c8e upstream.
Control DO_WHITE_BALANCE is a button, with read only and execute-on-write flags. Adding this control in the proper list in the fill function.
After adding it here, we can see output of v4l2-ctl -L do_white_balance 0x0098090d (button) : flags=write-only, execute-on-write
--- drivers/media/v4l2-core/v4l2-ctrls.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/v4l2-core/v4l2-ctrls.c +1 -0
@@ -1145,6 +1145,7 @@ void v4l2_ctrl_fill(u32 id, const char *case V4L2_CID_FLASH_STROBE_STOP :case V4L2_CID_AUTO_FOCUS_START :case V4L2_CID_AUTO_FOCUS_STOP : +case V4L2_CID_DO_WHITE_BALANCE : *type =V4L2_CTRL_TYPE_BUTTON ; *flags |=V4L2_CTRL_FLAG_WRITE_ONLY |V4L2_CTRL_FLAG_EXECUTE_ON_WRITE ;
Greg Kroah-Hartman
maintainerPATCH 278/321 net: macb: fix error format in dev_err()
In reply to Greg Kroah-HartmanFrom: Luca Ceresoli <[email protected]>
commit f413cbb332a0b5251a790f396d0eb4ebcade5dec upstream.
Errors are negative numbers. Using %u shows them as very large positive numbers such as 4294967277 that don't make sense. Use the %d format instead, and get a much nicer -19.
--- drivers/net/ethernet/cadence/macb_main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +7 -7
@@ -3328,7 +3328,7 @@ static int macb_clk_init(struct platformif (!err) err = -ENODEV ; -dev_err (&pdev->dev,"failed to get macb_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to get macb_clk (%d)\n" , err);return err; }
@@ -3337,7 +3337,7 @@ static int macb_clk_init(struct platformif (!err) err = -ENODEV ; -dev_err (&pdev->dev,"failed to get hclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to get hclk (%d)\n" , err);return err; }
@@ -3351,25 +3351,25 @@ static int macb_clk_init(struct platform err =clk_prepare_enable (*pclk);if (err) { -dev_err (&pdev->dev,"failed to enable pclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable pclk (%d)\n" , err);return err; } err =clk_prepare_enable (*hclk);if (err) { -dev_err (&pdev->dev,"failed to enable hclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable hclk (%d)\n" , err); goto err_disable_pclk; } err =clk_prepare_enable (*tx_clk);if (err) { -dev_err (&pdev->dev,"failed to enable tx_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable tx_clk (%d)\n" , err); goto err_disable_hclk; } err =clk_prepare_enable (*rx_clk);if (err) { -dev_err (&pdev->dev,"failed to enable rx_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable rx_clk (%d)\n" , err); goto err_disable_txclk; }
@@ -3839,7 +3839,7 @@ static int at91ether_clk_init(struct pla err =clk_prepare_enable (*pclk);if (err) { -dev_err (&pdev->dev,"failed to enable pclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable pclk (%d)\n" , err);return err; }
Greg Kroah-Hartman
maintainerPATCH 279/321 pwm: Clear chip_data in pwm_put()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
commit e926b12c611c2095c7976e2ed31753ad6eb5ff1a upstream.
After a PWM is disposed by its user the per chip data becomes invalid. Clear the data in common code instead of the device drivers to get consistent behaviour. Before this patch only three of nine drivers cleaned up here.
--- drivers/pwm/core.c | 1 + drivers/pwm/pwm-berlin.c | 1 - drivers/pwm/pwm-pca9685.c | 1 - drivers/pwm/pwm-samsung.c | 1 - 4 files changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/core.c +1 -0
@@ -874,6 +874,7 @@ void pwm_put(struct pwm_device *pwm)if (pwm->chip->ops->free) pwm->chip->ops->free (pwm->chip, pwm); +pwm_set_chip_data (pwm,NULL ); pwm->label =NULL ;module_put (pwm->chip->ops->owner);
drivers/pwm/pwm-berlin.c +0 -1
@@ -84,7 +84,6 @@ static void berlin_pwm_free(struct pwm_c {struct berlin_pwm_channel *channel =pwm_get_chip_data (pwm); -pwm_set_chip_data (pwm,NULL );kfree (channel); }
drivers/pwm/pwm-pca9685.c +0 -1
@@ -176,7 +176,6 @@ static void pca9685_pwm_gpio_free(structpm_runtime_put (pca->chip.dev);mutex_lock (&pca->lock); pwm = &pca->chip.pwms[offset]; -pwm_set_chip_data (pwm,NULL );mutex_unlock (&pca->lock); }
drivers/pwm/pwm-samsung.c +0 -1
@@ -238,7 +238,6 @@ static int pwm_samsung_request(struct pwstatic void pwm_samsung_free (struct pwm_chip *chip,struct pwm_device *pwm) {devm_kfree (chip->dev,pwm_get_chip_data (pwm)); -pwm_set_chip_data (pwm,NULL ); }static int pwm_samsung_enable (struct pwm_chip *chip,struct pwm_device *pwm)
Greg Kroah-Hartman
maintainerPATCH 280/321 media: atmel: atmel-isc: fix asd memory allocation
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
commit 1e4e25c4959c10728fbfcc6a286f9503d32dfe02 upstream.
The subsystem will free the asd memory on notifier cleanup, if the asd is added to the notifier.
However the memory is freed using kfree.
Thus, we cannot allocate the asd using devm_*
This can lead to crashes and problems.
To test this issue, just return an error at probe, but cleanup the notifier beforehand.
--- drivers/media/platform/atmel/atmel-isc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc.c +6 -2
@@ -2062,8 +2062,11 @@ static int isc_parse_dt(struct device *dbreak ; } - subdev_entity->asd =devm_kzalloc (dev, -sizeof (*subdev_entity->asd),GFP_KERNEL ); +/* asd will be freed by the subsystem once it's added to the +* notifier list +*/ + subdev_entity->asd =kzalloc (sizeof (*subdev_entity->asd), +GFP_KERNEL );if (!subdev_entity->asd) {of_node_put (rem); ret = -ENOMEM ;
@@ -2209,6 +2212,7 @@ static int atmel_isc_probe(struct platfo &subdev_entity->notifier);if (ret) {dev_err (dev,"fail to register async notifier\n" ); +kfree (subdev_entity->asd); goto cleanup_subdev; }
Greg Kroah-Hartman
maintainerPATCH 281/321 media: atmel: atmel-isc: fix INIT_WORK misplacement
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
commit 79199002db5c571e335131856b3ff057ffd9f3c0 upstream.
In case the completion function failes, unbind will be called which will call cancel_work for awb_work.
This will trigger a WARN message from the workqueue.
To avoid this, move the INIT_WORK call at the start of the completion function. This way the work is always initialized, which corresponds to the 'always canceled' unbind code.
--- drivers/media/platform/atmel/atmel-isc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/atmel/atmel-isc.c +2 -2
@@ -1895,6 +1895,8 @@ static int isc_async_complete(struct v4lstruct vb2_queue *q = &isc->vb2_vidq;int ret; +INIT_WORK (&isc->awb_work, isc_awb_work); + ret =v4l2_device_register_subdev_nodes (&isc->v4l2_dev);if (ret <0 ) {v4l2_err (&isc->v4l2_dev,"Failed to register subdev nodes\n" );
@@ -1948,8 +1950,6 @@ static int isc_async_complete(struct v4lreturn ret; } -INIT_WORK (&isc->awb_work, isc_awb_work); -/* Register video device */ strlcpy (vdev->name,ATMEL_ISC_NAME ,sizeof (vdev->name)); vdev->release = video_device_release_empty;
Greg Kroah-Hartman
maintainerPATCH 282/321 macvlan: schedule bc_work even if error
In reply to Greg Kroah-HartmanFrom: Menglong Dong <[email protected]>
[ Upstream commit 1d7ea55668878bb350979c377fc72509dd6f5b21 ]
While enqueueing a broadcast skb to port->bc_queue, schedule_work() is called to add port->bc_work, which processes the skbs in bc_queue, to "events" work queue. If port->bc_queue is full, the skb will be discarded and schedule_work(&port->bc_work) won't be called. However, if port->bc_queue is full and port->bc_work is not running or pending, port->bc_queue will keep full and schedule_work() won't be called any more, and all broadcast skbs to macvlan will be discarded. This case can happen:
macvlan_process_broadcast() is the pending function of port->bc_work, it moves all the skbs in port->bc_queue to the queue "list", and processes the skbs in "list". During this, new skbs will keep being added to port->bc_queue in macvlan_broadcast_enqueue(), and port->bc_queue may already full when macvlan_process_broadcast() return. This may happen, especially when there are a lot of real-time threads and the process is preempted.
Fix this by calling schedule_work(&port->bc_work) even if port->bc_work is full in macvlan_broadcast_enqueue().
--- drivers/net/macvlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/macvlan.c +2 -1
@@ -363,10 +363,11 @@ static void macvlan_broadcast_enqueue(st }spin_unlock (&port->bc_queue.lock); +schedule_work (&port->bc_work); +if (err) goto free_nskb; -schedule_work (&port->bc_work);return ; free_nskb:
Greg Kroah-Hartman
maintainerPATCH 283/321 net: psample: fix skb_over_panic
In reply to Greg Kroah-HartmanFrom: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 7eb9d7675c08937cd11d32b0b40442d4d731c5ee ]
We need to calculate the skb size correctly otherwise we risk triggering skb_over_panic[1]. The issue is that data_len is added to the skb in a nl attribute, but we don't account for its header size (nlattr 4 bytes) and alignment. We account for it when calculating the total size in the > PSAMPLE_MAX_PACKET_SIZE comparison correctly, but not when allocating after that. The fix is simple - use nla_total_size() for data_len when allocating.
To reproduce:
$ tc qdisc add dev eth1 clsact $ tc filter add dev eth1 egress matchall action sample rate 1 group 1 trunc 129 $ mausezahn eth1 -b bcast -a rand -c 1 -p 129 < skb_over_panic BUG(), tail is 4 bytes past skb->end >
[1] Trace:
[ 50.459526][ T3480] skbuff: skb_over_panic: text:(____ptrval____) len:196 put:136 head:(____ptrval____) data:(____ptrval____) tail:0xc4 end:0xc0 dev:<NULL> [ 50.474339][ T3480] ------------[ cut here ]------------ [ 50.481132][ T3480] kernel BUG at net/core/skbuff.c:108! [ 50.486059][ T3480] invalid opcode: 0000 [#1] PREEMPT SMP [ 50.489463][ T3480] CPU: 3 PID: 3480 Comm: mausezahn Not tainted 5.4.0-rc7 #108 [ 50.492844][ T3480] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014 [ 50.496551][ T3480] RIP: 0010:skb_panic+0x79/0x7b [ 50.498261][ T3480] Code: bc 00 00 00 41 57 4c 89 e6 48 c7 c7 90 29 9a 83 4c 8b 8b c0 00 00 00 50 8b 83 b8 00 00 00 50 ff b3 c8 00 00 00 e8 ae ef c0 fe <0f> 0b e8 2f df c8 fe 48 8b 55 08 44 89 f6 4c 89 e7 48 c7 c1 a0 22 [ 50.504111][ T3480] RSP: 0018:ffffc90000447a10 EFLAGS: 00010282 [ 50.505835][ T3480] RAX: 0000000000000087 RBX: ffff888039317d00 RCX: 0000000000000000 [ 50.507900][ T3480] RDX: 0000000000000000 RSI: ffffffff812716e1 RDI: 00000000ffffffff [ 50.509820][ T3480] RBP: ffffc90000447a60 R08: 0000000000000001 R09: 0000000000000000 [ 50.511735][ T3480] R10: ffffffff81d4f940 R11: 0000000000000000 R12: ffffffff834a22b0 [ 50.513494][ T3480] R13: ffffffff82c10433 R14: 0000000000000088 R15: ffffffff838a8084 [ 50.515222][ T3480] FS: 00007f3536462700(0000) GS:ffff88803eac0000(0000) knlGS:0000000000000000 [ 50.517135][ T3480] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 50.518583][ T3480] CR2: 0000000000442008 CR3: 000000003b222000 CR4: 00000000000006e0 [ 50.520723][ T3480] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 50.522709][ T3480] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 50.524450][ T3480] Call Trace: [ 50.525214][ T3480] skb_put.cold+0x1b/0x1b [ 50.526171][ T3480] psample_sample_packet+0x1d3/0x340 [ 50.527307][ T3480] tcf_sample_act+0x178/0x250 [ 50.528339][ T3480] tcf_action_exec+0xb1/0x190 [ 50.529354][ T3480] mall_classify+0x67/0x90 [ 50.530332][ T3480] tcf_classify+0x72/0x160 [ 50.531286][ T3480] __dev_queue_xmit+0x3db/0xd50 [ 50.532327][ T3480] dev_queue_xmit+0x18/0x20 [ 50.533299][ T3480] packet_sendmsg+0xee7/0x2090 [ 50.534331][ T3480] sock_sendmsg+0x54/0x70 [ 50.535271][ T3480] __sys_sendto+0x148/0x1f0 [ 50.536252][ T3480] ? tomoyo_file_ioctl+0x23/0x30 [ 50.537334][ T3480] ? ksys_ioctl+0x5e/0xb0 [ 50.540068][ T3480] __x64_sys_sendto+0x2a/0x30 [ 50.542810][ T3480] do_syscall_64+0x73/0x1f0 [ 50.545383][ T3480] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 50.548477][ T3480] RIP: 0033:0x7f35357d6fb3 [ 50.551020][ T3480] Code: 48 8b 0d 18 90 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d f9 d3 20 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8 eb f6 ff ff 48 89 04 24 [ 50.558547][ T3480] RSP: 002b:00007ffe0c7212c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c [ 50.561870][ T3480] RAX: ffffffffffffffda RBX: 0000000001dac010 RCX: 00007f35357d6fb3 [ 50.565142][ T3480] RDX: 0000000000000082 RSI: 0000000001dac2a2 RDI: 0000000000000003 [ 50.568469][ T3480] RBP: 00007ffe0c7212f0 R08: 00007ffe0c7212d0 R09: 0000000000000014 [ 50.571731][ T3480] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000082 [ 50.574961][ T3480] R13: 0000000001dac2a2 R14: 0000000000000001 R15: 0000000000000003 [ 50.578170][ T3480] Modules linked in: sch_ingress virtio_net [ 50.580976][ T3480] ---[ end trace 61a515626a595af6 ]---
--- net/psample/psample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/psample/psample.c +1 -1
@@ -223,7 +223,7 @@ void psample_sample_packet(struct psampl data_len =PSAMPLE_MAX_PACKET_SIZE - meta_len -NLA_HDRLEN -NLA_ALIGNTO ; - nl_skb =genlmsg_new (meta_len + data_len,GFP_ATOMIC ); + nl_skb =genlmsg_new (meta_len +nla_total_size (data_len),GFP_ATOMIC );if (unlikely (!nl_skb))return ;
Greg Kroah-Hartman
maintainerPATCH 284/321 openvswitch: fix flow command message size
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 4e81c0b3fa93d07653e2415fa71656b080a112fd ]
When user-space sets the OVS_UFID_F_OMIT_* flags, and the relevant flow has no UFID, we can exceed the computed size, as ovs_nla_put_identifier() will always dump an OVS_FLOW_ATTR_KEY attribute.
Take the above in account when computing the flow command message size.
--- net/openvswitch/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/openvswitch/datapath.c +5 -1
@@ -697,9 +697,13 @@ static size_t ovs_flow_cmd_msg_size(cons {size_t len =NLMSG_ALIGN (sizeof (struct ovs_header )); -/* OVS_FLOW_ATTR_UFID */ +/* OVS_FLOW_ATTR_UFID, or unmasked flow key as fallback +* see ovs_nla_put_identifier() +*/ if (sfid &&ovs_identifier_is_ufid (sfid)) len +=nla_total_size (sfid->ufid_len); +else + len +=nla_total_size (ovs_key_attr_size ());/* OVS_FLOW_ATTR_KEY */ if (!sfid ||should_fill_key (sfid, ufid_flags))
Greg Kroah-Hartman
maintainerPATCH 285/321 sctp: Fix memory leak in sctp_sf_do_5_2_4_dupcook
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit b6631c6031c746ed004c4221ec0616d7a520f441 ]
In the implementation of sctp_sf_do_5_2_4_dupcook() the allocated new_asoc is leaked if security_sctp_assoc_request() fails. Release it via sctp_association_free().
--- net/sctp/sm_statefuns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sctp/sm_statefuns.c +3 -1
@@ -2175,8 +2175,10 @@ enum sctp_disposition sctp_sf_do_5_2_4_d/* Update socket peer label if first association. */ if (security_sctp_assoc_request ((struct sctp_endpoint *)ep, - chunk->skb)) + chunk->skb)) { +sctp_association_free (new_asoc);return sctp_sf_pdiscard (net, ep, asoc, type, arg, commands); + }/* Set temp so that it won't be added into hashtable */ new_asoc->temp =1 ;
Greg Kroah-Hartman
maintainerPATCH 286/321 slip: Fix use-after-free Read in slip_open
In reply to Greg Kroah-HartmanFrom: Jouni Hogander <[email protected]>
[ Upstream commit e58c1912418980f57ba2060017583067f5f71e52 ]
Slip_open doesn't clean-up device which registration failed from the slip_devs device list. On next open after failure this list is iterated and freed device is accessed. Fix this by calling sl_free_netdev in error path.
Here is the trace from the Syzbot:
__dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:634 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 sl_sync drivers/net/slip/slip.c:725 [inline] slip_open+0xecd/0x11b7 drivers/net/slip/slip.c:801 tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469 tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596 tiocsetd drivers/tty/tty_io.c:2334 [inline] tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- drivers/net/slip/slip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/slip/slip.c +1 -0
@@ -855,6 +855,7 @@ err_free_chan: sl->tty =NULL ; tty->disc_data =NULL ;clear_bit (SLF_INUSE , &sl->flags); +sl_free_netdev (sl->dev);free_netdev (sl->dev); err_exit:
Greg Kroah-Hartman
maintainerPATCH 287/321 openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info()
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 8ffeb03fbba3b599690b361467bfd2373e8c450f ]
All the callers of ovs_flow_cmd_build_info() already deal with error return code correctly, so we can handle the error condition in a more gracefull way. Still dump a warning to preserve debuggability.
v1 -> v2:
- clarify the commit message
- clean the skb and report the error (DaveM)
--- net/openvswitch/datapath.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/openvswitch/datapath.c +4 -1
@@ -879,7 +879,10 @@ static struct sk_buff *ovs_flow_cmd_buil retval =ovs_flow_cmd_fill_info (flow, dp_ifindex, skb, info->snd_portid, info->snd_seq,0 , cmd, ufid_flags); -BUG_ON (retval <0 ); +if (WARN_ON_ONCE (retval <0 )) { +kfree_skb (skb); + skb =ERR_PTR (retval); + }return skb; }
Greg Kroah-Hartman
maintainerPATCH 288/321 openvswitch: remove another BUG_ON()
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 8a574f86652a4540a2433946ba826ccb87f398cc ]
If we can't build the flow del notification, we can simply delete the flow, no need to crash the kernel. Still keep a WARN_ON to preserve debuggability.
Note: the BUG_ON() predates the Fixes tag, but this change can be applied only after the mentioned commit.
v1 -> v2:
- do not leak an skb on error
--- net/openvswitch/datapath.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/openvswitch/datapath.c +5 -1
@@ -1345,7 +1345,10 @@ static int ovs_flow_cmd_del(struct sk_buOVS_FLOW_CMD_DEL , ufid_flags);rcu_read_unlock (); -BUG_ON (err <0 ); +if (WARN_ON_ONCE (err <0 )) { +kfree_skb (reply); + goto out_free; + }ovs_notify (&dp_flow_genl_family, reply, info); }else {
@@ -1353,6 +1356,7 @@ static int ovs_flow_cmd_del(struct sk_bu } } +out_free:ovs_flow_free (flow, true);return 0 ; unlock:
Greg Kroah-Hartman
maintainerPATCH 289/321 selftests: bpf: test_sockmap: handle file creation failures gracefully
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 4b67c515036313f3c3ecba3cb2babb9cbddb3f85 ]
test_sockmap creates a temporary file to use for sendpage. this may fail for various reasons. Handle the error rather than segfault.
--- tools/testing/selftests/bpf/test_sockmap.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/testing/selftests/bpf/test_sockmap.c +9 -0
@@ -248,6 +248,10 @@ static int msg_loop_sendpage(int fd, intint i, fp; file =fopen (".sendpage_tst.tmp" ,"w+" ); +if (!file) { +perror ("create file for sendpage" ); +return 1 ; + }for (i =0 ; i < iov_length * cnt; i++, k++)fwrite (&k,sizeof (char ),1 , file);fflush (file);
@@ -255,6 +259,11 @@ static int msg_loop_sendpage(int fd, intfclose (file); fp =open (".sendpage_tst.tmp" ,O_RDONLY ); +if (fp <0 ) { +perror ("reopen file for sendpage" ); +return 1 ; + } +clock_gettime (CLOCK_MONOTONIC , &s->start);for (i =0 ; i < cnt; i++) {int sent =sendfile (fd, fp,NULL , iov_length);
Greg Kroah-Hartman
maintainerPATCH 290/321 tipc: fix link name length check
In reply to Greg Kroah-HartmanFrom: John Rutherford <[email protected]>
[ Upstream commit fd567ac20cb0377ff466d3337e6e9ac5d0cb15e4 ]
In commit 4f07b80c9733 ("tipc: check msg->req data len in tipc_nl_compat_bearer_disable") the same patch code was copied into
routines: tipc_nl_compat_bearer_disable(), tipc_nl_compat_link_stat_dump() and tipc_nl_compat_link_reset_stats(). The two link routine occurrences should have been modified to check the maximum link name length and not bearer name length.
--- net/tipc/netlink_compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tipc/netlink_compat.c +2 -2
@@ -548,7 +548,7 @@ static int tipc_nl_compat_link_stat_dumpif (len <=0 )return -EINVAL ; - len =min_t (int, len,TIPC_MAX_BEARER_NAME ); + len =min_t (int, len,TIPC_MAX_LINK_NAME );if (!string_is_valid (name, len))return -EINVAL ;
@@ -830,7 +830,7 @@ static int tipc_nl_compat_link_reset_staif (len <=0 )return -EINVAL ; - len =min_t (int, len,TIPC_MAX_BEARER_NAME ); + len =min_t (int, len,TIPC_MAX_LINK_NAME );if (!string_is_valid (name, len))return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 291/321 sctp: cache netns in sctp_ep_common
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 312434617cb16be5166316cf9d08ba760b1042a1 ]
This patch is to fix a data-race reported by syzbot:
BUG: KCSAN: data-race in sctp_assoc_migrate / sctp_hash_obj
write to 0xffff8880b67c0020 of 8 bytes by task 18908 on cpu 1:
sctp_assoc_migrate+0x1a6/0x290 net/sctp/associola.c:1091
sctp_sock_migrate+0x8aa/0x9b0 net/sctp/socket.c:9465
sctp_accept+0x3c8/0x470 net/sctp/socket.c:4916
inet_accept+0x7f/0x360 net/ipv4/af_inet.c:734
__sys_accept4+0x224/0x430 net/socket.c:1754
__do_sys_accept net/socket.c:1795 [inline]
__se_sys_accept net/socket.c:1792 [inline]
__x64_sys_accept+0x4e/0x60 net/socket.c:1792
do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x44/0xa9 read to 0xffff8880b67c0020 of 8 bytes by task 12003 on cpu 0:
sctp_hash_obj+0x4f/0x2d0 net/sctp/input.c:894
rht_key_get_hash include/linux/rhashtable.h:133 [inline]
rht_key_hashfn include/linux/rhashtable.h:159 [inline]
rht_head_hashfn include/linux/rhashtable.h:174 [inline]
head_hashfn lib/rhashtable.c:41 [inline]
rhashtable_rehash_one lib/rhashtable.c:245 [inline]
rhashtable_rehash_chain lib/rhashtable.c:276 [inline]
rhashtable_rehash_table lib/rhashtable.c:316 [inline]
rht_deferred_worker+0x468/0xab0 lib/rhashtable.c:420
process_one_work+0x3d4/0x890 kernel/workqueue.c:2269
worker_thread+0xa0/0x800 kernel/workqueue.c:2415
kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352It was caused by rhashtable access asoc->base.sk when sctp_assoc_migrate is changing its value. However, what rhashtable wants is netns from asoc base.sk, and for an asoc, its netns won't change once set. So we can simply fix it by caching netns since created.
--- include/net/sctp/structs.h | 3 +++ net/sctp/associola.c | 1 + net/sctp/endpointola.c | 1 + net/sctp/input.c | 4 ++-- 4 files changed, 7 insertions(+), 2 deletions(-)
include/net/sctp/structs.h +3 -0
@@ -1247,6 +1247,9 @@ struct sctp_ep_common {/* What socket does this endpoint belong to? */ struct sock *sk; +/* Cache netns and it won't change once set */ +struct net *net; +/* This is where we receive inbound chunks. */ struct sctp_inq inqueue;
net/sctp/associola.c +1 -0
@@ -80,6 +80,7 @@ static struct sctp_association *sctp_ass/* Discarding const is appropriate here. */ asoc->ep = (struct sctp_endpoint *)ep; asoc->base.sk = (struct sock *)sk; + asoc->base.net =sock_net (sk);sctp_endpoint_hold (asoc->ep);sock_hold (asoc->base.sk);
net/sctp/endpointola.c +1 -0
@@ -165,6 +165,7 @@ static struct sctp_endpoint *sctp_endpoi/* Remember who we are attached to. */ ep->base.sk = sk; + ep->base.net =sock_net (sk);sock_hold (ep->base.sk);return ep;
net/sctp/input.c +2 -2
@@ -815,7 +815,7 @@ static inline int sctp_hash_cmp(struct rif (!sctp_transport_hold (t))return err; -if (!net_eq (sock_net (t->asoc->base.sk), x->net)) +if (!net_eq (t->asoc->base.net, x->net)) goto out;if (x->lport !=htons (t->asoc->base.bind_addr.port)) goto out;
@@ -830,7 +830,7 @@ static inline __u32 sctp_hash_obj(const {const struct sctp_transport *t = data;const union sctp_addr *paddr = &t->ipaddr; -const struct net *net =sock_net (t->asoc->base.sk); +const struct net *net = t->asoc->base.net;__be16 lport =htons (t->asoc->base.bind_addr.port);__u32 addr;
Greg Kroah-Hartman
maintainerPATCH 292/321 net: sched: fix `tc -s class show` no bstats on class with nolock subqueues
In reply to Greg Kroah-HartmanFrom: Dust Li <[email protected]>
[ Upstream commit 14e54ab9143fa60794d13ea0a66c792a2046a8f3 ]
When a classful qdisc's child qdisc has set the flag TCQ_F_CPUSTATS (pfifo_fast for example), the child qdisc's cpu_bstats should be passed to gnet_stats_copy_basic(), but many classful qdisc didn't do that. As a result, tc -s class show dev DEV always return 0 for bytes and packets in this case.
Pass the child qdisc's cpu_bstats to gnet_stats_copy_basic() to fix this issue.
The qstats also has this problem, but it has been fixed in 5dd431b6b9 ("net: sched: introduce and use qstats read...") and bstats still remains buggy.
--- net/sched/sch_mq.c | 3 ++- net/sched/sch_mqprio.c | 4 ++-- net/sched/sch_multiq.c | 2 +- net/sched/sch_prio.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-)
net/sched/sch_mq.c +2 -1
@@ -242,7 +242,8 @@ static int mq_dump_class_stats(struct Qdstruct netdev_queue *dev_queue =mq_queue_get (sch, cl); sch = dev_queue->qdisc_sleeping; -if (gnet_stats_copy_basic (&sch->running, d,NULL , &sch->bstats) <0 || +if (gnet_stats_copy_basic (&sch->running, d, sch->cpu_bstats, + &sch->bstats) <0 ||gnet_stats_copy_queue (d,NULL , &sch->qstats, sch->q.qlen) <0 )return -1 ;return 0 ;
net/sched/sch_mqprio.c +2 -2
@@ -559,8 +559,8 @@ static int mqprio_dump_class_stats(strucstruct netdev_queue *dev_queue =mqprio_queue_get (sch, cl); sch = dev_queue->qdisc_sleeping; -if (gnet_stats_copy_basic (qdisc_root_sleeping_running (sch), - d,NULL , &sch->bstats) <0 || +if (gnet_stats_copy_basic (qdisc_root_sleeping_running (sch), d, + sch->cpu_bstats, &sch->bstats) <0 ||gnet_stats_copy_queue (d,NULL , &sch->qstats, sch->q.qlen) <0 )return -1 ;
net/sched/sch_multiq.c +1 -1
@@ -343,7 +343,7 @@ static int multiq_dump_class_stats(struc cl_q = q->queues[cl -1 ];if (gnet_stats_copy_basic (qdisc_root_sleeping_running (sch), - d,NULL , &cl_q->bstats) <0 || + d, cl_q->cpu_bstats, &cl_q->bstats) <0 ||gnet_stats_copy_queue (d,NULL , &cl_q->qstats, cl_q->q.qlen) <0 )return -1 ;
net/sched/sch_prio.c +1 -1
@@ -396,7 +396,7 @@ static int prio_dump_class_stats(struct cl_q = q->queues[cl -1 ];if (gnet_stats_copy_basic (qdisc_root_sleeping_running (sch), - d,NULL , &cl_q->bstats) <0 || + d, cl_q->cpu_bstats, &cl_q->bstats) <0 ||gnet_stats_copy_queue (d,NULL , &cl_q->qstats, cl_q->q.qlen) <0 )return -1 ;
Greg Kroah-Hartman
maintainerPATCH 293/321 net: macb: add missed tasklet_kill
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 61183b056b49e2937ff92a1424291ba36a6f6d05 ]
This driver forgets to kill tasklet in remove. Add the call to fix it.
--- drivers/net/ethernet/cadence/macb_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/cadence/macb_main.c +1 -0
@@ -4192,6 +4192,7 @@ static int macb_remove(struct platform_dmdiobus_free (bp->mii_bus);unregister_netdev (dev); +tasklet_kill (&bp->hresp_err_tasklet);clk_disable_unprepare (bp->tx_clk);clk_disable_unprepare (bp->hclk);clk_disable_unprepare (bp->pclk);
Greg Kroah-Hartman
maintainerPATCH 294/321 ext4: add more paranoia checking in ext4_expand_extra_isize handling
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 4ea99936a1630f51fc3a2d61a58ec4a1c4b7d55a upstream.
It's possible to specify a non-zero s_want_extra_isize via debugging option, and this can cause bad things(tm) to happen when using a file system with an inode size of 128 bytes.
Add better checking when the file system is mounted, as well as when we are actually doing the trying to do the inode expansion.
--- fs/ext4/inode.c | 15 +++++++++++++++ fs/ext4/super.c | 21 ++++++++++++--------- 2 files changed, 27 insertions(+), 9 deletions(-)
fs/ext4/inode.c +15 -0
@@ -5904,8 +5904,23 @@ static int __ext4_expand_extra_isize(str {struct ext4_inode *raw_inode;struct ext4_xattr_ibody_header *header; +unsigned int inode_size =EXT4_INODE_SIZE (inode->i_sb); +struct ext4_inode_info *ei =EXT4_I (inode);int error; +/* this was checked at iget time, but double check for good measure */ +if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) || + (ei->i_extra_isize &3 )) { +EXT4_ERROR_INODE (inode,"bad extra_isize %u (inode size %u)" , + ei->i_extra_isize, +EXT4_INODE_SIZE (inode->i_sb)); +return -EFSCORRUPTED ; + } +if ((new_extra_isize < ei->i_extra_isize) || + (new_extra_isize <4 ) || + (new_extra_isize > inode_size -EXT4_GOOD_OLD_INODE_SIZE )) +return -EINVAL ;/* Should never happen */ + raw_inode =ext4_raw_inode (iloc); header =IHDR (inode, raw_inode);
fs/ext4/super.c +12 -9
@@ -3517,12 +3517,15 @@ static void ext4_clamp_want_extra_isize( {struct ext4_sb_info *sbi =EXT4_SB (sb);struct ext4_super_block *es = sbi->s_es; +unsigned def_extra_isize =sizeof (struct ext4_inode ) - +EXT4_GOOD_OLD_INODE_SIZE ; -/* determine the minimum size of new large inodes, if present */ -if (sbi->s_inode_size >EXT4_GOOD_OLD_INODE_SIZE && - sbi->s_want_extra_isize ==0 ) { - sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; +if (sbi->s_inode_size ==EXT4_GOOD_OLD_INODE_SIZE ) { + sbi->s_want_extra_isize =0 ; +return ; + } +if (sbi->s_want_extra_isize <4 ) { + sbi->s_want_extra_isize = def_extra_isize;if (ext4_has_feature_extra_isize (sb)) {if (sbi->s_want_extra_isize <le16_to_cpu (es->s_want_extra_isize))
@@ -3535,10 +3538,10 @@ static void ext4_clamp_want_extra_isize( } }/* Check if enough inode space is available */ -if (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > - sbi->s_inode_size) { - sbi->s_want_extra_isize =sizeof (struct ext4_inode ) - -EXT4_GOOD_OLD_INODE_SIZE ; +if ((sbi->s_want_extra_isize > sbi->s_inode_size) || + (EXT4_GOOD_OLD_INODE_SIZE + sbi->s_want_extra_isize > + sbi->s_inode_size)) { + sbi->s_want_extra_isize = def_extra_isize;ext4_msg (sb,KERN_INFO ,"required extra inode space not available" ); }
Greg Kroah-Hartman
maintainerPATCH 295/321 watchdog: sama5d4: fix WDD value to be always set to max
In reply to Greg Kroah-HartmanFrom: Eugen Hristev <[email protected]>
commit 8632944841d41a36d77dd1fa88d4201b5291100f upstream.
WDD value must be always set to max (0xFFF) otherwise the hardware block will reset the board on the first ping of the watchdog.
--- drivers/watchdog/sama5d4_wdt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/watchdog/sama5d4_wdt.c +1 -3
@@ -111,9 +111,7 @@ static int sama5d4_wdt_set_timeout(strucu32 value =WDT_SEC2TICKS (timeout); wdt->mr &= ~AT91_WDT_WDV ; - wdt->mr &= ~AT91_WDT_WDD ; wdt->mr |=AT91_WDT_SET_WDV (value); - wdt->mr |=AT91_WDT_SET_WDD (value);/* * WDDIS has to be 0 when updating WDD/WDV. The datasheet states: When
@@ -251,7 +249,7 @@ static int sama5d4_wdt_probe(struct plat timeout =WDT_SEC2TICKS (wdd->timeout); - wdt->mr |=AT91_WDT_SET_WDD (timeout); + wdt->mr |=AT91_WDT_SET_WDD (WDT_SEC2TICKS (MAX_WDT_TIMEOUT )); wdt->mr |=AT91_WDT_SET_WDV (timeout); ret =sama5d4_wdt_init (wdt);
Greg Kroah-Hartman
maintainerPATCH 296/321 net: macb: Fix SUBNS increment and increase resolution
In reply to Greg Kroah-HartmanFrom: Harini Katakam <[email protected]>
commit 7ad342bc58cc5197cd2f12a3c30b3949528c6d83 upstream.
The subns increment register has 24 bits as follows:
RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0]
Fix the same in the driver and increase sub ns resolution to the best capable, 24 bits. This should be the case on all GEM versions that this PTP driver supports.
--- drivers/net/ethernet/cadence/macb.h | 6 +++++- drivers/net/ethernet/cadence/macb_ptp.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/macb.h +5 -1
@@ -499,7 +499,11 @@/* Bitfields in TISUBN */ #define GEM_SUBNSINCR_OFFSET 0 -#define GEM_SUBNSINCR_SIZE 16 +#define GEM_SUBNSINCRL_OFFSET 24 +#define GEM_SUBNSINCRL_SIZE 8 +#define GEM_SUBNSINCRH_OFFSET 0 +#define GEM_SUBNSINCRH_SIZE 16 +#define GEM_SUBNSINCR_SIZE 24/* Bitfields in TI */ #define GEM_NSINCR_OFFSET 0
drivers/net/ethernet/cadence/macb_ptp.c +4 -1
@@ -115,7 +115,10 @@ static int gem_tsu_incr_set(struct macb* to take effect. */ spin_lock_irqsave (&bp->tsu_clk_lock, flags); -gem_writel (bp,TISUBN ,GEM_BF (SUBNSINCR , incr_spec->sub_ns)); +/* RegBit[15:0] = Subns[23:8]; RegBit[31:24] = Subns[7:0] */ +gem_writel (bp,TISUBN ,GEM_BF (SUBNSINCRL , incr_spec->sub_ns) | +GEM_BF (SUBNSINCRH , (incr_spec->sub_ns >> +GEM_SUBNSINCRL_SIZE )));gem_writel (bp,TI ,GEM_BF (NSINCR , incr_spec->ns));spin_unlock_irqrestore (&bp->tsu_clk_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 297/321 net: macb driver, check for SKBTX_HW_TSTAMP
In reply to Greg Kroah-HartmanFrom: Paul Thomas <[email protected]>
commit a62520473f15750cd1432d36b377a06cd7cff8d2 upstream.
Make sure SKBTX_HW_TSTAMP (i.e. SOF_TIMESTAMPING_TX_HARDWARE) has been enabled for this skb. It does fix the issue where normal socks that aren't expecting a timestamp will not wake up on select, but when a user does want a SOF_TIMESTAMPING_TX_HARDWARE it does work.
--- drivers/net/ethernet/cadence/macb_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +3 -1
@@ -860,7 +860,9 @@ static void macb_tx_interrupt(struct mac/* First, update TX stats if needed */ if (skb) { -if (gem_ptp_do_txstamp (queue, skb, desc) ==0 ) { +if (unlikely (skb_shinfo (skb)->tx_flags & +SKBTX_HW_TSTAMP ) && +gem_ptp_do_txstamp (queue, skb, desc) ==0 ) {/* skb now belongs to timestamp buffer * and will be removed later */
Greg Kroah-Hartman
maintainerPATCH 298/321 mtd: rawnand: atmel: Fix spelling mistake in error message
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit e39bb786816453788836c367caefd72eceea380c upstream.
Wrong copy/paste from the previous block, the error message should refer to #size-cells instead of #address-cells.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +1 -1
@@ -1826,7 +1826,7 @@ static int atmel_nand_controller_add_nan ret =of_property_read_u32 (np,"#size-cells" , &val);if (ret) { -dev_err (dev,"missing #address-cells property\n" ); +dev_err (dev,"missing #size-cells property\n" );return ret; }
Greg Kroah-Hartman
maintainerPATCH 299/321 mtd: rawnand: atmel: fix possible object reference leak
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit a12085d13997ed15f745f33a0e01002541160179 upstream.
of_find_device_by_node() takes a reference to the struct device when it finds a match via get_device, there is no need to call get_device() twice.
We also should make sure to drop the reference to the device taken by of_find_device_by_node() on driver unbind.
--- drivers/mtd/nand/raw/atmel/pmecc.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/atmel/pmecc.c +15 -6
@@ -876,23 +876,32 @@ static struct atmel_pmecc *atmel_pmecc_g {struct platform_device *pdev;struct atmel_pmecc *pmecc, **ptr; +int ret; pdev =of_find_device_by_node (np); -if (!pdev || !platform_get_drvdata (pdev)) +if (!pdev)return ERR_PTR (-EPROBE_DEFER ); + pmecc =platform_get_drvdata (pdev); +if (!pmecc) { + ret = -EPROBE_DEFER ; + goto err_put_device; + } ptr =devres_alloc (devm_atmel_pmecc_put,sizeof (*ptr),GFP_KERNEL ); -if (!ptr) -return ERR_PTR (-ENOMEM ); - -get_device (&pdev->dev); - pmecc =platform_get_drvdata (pdev); +if (!ptr) { + ret = -ENOMEM ; + goto err_put_device; + } *ptr = pmecc;devres_add (userdev, ptr);return pmecc; + +err_put_device: +put_device (&pdev->dev); +return ERR_PTR (ret); }static const int atmel_pmecc_strengths[] = {2 ,4 ,8 ,12 ,24 ,32 };
Greg Kroah-Hartman
maintainerPATCH 300/321 mtd: spi-nor: cast to u64 to avoid uint overflows
In reply to Greg Kroah-HartmanFrom: huijin.park <[email protected]>
commit 84a1c2109d23df3543d96231c4fee1757299bb1a upstream.
The "params->size" is defined as "u64".
And "info->sector_size" and "info->n_sectors" are defined as unsigned int and u16.
Thus, u64 data might have strange data(loss data) if the result overflows an unsigned int.
This patch casts "info->sector_size" to an u64.
--- drivers/mtd/spi-nor/spi-nor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/spi-nor.c +1 -1
@@ -2459,7 +2459,7 @@ static int spi_nor_init_params(struct spmemset (params,0 ,sizeof (*params));/* Set SPI NOR sizes. */ - params->size = info->sector_size * info->n_sectors; + params->size = (u64 )info->sector_size * info->n_sectors; params->page_size = info->page_size;/* (Fast) Read settings. */
Greg Kroah-Hartman
maintainerPATCH 301/321 drm/atmel-hlcdc: revert shift by 8
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
commit cbb32079149dbf557fa3f7bab8fa3c5fec857da7 upstream.
Revert shift by 8 of state->base.alpha. This introduced a regression on planes.
--- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +1 -1
@@ -382,7 +382,7 @@ atmel_hlcdc_plane_update_general_setting cfg |=ATMEL_HLCDC_LAYER_LAEN ; else cfg |= ATMEL_HLCDC_LAYER_GAEN | - ATMEL_HLCDC_LAYER_GA(state->base.alpha >> 8); + ATMEL_HLCDC_LAYER_GA(state->base.alpha); }if (state->disc_h && state->disc_w)
Greg Kroah-Hartman
maintainerPATCH 302/321 mailbox: stm32_ipcc: add spinlock to fix channels concurrent access
In reply to Greg Kroah-HartmanFrom: Arnaud Pouliquen <[email protected]>
commit dba9a3dfe912dc47c9dbc9ba1f5f65adbf9aea0f upstream.
Add spinlock protection on IPCC register update to avoid race condition. Without this fix, stm32_ipcc_set_bits and stm32_ipcc_clr_bits can be called in parallel for different channels. This results in register corruptions.
--- drivers/mailbox/stm32-ipcc.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/mailbox/stm32-ipcc.c +27 -10
@@ -50,6 +50,7 @@ struct stm32_ipcc {void __iomem *reg_base;void __iomem *reg_proc;struct clk *clk; +spinlock_t lock;/* protect access to IPCC registers */ int irqs[IPCC_IRQ_NUM ];int wkp;u32 proc_id;
@@ -58,14 +59,24 @@ struct stm32_ipcc {u32 xmr; }; -static inline void stm32_ipcc_set_bits (void __iomem *reg,u32 mask) +static inline void stm32_ipcc_set_bits (spinlock_t *lock,void __iomem *reg, +u32 mask) { +unsigned long flags; + +spin_lock_irqsave (lock, flags);writel_relaxed (readl_relaxed (reg) | mask, reg); +spin_unlock_irqrestore (lock, flags); } -static inline void stm32_ipcc_clr_bits (void __iomem *reg,u32 mask) +static inline void stm32_ipcc_clr_bits (spinlock_t *lock,void __iomem *reg, +u32 mask) { +unsigned long flags; + +spin_lock_irqsave (lock, flags);writel_relaxed (readl_relaxed (reg) & ~mask, reg); +spin_unlock_irqrestore (lock, flags); }static irqreturn_t stm32_ipcc_rx_irq (int irq,void *data)
@@ -92,7 +103,7 @@ static irqreturn_t stm32_ipcc_rx_irq(intmbox_chan_received_data (&ipcc->controller.chans[chan],NULL ); -stm32_ipcc_set_bits (ipcc->reg_proc +IPCC_XSCR , +stm32_ipcc_set_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XSCR ,RX_BIT_CHAN (chan)); ret =IRQ_HANDLED ;
@@ -121,7 +132,7 @@ static irqreturn_t stm32_ipcc_tx_irq(intdev_dbg (dev,"%s: chan:%d tx\n" , __func__, chan);/* mask 'tx channel free' interrupt */ -stm32_ipcc_set_bits (ipcc->reg_proc +IPCC_XMR , +stm32_ipcc_set_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XMR ,TX_BIT_CHAN (chan));mbox_chan_txdone (&ipcc->controller.chans[chan],0 );
@@ -141,10 +152,12 @@ static int stm32_ipcc_send_data(struct mdev_dbg (ipcc->controller.dev,"%s: chan:%d\n" , __func__, chan);/* set channel n occupied */ -stm32_ipcc_set_bits (ipcc->reg_proc +IPCC_XSCR ,TX_BIT_CHAN (chan)); +stm32_ipcc_set_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XSCR , +TX_BIT_CHAN (chan));/* unmask 'tx channel free' interrupt */ -stm32_ipcc_clr_bits (ipcc->reg_proc +IPCC_XMR ,TX_BIT_CHAN (chan)); +stm32_ipcc_clr_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XMR , +TX_BIT_CHAN (chan));return 0 ; }
@@ -163,7 +176,8 @@ static int stm32_ipcc_startup(struct mbo }/* unmask 'rx channel occupied' interrupt */ -stm32_ipcc_clr_bits (ipcc->reg_proc +IPCC_XMR ,RX_BIT_CHAN (chan)); +stm32_ipcc_clr_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XMR , +RX_BIT_CHAN (chan));return 0 ; }
@@ -175,7 +189,7 @@ static void stm32_ipcc_shutdown(struct m controller);/* mask rx/tx interrupt */ -stm32_ipcc_set_bits (ipcc->reg_proc +IPCC_XMR , +stm32_ipcc_set_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XMR ,RX_BIT_CHAN (chan) |TX_BIT_CHAN (chan));clk_disable_unprepare (ipcc->clk);
@@ -208,6 +222,8 @@ static int stm32_ipcc_probe(struct platfif (!ipcc)return -ENOMEM ; +spin_lock_init (&ipcc->lock); +/* proc_id */ if (of_property_read_u32 (np,"st,proc-id" , &ipcc->proc_id)) {dev_err (dev,"Missing st,proc-id\n" );
@@ -259,9 +275,10 @@ static int stm32_ipcc_probe(struct platf }/* mask and enable rx/tx irq */ -stm32_ipcc_set_bits (ipcc->reg_proc +IPCC_XMR , +stm32_ipcc_set_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XMR ,RX_BIT_MASK |TX_BIT_MASK ); -stm32_ipcc_set_bits (ipcc->reg_proc +IPCC_XCR ,XCR_RXOIE |XCR_TXOIE ); +stm32_ipcc_set_bits (&ipcc->lock, ipcc->reg_proc +IPCC_XCR , +XCR_RXOIE |XCR_TXOIE );/* wakeup */ if (of_property_read_bool (np,"wakeup-source" )) {
Greg Kroah-Hartman
maintainerPATCH 303/321 tcp: exit if nothing to retransmit on RTO timeout
In reply to Greg Kroah-HartmanFrom: Yuchung Cheng <[email protected]>
commit 88f8598d0a302a08380eadefd09b9f5cb1c4c428 upstream.
Previously TCP only warns if its RTO timer fires and the retransmission queue is empty, but it'll cause null pointer reference later on. It's better to avoid such catastrophic failure and simply exit with a warning.
--- net/ipv4/tcp_timer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/ipv4/tcp_timer.c +2 -4
@@ -443,10 +443,8 @@ void tcp_retransmit_timer(struct sock *s*/ return ; } -if (!tp->packets_out) - goto out; - -WARN_ON (tcp_rtx_queue_empty (sk)); +if (!tp->packets_out ||WARN_ON_ONCE (tcp_rtx_queue_empty (sk))) +return ; tp->tlp_high_seq =0 ;
Greg Kroah-Hartman
maintainerPATCH 304/321 HID: core: check whether Usage Page item is after Usage ID items
In reply to Greg Kroah-HartmanFrom: Candle Sun <[email protected]>
commit 1cb0d2aee26335d0bccf29100c7bed00ebece851 upstream.
Upstream commit 58e75155009c ("HID: core: move Usage Page concatenation to Main item") adds support for Usage Page item after Usage ID items (such as keyboards manufactured by Primax).
Usage Page concatenation in Main item works well for following report descriptor patterns:
USAGE_PAGE (Keyboard) 05 07
USAGE_MINIMUM (Keyboard LeftControl) 19 E0
USAGE_MAXIMUM (Keyboard Right GUI) 29 E7
LOGICAL_MINIMUM (0) 15 00
LOGICAL_MAXIMUM (1) 25 01
REPORT_SIZE (1) 75 01
REPORT_COUNT (8) 95 08
INPUT (Data,Var,Abs) 81 02-------------
USAGE_MINIMUM (Keyboard LeftControl) 19 E0
USAGE_MAXIMUM (Keyboard Right GUI) 29 E7
LOGICAL_MINIMUM (0) 15 00
LOGICAL_MAXIMUM (1) 25 01
REPORT_SIZE (1) 75 01
REPORT_COUNT (8) 95 08
USAGE_PAGE (Keyboard) 05 07
INPUT (Data,Var,Abs) 81 02But it makes the parser act wrong for the following report descriptor pattern(such as some Gamepads):
USAGE_PAGE (Button) 05 09
USAGE (Button 1) 09 01
USAGE (Button 2) 09 02
USAGE (Button 4) 09 04
USAGE (Button 5) 09 05
USAGE (Button 7) 09 07
USAGE (Button 8) 09 08
USAGE (Button 14) 09 0E
USAGE (Button 15) 09 0F
USAGE (Button 13) 09 0D
USAGE_PAGE (Consumer Devices) 05 0C
USAGE (Back) 0a 24 02
USAGE (HomePage) 0a 23 02
LOGICAL_MINIMUM (0) 15 00
LOGICAL_MAXIMUM (1) 25 01
REPORT_SIZE (1) 75 01
REPORT_COUNT (11) 95 0B
INPUT (Data,Var,Abs) 81 02With Usage Page concatenation in Main item, parser recognizes all the 11 Usages as consumer keys, it is not the HID device's real intention.
This patch checks whether Usage Page is really defined after Usage ID items by comparing usage page using status.
Usage Page concatenation on currently defined Usage Page will always do in local parsing when Usage ID items encountered.
When Main item is parsing, concatenation will do again with last defined Usage Page if this page has not been used in the previous usages concatenation.
--- drivers/hid/hid-core.c | 51 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-)
drivers/hid/hid-core.c +45 -6
@@ -212,6 +212,18 @@ static unsigned hid_lookup_collection(st }/* +* Concatenate usage which defines 16 bits or less with the +* currently defined usage page to form a 32 bit usage +*/ + +static void complete_usage (struct hid_parser *parser,unsigned int index) +{ + parser->local.usage[index] &=0xFFFF ; + parser->local.usage[index] |= + (parser->global.usage_page &0xFFFF ) <<16 ; +} + +/* * Add a usage to the temporary parser table. */
@@ -222,6 +234,14 @@ static int hid_add_usage(struct hid_parsreturn -1 ; } parser->local.usage[parser->local.usage_index] = usage; + +/* +* If Usage item only includes usage id, concatenate it with +* currently defined usage page +*/ +if (size <=2 ) +complete_usage (parser, parser->local.usage_index); + parser->local.usage_size[parser->local.usage_index] = size; parser->local.collection_index[parser->local.usage_index] = parser->collection_stack_ptr ?
@@ -542,13 +562,32 @@ static int hid_parser_local(struct hid_p* usage value." */ -static void hid_concatenate_usage_page (struct hid_parser *parser) +static void hid_concatenate_last_usage_page (struct hid_parser *parser) {int i; +unsigned int usage_page; +unsigned int current_page; + +if (!parser->local.usage_index) +return ; -for (i =0 ; i < parser->local.usage_index; i++) -if (parser->local.usage_size[i] <=2 ) - parser->local.usage[i] += parser->global.usage_page <<16 ; + usage_page = parser->global.usage_page; + +/* +* Concatenate usage page again only if last declared Usage Page +* has not been already used in previous usages concatenation +*/ +for (i = parser->local.usage_index -1 ; i >=0 ; i--) { +if (parser->local.usage_size[i] >2 ) +/* Ignore extended usages */ +continue ; + + current_page = parser->local.usage[i] >>16 ; +if (current_page == usage_page) +break ; + +complete_usage (parser, i); + } }/*
@@ -560,7 +599,7 @@ static int hid_parser_main(struct hid_pa__u32 data;int ret; -hid_concatenate_usage_page (parser); +hid_concatenate_last_usage_page (parser); data =item_udata (item);
@@ -771,7 +810,7 @@ static int hid_scan_main(struct hid_pars__u32 data;int i; -hid_concatenate_usage_page (parser); +hid_concatenate_last_usage_page (parser); data =item_udata (item);
Greg Kroah-Hartman
maintainerPATCH 305/321 crypto: stm32/hash - Fix hmac issue more than 256 bytes
In reply to Greg Kroah-HartmanFrom: Lionel Debieve <[email protected]>
commit 0acabecebc912b3ba06289e4ef40476acc499a37 upstream.
Correct condition for the second hmac loop. Key must be only set in the first loop. Initial condition was wrong, HMAC_KEY flag was not properly checked.
--- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/stm32/stm32-hash.c +1 -1
@@ -365,7 +365,7 @@ static int stm32_hash_xmit_cpu(struct streturn -ETIMEDOUT ;if ((hdev->flags &HASH_FLAGS_HMAC ) && - (hdev->flags & ~HASH_FLAGS_HMAC_KEY )) { + (!(hdev->flags &HASH_FLAGS_HMAC_KEY ))) { hdev->flags |=HASH_FLAGS_HMAC_KEY ;stm32_hash_write_key (hdev);if (stm32_hash_wait_busy (hdev))
Greg Kroah-Hartman
maintainerPATCH 306/321 media: stm32-dcmi: fix DMA corruption when stopping streaming
In reply to Greg Kroah-HartmanFrom: Hugues Fruchet <[email protected]>
commit b3ce6f6ff3c260ee53b0f2236e5fd950d46957da upstream.
Avoid call of dmaengine_terminate_all() between dmaengine_prep_slave_single() and dmaengine_submit() by locking the whole DMA submission sequence.
--- drivers/media/platform/stm32/stm32-dcmi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/media/platform/stm32/stm32-dcmi.c +17 -0
@@ -164,6 +164,9 @@ struct stm32_dcmi {int errors_count;int overrun_count;int buffers_count; + +/* Ensure DMA operations atomicity */ +struct mutex dma_lock; };static inline struct stm32_dcmi *notifier_to_dcmi (struct v4l2_async_notifier *n)
@@ -314,6 +317,13 @@ static int dcmi_start_dma(struct stm32_dreturn ret; } +/* +* Avoid call of dmaengine_terminate_all() between +* dmaengine_prep_slave_single() and dmaengine_submit() +* by locking the whole DMA submission sequence +*/ +mutex_lock (&dcmi->dma_lock); +/* Prepare a DMA transaction */ desc = dmaengine_prep_slave_single(dcmi->dma_chan, buf->paddr, buf->size,
@@ -322,6 +332,7 @@ static int dcmi_start_dma(struct stm32_dif (!desc) {dev_err (dcmi->dev,"%s: DMA dmaengine_prep_slave_single failed for buffer phy=%pad size=%zu\n" , __func__, &buf->paddr, buf->size); +mutex_unlock (&dcmi->dma_lock);return -EINVAL ; }
@@ -333,9 +344,12 @@ static int dcmi_start_dma(struct stm32_d dcmi->dma_cookie =dmaengine_submit (desc);if (dma_submit_error (dcmi->dma_cookie)) {dev_err (dcmi->dev,"%s: DMA submission failed\n" , __func__); +mutex_unlock (&dcmi->dma_lock);return -ENXIO ; } +mutex_unlock (&dcmi->dma_lock); +dma_async_issue_pending (dcmi->dma_chan);return 0 ;
@@ -717,7 +731,9 @@ static void dcmi_stop_streaming(struct vspin_unlock_irq (&dcmi->irqlock);/* Stop all pending DMA operations */ +mutex_lock (&dcmi->dma_lock);dmaengine_terminate_all (dcmi->dma_chan); +mutex_unlock (&dcmi->dma_lock);pm_runtime_put (dcmi->dev);
@@ -1719,6 +1735,7 @@ static int dcmi_probe(struct platform_despin_lock_init (&dcmi->irqlock);mutex_init (&dcmi->lock); +mutex_init (&dcmi->dma_lock);init_completion (&dcmi->complete);INIT_LIST_HEAD (&dcmi->buffers);
Greg Kroah-Hartman
maintainerPATCH 307/321 media: stm32-dcmi: fix check of pm_runtime_get_sync return value
In reply to Greg Kroah-HartmanFrom: Hugues Fruchet <[email protected]>
commit ab41b99e7e55c85f29ff7b54718ccbbe051905e7 upstream.
Start streaming was sometimes failing because of pm_runtime_get_sync() non-0 return value. In fact return value was not an error but a positive value (1), indicating that PM was already enabled. Fix this by going to error path only with negative return value.
--- drivers/media/platform/stm32/stm32-dcmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/stm32/stm32-dcmi.c +3 -3
@@ -584,9 +584,9 @@ static int dcmi_start_streaming(struct vint ret; ret =pm_runtime_get_sync (dcmi->dev); -if (ret) { -dev_err (dcmi->dev,"%s: Failed to start streaming, cannot get sync\n" , - __func__); +if (ret <0 ) { +dev_err (dcmi->dev,"%s: Failed to start streaming, cannot get sync (%d)\n" , + __func__, ret); goto err_release_buffers; }
Greg Kroah-Hartman
maintainerPATCH 308/321 hwrng: stm32 - fix unbalanced pm_runtime_enable
In reply to Greg Kroah-HartmanFrom: Lionel Debieve <[email protected]>
commit af0d4442dd6813de6e77309063beb064fa8e89ae upstream.
No remove function implemented yet in the driver. Without remove function, the pm_runtime implementation complains when removing and probing again the driver.
--- drivers/char/hw_random/stm32-rng.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/hw_random/stm32-rng.c +8 -0
@@ -169,6 +169,13 @@ static int stm32_rng_probe(struct platforeturn devm_hwrng_register (dev, &priv->rng); } +static int stm32_rng_remove (struct platform_device *ofdev) +{ +pm_runtime_disable (&ofdev->dev); + +return 0 ; +} +#ifdef CONFIG_PM static int stm32_rng_runtime_suspend (struct device *dev) {
@@ -210,6 +217,7 @@ static struct platform_driver stm32_rng_ .of_match_table = stm32_rng_match, }, .probe = stm32_rng_probe, + .remove = stm32_rng_remove, };module_platform_driver (stm32_rng_driver);
Greg Kroah-Hartman
maintainerPATCH 309/321 clk: stm32mp1: fix HSI divider flag
In reply to Greg Kroah-HartmanFrom: Gabriel Fernandez <[email protected]>
commit d3f2e33c875de5052e032a9eefa64c897a930ed1 upstream.
The divider of HSI (clk-hsi-div) is power of two divider.
--- drivers/clk/clk-stm32mp1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-stm32mp1.c +2 -2
@@ -1655,8 +1655,8 @@ static const struct stm32_mux_cfg ker_mustatic const struct clock_config stm32mp1_clock_cfg[] = {/* Oscillator divider */ -DIV (NO_ID ,"clk-hsi-div" ,"clk-hsi" ,0 ,RCC_HSICFGR ,0 ,2 , -CLK_DIVIDER_READ_ONLY ), +DIV (NO_ID ,"clk-hsi-div" ,"clk-hsi" ,CLK_DIVIDER_POWER_OF_TWO , +RCC_HSICFGR ,0 ,2 ,CLK_DIVIDER_READ_ONLY ),/* External / Internal Oscillators */ GATE_MP1 (CK_HSE ,"ck_hse" ,"clk-hse" ,0 ,RCC_OCENSETR ,8 ,0 ),
Greg Kroah-Hartman
maintainerPATCH 310/321 clk: stm32mp1: fix mcu divider table
In reply to Greg Kroah-HartmanFrom: Gabriel Fernandez <[email protected]>
commit 140fc4e406fac420b978a0ef2ee1fe3c641a6ae4 upstream.
index 8: ck_mcu is divided by 256 (not 512)
--- drivers/clk/clk-stm32mp1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-stm32mp1.c +1 -1
@@ -269,7 +269,7 @@ static const struct clk_div_table axi_distatic const struct clk_div_table mcu_div_table[] = { {0 ,1 }, {1 ,2 }, {2 ,4 }, {3 ,8 }, {4 ,16 }, {5 ,32 }, {6 ,64 }, {7 ,128 }, - {8 ,512 }, {9 ,512 }, {10 ,512 }, {11 ,512 }, + {8 ,256 }, {9 ,512 }, {10 ,512 }, {11 ,512 }, {12 ,512 }, {13 ,512 }, {14 ,512 }, {15 ,512 }, {0 }, };
Greg Kroah-Hartman
maintainerPATCH 311/321 clk: stm32mp1: add CLK_SET_RATE_NO_REPARENT to Kernel clocks
In reply to Greg Kroah-HartmanFrom: Gabriel Fernandez <[email protected]>
commit 72cfd1ad1057f16fc614861b3c271597995e57ba upstream.
STM32MP1 clock IP offers lots of Kernel clocks that are shared by multiple IP's at the same time.
Then boot loader applies a clock tree that allows to use all IP's at same time and with the maximum of performance.
Not change parents on a change rate on kernel clocks ensures the integrity of the system.
--- drivers/clk/clk-stm32mp1.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/clk/clk-stm32mp1.c +7 -5
@@ -1286,10 +1286,11 @@ _clk_stm32_register_composite(struct dev MGATE_MP1(_id, _name, _parent, _flags, _mgate)#define KCLK (_id, _name, _parents, _flags, _mgate, _mmux)\ - COMPOSITE(_id, _name, _parents, CLK_OPS_PARENT_ENABLE | _flags,\ - _MGATE_MP1(_mgate),\ - _MMUX(_mmux),\ - _NO_DIV) + COMPOSITE(_id, _name, _parents, CLK_OPS_PARENT_ENABLE |\ + CLK_SET_RATE_NO_REPARENT | _flags,\ + _MGATE_MP1(_mgate),\ + _MMUX(_mmux),\ + _NO_DIV)enum {G_SAI1 ,
@@ -1952,7 +1953,8 @@ static const struct clock_config stm32mpMGATE_MP1 (GPU_K ,"gpu_k" ,"pll2_q" ,0 ,G_GPU ),MGATE_MP1 (DAC12_K ,"dac12_k" ,"ck_lsi" ,0 ,G_DAC12 ), -COMPOSITE (ETHPTP_K ,"ethptp_k" , eth_src,CLK_OPS_PARENT_ENABLE , +COMPOSITE (ETHPTP_K ,"ethptp_k" , eth_src,CLK_OPS_PARENT_ENABLE | +CLK_SET_RATE_NO_REPARENT , _NO_GATE,_MMUX (M_ETHCK ), _DIV(RCC_ETHCKSELR, 4, 4, CLK_DIVIDER_ALLOW_ZERO, NULL)),
Greg Kroah-Hartman
maintainerPATCH 312/321 clk: stm32mp1: parent clocks update
In reply to Greg Kroah-HartmanFrom: Gabriel Fernandez <[email protected]>
commit 749c9e553e1f063eb132a78d80225532cbfedb80 upstream.
Fixes parent clock for axi, fdcan, sai and adc12 clocks.
--- drivers/clk/clk-stm32mp1.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-stm32mp1.c +5 -5
@@ -121,7 +121,7 @@ static const char * const cpu_src[] = { };static const char *const axi_src[] = { -"ck_hsi" ,"ck_hse" ,"pll2_p" ,"pll3_p" +"ck_hsi" ,"ck_hse" ,"pll2_p" };static const char *const per_src[] = {
@@ -225,19 +225,19 @@ static const char * const usart6_src[] = };static const char *const fdcan_src[] = { -"ck_hse" ,"pll3_q" ,"pll4_q" +"ck_hse" ,"pll3_q" ,"pll4_q" ,"pll4_r" };static const char *const sai_src[] = { -"pll4_q" ,"pll3_q" ,"i2s_ckin" ,"ck_per" +"pll4_q" ,"pll3_q" ,"i2s_ckin" ,"ck_per" ,"pll3_r" };static const char *const sai2_src[] = { -"pll4_q" ,"pll3_q" ,"i2s_ckin" ,"ck_per" ,"spdif_ck_symb" +"pll4_q" ,"pll3_q" ,"i2s_ckin" ,"ck_per" ,"spdif_ck_symb" ,"pll3_r" };static const char *const adc12_src[] = { -"pll4_q" ,"ck_per" +"pll4_r" ,"ck_per" ,"pll3_q" };static const char *const dsi_src[] = {
Greg Kroah-Hartman
maintainerPATCH 313/321 mailbox: mailbox-test: fix null pointer if no mmio
In reply to Greg Kroah-HartmanFrom: Fabien Dessenne <[email protected]>
commit 6899b4f7c99c72968e58e502f96084f74f6e5e86 upstream.
Fix null pointer issue if resource_size is called with no ioresource.
--- drivers/mailbox/mailbox-test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mailbox/mailbox-test.c +8 -6
@@ -363,22 +363,24 @@ static int mbox_test_probe(struct platfo/* It's okay for MMIO to be NULL */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - size =resource_size (res); tdev->tx_mmio =devm_ioremap_resource (&pdev->dev, res); -if (PTR_ERR (tdev->tx_mmio) == -EBUSY ) +if (PTR_ERR (tdev->tx_mmio) == -EBUSY ) {/* if reserved area in SRAM, try just ioremap */ + size =resource_size (res); tdev->tx_mmio =devm_ioremap (&pdev->dev, res->start, size); -else if (IS_ERR (tdev->tx_mmio)) + }else if (IS_ERR (tdev->tx_mmio)) { tdev->tx_mmio =NULL ; + }/* If specified, second reg entry is Rx MMIO */ res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); - size =resource_size (res); tdev->rx_mmio =devm_ioremap_resource (&pdev->dev, res); -if (PTR_ERR (tdev->rx_mmio) == -EBUSY ) +if (PTR_ERR (tdev->rx_mmio) == -EBUSY ) { + size =resource_size (res); tdev->rx_mmio =devm_ioremap (&pdev->dev, res->start, size); -else if (IS_ERR (tdev->rx_mmio)) + }else if (IS_ERR (tdev->rx_mmio)) { tdev->rx_mmio = tdev->tx_mmio; + } tdev->tx_channel =mbox_test_request_channel (pdev,"tx" ); tdev->rx_channel =mbox_test_request_channel (pdev,"rx" );
Greg Kroah-Hartman
maintainerPATCH 314/321 pinctrl: stm32: fix memory leak issue
In reply to Greg Kroah-HartmanFrom: Alexandre Torgue <[email protected]>
commit cd8c9b5a49576bf28990237715bc2cb2210ac80a upstream.
configs is allocated by pinconf_generic_parse_dt_config(), pinctrl_utils_add_map_configs() duplicates configs so it can and has to be freed to prevent memory leaks.
--- drivers/pinctrl/stm32/pinctrl-stm32.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/pinctrl/stm32/pinctrl-stm32.c +16 -10
@@ -410,7 +410,7 @@ static int stm32_pctrl_dt_subnode_to_mapunsigned int num_configs;bool has_config =0 ;unsigned reserve =0 ; -int num_pins, num_funcs, maps_per_pin, i, err; +int num_pins, num_funcs, maps_per_pin, i, err =0 ; pctl =pinctrl_dev_get_drvdata (pctldev);
@@ -437,41 +437,45 @@ static int stm32_pctrl_dt_subnode_to_mapif (has_config && num_pins >=1 ) maps_per_pin++; -if (!num_pins || !maps_per_pin) -return -EINVAL ; +if (!num_pins || !maps_per_pin) { + err = -EINVAL ; + goto exit; + } reserve = num_pins * maps_per_pin; err =pinctrl_utils_reserve_map (pctldev, map, reserved_maps, num_maps, reserve);if (err) -return err; + goto exit;for (i =0 ; i < num_pins; i++) { err =of_property_read_u32_index (node,"pinmux" , i, &pinfunc);if (err) -return err; + goto exit; pin =STM32_GET_PIN_NO (pinfunc); func =STM32_GET_PIN_FUNC (pinfunc);if (!stm32_pctrl_is_function_valid (pctl, pin, func)) {dev_err (pctl->dev,"invalid function.\n" ); -return -EINVAL ; + err = -EINVAL ; + goto exit; } grp =stm32_pctrl_find_group_by_pin (pctl, pin);if (!grp) {dev_err (pctl->dev,"unable to match pin %d to group\n" , pin); -return -EINVAL ; + err = -EINVAL ; + goto exit; } err =stm32_pctrl_dt_node_to_map_func (pctl, pin, func, grp, map, reserved_maps, num_maps);if (err) -return err; + goto exit;if (has_config) { err = pinctrl_utils_add_map_configs(pctldev, map,
@@ -479,11 +483,13 @@ static int stm32_pctrl_dt_subnode_to_map configs, num_configs, PIN_MAP_TYPE_CONFIGS_GROUP);if (err) -return err; + goto exit; } } -return 0 ; +exit: +kfree (configs); +return err; } static int stm32_pctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
Greg Kroah-Hartman
maintainerPATCH 315/321 ASoC: stm32: i2s: fix dma configuration
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
commit 1ac2bd16448997d9ec01922423486e1e85535eda upstream.
DMA configuration is not balanced on start/stop. Move DMA configuration to trigger callback.
--- sound/soc/stm/stm32_i2s.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
sound/soc/stm/stm32_i2s.c +7 -7
@@ -488,7 +488,7 @@ static int stm32_i2s_configure(struct sn {struct stm32_i2s_data *i2s =snd_soc_dai_get_drvdata (cpu_dai);int format =params_width (params); -u32 cfgr, cfgr_mask, cfg1, cfg1_mask; +u32 cfgr, cfgr_mask, cfg1;unsigned int fthlv;int ret;
@@ -529,15 +529,11 @@ static int stm32_i2s_configure(struct snif (ret <0 )return ret; - cfg1 =I2S_CFG1_RXDMAEN |I2S_CFG1_TXDMAEN ; - cfg1_mask = cfg1; - fthlv =STM32_I2S_FIFO_SIZE *I2S_FIFO_TH_ONE_QUARTER /4 ; - cfg1 |=I2S_CFG1_FTHVL_SET (fthlv -1 ); - cfg1_mask |=I2S_CFG1_FTHVL_MASK ; + cfg1 =I2S_CFG1_FTHVL_SET (fthlv -1 );return regmap_update_bits (i2s->regmap,STM32_I2S_CFG1_REG , - cfg1_mask, cfg1); +I2S_CFG1_FTHVL_MASK , cfg1); } static int stm32_i2s_startup(struct snd_pcm_substream *substream,
@@ -589,6 +585,10 @@ static int stm32_i2s_trigger(struct snd_/* Enable i2s */ dev_dbg (cpu_dai->dev,"start I2S\n" ); + cfg1_mask =I2S_CFG1_RXDMAEN |I2S_CFG1_TXDMAEN ; +regmap_update_bits (i2s->regmap,STM32_I2S_CFG1_REG , + cfg1_mask, cfg1_mask); + ret =regmap_update_bits (i2s->regmap,STM32_I2S_CR1_REG ,I2S_CR1_SPE ,I2S_CR1_SPE );if (ret <0 ) {
Greg Kroah-Hartman
maintainerPATCH 316/321 ASoC: stm32: i2s: fix 16 bit format support
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
commit 0c4c68d6fa1bae74d450e50823c24fcc3cd0b171 upstream.
I2S supports 16 bits data in 32 channel length. However the expected driver behavior, is to
set channel length to 16 bits when data format is 16 bits.
--- sound/soc/stm/stm32_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/stm/stm32_i2s.c +1 -1
@@ -501,7 +501,7 @@ static int stm32_i2s_configure(struct snswitch (format) {case 16 : cfgr =I2S_CGFR_DATLEN_SET (I2S_I2SMOD_DATLEN_16 ); - cfgr_mask =I2S_CGFR_DATLEN_MASK ; + cfgr_mask =I2S_CGFR_DATLEN_MASK |I2S_CGFR_CHLEN ;break ;case 32 : cfgr = I2S_CGFR_DATLEN_SET(I2S_I2SMOD_DATLEN_32) |
Greg Kroah-Hartman
maintainerPATCH 317/321 ASoC: stm32: i2s: fix IRQ clearing
In reply to Greg Kroah-HartmanFrom: Olivier Moysan <[email protected]>
commit 8ba3c5215d69c09f5c39783ff3b78347769822ad upstream.
Because of regmap cache, interrupts may not be cleared as expected.
Declare IFCR register as write only and make writings to IFCR register unconditional.
--- sound/soc/stm/stm32_i2s.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
sound/soc/stm/stm32_i2s.c +6 -7
@@ -246,8 +246,8 @@ static irqreturn_t stm32_i2s_isr(int irqreturn IRQ_NONE ; } -regmap_update_bits (i2s->regmap,STM32_I2S_IFCR_REG , -I2S_IFCR_MASK , flags); +regmap_write_bits (i2s->regmap,STM32_I2S_IFCR_REG , +I2S_IFCR_MASK , flags);if (flags &I2S_SR_OVR ) {dev_dbg (&pdev->dev,"Overrun\n" );
@@ -276,7 +276,6 @@ static bool stm32_i2s_readable_reg(struccase STM32_I2S_CFG2_REG :case STM32_I2S_IER_REG :case STM32_I2S_SR_REG : -case STM32_I2S_IFCR_REG :case STM32_I2S_TXDR_REG :case STM32_I2S_RXDR_REG :case STM32_I2S_CGFR_REG :
@@ -547,8 +546,8 @@ static int stm32_i2s_startup(struct snd_ i2s->refcount++;spin_unlock (&i2s->lock_fd); -return regmap_update_bits (i2s->regmap,STM32_I2S_IFCR_REG , -I2S_IFCR_MASK ,I2S_IFCR_MASK ); +return regmap_write_bits (i2s->regmap,STM32_I2S_IFCR_REG , +I2S_IFCR_MASK ,I2S_IFCR_MASK ); } static int stm32_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -603,8 +602,8 @@ static int stm32_i2s_trigger(struct snd_return ret; } -regmap_update_bits (i2s->regmap,STM32_I2S_IFCR_REG , -I2S_IFCR_MASK ,I2S_IFCR_MASK ); +regmap_write_bits (i2s->regmap,STM32_I2S_IFCR_REG , +I2S_IFCR_MASK ,I2S_IFCR_MASK );if (playback_flg) { ier =I2S_IER_UDRIE ;
Greg Kroah-Hartman
maintainerPATCH 318/321 ASoC: stm32: sai: add missing put_device()
In reply to Greg Kroah-HartmanFrom: Wen Yang <[email protected]>
commit 1c3816a194870e7a6622345dab7fb56c7d708613 upstream.
The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.
--- sound/soc/stm/stm32_sai.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
sound/soc/stm/stm32_sai.c +8 -3
@@ -112,16 +112,21 @@ static int stm32_sai_set_sync(struct stmif (!sai_provider) {dev_err (&sai_client->pdev->dev,"SAI sync provider data not found\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_put_dev; }/* Configure sync client */ ret =stm32_sai_sync_conf_client (sai_client, synci);if (ret <0 ) -return ret; + goto out_put_dev;/* Configure sync provider */ -return stm32_sai_sync_conf_provider (sai_provider, synco); + ret =stm32_sai_sync_conf_provider (sai_provider, synco); + +out_put_dev: +put_device (&pdev->dev); +return ret; }static int stm32_sai_probe (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 319/321 dmaengine: stm32-dma: check whether length is aligned on FIFO threshold
In reply to Greg Kroah-HartmanFrom: Pierre-Yves MORDRET <[email protected]>
commit cc832dc8e32785a730ba07c3a357e17c201a5df8 upstream.
When a period length is not multiple of FIFO some data may be stuck within FIFO.
Burst/FIFO Threshold/Period or buffer length check has to be hardened
In any case DMA will grant any request from client but will degraded any parameters whether awkward.
--- drivers/dma/stm32-dma.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/dma/stm32-dma.c +6 -14
@@ -308,20 +308,12 @@ static bool stm32_dma_fifo_threshold_is_static bool stm32_dma_is_burst_possible (u32 buf_len,u32 threshold) { -switch (threshold) { -case STM32_DMA_FIFO_THRESHOLD_FULL : -if (buf_len >=STM32_DMA_MAX_BURST ) -return true; -else -return false; -case STM32_DMA_FIFO_THRESHOLD_HALFFULL : -if (buf_len >=STM32_DMA_MAX_BURST /2 ) -return true; -else -return false; -default : -return false; - } +/* +* Buffer or period length has to be aligned on FIFO depth. +* Otherwise bytes may be stuck within FIFO at buffer or period +* length. +*/ +return ((buf_len % ((threshold +1 ) *4 )) ==0 ); } static u32 stm32_dma_get_best_burst(u32 buf_len, u32 max_burst, u32 threshold,
Greg Kroah-Hartman
maintainerPATCH 320/321 platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 16245db1489cd9aa579506f64afeeeb13d825a93 upstream.
The HP WMI calls may take up to 128 bytes of data as input, and the AML methods implementing the WMI calls, declare a couple of fields for accessing input in different sizes, specifycally the HWMC method contains:
CreateField (Arg1, 0x80, 0x0400, D128)
Even though we do not use any of the WMI command-types which need a buffer of this size, the APCI interpreter still tries to create it as it is declared in generoc code at the top of the HWMC method which runs before the code looks at which command-type is requested.
This results in many of these errors on many different HP laptop models:
[ 14.459261] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20170303/dsopcode-236) [ 14.459268] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8edcc61507f8), AE_AML_BUFFER_LIMIT (20170303/psparse-543) [ 14.459279] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8edcc61523c0), AE_AML_BUFFER_LIMIT (20170303/psparse-543)
This commit increases the size of the data element of the bios_args struct to 128 bytes fixing these errors.
--- drivers/platform/x86/hp-wmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/platform/x86/hp-wmi.c +3 -3
@@ -78,7 +78,7 @@ struct bios_args {u32 command;u32 commandtype;u32 datasize; -u32 data; +u8 data[128 ]; };enum hp_wmi_commandtype {
@@ -229,7 +229,7 @@ static int hp_wmi_perform_query(int quer .command = command, .commandtype = query, .datasize = insize, - .data = 0, + .data = { 0 }, };struct acpi_buffer input = {sizeof (struct bios_args ), &args };struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -241,7 +241,7 @@ static int hp_wmi_perform_query(int querif (WARN_ON (insize >sizeof (args.data)))return -EINVAL ; -memcpy (&args.data, buffer, insize); +memcpy (&args.data[0 ], buffer, insize);wmi_evaluate_method (HPWMI_BIOS_GUID ,0 , mid, &input, &output);
Greg Kroah-Hartman
maintainerPATCH 321/321 platform/x86: hp-wmi: Fix ACPI errors caused by passing 0 as input size
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit f3e4f3fc8ee9729c4b1b27a478c68b713df53c0c upstream.
The AML code implementing the WMI methods creates a variable length field to hold the input data we pass like this:
CreateDWordField (Arg1, 0x0C, DSZI)
Local5 = DSZI /* \HWMC.DSZI */
CreateField (Arg1, 0x80, (Local5 * 0x08), DAIN)If we pass 0 as bios_args.datasize argument then (Local5 * 0x08) is 0 which results in these errors:
[ 71.973305] ACPI BIOS Error (bug): Attempt to CreateField of length zero (20190816/dsopcode-133) [ 71.973332] ACPI Error: Aborting method \HWMC due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529) [ 71.973413] ACPI Error: Aborting method \_SB.WMID.WMAA due to previous error (AE_AML_OPERAND_VALUE) (20190816/psparse-529)
And in our HPWMI_WIRELESS2_QUERY calls always failing. for read commands like HPWMI_WIRELESS2_QUERY the DSZI value is not used / checked, except for read commands where extra input is needed to specify exactly what to read.
So for HPWMI_WIRELESS2_QUERY we can safely pass the size of the expected output as insize to hp_wmi_perform_query(), as we are already doing for all other HPWMI_READ commands we send. Doing so fixes these errors.
--- drivers/platform/x86/hp-wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/hp-wmi.c +2 -2
@@ -393,7 +393,7 @@ static int hp_wmi_rfkill2_refresh(void)int err, i; err =hp_wmi_perform_query (HPWMI_WIRELESS2_QUERY ,HPWMI_READ , &state, -0 ,sizeof (state)); +sizeof (state),sizeof (state));if (err)return err;
@@ -790,7 +790,7 @@ static int __init hp_wmi_rfkill2_setup(sint err, i; err =hp_wmi_perform_query (HPWMI_WIRELESS2_QUERY ,HPWMI_READ , &state, -0 ,sizeof (state)); +sizeof (state),sizeof (state));if (err)return err <0 ? err : -EINVAL ;
Jon Hunter
maintainerQuoted 20 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.88 release. There are 321 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Dec 2019 22:30:32 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.88-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
...
Quoted 2 lines
Ding Tao <[email protected]>
arm64: dts: marvell: armada-37xx: Enable emmc on espressobin
The above commit is causing the following build failure for ARM64 ...
DTC arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtbarch/arm64/boot/dts/marvell/armada-3720-espressobin.dtb: ERROR (phandle_references): /soc/internal-regs@d0000000/sdhci@d0000: Reference to non-existent node or label "sdio_pins"
arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtb: ERROR (phandle_references): /soc/internal-regs@d0000000/sdhci@d8000: Reference to non-existent node or label "mmc_pins"
Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 30 lines · Jon Hunter
Quoted 20 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.88 release. There are 321 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 05 Dec 2019 22:30:32 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.88-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:...
Quoted 2 lines
Ding Tao <[email protected]>
arm64: dts: marvell: armada-37xx: Enable emmc on espressobinThe above commit is causing the following build failure for ARM64 ...
Quoted 8 lines
DTC
arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtbarch/arm64/boot/dts/marvell/armada-3720-espressobin.dtb: ERROR (phandle_references): /soc/internal-regs@d0000000/sdhci@d0000: Reference to non-existent node or label "sdio_pins"
arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtb: ERROR (phandle_references): /soc/internal-regs@d0000000/sdhci@d8000: Reference to non-existent node or label "mmc_pins"
Thanks for letting me know, I'll go drop this one and push out a -rc2 with that removed.
greg k-h