ALSA: timer: Wrap with spinlock for queue access
Subsystems (3)
PATCH 1/101 ALSA: timer: Wrap with spinlock for queue access
From: Takashi Iwai <[email protected]>
[ Upstream commit d7f910bfedd863d13ea320030fe98e42d0938ed5 ]
For accessing the snd_timer_user queue indices, we take tu->qlock. But it's forgotten in a couple of places.
The one in snd_timer_user_params() should be safe without the spinlock as the timer is already stopped. But it's better for consistency.
The one in poll is just a read-out, so it's not inevitably needed, but it'd be good to make the result consistent, too.
--- sound/core/timer.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/timer.c +4 -0
@@ -1758,6 +1758,7 @@ static int snd_timer_user_params(struct file *file, } } } +spin_lock_irq (&tu->qlock); tu->qhead = tu->qtail = tu->qused =0 ;if (tu->timeri->flags &SNDRV_TIMER_IFLG_EARLY_EVENT ) {if (tu->tread) {
@@ -1778,6 +1779,7 @@ static int snd_timer_user_params(struct file *file, } tu->filter = params.filter; tu->ticks = params.ticks; +spin_unlock_irq (&tu->qlock); err =0 ; _end:if (copy_to_user (_params, ¶ms,sizeof (params)))
@@ -2019,10 +2021,12 @@ static unsigned int snd_timer_user_poll(struct file *file, poll_table * wait)poll_wait (file, &tu->qchange_sleep, wait); mask =0 ; +spin_lock_irq (&tu->qlock);if (tu->qused) mask |=POLLIN |POLLRDNORM ;if (tu->disconnected) mask |=POLLERR ; +spin_unlock_irq (&tu->qlock);return mask; }
Signature · 1 line
2.15.1
PATCH 6/101 net: emac: fix reset timeout with AR8035 phy
From: Christian Lamparter <[email protected]>
[ Upstream commit 19d90ece81da802207a9b91ce95a29fbdc40626e ]
This patch fixes a problem where the AR8035 PHY can't be detected on an Cisco Meraki MR24, if the ethernet cable is not connected on boot.
Russell Senior provided steps to reproduce the issue:
|Disconnect ethernet cable, apply power, wait until device has booted, |plug in ethernet, check for interfaces, no eth0 is listed. | |This appears to be a problem during probing of the AR8035 Phy chip. |When ethernet has no link, the phy detection fails, and eth0 is not |created. Plugging ethernet later has no effect, because there is no |interface as far as the kernel is concerned. The relevant part of |the boot log looks like this: |this is the failing case: | |[ 0.876611] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode |[ 0.882532] /plb/opb/ethernet@ef600c00: reset timeout |[ 0.888546] /plb/opb/ethernet@ef600c00: can't find PHY! |and the succeeding case: | |[ 0.876672] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode |[ 0.883952] eth0: EMAC-0 /plb/opb/ethernet@ef600c00, MAC 00:01:.. |[ 0.890822] eth0: found Atheros 8035 Gigabit Ethernet PHY (0x01)
Based on the comment and the commit message of commit 23fbb5a87c56 ("emac: Fix EMAC soft reset on 460EX/GT"). This is because the AR8035 PHY doesn't provide the TX Clock, if the ethernet cable is not attached. This causes the reset to timeout and the PHY detection code in emac_init_phy() is unable to detect the AR8035 PHY. As a result, the emac driver bails out early and the user left with no ethernet.
In order to stay compatible with existing configurations, the driver tries the current reset approach at first. Only if the first attempt timed out, it does perform one more retry with the clock temporarily switched to the internal source for just the duration of the reset.
LEDE-Bug: #687 <https://bugs.lede-project.org/index.php?do=details&task_id=687>
--- drivers/net/ethernet/ibm/emac/core.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/net/ethernet/ibm/emac/core.c +22 -4
@@ -349,6 +349,7 @@ static int emac_reset(struct emac_instance *dev) {struct emac_regs __iomem *p = dev->emacp;int n =20 ; +bool __maybe_unused try_internal_clock = false;DBG (dev,"reset" NL );
@@ -361,6 +362,7 @@ static int emac_reset(struct emac_instance *dev) }#ifdef CONFIG_PPC_DCR_NATIVE +do_retry:/* * PPC460EX/GT Embedded Processor Advanced User's Manual * section 28.10.1 Mode Register 0 (EMACx_MR0) states:
@@ -368,10 +370,19 @@ static int emac_reset(struct emac_instance *dev)* of the EMAC. If none is present, select the internal clock * (SDR0_ETH_CFG[EMACx_PHY_CLK] = 1). * After a soft reset, select the external clock. +* +* The AR8035-A PHY Meraki MR24 does not provide a TX Clk if the +* ethernet cable is not attached. This causes the reset to timeout +* and the PHY detection code in emac_init_phy() is unable to +* communicate and detect the AR8035-A PHY. As a result, the emac +* driver bails out early and the user has no ethernet. +* In order to stay compatible with existing configurations, the +* driver will temporarily switch to the internal clock, after +* the first reset fails. */ if (emac_has_feature (dev,EMAC_FTR_460EX_PHY_CLK_FIX )) { -if (dev->phy_address ==0xffffffff && - dev->phy_map ==0xffffffff ) { +if (try_internal_clock || (dev->phy_address ==0xffffffff && + dev->phy_map ==0xffffffff )) {/* No PHY: select internal loop clock before reset */ dcri_clrset (SDR0 ,SDR0_ETH_CFG ,0 ,SDR0_ETH_CFG_ECS << dev->cell_index);
@@ -389,8 +400,15 @@ static int emac_reset(struct emac_instance *dev)#ifdef CONFIG_PPC_DCR_NATIVE if (emac_has_feature (dev,EMAC_FTR_460EX_PHY_CLK_FIX )) { -if (dev->phy_address ==0xffffffff && - dev->phy_map ==0xffffffff ) { +if (!n && !try_internal_clock) { +/* first attempt has timed out. */ + n =20 ; + try_internal_clock = true; + goto do_retry; + } + +if (try_internal_clock || (dev->phy_address ==0xffffffff && + dev->phy_map ==0xffffffff )) {/* No PHY: restore external clock source after reset */ dcri_clrset (SDR0 ,SDR0_ETH_CFG ,SDR0_ETH_CFG_ECS << dev->cell_index,0 );
Signature · 1 line
2.15.1
PATCH 8/101 xen: avoid type warning in xchg_xen_ulong
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9cc91f212111cdcbefa02dcdb7dd443f224bf52c ]
The improved type-checking version of container_of() triggers a warning for xchg_xen_ulong, pointing out that 'xen_ulong_t' is unsigned, but atomic64_t contains a signed value:
drivers/xen/events/events_2l.c: In function 'evtchn_2l_handle_events':drivers/xen/events/events_2l.c:187:1020: error: call to '__compiletime_assert_187' declared with attribute error: pointer type mismatch in container_of()
This adds a cast to work around the warning.
--- arch/arm/include/asm/xen/events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/xen/events.h +1 -1
@@ -16,7 +16,7 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)return raw_irqs_disabled_flags (regs->ARM_cpsr); } -#define xchg_xen_ulong (ptr, val) atomic64_xchg(container_of((ptr), \ +#define xchg_xen_ulong (ptr, val) atomic64_xchg(container_of((long long*)(ptr),\ atomic64_t, \ counter), (val))
Signature · 1 line
2.15.1
PATCH 10/101 bnx2x: Allow vfs to disable txvlan offload
In reply to Sasha LevinFrom: "Mintz, Yuval" <[email protected]>
[ Upstream commit 92f85f05caa51d844af6ea14ffbc7a786446a644 ]
VF clients are configured as enforced, meaning firmware is validating the correctness of their ethertype/vid during transmission. Once txvlan is disabled, VF would start getting SKBs for transmission here vlan is on the payload - but it'll pass the packet's ethertype instead of the vid, leading to firmware declaring it as malicious.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +15 -4
@@ -3876,15 +3876,26 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)/* when transmitting in a vf, start bd must hold the ethertype * for fw to enforce it */ +u16 vlan_tci =0 ;#ifndef BNX2X_STOP_ON_ERROR -if (IS_VF (bp)) +if (IS_VF (bp)) {#endif - tx_start_bd->vlan_or_ethertype = -cpu_to_le16 (ntohs (eth->h_proto)); +/* Still need to consider inband vlan for enforced */ +if (__vlan_get_tag (skb, &vlan_tci)) { + tx_start_bd->vlan_or_ethertype = +cpu_to_le16 (ntohs (eth->h_proto)); + }else { + tx_start_bd->bd_flags.as_bitfield |= + (X_ETH_INBAND_VLAN << +ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT ); + tx_start_bd->vlan_or_ethertype = +cpu_to_le16 (vlan_tci); + } #ifndef BNX2X_STOP_ON_ERROR - else + }else {/* used by FW for packet accounting */ tx_start_bd->vlan_or_ethertype =cpu_to_le16 (pkt_prod); + }#endif }
Signature · 1 line
2.15.1
PATCH 12/101 sparc64: ldc abort during vds iso boot
In reply to Sasha LevinFrom: Jag Raman <[email protected]>
[ Upstream commit 6c95483b768c62f8ee933ae08a1bdbcb78b5410f ]
Orabug: 20902628
When an ldc control-only packet is received during data exchange in read_nonraw(), a new rx head is calculated but the rx queue head is not actually advanced (rx_set_head() is not called) and a branch is taken to 'no_data' at which point two things can happen depending on the value of the newly calculated rx head and the current rx tail:
- If the rx queue is determined to be not empty, then the wrong packet is picked up.
- If the rx queue is determined to be empty, then a read error (EAGAIN) is eventually returned since it is falsely assumed that more data was expected.
The fix is to update the rx head and return in case of a control only packet during data exchange.
--- arch/sparc/kernel/ldc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/sparc/kernel/ldc.c +6 -1
@@ -1693,9 +1693,14 @@ static int read_nonraw(struct ldc_channel *lp, void *buf, unsigned int size) lp->rcv_nxt = p->seqid; +/* +* If this is a control-only packet, there is nothing +* else to do but advance the rx queue since the packet +* was already processed above. +*/ if (!(p->type &LDC_DATA )) { new =rx_advance (lp, new); - goto no_data; +break ; }if (p->stype & (LDC_ACK |LDC_NACK )) { err =data_ack_nack (lp, p);
Signature · 1 line
2.15.1
PATCH 16/101 ACPICA: Disassembler: Abort on an invalid/unknown AML opcode
In reply to Sasha LevinFrom: Bob Moore <[email protected]>
[ Upstream commit 6f0527b77d9e0129dd8e50945b0d610ed943d6b2 ]
ACPICA commit ed0389cb11a61e63c568ac1f67948fc6a7bd1aeb
An invalid opcode indicates something seriously wrong with the input AML file. The AML parser is immediately confused and lost, causing the resulting parse tree to be ill-formed. The actual disassembly can then cause numerous unrelated errors and faults.
This change aborts the disassembly upon discovery of such an opcode during the AML parse phase.
--- drivers/acpi/acpica/psobject.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/acpi/acpica/psobject.c +14 -0
@@ -118,6 +118,9 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state) (u32)(walk_state->aml_offset + sizeof(struct acpi_table_header))); +ACPI_ERROR ((AE_INFO , +"Aborting disassembly, AML byte code is corrupt" )); +/* Dump the context surrounding the invalid opcode */ acpi_ut_dump_buffer(((u8 *)walk_state->parser_state.
@@ -126,6 +129,14 @@ static acpi_status acpi_ps_get_aml_opcode(struct acpi_walk_state *walk_state)sizeof (struct acpi_table_header ) - 16));acpi_os_printf (" */\n" ); + +/* +* Just abort the disassembly, cannot continue because the +* parser is essentially lost. The disassembler can then +* randomly fail because an ill-constructed parse tree +* can result. +*/ +return_ACPI_STATUS (AE_AML_BAD_OPCODE );#endif }
@@ -290,6 +301,9 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,if (status ==AE_CTRL_PARSE_CONTINUE ) {return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE ); } +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + }/* Create Op structure and append to parent's argument list */
Signature · 1 line
2.15.1
PATCH 17/101 s390/dasd: Display read-only attribute correctly
In reply to Sasha LevinFrom: Jan Höppner <[email protected]>
[ Upstream commit b487a914f853545842a0899329b6b72fe56c4081 ]
We have two flags, DASD_FLAG_DEVICE_RO and DASD_FEATURE_READONLY, that tell us whether a device is read-only. DASD_FLAG_DEVICE_RO is set when a device is attached as read-only to z/VM and DASD_FEATURE_READONLY is set when either the corresponding kernel parameter is configured, or the read-only state is changed via sysfs.
This is valuable information in any case. However, only the feature flag is being checked at the moment when we display the current state.
Fix this by checking both flags.
--- drivers/s390/block/dasd_devmap.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/s390/block/dasd_devmap.c +14 -5
@@ -758,13 +758,22 @@ static ssize_t dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf) { struct dasd_devmap *devmap; -int ro_flag; +struct dasd_device *device; +int ro_flag =0 ; devmap =dasd_find_busid (dev_name (dev)); -if (!IS_ERR (devmap)) - ro_flag = (devmap->features &DASD_FEATURE_READONLY ) !=0 ; -else - ro_flag = (DASD_FEATURE_DEFAULT &DASD_FEATURE_READONLY ) !=0 ; +if (IS_ERR (devmap)) + goto out; + + ro_flag = !!(devmap->features &DASD_FEATURE_READONLY ); + +spin_lock (&dasd_devmap_lock); + device = devmap->device; +if (device) + ro_flag |=test_bit (DASD_FLAG_DEVICE_RO , &device->flags); +spin_unlock (&dasd_devmap_lock); + +out:return snprintf (buf,PAGE_SIZE , ro_flag ?"1\n" :"0\n" ); }
Signature · 1 line
2.15.1
PATCH 20/101 scsi: megaraid: Fix a sleep-in-atomic bug
In reply to Sasha LevinFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 896f6966fc815abe71f85fb26f0193875df8a035 ]
The driver may sleep under a spin lock, and the function call path is:mraid_mm_attach_buf (acquire the lock by spin_lock_irqsave)
pci_pool_alloc(GFP_KERNEL) --> may sleep
To fix it, the "GFP_KERNEL" is replaced with "GFP_ATOMIC".
[mkp: fixed whitespace]
--- drivers/scsi/megaraid/megaraid_mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_mm.c +1 -1
@@ -570,7 +570,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen) kioc->pool_index = right_pool; kioc->free_buf =1 ; - kioc->buf_vaddr =pci_pool_alloc (pool->handle,GFP_KERNEL , + kioc->buf_vaddr =pci_pool_alloc (pool->handle,GFP_ATOMIC , &kioc->buf_paddr);spin_unlock_irqrestore (&pool->lock, flags);
Signature · 1 line
2.15.1
PATCH 21/101 scsi: lpfc: Fix return value of board_mode store routine in case of online failure
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 522dceeb62ded1a7b538d2f1f61cc69a1402537d ]
On hbacmd reset failure, observing wrong string "nline" in kernel log.
On failure, non negative value (1) is returned from sysfs store routine. It is interpreted as count by kernel and store routine is called again with the remaining characters as input.
Fix: Return negative error code (-EIO) in case of failure.
--- drivers/scsi/lpfc/lpfc_attr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_attr.c +2 -0
@@ -1085,6 +1085,8 @@ lpfc_board_mode_store(struct device *dev, struct device_attribute *attr, goto board_mode_out; }wait_for_completion (&online_compl); +if (status) + status = -EIO ; }else if (strncmp (buf,"offline" ,sizeof ("offline" ) -1 ) ==0 ) status =lpfc_do_offline (phba,LPFC_EVT_OFFLINE );else if (strncmp (buf,"warm" ,sizeof ("warm" ) -1 ) ==0 )
Signature · 1 line
2.15.1
PATCH 22/101 usb: usbip tool: Check the return of get_nports()
In reply to Sasha LevinFrom: Yuyang Du <[email protected]>
[ Upstream commit c3509715fc9484a48b69a9f0196b728c960840c9 ]
If we get nonpositive number of ports, there is no sense to continue, then fail gracefully.
In addition, the commit 0775a9cbc694e8c72 ("usbip: vhci extension:
modifications to vhci driver") introduced configurable numbers of controllers and ports, but we have a static port number maximum, MAXNPORT. If exceeded, the idev array will be overflown. We fix it by validating the nports to make sure the port number max is not exceeded.
--- tools/usb/usbip/libsrc/vhci_driver.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/usb/usbip/libsrc/vhci_driver.c +8 -1
@@ -238,9 +238,16 @@ int usbip_vhci_driver_open(void) } vhci_driver->nports =get_nports (); -dbg ("available ports: %d" , vhci_driver->nports); +if (vhci_driver->nports <=0 ) { +err ("no available ports" ); + goto err; + }else if (vhci_driver->nports >MAXNPORT ) { +err ("port number exceeds %d" ,MAXNPORT ); + goto err; + } +if (refresh_imported_device_list ()) goto err;
Signature · 1 line
2.15.1
PATCH 23/101 usb: usbip tool: Fix refresh_imported_device_list()
In reply to Sasha LevinFrom: Yuyang Du <[email protected]>
[ Upstream commit fd92b7deb98a4edd31ffcc2d64cee36103805ff5 ]
The commit 0775a9cbc694e8c7 ("usbip: vhci extension: modifications to vhci driver") introduced multiple controllers, but the status of the ports are only extracted from the first status file, fix it.
--- tools/usb/usbip/libsrc/vhci_driver.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
tools/usb/usbip/libsrc/vhci_driver.c +21 -6
@@ -107,18 +107,33 @@ static int parse_status(const char *value)return 0 ; } +#define MAX_STATUS_NAME 16 +static int refresh_imported_device_list (void ) {const char *attr_status; +char status[MAX_STATUS_NAME +1 ] ="status" ; +int i, ret; - attr_status =udev_device_get_sysattr_value (vhci_driver->hc_device, -"status" ); -if (!attr_status) { -err ("udev_device_get_sysattr_value failed" ); -return -1 ; +for (i =0 ; i < vhci_driver->ncontrollers; i++) { +if (i >0 ) +snprintf (status,sizeof (status),"status.%d" , i); + + attr_status =udev_device_get_sysattr_value (vhci_driver->hc_device, + status); +if (!attr_status) { +err ("udev_device_get_sysattr_value failed" ); +return -1 ; + } + +dbg ("controller %d" , i); + + ret =parse_status (attr_status); +if (ret !=0 ) +return ret; } -return parse_status (attr_status); +return 0 ; }static int get_nports (void )
Signature · 1 line
2.15.1
PATCH 26/101 mtd: handle partitioning on devices with 0 erasesize
In reply to Sasha LevinFrom: Chris Packham <[email protected]>
[ Upstream commit 1eeef2d7483a7e3f8d2dd2a5b9939b3b814dc549 ]
erasesize is meaningful for flash devices but for SRAM there is no concept of an erase block so erasesize is set to 0. When partitioning these devices instead of ensuring partitions fall on erasesize boundaries we ensure they fall on writesize boundaries.
--- drivers/mtd/mtdpart.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/mtd/mtdpart.c +17 -9
@@ -352,8 +352,12 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, const struct mtd_partition *part, int partno, uint64_t cur_offset) { + int wr_alignment = (master->flags & MTD_NO_ERASE) ? master->writesize: + master->erasesize;struct mtd_part *slave; +u32 remainder;char *name; +u64 tmp;/* allocate the partition structure */ slave =kzalloc (sizeof (*slave),GFP_KERNEL );
@@ -442,10 +446,11 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,if (slave->offset ==MTDPART_OFS_APPEND ) slave->offset = cur_offset;if (slave->offset ==MTDPART_OFS_NXTBLK ) { + tmp = cur_offset; slave->offset = cur_offset; -if (mtd_mod_by_eb (cur_offset, master) !=0 ) { -/* Round up to next erasesize */ - slave->offset = (mtd_div_by_eb (cur_offset, master) +1 ) * master->erasesize; + remainder =do_div (tmp, wr_alignment); +if (remainder) { + slave->offset += wr_alignment - remainder;printk (KERN_NOTICE "Moving partition %d: " "0x%012llx -> 0x%012llx\n" , partno, (unsigned long long )cur_offset, (unsigned long long )slave->offset);
@@ -510,19 +515,22 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, slave->mtd.erasesize = master->erasesize; } -if ((slave->mtd.flags &MTD_WRITEABLE ) && -mtd_mod_by_eb (slave->offset, &slave->mtd)) { + tmp = slave->offset; + remainder =do_div (tmp, wr_alignment); +if ((slave->mtd.flags &MTD_WRITEABLE ) && remainder) {/* Doesn't start on a boundary of major erase size */ /* FIXME: Let it be writable if it is on a boundary of * _minor_ erase size though */ slave->mtd.flags &= ~MTD_WRITEABLE ; -printk (KERN_WARNING "mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n" , +printk (KERN_WARNING "mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n" , part->name); } -if ((slave->mtd.flags &MTD_WRITEABLE ) && -mtd_mod_by_eb (slave->mtd.size, &slave->mtd)) { + + tmp = slave->mtd.size; + remainder =do_div (tmp, wr_alignment); +if ((slave->mtd.flags &MTD_WRITEABLE ) && remainder) { slave->mtd.flags &= ~MTD_WRITEABLE ; -printk (KERN_WARNING "mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n" , +printk (KERN_WARNING "mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n" , part->name); }
Signature · 1 line
2.15.1
PATCH 30/101 net_sched: move tcf_lock down after gen_replace_estimator()
In reply to Sasha LevinFrom: WANG Cong <[email protected]>
[ Upstream commit 74030603dfd9f76c0f279f19f1dd1ee3028fee7a ]
Laura reported a sleep-in-atomic kernel warning inside tcf_act_police_init() which calls gen_replace_estimator() with spinlock protection.
It is not necessary in this case, we already have RTNL lock here so it is enough to protect concurrent writers. For the reader, i.e. tcf_act_police(), it needs to make decision based on this rate estimator, in the worst case we drop more/less packets than necessary while changing the rate in parallel, it is still acceptable.
--- net/sched/act_police.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
net/sched/act_police.c +3 -5
@@ -176,21 +176,21 @@ override: } } -spin_lock_bh (&police->tcf_lock);if (est) { err =gen_replace_estimator (&police->tcf_bstats,NULL , &police->tcf_rate_est, &police->tcf_lock, est);if (err) - goto failure_unlock; + goto failure; }else if (tb[TCA_POLICE_AVRATE ] && (ret ==ACT_P_CREATED || !gen_estimator_active (&police->tcf_bstats, &police->tcf_rate_est))) { err = -EINVAL ; - goto failure_unlock; + goto failure; } +spin_lock_bh (&police->tcf_lock);/* No failure allowed after this point */ police->tcfp_mtu = parm->mtu;if (police->tcfp_mtu ==0 ) {
@@ -242,8 +242,6 @@ override: a->priv = police;return ret; -failure_unlock: -spin_unlock_bh (&police->tcf_lock); failure:qdisc_put_rtab (P_tab);qdisc_put_rtab (R_tab);
Signature · 1 line
2.15.1
PATCH 36/101 Btrfs: skip commit transaction if we don't have enough pinned bytes
In reply to Sasha LevinFrom: Liu Bo <[email protected]>
[ Upstream commit 28785f70ef882e4798cd5706066a55dbf7adf80e ]
We commit transaction in order to reclaim space from pinned bytes because it could process delayed refs, and in may_commit_transaction(), we check first if pinned bytes are enough for the required space, we then check if that plus bytes reserved for delayed insert are enough for the required space.
This changes the code to the above logic.
--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent-tree.c +1 -1
@@ -4207,7 +4207,7 @@ static int may_commit_transaction(struct btrfs_root *root,spin_lock (&delayed_rsv->lock);if (percpu_counter_compare (&space_info->total_bytes_pinned, - bytes - delayed_rsv->size) >=0 ) { + bytes - delayed_rsv->size) <0 ) {spin_unlock (&delayed_rsv->lock);return -ENOSPC ; }
Signature · 1 line
2.15.1
PATCH 38/101 mmc: sdhci-esdhc: Add SDHCI_QUIRK_32BIT_DMA_ADDR
In reply to Sasha LevinFrom: Benoît Thébaudeau <[email protected]>
[ Upstream commit cbb4509374963bea440c15ff26e2501d15e7927a ]
The eSDHC can only DMA from 32-bit-aligned addresses.
This fixes the following test cases of mmc_test:
11: Badly aligned write
12: Badly aligned read
13: Badly aligned multi-block write
14: Badly aligned multi-block read
--- drivers/mmc/host/sdhci-esdhc.h | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-esdhc.h +1 -0
@@ -19,6 +19,7 @@*/ #define ESDHC_DEFAULT_QUIRKS (SDHCI_QUIRK_FORCE_BLK_SZ_2048 | \ + SDHCI_QUIRK_32BIT_DMA_ADDR | \ SDHCI_QUIRK_NO_BUSY_IRQ | \ SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | \ SDHCI_QUIRK_PIO_NEEDS_DELAY)
Signature · 1 line
2.15.1
PATCH 39/101 x86/nmi: Fix timeout test in test_nmi_ipi()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit c133c7615751008f6c32ccae7cdfc5ff6e989c35 ]
We're supposed to exit the loop with "timeout" set to zero.
--- arch/x86/kernel/nmi_selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/nmi_selftest.c +1 -1
@@ -78,7 +78,7 @@ static void __init test_nmi_ipi(struct cpumask *mask)/* Don't wait longer than a second */ timeout =USEC_PER_SEC ; -while (!cpumask_empty (mask) && timeout--) +while (!cpumask_empty (mask) && --timeout)udelay (1 );/* What happens if we timeout, do we still unregister?? */
Signature · 1 line
2.15.1
PATCH 40/101 arm64: pass machine size to sparse
In reply to Sasha LevinFrom: Luc Van Oostenryck <[email protected]>
[ Upstream commit f5d284900c0f960e318a063f4c40826b6e3aa6a8 ]
When using sparse on the arm64 tree we get many thousands of warnings like 'constant ... is so big it is unsigned long long' or 'shift too big (32) for type unsigned long'. This happens because by default sparse considers the machine as 32bit and defines the size of the types accordingly.
Fix this by passing the '-m64' flag to sparse so that sparse can correctly define longs as being 64bit.
--- arch/arm64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Makefile +1 -1
@@ -32,7 +32,7 @@ AS += -EL LD += -EL endif -CHECKFLAGS += -D__aarch64__ +CHECKFLAGS += -D__aarch64__ -m64 ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) KBUILD_CFLAGS_MODULE += -mcmodel=large
Signature · 1 line
2.15.1
PATCH 43/101 arm64: ptrace: Fix VFP register dumping in compat coredumps
In reply to Sasha LevinFrom: Dave Martin <[email protected]>
[ Upstream commit af66b2d88a76574d55e81d712292abd34beb6178 ]
Currently, VFP registers are omitted from coredumps for compat processes, due to a bug in the REGSET_COMPAT_VFP regset implementation.
compat_vfp_get() needs to transfer non-contiguous data from thread_struct.fpsimd_state, and uses put_user() to handle the offending trailing word (FPSCR). This fails when copying to a kernel address (i.e., kbuf && !ubuf), which is what happens when dumping core. As a result, the ELF coredump core code silently omits the NT_ARM_VFP note from the dump.
It would be possible to work around this with additional special case code for the put_user(), but since user_regset_copyout() is explicitly designed to handle this scenario it is cleaner to port the put_user() to a user_regset_copyout() call, which this patch does.
--- arch/arm64/kernel/ptrace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm64/kernel/ptrace.c +7 -4
@@ -743,7 +743,7 @@ static int compat_vfp_get(struct task_struct *target, {struct user_fpsimd_state *uregs;compat_ulong_t fpscr; -int ret; +int ret, vregs_end_pos; uregs = &target->thread.fpsimd_state.user_fpsimd;
@@ -751,13 +751,16 @@ static int compat_vfp_get(struct task_struct *target,* The VFP registers are packed into the fpsimd_state, so they all sit * nicely together for us. We just need to create the fpscr separately. */ - ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, uregs,0 , -VFP_STATE_SIZE -sizeof (compat_ulong_t)); + vregs_end_pos =VFP_STATE_SIZE -sizeof (compat_ulong_t); + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, uregs, +0 , vregs_end_pos);if (count && !ret) { fpscr = (uregs->fpsr &VFP_FPSCR_STAT_MASK ) | (uregs->fpcr &VFP_FPSCR_CTRL_MASK ); - ret =put_user (fpscr, (compat_ulong_t *)ubuf); + + ret =user_regset_copyout (&pos, &count, &kbuf, &ubuf, &fpscr, + vregs_end_pos,VFP_STATE_SIZE ); }return ret;
Signature · 1 line
2.15.1
PATCH 44/101 veth: Be more robust on network device creation when no attributes
In reply to Sasha LevinFrom: Serhey Popovych <[email protected]>
[ Upstream commit 191cdb3822e5df6b3c8b9f8cb8c4bf93f6cc90c7 ]
There are number of problems with configuration peer network device in absence of IFLA_VETH_PEER attributes where attributes for main network device shared with peer.
First it is not feasible to configure both network devices with same MAC address since this makes communication in such configuration problematic.
This case can be reproduced with following sequence:
# ip link add address 02:11:22:33:44:55 type veth
# ip li sh
...
26: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc \
noop state DOWN mode DEFAULT qlen 1000
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
27: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc \
noop state DOWN mode DEFAULT qlen 1000
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ffSecond it is not possible to register both main and peer network devices with same name, that happens when name for main interface is given with IFLA_IFNAME and same attribute reused for peer.
This case can be reproduced with following sequence:
# ip link add dev veth1a type veth RTNETLINK answers: File exists
To fix both of the cases check if corresponding netlink attributes are taken from peer_tb when valid or name based on rtnl ops kind and random address is used.
--- drivers/net/veth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/veth.c +2 -2
@@ -357,7 +357,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, tbp = tb; } -if (tbp[IFLA_IFNAME ]) { +if (ifmp && tbp[IFLA_IFNAME ]) {nla_strlcpy (ifname, tbp[IFLA_IFNAME ],IFNAMSIZ ); name_assign_type =NET_NAME_USER ; }else {
@@ -376,7 +376,7 @@ static int veth_newlink(struct net *src_net, struct net_device *dev,return PTR_ERR (peer); } -if (tbp[IFLA_ADDRESS ] ==NULL ) +if (!ifmp || !tbp[IFLA_ADDRESS ])eth_hw_addr_random (peer);if (ifmp && (dev->ifindex !=0 ))
Signature · 1 line
2.15.1
PATCH 47/101 arm64: pass endianness info to sparse
In reply to Sasha LevinFrom: Luc Van Oostenryck <[email protected]>
[ Upstream commit bcde519e8c325f3cc1fcf443eb6466e6bb3a3aca ]
ARM64 depends on the macro __AARCH64EB__ being defined or not to correctly select or define endian-specific macros, structures or pieces of code.
This macro is predefined by the compiler but sparse knows nothing about it and thus may pre-process files differently from what gcc would.
Fix this by passing '-D__AARCH64EL__' or '-D__AARCH64EB__' to sparse depending of the endianness of the kernel, like defined by GCC.
Note: In most case it won't change anything since most arm64 use
little-endian (but an allyesconfig would use big-endian!).
--- arch/arm64/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/Makefile +2 -0
@@ -24,10 +24,12 @@ KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads) ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) KBUILD_CPPFLAGS += -mbig-endian +CHECKFLAGS += -D__AARCH64EB__ AS += -EB LD += -EB else KBUILD_CPPFLAGS += -mlittle-endian +CHECKFLAGS += -D__AARCH64EL__ AS += -EL LD += -EL endif
Signature · 1 line
2.15.1
PATCH 49/101 powerpc: Fix /proc/cpuinfo revision for POWER9 DD2
In reply to Sasha LevinFrom: Michael Neuling <[email protected]>
[ Upstream commit 64ebb9a208c6e66316329a6d9101815d1ee06fa9 ]
The P9 PVR bits 12-15 don't indicate a revision but instead different chip configurations. From BookIV we have:
Bits Configuration
0 : Scale out 12 cores
1 : Scale out 24 cores
2 : Scale up 12 cores
3 : Scale up 24 coresDD1 doesn't use this but DD2 does. Linux will mostly use the "Scale out 24 core" configuration (ie. SMT4 not SMT8) which results in a PVR of 0x004e1200. The reported revision in /proc/cpuinfo is hence reported incorrectly as "18.0".
This patch fixes this to mask off only the relevant bits for the major revision (ie. bits 8-11) for POWER9.
--- arch/powerpc/kernel/setup-common.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/kernel/setup-common.c +4 -0
@@ -310,6 +310,10 @@ static int show_cpuinfo(struct seq_file *m, void *v) maj = ((pvr >>8 ) &0xFF ) -1 ; min = pvr &0xFF ;break ; +case 0x004e :/* POWER9 bits 12-15 give chip type */ + maj = (pvr >>8 ) &0x0F ; + min = pvr &0xFF ; +break ;default : maj = (pvr >>8 ) &0xFF ; min = pvr &0xFF ;
Signature · 1 line
2.15.1
PATCH 2/101 e1000e: Undo e1000e_pm_freeze if __e1000_shutdown fails
In reply to Sasha LevinFrom: Chris Wilson <[email protected]>
[ Upstream commit 833521ebc65b1c3092e5c0d8a97092f98eec595d ]
An error during suspend (e100e_pm_suspend),
[ 429.994338] ACPI : EC: event blocked [ 429.994633] e1000e: EEE TX LPI TIMER: 00000011 [ 430.955451] pci_pm_suspend(): e1000e_pm_suspend+0x0/0x30 [e1000e] returns -2 [ 430.955454] dpm_run_callback(): pci_pm_suspend+0x0/0x140 returns -2 [ 430.955458] PM: Device 0000:00:19.0 failed to suspend async: error -2 [ 430.955581] PM: Some devices failed to suspend, or early wake event detected [ 430.957709] ACPI : EC: event unblocked
lead to complete failure:
[ 432.585002] ------------[ cut here ]------------ [ 432.585013] WARNING: CPU: 3 PID: 8372 at kernel/irq/manage.c:1478 __free_irq+0x9f/0x280 [ 432.585015] Trying to free already-free IRQ 20 [ 432.585016] Modules linked in: cdc_ncm usbnet x86_pkg_temp_thermal intel_powerclamp coretemp mii crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep lpc_ich snd_hda_core snd_pcm mei_me mei sdhci_pci sdhci i915 mmc_core e1000e ptp pps_core prime_numbers [ 432.585042] CPU: 3 PID: 8372 Comm: kworker/u16:40 Tainted: G U 4.10.0-rc8-CI-Patchwork_3870+ #1 [ 432.585044] Hardware name: LENOVO 2356GCG/2356GCG, BIOS G7ET31WW (1.13 ) 07/02/2012 [ 432.585050] Workqueue: events_unbound async_run_entry_fn [ 432.585051] Call Trace: [ 432.585058] dump_stack+0x67/0x92 [ 432.585062] __warn+0xc6/0xe0 [ 432.585065] warn_slowpath_fmt+0x4a/0x50 [ 432.585070] ? _raw_spin_lock_irqsave+0x49/0x60 [ 432.585072] __free_irq+0x9f/0x280 [ 432.585075] free_irq+0x34/0x80 [ 432.585089] e1000_free_irq+0x65/0x70 [e1000e] [ 432.585098] e1000e_pm_freeze+0x7a/0xb0 [e1000e] [ 432.585106] e1000e_pm_suspend+0x21/0x30 [e1000e] [ 432.585113] pci_pm_suspend+0x71/0x140 [ 432.585118] dpm_run_callback+0x6f/0x330 [ 432.585122] ? pci_pm_freeze+0xe0/0xe0 [ 432.585125] __device_suspend+0xea/0x330 [ 432.585128] async_suspend+0x1a/0x90 [ 432.585132] async_run_entry_fn+0x34/0x160 [ 432.585137] process_one_work+0x1f4/0x6d0 [ 432.585140] ? process_one_work+0x16e/0x6d0 [ 432.585143] worker_thread+0x49/0x4a0 [ 432.585145] kthread+0x107/0x140 [ 432.585148] ? process_one_work+0x6d0/0x6d0 [ 432.585150] ? kthread_create_on_node+0x40/0x40 [ 432.585154] ret_from_fork+0x2e/0x40 [ 432.585156] ---[ end trace 6712df7f8c4b9124 ]---
The unwind failures stems from commit 2800209994f8 ("e1000e: Refactor PM flows"), but it may be a later patch that introduced the non-recoverable behaviour.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99847
--- drivers/net/ethernet/intel/e1000e/netdev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000e/netdev.c +6 -1
@@ -6357,12 +6357,17 @@ static int e1000e_pm_thaw(struct device *dev)static int e1000e_pm_suspend (struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev); +int rc;e1000e_flush_lpic (pdev);e1000e_pm_freeze (dev); -return __e1000_shutdown (pdev, false); + rc =__e1000_shutdown (pdev, false); +if (rc) +e1000e_pm_thaw (dev); + +return rc; }static int e1000e_pm_resume (struct device *dev)
Signature · 1 line
2.15.1
PATCH 4/101 MIPS: mm: fixed mappings: correct initialisation
In reply to Sasha LevinFrom: Marcin Nowakowski <[email protected]>
[ Upstream commit 71eb989ab5a110df8bcbb9609bacde73feacbedd ]
fixrange_init operates at PMD-granularity and expects the addresses to be PMD-size aligned, but currently that might not be the case for PKMAP_BASE unless it is defined properly, so ensure a correct alignment is used before passing the address to fixrange_init.
fixed mappings: only align the start address that is passed to fixrange_init rather than the value before adding the size, as we may end up with uninitialised upper part of the range.
Patchwork: https://patchwork.linux-mips.org/patch/15948/
--- arch/mips/mm/pgtable-32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/mips/mm/pgtable-32.c +3 -3
@@ -51,15 +51,15 @@ void __init pagetable_init(void)/* * Fixed mappings: */ - vaddr =__fix_to_virt (__end_of_fixed_addresses -1 ) &PMD_MASK ; -fixrange_init (vaddr, vaddr +FIXADDR_SIZE , pgd_base); + vaddr =__fix_to_virt (__end_of_fixed_addresses -1 ); +fixrange_init (vaddr &PMD_MASK , vaddr +FIXADDR_SIZE , pgd_base);#ifdef CONFIG_HIGHMEM /* * Permanent kmaps: */ vaddr =PKMAP_BASE ; -fixrange_init (vaddr, vaddr +PAGE_SIZE *LAST_PKMAP , pgd_base); +fixrange_init (vaddr &PMD_MASK , vaddr +PAGE_SIZE *LAST_PKMAP , pgd_base); pgd = swapper_pg_dir +__pgd_offset (vaddr); pud =pud_offset (pgd, vaddr);
Signature · 1 line
2.15.1
PATCH 3/101 perf/core: Correct event creation with PERF_FORMAT_GROUP
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit ba5213ae6b88fb170c4771fef6553f759c7d8cdd ]
Andi was asking about PERF_FORMAT_GROUP vs inherited events, which led to the discovery of a bug from commit:
3dab77fb1bf8 ("perf: Rework/fix the whole read vs group stuff")
- PERF_SAMPLE_GROUP = 1U << 4, + PERF_SAMPLE_READ = 1U << 4,
- if (attr->inherit && (attr->sample_type & PERF_SAMPLE_GROUP))
+ if (attr->inherit && (attr->read_format & PERF_FORMAT_GROUP))
is a clear fail :/
While this changes user visible behaviour; it was previously possible to create an inherited event with PERF_SAMPLE_READ; this is deemed acceptible because its results were always incorrect.
--- kernel/events/core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/events/core.c +10 -5
@@ -4861,9 +4861,6 @@ static void perf_output_read_one(struct perf_output_handle *handle,__output_copy (handle, values, n *sizeof (u64)); } -/* -* XXX PERF_FORMAT_GROUP vs inherited events seems difficult. -*/ static void perf_output_read_group (struct perf_output_handle *handle,struct perf_event *event,u64 enabled,u64 running)
@@ -4908,6 +4905,13 @@ static void perf_output_read_group(struct perf_output_handle *handle,#define PERF_FORMAT_TOTAL_TIMES (PERF_FORMAT_TOTAL_TIME_ENABLED|\ PERF_FORMAT_TOTAL_TIME_RUNNING) +/* +* XXX PERF_SAMPLE_READ vs inherited events seems difficult. +* +* The problem is that its both hard and excessively expensive to iterate the +* child list, not to mention that its impossible to IPI the children running +* on another CPU, from interrupt/NMI context. +*/ static void perf_output_read (struct perf_output_handle *handle,struct perf_event *event) {
@@ -7194,9 +7198,10 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,local64_set (&hwc->period_left, hwc->sample_period);/* -* we currently do not support PERF_FORMAT_GROUP on inherited events +* We currently do not support PERF_SAMPLE_READ on inherited events. +* See perf_output_read(). */ -if (attr->inherit && (attr->read_format &PERF_FORMAT_GROUP )) +if (attr->inherit && (attr->sample_type &PERF_SAMPLE_READ )) goto err_ns; pmu =perf_init_event (event);
Signature · 1 line
2.15.1
PATCH 5/101 MIPS: kprobes: flush_insn_slot should flush only if probe initialised
In reply to Sasha LevinFrom: Marcin Nowakowski <[email protected]>
[ Upstream commit 698b851073ddf5a894910d63ca04605e0473414e ]
When ftrace is used with kprobes, it is possible for a kprobe to contain an invalid location (ie. only initialised to 0 and not to a specific location in the code). Trying to perform a cache flush on such location leads to a crash r4k_flush_icache_range().
Patchwork: https://patchwork.linux-mips.org/patch/16296/
--- arch/mips/include/asm/kprobes.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/include/asm/kprobes.h +2 -1
@@ -40,7 +40,8 @@ typedef union mips_instruction kprobe_opcode_t;#define flush_insn_slot (p) \ do { \ - flush_icache_range((unsigned long)p->addr, \ + if (p->addr) \ + flush_icache_range((unsigned long)p->addr, \ (unsigned long)p->addr + \ (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \ } while (0)
Signature · 1 line
2.15.1
PATCH 7/101 perf tests: Decompress kernel module before objdump
In reply to Sasha LevinFrom: Namhyung Kim <[email protected]>
[ Upstream commit 94df1040b1e6aacd8dec0ba3c61d7e77cd695f26 ]
If a kernel modules is compressed, it should be decompressed before running objdump to parse binary data correctly. This fixes a failure of object code reading test for me.
--- tools/perf/tests/code-reading.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
tools/perf/tests/code-reading.c +19 -1
@@ -141,6 +141,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,unsigned char buf2[BUFSZ ];size_t ret_len;u64 objdump_addr; +const char *objdump_name; +char decomp_name[KMOD_DECOMP_LEN ];int ret;pr_debug ("Reading object code for memory address: %#" PRIx64"\n" , addr);
@@ -202,9 +204,25 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, state->done[state->done_cnt++] = al.map->start; } + objdump_name = al.map->dso->long_name; +if (dso__needs_decompress (al.map->dso)) { +if (dso__decompress_kmodule_path (al.map->dso, objdump_name, + decomp_name, +sizeof (decomp_name)) <0 ) { +pr_debug ("decompression failed\n" ); +return -1 ; + } + + objdump_name = decomp_name; + } +/* Read the object code using objdump */ objdump_addr =map__rip_2objdump (al.map, al.addr); - ret =read_via_objdump (al.map->dso->long_name, objdump_addr, buf2, len); + ret =read_via_objdump (objdump_name, objdump_addr, buf2, len); + +if (dso__needs_decompress (al.map->dso)) +unlink (objdump_name); +if (ret >0 ) {/* * The kernel maps are inaccurate - assume objdump is right in
Signature · 1 line
2.15.1
PATCH 9/101 KEYS: put keyring if install_session_keyring_to_cred() fails
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit d636bd9f12a66ea3775c9fabbf3f8e118253467a ]
In join_session_keyring(), if install_session_keyring_to_cred() were to fail, we would leak the keyring reference, just like in the bug fixed by commit 23567fd052a9 ("KEYS: Fix keyring ref leak in join_session_keyring()"). Fortunately this cannot happen currently, but we really should be more careful. Do this by adding and using a new error label at which the keyring reference is dropped.
--- security/keys/process_keys.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
security/keys/process_keys.c +4 -3
@@ -808,15 +808,14 @@ long join_session_keyring(const char *name) ret =PTR_ERR (keyring); goto error2; }else if (keyring == new->session_keyring) { -key_put (keyring); ret =0 ; - goto error2; + goto error3; }/* we've got a keyring - now to install it */ ret =install_session_keyring_to_cred (new, keyring);if (ret <0 ) - goto error2; + goto error3;commit_creds (new);mutex_unlock (&key_session_mutex);
@@ -826,6 +825,8 @@ long join_session_keyring(const char *name) okay:return ret; +error3: +key_put (keyring); error2:mutex_unlock (&key_session_mutex); error:
Signature · 1 line
2.15.1
PATCH 11/101 sctp: fix recursive locking warning in sctp_do_peeloff
In reply to Sasha LevinFrom: Xin Long <[email protected]>
[ Upstream commit 6dfe4b97e08ec3d1a593fdaca099f0ef0a3a19e6 ]
Dmitry got the following recursive locking report while running syzkaller fuzzer, the Call Trace:
__dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x2ee/0x3ef lib/dump_stack.c:52 print_deadlock_bug kernel/locking/lockdep.c:1729 [inline] check_deadlock kernel/locking/lockdep.c:1773 [inline] validate_chain kernel/locking/lockdep.c:2251 [inline] __lock_acquire+0xef2/0x3430 kernel/locking/lockdep.c:3340 lock_acquire+0x2a1/0x630 kernel/locking/lockdep.c:3755 lock_sock_nested+0xcb/0x120 net/core/sock.c:2536 lock_sock include/net/sock.h:1460 [inline] sctp_close+0xcd/0x9d0 net/sctp/socket.c:1497 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:425 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:432 sock_release+0x8d/0x1e0 net/socket.c:597 __sock_create+0x38b/0x870 net/socket.c:1226 sock_create+0x7f/0xa0 net/socket.c:1237 sctp_do_peeloff+0x1a2/0x440 net/sctp/socket.c:4879 sctp_getsockopt_peeloff net/sctp/socket.c:4914 [inline] sctp_getsockopt+0x111a/0x67e0 net/sctp/socket.c:6628 sock_common_getsockopt+0x95/0xd0 net/core/sock.c:2690 SYSC_getsockopt net/socket.c:1817 [inline] SyS_getsockopt+0x240/0x380 net/socket.c:1799 entry_SYSCALL_64_fastpath+0x1f/0xc2
This warning is caused by the lock held by sctp_getsockopt() is on one socket, while the other lock that sctp_close() is getting later is on the newly created (which failed) socket during peeloff operation.
This patch is to avoid this warning by use lock_sock with subclass SINGLE_DEPTH_NESTING as Wang Cong and Marcelo's suggestion.
--- net/sctp/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sctp/socket.c +2 -2
@@ -1513,7 +1513,7 @@ static void sctp_close(struct sock *sk, long timeout)pr_debug ("%s: sk:%p, timeout:%ld\n" , __func__, sk, timeout); -lock_sock (sk); +lock_sock_nested (sk,SINGLE_DEPTH_NESTING ); sk->sk_shutdown =SHUTDOWN_MASK ; sk->sk_state =SCTP_SS_CLOSING ;
@@ -1564,7 +1564,7 @@ static void sctp_close(struct sock *sk, long timeout)* held and that should be grabbed before socket lock. */ spin_lock_bh (&net->sctp.addr_wq_lock); -bh_lock_sock (sk); +bh_lock_sock_nested (sk);/* Hold the sock, since sk_common_release() will put sock_put() * and we have just a little more cleanup.
Signature · 1 line
2.15.1
PATCH 13/101 iio: magnetometer: st_magn_spi: fix spi_device_id table
In reply to Sasha LevinFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit c83761ff0aac954aa368c623bb0f0d1a3214e834 ]
Remove LSM303DLHC, LSM303DLM from st_magn_id_table since LSM303DL series does not support spi interface
--- drivers/iio/magnetometer/st_magn_spi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/iio/magnetometer/st_magn_spi.c +0 -2
@@ -49,8 +49,6 @@ static int st_magn_spi_remove(struct spi_device *spi) }static const struct spi_device_id st_magn_id_table[] = { - {LSM303DLHC_MAGN_DEV_NAME }, - {LSM303DLM_MAGN_DEV_NAME }, {LIS3MDL_MAGN_DEV_NAME }, {}, };
Signature · 1 line
2.15.1
PATCH 14/101 Bluetooth: Send HCI Set Event Mask Page 2 command only when needed
In reply to Sasha LevinFrom: Marcel Holtmann <[email protected]>
[ Upstream commit 313f6888c8fbb1bc8b36c9012ce4e1de848df696 ]
The Broadcom BCM20702 Bluetooth controller in ThinkPad-T530 devices report support for the Set Event Mask Page 2 command, but actually do return an error when trying to use it.
< HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 68
Read Local Supported Commands (0x04|0x0002) ncmd 1
Status: Success (0x00)
Commands: 162 entries
...
Set Event Mask Page 2 (Octet 22 - Bit 2)
...< HCI Command: Set Event Mask Page 2 (0x03|0x0063) plen 8
Mask: 0x0000000000000000
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
Set Event Mask Page 2 (0x03|0x0063) ncmd 1
Status: Unknown HCI Command (0x01)Since these controllers do not support any feature that would require the event mask page 2 to be modified, it is safe to not send this command at all. The default value is all bits set to zero.
T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 9 Spd=12 MxCh= 0 D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=0a5c ProdID=21e6 Rev= 1.12 S: Manufacturer=Broadcom Corp S: Product=BCM20702A0 S: SerialNumber=F82FA8E8CFC0 C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr= 0mA I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms I: If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms I: If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms I: If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms I: If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms I: If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=btusb E: Ad=84(I) Atr=02(Bulk) MxPS= 32 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
--- net/bluetooth/hci_core.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +15 -2
@@ -1635,6 +1635,7 @@ static void hci_set_event_mask_page_2(struct hci_request *req) {struct hci_dev *hdev = req->hdev;u8 events[8 ] = {0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; +bool changed = false;/* If Connectionless Slave Broadcast master role is supported * enable all necessary events for it.
@@ -1644,6 +1645,7 @@ static void hci_set_event_mask_page_2(struct hci_request *req) events[1 ] |=0x80 ;/* Synchronization Train Complete */ events[2 ] |=0x10 ;/* Slave Page Response Timeout */ events[2 ] |=0x20 ;/* CSB Channel Map Change */ + changed = true; }/* If Connectionless Slave Broadcast slave role is supported
@@ -1654,13 +1656,24 @@ static void hci_set_event_mask_page_2(struct hci_request *req) events[2 ] |=0x02 ;/* CSB Receive */ events[2 ] |=0x04 ;/* CSB Timeout */ events[2 ] |=0x08 ;/* Truncated Page Complete */ + changed = true; }/* Enable Authenticated Payload Timeout Expired event if supported */ -if (lmp_ping_capable (hdev) || hdev->le_features[0 ] &HCI_LE_PING ) +if (lmp_ping_capable (hdev) || hdev->le_features[0 ] &HCI_LE_PING ) { events[2 ] |=0x80 ; + changed = true; + } -hci_req_add (req,HCI_OP_SET_EVENT_MASK_PAGE_2 ,sizeof (events), events); +/* Some Broadcom based controllers indicate support for Set Event +* Mask Page 2 command, but then actually do not support it. Since +* the default value is all bits set to zero, the command is only +* required if the event mask has to be changed. In case no change +* to the event mask is needed, skip this command. +*/ +if (changed) +hci_req_add (req,HCI_OP_SET_EVENT_MASK_PAGE_2 , +sizeof (events), events); }static void hci_init3_req (struct hci_request *req,unsigned long opt)
Signature · 1 line
2.15.1
PATCH 18/101 vxlan: dont migrate permanent fdb entries during learn
In reply to Sasha LevinFrom: Roopa Prabhu <[email protected]>
[ Upstream commit e0090a9e979de5202c7d16c635dea2f005221073 ]
This patch fixes vxlan_snoop to not move permanent fdb entries on learn events. This is consistent with the bridge fdb handling of permanent entries.
--- drivers/net/vxlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vxlan.c +1 -1
@@ -985,7 +985,7 @@ static bool vxlan_snoop(struct net_device *dev,return false;/* Don't migrate static entries, drop packets */ -if (f->state &NUD_NOARP ) +if (f->state & (NUD_PERMANENT |NUD_NOARP ))return true;if (net_ratelimit ())
Signature · 1 line
2.15.1
PATCH 15/101 ACPICA: Events: Add runtime stub support for event APIs
In reply to Sasha LevinFrom: Lv Zheng <[email protected]>
[ Upstream commit 861ba6351c520328e94a78c923b415faa9116287 ]
ACPICA commit 99bc3beca92c6574ea1d69de42e54f872e6373ce
It is reported that on Linux, RTC driver complains wrong errors on hardware reduced platform:
[ 4.085420] ACPI Warning: Could not enable fixed event - real_time_clock (4) (20160422/evxface-654)
This patch fixes this by correctly adding runtime reduced hardware check. Reported by Chandan Tagore, fixed by Lv Zheng.
--- drivers/acpi/acpica/evxfevnt.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/acpi/acpica/evxfevnt.c +18 -0
@@ -180,6 +180,12 @@ acpi_status acpi_enable_event(u32 event, u32 flags)ACPI_FUNCTION_TRACE (acpi_enable_event); +/* If Hardware Reduced flag is set, there are no fixed events */ + +if (acpi_gbl_reduced_hardware) { +return_ACPI_STATUS (AE_OK ); + } +/* Decode the Fixed Event */ if (event >ACPI_EVENT_MAX ) {
@@ -237,6 +243,12 @@ acpi_status acpi_disable_event(u32 event, u32 flags)ACPI_FUNCTION_TRACE (acpi_disable_event); +/* If Hardware Reduced flag is set, there are no fixed events */ + +if (acpi_gbl_reduced_hardware) { +return_ACPI_STATUS (AE_OK ); + } +/* Decode the Fixed Event */ if (event >ACPI_EVENT_MAX ) {
@@ -290,6 +302,12 @@ acpi_status acpi_clear_event(u32 event)ACPI_FUNCTION_TRACE (acpi_clear_event); +/* If Hardware Reduced flag is set, there are no fixed events */ + +if (acpi_gbl_reduced_hardware) { +return_ACPI_STATUS (AE_OK ); + } +/* Decode the Fixed Event */ if (event >ACPI_EVENT_MAX ) {
Signature · 1 line
2.15.1
PATCH 19/101 scsi: csiostor: Avoid content leaks and casts
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 42c335f7e67029d2e01711f2f2bc6252277c8993 ]
When copying attributes, the len argument was padded out and the resulting memcpy() would copy beyond the end of the source buffer. Avoid this, and use size_t for val_len to avoid all the casts. Similarly, avoid source buffer casts and use void *.
Additionally enforces val_len can be represented by u16 and that the DMA buffer was not overflowed. Fixes the size of mfa, which is not FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN (but it will be padded up to 4). This was noticed by the future CONFIG_FORTIFY_SOURCE checks.
--- drivers/scsi/csiostor/csio_lnode.c | 43 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 17 deletions(-)
drivers/scsi/csiostor/csio_lnode.c +26 -17
@@ -238,14 +238,23 @@ csio_osname(uint8_t *buf, size_t buf_len) }static inline void -csio_append_attrib (uint8_t **ptr,uint16_t type,uint8_t *val,uint16_t len) +csio_append_attrib (uint8_t **ptr,uint16_t type,void *val,size_t val_len) { +uint16_t len;struct fc_fdmi_attr_entry *ae = (struct fc_fdmi_attr_entry *)*ptr; + +if (WARN_ON (val_len >U16_MAX )) +return ; + + len = val_len; + ae->type =htons (type); len +=4 ;/* includes attribute type and length */ len = (len +3 ) & ~3 ;/* should be multiple of 4 bytes */ ae->len =htons (len); -memcpy (ae->value, val, len); +memcpy (ae->value, val, val_len); +if (len > val_len) +memset (ae->value + val_len,0 , len - val_len); *ptr += len; }
@@ -335,7 +344,7 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req) numattrs++; val =htonl (FC_PORTSPEED_1GBIT |FC_PORTSPEED_10GBIT );csio_append_attrib (&pld,FC_FDMI_PORT_ATTR_SUPPORTEDSPEED , - (uint8_t *)&val, + &val,FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN ); numattrs++;
@@ -346,23 +355,22 @@ csio_ln_fdmi_rhba_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req)else val =htonl (CSIO_HBA_PORTSPEED_UNKNOWN );csio_append_attrib (&pld,FC_FDMI_PORT_ATTR_CURRENTPORTSPEED , - (uint8_t *)&val, -FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN ); + &val,FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN ); numattrs++; mfs = ln->ln_sparm.csp.sp_bb_data;csio_append_attrib (&pld,FC_FDMI_PORT_ATTR_MAXFRAMESIZE , - (uint8_t *)&mfs,FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN ); + &mfs,sizeof (mfs)); numattrs++;strcpy (buf,"csiostor" );csio_append_attrib (&pld,FC_FDMI_PORT_ATTR_OSDEVICENAME , buf, - (uint16_t )strlen (buf)); +strlen (buf)); numattrs++;if (!csio_hostname (buf,sizeof (buf))) {csio_append_attrib (&pld,FC_FDMI_PORT_ATTR_HOSTNAME , - buf, (uint16_t )strlen (buf)); + buf,strlen (buf)); numattrs++; } attrib_blk->numattrs =htonl (numattrs);
@@ -444,33 +452,32 @@ csio_ln_fdmi_dprt_cbfn(struct csio_hw *hw, struct csio_ioreq *fdmi_req)strcpy (buf,"Chelsio Communications" );csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_MANUFACTURER , buf, - (uint16_t )strlen (buf)); +strlen (buf)); numattrs++;csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_SERIALNUMBER , - hw->vpd.sn, (uint16_t )sizeof (hw->vpd.sn)); + hw->vpd.sn,sizeof (hw->vpd.sn)); numattrs++;csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_MODEL , hw->vpd.id, - (uint16_t )sizeof (hw->vpd.id)); +sizeof (hw->vpd.id)); numattrs++;csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_MODELDESCRIPTION , - hw->model_desc, (uint16_t )strlen (hw->model_desc)); + hw->model_desc,strlen (hw->model_desc)); numattrs++;csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_HARDWAREVERSION , - hw->hw_ver, (uint16_t )sizeof (hw->hw_ver)); + hw->hw_ver,sizeof (hw->hw_ver)); numattrs++;csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_FIRMWAREVERSION , - hw->fwrev_str, (uint16_t )strlen (hw->fwrev_str)); + hw->fwrev_str,strlen (hw->fwrev_str)); numattrs++;if (!csio_osname (buf,sizeof (buf))) {csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_OSNAMEVERSION , - buf, (uint16_t )strlen (buf)); + buf,strlen (buf)); numattrs++; }csio_append_attrib (&pld,FC_FDMI_HBA_ATTR_MAXCTPAYLOAD , - (uint8_t *)&maxpayload, -FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN ); + &maxpayload,FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN ); len = (uint32_t )(pld - (uint8_t *)cmd); numattrs++; attrib_blk->numattrs =htonl (numattrs);
@@ -1794,6 +1801,8 @@ csio_ln_mgmt_submit_req(struct csio_ioreq *io_req,struct csio_mgmtm *mgmtm =csio_hw_to_mgmtm (hw);int rv; +BUG_ON (pld_len > pld->len); + io_req->io_cbfn = io_cbfn;/* Upper layer callback handler */ io_req->fw_handle = (uintptr_t ) (io_req); io_req->eq_idx = mgmtm->eq_idx;
Signature · 1 line
2.15.1
PATCH 27/101 platform/x86: acer-wmi: Detect RF Button capability
In reply to Sasha LevinFrom: João Paulo Rechi Vita <[email protected]>
[ Upstream commit 3e2bc5c5b3274ec7402fabbfba557ea58084985e ]
If a machine reports a RF Button in the communication button device bitmap, we need to remove it before calling Get Device Status otherwise it will return the "Undefined device" (0xE2) error code.
Although this may be a BIOS bug, we don't really need to get or set the RF Button status. The status indicator LED embedded in the button is controlled by firmware logic, depending on the status of the wireless radios present on the machine (WiFi || WWAN).
This commit fixes the wireless status indicator LED on the Acer TravelMate P648-G2-MG, and cleans the following message from the kernel
log: "Get Current Device Status failed: 0xe2 - 0x0".
--- drivers/platform/x86/acer-wmi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/acer-wmi.c +7 -0
@@ -148,6 +148,8 @@ struct event_return_value {#define ACER_WMID3_GDS_THREEG (1<<6)/* 3G */ #define ACER_WMID3_GDS_WIMAX (1<<7)/* WiMAX */ #define ACER_WMID3_GDS_BLUETOOTH (1<<11)/* BT */ +#define ACER_WMID3_GDS_RFBTN (1<<14)/* RF Button */ +#define ACER_WMID3_GDS_TOUCHPAD (1<<1)/* Touchpad */ struct lm_input_params {
@@ -205,6 +207,7 @@ struct hotkey_function_type_aa {#define ACER_CAP_BRIGHTNESS (1<<3)#define ACER_CAP_THREEG (1<<4)#define ACER_CAP_ACCEL (1<<5) +#define ACER_CAP_RFBTN (1<<6)#define ACER_CAP_ANY (0xFFFFFFFF)/*
@@ -1217,6 +1220,10 @@ static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d) interface->capability |=ACER_CAP_THREEG ;if (type_aa->commun_func_bitmap &ACER_WMID3_GDS_BLUETOOTH ) interface->capability |=ACER_CAP_BLUETOOTH ; +if (type_aa->commun_func_bitmap &ACER_WMID3_GDS_RFBTN ) { + interface->capability |=ACER_CAP_RFBTN ; + commun_func_bitmap &= ~ACER_WMID3_GDS_RFBTN ; + } commun_fn_key_number = type_aa->commun_fn_key_number; }
Signature · 1 line
2.15.1
PATCH 28/101 caif: Add sockaddr length check before accessing sa_family in connect handler
In reply to Sasha LevinFrom: Mateusz Jurczyk <[email protected]>
[ Upstream commit 20a3d5bf5e5b13c02450ab6178ec374abd830686 ]
Verify that the caller-provided sockaddr structure is large enough to contain the sa_family field, before accessing it in the connect() handler of the AF_CAIF socket. Since the syscall doesn't enforce a minimum size of the corresponding memory region, very short sockaddrs (zero or one byte long) result in operating on uninitialized memory while referencing sa_family.
--- net/caif/caif_socket.c | 4 ++++ 1 file changed, 4 insertions(+)
net/caif/caif_socket.c +4 -0
@@ -758,6 +758,10 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,lock_sock (sk); + err = -EINVAL ; + if (addr_len < offsetofend(struct sockaddr, sa_family)) + goto out; + err = -EAFNOSUPPORT ;if (uaddr->sa_family !=AF_CAIF ) goto out;
Signature · 1 line
2.15.1
PATCH 29/101 ixgbe: avoid permanent lock of *_PTP_TX_IN_PROGRESS
In reply to Sasha LevinFrom: Jacob Keller <[email protected]>
[ Upstream commit 5fef124d9c75942dc5c2445a3faa8ad37cbf4c82 ]
The ixgbe driver uses a state bit lock to avoid handling more than one Tx timestamp request at once. This is required because hardware is limited to a single set of registers for Tx timestamps.
The state bit lock is not properly cleaned up during ixgbe_xmit_frame_ring() if the transmit fails such as due to DMA or TSO failure. In some hardware this results in blocking timestamps until the service task times out. In other hardware this results in a permanent lock of the timestamp bit because we never receive an interrupt indicating the timestamp occurred, since indeed the packet was never transmitted.
Fix this by checking for DMA and TSO errors in ixgbe_xmit_frame_ring() and properly cleaning up after ourselves when these occur.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +15 -5
@@ -6776,9 +6776,9 @@ static inline int ixgbe_maybe_stop_tx(struct ixgbe_ring *tx_ring, u16 size)#define IXGBE_TXD_CMD (IXGBE_TXD_CMD_EOP | \ IXGBE_TXD_CMD_RS) -static void ixgbe_tx_map (struct ixgbe_ring *tx_ring, -struct ixgbe_tx_buffer *first, -const u8 hdr_len) +static int ixgbe_tx_map (struct ixgbe_ring *tx_ring, +struct ixgbe_tx_buffer *first, +const u8 hdr_len) {struct sk_buff *skb = first->skb;struct ixgbe_tx_buffer *tx_buffer;
@@ -6901,7 +6901,7 @@ static void ixgbe_tx_map(struct ixgbe_ring *tx_ring,ixgbe_write_tail (tx_ring, i); } -return ; +return 0 ; dma_error:dev_err (tx_ring->dev,"TX DMA map failed\n" );
@@ -6917,6 +6917,8 @@ dma_error: } tx_ring->next_to_use = i; + +return -1 ; } static void ixgbe_atr(struct ixgbe_ring *ring,
@@ -7174,13 +7176,21 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,#ifdef IXGBE_FCOE xmit_fcoe:#endif /* IXGBE_FCOE */ -ixgbe_tx_map (tx_ring, first, hdr_len); +if (ixgbe_tx_map (tx_ring, first, hdr_len)) + goto cleanup_tx_timestamp;return NETDEV_TX_OK ; out_drop:dev_kfree_skb_any (first->skb); first->skb =NULL ; +cleanup_tx_timestamp: +if (unlikely (tx_flags &IXGBE_TX_FLAGS_TSTAMP )) { +dev_kfree_skb_any (adapter->ptp_tx_skb); + adapter->ptp_tx_skb =NULL ; +cancel_work_sync (&adapter->ptp_tx_work); +clear_bit_unlock (__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state); + }return NETDEV_TX_OK ; }
Signature · 1 line
2.15.1
PATCH 24/101 PCI: Correct PCI_STD_RESOURCE_END usage
In reply to Sasha LevinFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 2f686f1d9beee135de6d08caea707ec7bfc916d4 ]
PCI_STD_RESOURCE_END is (confusingly) the index of the last valid BAR, not the *number* of BARs. To iterate through all possible BARs, we need to include PCI_STD_RESOURCE_END.
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
@@ -305,7 +305,7 @@ static void quirk_extend_bar_to_page(struct pci_dev *dev) {int i; -for (i =0 ; i <PCI_STD_RESOURCE_END ; i++) { +for (i =0 ; i <=PCI_STD_RESOURCE_END ; i++) {struct resource *r = &dev->resource[i];if (r->flags &IORESOURCE_MEM &&resource_size (r) <PAGE_SIZE ) {
Signature · 1 line
2.15.1
PATCH 25/101 PCI: Add domain number check to find_smbios_instance_string()
In reply to Sasha LevinFrom: Sujith Pandel <[email protected]>
[ Upstream commit 6c51c82c60991bdbfb937f3bf0cdbe68d042073d ]
The function find_smbios_instance_string() does not consider the PCI domain number. As a result, SMBIOS type 41 device type instance would be exported to sysfs for all the PCI domains which have a PCI device with same bus/device/function, though PCI bus/device/func from a specific PCI domain has SMBIOS type 41 device type instance defined.
Address the issue by making find_smbios_instance_string() check PCI domain number as well.
--- drivers/pci/pci-label.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pci/pci-label.c +5 -2
@@ -45,9 +45,11 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf, {const struct dmi_device *dmi;struct dmi_dev_onboard *donboard; +int domain_nr;int bus;int devfn; + domain_nr =pci_domain_nr (pdev->bus); bus = pdev->bus->number; devfn = pdev->devfn;
@@ -55,8 +57,9 @@ static size_t find_smbios_instance_string(struct pci_dev *pdev, char *buf,while ((dmi =dmi_find_device (DMI_DEV_TYPE_DEV_ONBOARD ,NULL , dmi)) !=NULL ) { donboard = dmi->device_data; -if (donboard && donboard->bus == bus && - donboard->devfn == devfn) { +if (donboard && donboard->segment == domain_nr && + donboard->bus == bus && + donboard->devfn == devfn) {if (buf) {if (attribute ==SMBIOS_ATTR_INSTANCE_SHOW ) return scnprintf(buf, PAGE_SIZE,
Signature · 1 line
2.15.1
PATCH 31/101 PCI: Protect pci_error_handlers->reset_notify() usage with device_lock()
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit b014e96d1abbd67404bbe2018937b46466299e9e ]
Every method in struct device_driver or structures derived from it like struct pci_driver MUST provide exclusion vs the driver's ->remove() method, usually by using device_lock().
Protect use of pci_error_handlers->reset_notify() by holding the device lock while calling it.
Note:
- pci_dev_lock() calls device_lock() in addition to blocking user-space config accesses.
- pci_err_handlers->reset_notify() is used inside pci_dev_save_and_disable() and pci_dev_restore(). We could hold the device lock directly in pci_reset_notify(), but we expand the region since we have several calls following each other.
Without this, ->reset_notify() may race with ->remove() calls, which can be easily triggered in NVMe.
[bhelgaas: changelog, add pci_reset_notify() comment] [bhelgaas: fold in fix from Dan Carpenter <[email protected]>:
http://lkml.kernel.org/r/20170701135323.x5vaj4e2wcs2mcro@mwanda]
--- drivers/pci/pci.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/pci/pci.c +18 -8
@@ -3402,6 +3402,12 @@ static void pci_reset_notify(struct pci_dev *dev, bool prepare) {const struct pci_error_handlers *err_handler = dev->driver ? dev->driver->err_handler :NULL ; + +/* +* dev->driver->err_handler->reset_notify() is protected against +* races with ->remove() by the device lock, which must be held by +* the caller. +*/ if (err_handler && err_handler->reset_notify) err_handler->reset_notify (dev, prepare); }
@@ -3537,11 +3543,13 @@ int pci_reset_function(struct pci_dev *dev)if (rc)return rc; +pci_dev_lock (dev);pci_dev_save_and_disable (dev); - rc =pci_dev_reset (dev,0 ); + rc =__pci_dev_reset (dev,0 );pci_dev_restore (dev); +pci_dev_unlock (dev);return rc; }
@@ -3561,16 +3569,14 @@ int pci_try_reset_function(struct pci_dev *dev)if (rc)return rc; -pci_dev_save_and_disable (dev); +if (!pci_dev_trylock (dev)) +return -EAGAIN ; -if (pci_dev_trylock (dev)) { - rc =__pci_dev_reset (dev,0 ); -pci_dev_unlock (dev); - }else - rc = -EAGAIN ; +pci_dev_save_and_disable (dev); + rc =__pci_dev_reset (dev,0 ); +pci_dev_unlock (dev);pci_dev_restore (dev); -return rc; }EXPORT_SYMBOL_GPL (pci_try_reset_function);
@@ -3724,7 +3730,9 @@ static void pci_bus_save_and_disable(struct pci_bus *bus)struct pci_dev *dev;list_for_each_entry (dev, &bus->devices, bus_list) { +pci_dev_lock (dev);pci_dev_save_and_disable (dev); +pci_dev_unlock (dev);if (dev->subordinate)pci_bus_save_and_disable (dev->subordinate); }
@@ -3739,7 +3747,9 @@ static void pci_bus_restore(struct pci_bus *bus)struct pci_dev *dev;list_for_each_entry (dev, &bus->devices, bus_list) { +pci_dev_lock (dev);pci_dev_restore (dev); +pci_dev_unlock (dev);if (dev->subordinate)pci_bus_restore (dev->subordinate); }
Signature · 1 line
2.15.1
PATCH 32/101 firmware: dmi_scan: Check DMI structure length
In reply to Sasha LevinFrom: Jean Delvare <[email protected]>
[ Upstream commit a814c3597a6b6040e2ef9459748081a6d5b7312d ]
Before accessing DMI data to record it for later, we should ensure that the DMI structures are large enough to contain the data in question.
--- drivers/firmware/dmi_scan.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/firmware/dmi_scan.c +16 -7
@@ -152,7 +152,7 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot,const char *d = (const char *) dm;const char *p; -if (dmi_ident[slot]) +if (dmi_ident[slot] || dm->length <= string)return ; p =dmi_string (dm, d[string]);
@@ -165,13 +165,14 @@ static void __init dmi_save_ident(const struct dmi_header *dm, int slot,static void __init dmi_save_uuid (const struct dmi_header *dm,int slot,int index) { -const u8 *d = (u8 *) dm + index; +const u8 *d;char *s;int is_ff =1 , is_00 =1 , i; -if (dmi_ident[slot]) +if (dmi_ident[slot] || dm->length <= index +16 )return ; + d = (u8 *) dm + index;for (i =0 ; i <16 && (is_ff || is_00); i++) {if (d[i] !=0x00 ) is_00 =0 ;
@@ -202,16 +203,17 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot,static void __init dmi_save_type (const struct dmi_header *dm,int slot,int index) { -const u8 *d = (u8 *) dm + index; +const u8 *d;char *s; -if (dmi_ident[slot]) +if (dmi_ident[slot] || dm->length <= index)return ; s =dmi_alloc (4 );if (!s)return ; + d = (u8 *) dm + index;sprintf (s,"%u" , *d &0x7F ); dmi_ident[slot] = s; }
@@ -252,9 +254,13 @@ static void __init dmi_save_devices(const struct dmi_header *dm)static void __init dmi_save_oem_strings_devices (const struct dmi_header *dm) { -int i, count = *(u8 *)(dm +1 ); +int i, count;struct dmi_device *dev; +if (dm->length <0x05 ) +return ; + + count = *(u8 *)(dm +1 );for (i =1 ; i <= count; i++) {const char *devname =dmi_string (dm, i);
@@ -321,6 +327,9 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm) {const u8 *d = (u8 *) dm +5 ; +if (dm->length <0x0B ) +return ; +/* Skip disabled device */ if ((*d &0x80 ) ==0 )return ;
@@ -342,7 +351,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v)const char *d = (const char *)dm;static int nr; -if (dm->type !=DMI_ENTRY_MEM_DEVICE ) +if (dm->type !=DMI_ENTRY_MEM_DEVICE || dm->length <0x12 )return ;if (nr >= dmi_memdev_nr) {pr_warn (FW_BUG "Too many DIMM entries in SMBIOS table\n" );
Signature · 1 line
2.15.1
PATCH 33/101 i2c: ismt: fix wrong device address when unmap the data buffer
In reply to Sasha LevinFrom: Liwei Song <[email protected]>
[ Upstream commit 17e83549e199d89aace7788a9f11c108671eecf5 ]
Fix the following kernel bug:
kernel BUG at drivers/iommu/intel-iommu.c:3260!
invalid opcode: 0000 [#5] PREEMPT SMP
Hardware name: Intel Corp. Harcuvar/Server, BIOS HAVLCRB0.X64.0013.D39.1608311820 08/31/2016 task: ffff880175389950 ti: ffff880176bec000 task.ti: ffff880176bec000 RIP: 0010:[<ffffffff8150a83b>] [<ffffffff8150a83b>] intel_unmap+0x25b/0x260 RSP: 0018:ffff880176bef5e8 EFLAGS: 00010296 RAX: 0000000000000024 RBX: ffff8800773c7c88 RCX: 000000000000ce04 RDX: 0000000080000000 RSI: 0000000000000000 RDI: 0000000000000009 RBP: ffff880176bef638 R08: 0000000000000010 R09: 0000000000000004 R10: ffff880175389c78 R11: 0000000000000a4f R12: ffff8800773c7868 R13: 00000000ffffac88 R14: ffff8800773c7818 R15: 0000000000000001 FS: 00007fef21258700(0000) GS:ffff88017b5c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000066d6d8 CR3: 000000007118c000 CR4: 00000000003406e0 Stack: 00000000ffffac88 ffffffff8199867f ffff880176bef5f8 ffff880100000030 ffff880176bef668 ffff8800773c7c88 ffff880178288098 ffff8800772c0010 ffff8800773c7818 0000000000000001 ffff880176bef648 ffffffff8150a86e Call Trace: [<ffffffff8199867f>] ? printk+0x46/0x48 [<ffffffff8150a86e>] intel_unmap_page+0xe/0x10 [<ffffffffa039d99b>] ismt_access+0x27b/0x8fa [i2c_ismt] [<ffffffff81554420>] ? __pm_runtime_suspend+0xa0/0xa0 [<ffffffff815544a0>] ? pm_suspend_timer_fn+0x80/0x80 [<ffffffff81554420>] ? __pm_runtime_suspend+0xa0/0xa0 [<ffffffff815544a0>] ? pm_suspend_timer_fn+0x80/0x80 [<ffffffff8143dfd0>] ? pci_bus_read_dev_vendor_id+0xf0/0xf0 [<ffffffff8172b36c>] i2c_smbus_xfer+0xec/0x4b0 [<ffffffff810aa4d5>] ? vprintk_emit+0x345/0x530 [<ffffffffa038936b>] i2cdev_ioctl_smbus+0x12b/0x240 [i2c_dev] [<ffffffff810aa829>] ? vprintk_default+0x29/0x40 [<ffffffffa0389b33>] i2cdev_ioctl+0x63/0x1ec [i2c_dev] [<ffffffff811b04c8>] do_vfs_ioctl+0x328/0x5d0 [<ffffffff8119d8ec>] ? vfs_write+0x11c/0x190 [<ffffffff8109d449>] ? rt_up_read+0x19/0x20 [<ffffffff811b07f1>] SyS_ioctl+0x81/0xa0 [<ffffffff819a351b>] system_call_fastpath+0x16/0x6e
This happen When run "i2cdetect -y 0" detect SMBus iSMT adapter.
After finished I2C block read/write, when unmap the data buffer, a wrong device address was pass to dma_unmap_single().
To fix this, give dma_unmap_single() the "dev" parameter, just like what dma_map_single() does, then unmap can find the right devices.
--- drivers/i2c/busses/i2c-ismt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-ismt.c +1 -1
@@ -587,7 +587,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,/* unmap the data buffer */ if (dma_size !=0 ) -dma_unmap_single (&adap->dev, dma_addr, dma_size, dma_direction); +dma_unmap_single (dev, dma_addr, dma_size, dma_direction);if (unlikely (!ret)) {dev_err (dev,"completion wait timed out\n" );
Signature · 1 line
2.15.1
PATCH 34/101 drm/mgag200: Fix to always set HiPri for G200e4 V2
In reply to Sasha LevinFrom: Mathieu Larouche <[email protected]>
[ Upstream commit 0cbb738108927916a659b5b0b96e386fcd7cc6e1 ]
- Changed the HiPri value for G200e4 to always be 0.
- Added Bandwith limitation to block resolution above 1920x1200x60Hz
--- drivers/gpu/drm/mgag200/mgag200_mode.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/mgag200/mgag200_mode.c +8 -1
@@ -1029,7 +1029,10 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,if (IS_G200_SE (mdev)) { -if (mdev->unique_rev_id >=0x02 ) { +if (mdev->unique_rev_id >=0x04 ) { +WREG8 (MGAREG_CRTCEXT_INDEX ,0x06 ); +WREG8 (MGAREG_CRTCEXT_DATA ,0 ); + }else if (mdev->unique_rev_id >=0x02 ) {u8 hi_pri_lvl;u32 bpp;u32 mb;
@@ -1502,6 +1505,10 @@ static int mga_vga_mode_valid(struct drm_connector *connector,if (mga_vga_calculate_mode_bandwidth (mode, bpp) > (30100 *1024 ))return MODE_BANDWIDTH ; + }else { +if (mga_vga_calculate_mode_bandwidth (mode, bpp) + > (55000 *1024 )) +return MODE_BANDWIDTH ; } }else if (mdev->type ==G200_WB ) {if (mode->hdisplay >1280 )
Signature · 1 line
2.15.1
PATCH 35/101 r8152: add byte_enable for ocp_read_word function
In reply to Sasha LevinFrom: hayeswang <[email protected]>
[ Upstream commit d8fbd27469fc02049c674de296a3263bef089131 ]
Add byte_enable for ocp_read_word() to replace reading 4 bytes data with reading the desired 2 bytes data.
This is used to avoid the issue which is described in commit b4d99def0938 ("r8152: remove sram_read"). The original method always reads 4 bytes data, and it may have problem when reading the PHY registers.
The new method is supported since RTL8153B, but it doesn't influence the previous chips. The bits of the byte_enable for the previous chips are the reserved bits, and the hw would ignore them.
--- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +3 -1
@@ -804,11 +804,13 @@ static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) {u32 data;__le32 tmp; +u16 byen =BYTE_EN_WORD ;u8 shift = index &2 ; index &= ~3 ; + byen <<= shift; -generic_ocp_read (tp, index,sizeof (tmp), &tmp, type); +generic_ocp_read (tp, index,sizeof (tmp), &tmp, type | byen); data =__le32_to_cpu (tmp); data >>= (shift *8 );
Signature · 1 line
2.15.1
PATCH 37/101 scsi: lpfc: Fix crash after firmware flash when IO is running.
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 569dbe84a3e769009aa4a5d1030d000168889580 ]
OS crashes after the completion of firmware download.
Failure in posting SCSI SGL buffers because number of SGL buffers is less than total count. Some of the pending IOs are not completed by driver. SGL buffers for these IOs are not added back to the list. Pending IOs are not completed because lpfc_wq_list list is initialized before completion of pending IOs.
Postpone lpfc_wq_list reinitialization by moving lpfc_sli4_queue_destroy() after lpfc_hba_down_post().
--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -4057,7 +4057,6 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba)/* Perform FCoE PCI function reset before freeing queue memory */ rc =lpfc_pci_function_reset (phba); -lpfc_sli4_queue_destroy (phba);/* Restore PCI cmd register */ pci_write_config_word (phba->pcidev,PCI_COMMAND , cfg_value);
@@ -4180,6 +4179,7 @@ lpfc_sli_brdrestart_s4(struct lpfc_hba *phba)pci_disable_pcie_error_reporting (phba->pcidev);lpfc_hba_down_post (phba); +lpfc_sli4_queue_destroy (phba);return rc; }
Signature · 1 line
2.15.1
PATCH 41/101 fib_rules: Resolve goto rules target on delete
In reply to Sasha LevinFrom: Serhey Popovych <[email protected]>
[ Upstream commit bdaf32c3ced3d111b692f0af585f880f82d686c5 ]
We should avoid marking goto rules unresolved when their target is actually reachable after rule deletion.
Consolder following sample scenario:
# ip -4 ru sh 0: from all lookup local 32000: from all goto 32100 32100: from all lookup main 32100: from all lookup default 32766: from all lookup main 32767: from all lookup default
# ip -4 ru del pref 32100 table main # ip -4 ru sh 0: from all lookup local 32000: from all goto 32100 [unresolved] 32100: from all lookup default 32766: from all lookup main 32767: from all lookup default
After removal of first rule with preference 32100 we mark all goto rules as unreachable, even when rule with same preference as removed one still present.
Check if next rule with same preference is available and make all rules with goto action pointing to it.
--- net/core/fib_rules.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
net/core/fib_rules.c +14 -7
@@ -435,7 +435,7 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh)struct net *net =sock_net (skb->sk);struct fib_rule_hdr *frh =nlmsg_data (nlh);struct fib_rules_ops *ops =NULL ; -struct fib_rule *rule, *tmp; +struct fib_rule *rule, *r;struct nlattr *tb[FRA_MAX +1 ];int err = -EINVAL ;
@@ -502,16 +502,23 @@ static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh)/* * Check if this rule is a target to any of them. If so, +* adjust to the next one with the same preference or * disable them. As this operation is eventually very -* expensive, it is only performed if goto rules have -* actually been added. +* expensive, it is only performed if goto rules, except +* current if it is goto rule, have actually been added. */ if (ops->nr_goto_rules >0 ) { -list_for_each_entry (tmp, &ops->rules_list, list) { -if (rtnl_dereference (tmp->ctarget) == rule) { -RCU_INIT_POINTER (tmp->ctarget,NULL ); +struct fib_rule *n; + + n =list_next_entry (rule, list); +if (&n->list == &ops->rules_list || n->pref != rule->pref) + n =NULL ; +list_for_each_entry (r, &ops->rules_list, list) { +if (rtnl_dereference (r->ctarget) != rule) +continue ; +rcu_assign_pointer (r->ctarget, n); +if (!n) ops->unresolved_rules++; - } } }
Signature · 1 line
2.15.1
PATCH 42/101 dccp: call inet_add_protocol after register_pernet_subsys in dccp_v4_init
In reply to Sasha LevinFrom: Xin Long <[email protected]>
[ Upstream commit d5494acb88aa9dd1325079c9b8855008a52c19b3 ]
Now dccp_ipv4 works as a kernel module. During loading this module, if one dccp packet is being recieved after inet_add_protocol but before register_pernet_subsys in which v4_ctl_sk is initialized, a null pointer dereference may be triggered because of init_net.dccp.v4_ctl_sk is 0x0.
Jianlin found this issue when the following call trace occurred:
[ 171.950177] BUG: unable to handle kernel NULL pointer dereference at 0000000000000110 [ 171.951007] IP: [<ffffffffc0558364>] dccp_v4_ctl_send_reset+0xc4/0x220 [dccp_ipv4] [...] [ 171.984629] Call Trace: [ 171.984859] <IRQ> [ 171.985061] [ 171.985213] [<ffffffffc0559a53>] dccp_v4_rcv+0x383/0x3f9 [dccp_ipv4] [ 171.985711] [<ffffffff815ca054>] ip_local_deliver_finish+0xb4/0x1f0 [ 171.986309] [<ffffffff815ca339>] ip_local_deliver+0x59/0xd0 [ 171.986852] [<ffffffff810cd7a4>] ? update_curr+0x104/0x190 [ 171.986956] [<ffffffff815c9cda>] ip_rcv_finish+0x8a/0x350 [ 171.986956] [<ffffffff815ca666>] ip_rcv+0x2b6/0x410 [ 171.986956] [<ffffffff810c83b4>] ? task_cputime+0x44/0x80 [ 171.986956] [<ffffffff81586f22>] __netif_receive_skb_core+0x572/0x7c0 [ 171.986956] [<ffffffff810d2c51>] ? trigger_load_balance+0x61/0x1e0 [ 171.986956] [<ffffffff81587188>] __netif_receive_skb+0x18/0x60 [ 171.986956] [<ffffffff8158841e>] process_backlog+0xae/0x180 [ 171.986956] [<ffffffff8158799d>] net_rx_action+0x16d/0x380 [ 171.986956] [<ffffffff81090b7f>] __do_softirq+0xef/0x280 [ 171.986956] [<ffffffff816b6a1c>] call_softirq+0x1c/0x30
This patch is to move inet_add_protocol after register_pernet_subsys in dccp_v4_init, so that v4_ctl_sk is initialized before any incoming dccp packets are processed.
--- net/dccp/ipv4.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
net/dccp/ipv4.c +9 -8
@@ -1051,33 +1051,34 @@ static int __init dccp_v4_init(void) {int err =proto_register (&dccp_v4_prot,1 ); -if (err !=0 ) +if (err) goto out; - err =inet_add_protocol (&dccp_v4_protocol,IPPROTO_DCCP ); -if (err !=0 ) - goto out_proto_unregister; -inet_register_protosw (&dccp_v4_protosw); err =register_pernet_subsys (&dccp_v4_ops);if (err) goto out_destroy_ctl_sock; + + err =inet_add_protocol (&dccp_v4_protocol,IPPROTO_DCCP ); +if (err) + goto out_proto_unregister; + out:return err; +out_proto_unregister: +unregister_pernet_subsys (&dccp_v4_ops); out_destroy_ctl_sock:inet_unregister_protosw (&dccp_v4_protosw); -inet_del_protocol (&dccp_v4_protocol,IPPROTO_DCCP ); -out_proto_unregister:proto_unregister (&dccp_v4_prot); goto out; } static void __exit dccp_v4_exit(void) { +inet_del_protocol (&dccp_v4_protocol,IPPROTO_DCCP );unregister_pernet_subsys (&dccp_v4_ops);inet_unregister_protosw (&dccp_v4_protosw); -inet_del_protocol (&dccp_v4_protocol,IPPROTO_DCCP );proto_unregister (&dccp_v4_prot); }
Signature · 1 line
2.15.1
PATCH 45/101 macvlan: Do not return error when setting the same mac address
In reply to Sasha LevinFrom: Vlad Yasevich <[email protected]>
[ Upstream commit e26f43faa0d79dd06e9e94829696b68b9940c2ee ]
The user currently gets an EBUSY error when attempting to set the mac address on a macvlan device to the same value.
This should really be a no-op as nothing changes. Catch the condition and return early.
--- drivers/net/macvlan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/macvlan.c +4 -0
@@ -681,6 +681,10 @@ static int macvlan_set_mac_address(struct net_device *dev, void *p)if (!is_valid_ether_addr (addr->sa_data))return -EADDRNOTAVAIL ; +/* If the addresses are the same, this is a no-op */ +if (ether_addr_equal (dev->dev_addr, addr->sa_data)) +return 0 ; +if (vlan->mode ==MACVLAN_MODE_PASSTHRU ) {dev_set_mac_address (vlan->lowerdev, addr);return 0 ;
Signature · 1 line
2.15.1
PATCH 46/101 sctp: adjust ssthresh when transport is idle
In reply to Sasha LevinFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit a02d036c027e9070ca27c156f59eb445d5405480 ]
RFC 4960 Errata 3.27 identifies that ssthresh should be adjusted to cwnd because otherwise it could cause the transport to lock into congestion avoidance phase specially if ssthresh was previously reduced by some packet drop, leading to poor performance.
The Errata says to adjust ssthresh to cwnd only once, though the same goal is achieved by updating it every time we update cwnd too. The caveat is that we could take longer to get back up to speed but that should be compensated by the fact that we don't adjust on RTO basis (as RFC says) but based on Heartbeats, which are usually way longer.
See-also: https://tools.ietf.org/html/draft-ietf-tsvwg-rfc4960-errata-01#section-3.27
--- net/sctp/transport.c | 2 ++ 1 file changed, 2 insertions(+)
net/sctp/transport.c +2 -0
@@ -546,6 +546,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,*/ transport->cwnd =max (transport->cwnd/2 ,4 *asoc->pathmtu); +/* RFC 4960 Errata 3.27.2: also adjust sshthresh */ + transport->ssthresh = transport->cwnd;break ; }
Signature · 1 line
2.15.1
PATCH 48/101 scsi: bnx2i: missing error code in bnx2i_ep_connect()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 1d32a62c74b3bcb69822b0f4745af5410cfec3a7 ]
If bnx2i_map_ep_dbell_regs() then we accidentally return NULL instead of an error pointer. It results in a NULL dereference in iscsi_if_ep_connect().
--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -1
@@ -1907,7 +1907,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,bnx2i_ep_active_list_add (hba, bnx2i_ep); -if (bnx2i_map_ep_dbell_regs (bnx2i_ep)) + rc =bnx2i_map_ep_dbell_regs (bnx2i_ep); +if (rc) goto del_active_ep;mutex_unlock (&hba->net_dev_lock);
Signature · 1 line
2.15.1
PATCH 50/101 ACPI: EC: Fix EC command visibility for dynamic debug
In reply to Sasha LevinFrom: Lv Zheng <[email protected]>
[ Upstream commit 4625d752e600c116e6327f9d7fc16e8f5be107e9 ]
acpi_ec_cmd_string() currently is only enabled for "DEBUG" macro, but users trend to use CONFIG_DYNAMIC_DEBUG and enable ec.c pr_debug() print-outs by "dyndbg='file ec.c +p'". In this use case, all command names are turned into UNDEF and the log is confusing. This affects bugzilla triage work.
This patch fixes this issue by enabling acpi_ec_cmd_string() for CONFIG_DYNAMIC_DEBUG.
--- drivers/acpi/ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/ec.c +1 -1
@@ -167,7 +167,7 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)outb (data, ec->data_addr); } -#ifdef DEBUG +#if defined(DEBUG ) || defined(CONFIG_DYNAMIC_DEBUG )static const char *acpi_ec_cmd_string (u8 cmd) {switch (cmd) {
Signature · 1 line
2.15.1
PATCH 51/101 scsi: sun_esp: fix device reference leaks
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit f62f9ffdb5ef683ef8cffb43932fa72cc3713e94 ]
Make sure to drop the reference to the dma device taken by of_find_device_by_node() on probe errors and on driver unbind.
--- drivers/scsi/sun_esp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/scsi/sun_esp.c +8 -1
@@ -566,6 +566,7 @@ static int esp_sbus_probe(struct platform_device *op)struct device_node *dp = op->dev.of_node;struct platform_device *dma_of =NULL ;int hme =0 ; +int ret; if (dp->parent && (!strcmp(dp->parent->name, "espdma") ||
@@ -580,7 +581,11 @@ static int esp_sbus_probe(struct platform_device *op)if (!dma_of)return -ENODEV ; -return esp_sbus_probe_one (op, dma_of, hme); + ret =esp_sbus_probe_one (op, dma_of, hme); +if (ret) +put_device (&dma_of->dev); + +return ret; }static int esp_sbus_remove (struct platform_device *op)
@@ -613,6 +618,8 @@ static int esp_sbus_remove(struct platform_device *op)dev_set_drvdata (&op->dev,NULL ); +put_device (&dma_of->dev); +return 0 ; }
Signature · 1 line
2.15.1
PATCH 52/101 powerpc/fadump: avoid duplicates in crash memory ranges
In reply to Sasha LevinFrom: Hari Bathini <[email protected]>
[ Upstream commit a77af552ccc9d4d54459a39f9e5f7ad307aeb4f9 ]
fadump sets up crash memory ranges to be used for creating PT_LOAD program headers in elfcore header. Memory chunk RMA_START through boot memory area size is added as the first memory range because firmware, at the time of crash, moves this memory chunk to different location specified during fadump registration making it necessary to create a separate program header for it with the correct offset. This memory chunk is skipped while setting up the remaining memory ranges. But currently, there is possibility that some of this memory may have duplicate entries like when it is hot-removed and added again. Ensure that no two memory ranges represent the same memory.
When 5 lmbs are hot-removed and then hot-plugged before registering fadump, here is how the program headers in /proc/vmcore exported by fadump look like
without this change:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000010000 0x0000000000000000 0x0000000000000000
0x0000000000001894 0x0000000000001894 0
LOAD 0x0000000000021020 0xc000000000000000 0x0000000000000000
0x0000000040000000 0x0000000040000000 RWE 0
LOAD 0x0000000040031020 0xc000000000000000 0x0000000000000000
0x0000000010000000 0x0000000010000000 RWE 0
LOAD 0x0000000050040000 0xc000000010000000 0x0000000010000000
0x0000000050000000 0x0000000050000000 RWE 0
LOAD 0x00000000a0040000 0xc000000060000000 0x0000000060000000
0x000000019ffe0000 0x000000019ffe0000 RWE 0and with this change:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
NOTE 0x0000000000010000 0x0000000000000000 0x0000000000000000
0x0000000000001894 0x0000000000001894 0
LOAD 0x0000000000021020 0xc000000000000000 0x0000000000000000
0x0000000040000000 0x0000000040000000 RWE 0
LOAD 0x0000000040030000 0xc000000040000000 0x0000000040000000
0x0000000020000000 0x0000000020000000 RWE 0
LOAD 0x0000000060030000 0xc000000060000000 0x0000000060000000
0x000000019ffe0000 0x000000019ffe0000 RWE 0--- arch/powerpc/kernel/fadump.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/kernel/fadump.c +13 -2
@@ -812,8 +812,19 @@ static void fadump_setup_crash_memory_ranges(void)for_each_memblock (memory, reg) { start = (unsigned long long )reg->base; end = start + (unsigned long long )reg->size; -if (start ==RMA_START && end >= fw_dump.boot_memory_size) - start = fw_dump.boot_memory_size; + +/* +* skip the first memory chunk that is already added (RMA_START +* through boot_memory_size). This logic needs a relook if and +* when RMA_START changes to a non-zero value. +*/ +BUILD_BUG_ON (RMA_START !=0 ); +if (start < fw_dump.boot_memory_size) { +if (end > fw_dump.boot_memory_size) + start = fw_dump.boot_memory_size; +else +continue ; + }/* add this range excluding the reserved dump area. */ fadump_exclude_reserved_area (start, end);
Signature · 1 line
2.15.1