selinux: allow labeling before policy is loaded
Subsystems (40)
Sasha Levin
maintainerPATCH 144/206 KVM: Remove CREATE_IRQCHIP/SET_PIT2 race
In reply to Sasha LevinFrom: Steve Rutherford <[email protected]>
[ Upstream commit 7289fdb5dcdbc5155b5531529c44105868a762f2 ]
Fixes a NULL pointer dereference, caused by the PIT firing an interrupt before the interrupt table has been initialized.
SET_PIT2 can race with the creation of the IRQchip. In particular, if SET_PIT2 is called with a low PIT timer period (after the creation of the IOAPIC, but before the instantiation of the irq routes), the PIT can fire an interrupt at an uninitialized table.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/x86/kvm/x86.c +8 -2
@@ -4668,10 +4668,13 @@ set_identity_unlock: r = -EFAULT ;if (copy_from_user (&u.ps, argp,sizeof u.ps)) goto out; +mutex_lock (&kvm->lock); r = -ENXIO ;if (!kvm->arch.vpit) - goto out; + goto set_pit_out; r =kvm_vm_ioctl_set_pit (kvm, &u.ps); +set_pit_out: +mutex_unlock (&kvm->lock);break ; }case KVM_GET_PIT2 : {
@@ -4691,10 +4694,13 @@ set_identity_unlock: r = -EFAULT ;if (copy_from_user (&u.ps2, argp,sizeof (u.ps2))) goto out; +mutex_lock (&kvm->lock); r = -ENXIO ;if (!kvm->arch.vpit) - goto out; + goto set_pit2_out; r =kvm_vm_ioctl_set_pit2 (kvm, &u.ps2); +set_pit2_out: +mutex_unlock (&kvm->lock);break ; }case KVM_REINJECT_CONTROL : {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 145/206 perf stat: Force error in fallback on :k events
In reply to Sasha LevinFrom: Stephane Eranian <[email protected]>
[ Upstream commit bec49a9e05db3dbdca696fa07c62c52638fb6371 ]
When it is not possible for a non-privilege perf command to monitor at the kernel level (:k), the fallback code forces a :u. That works if the event was previously monitoring both levels. But if the event was already constrained to kernel only, then it does not make sense to restrict it to user only.
Given the code works by exclusion, a kernel only event would have:
attr->exclude_user = 1
The fallback code would add:
attr->exclude_kernel = 1
In the end the end would not monitor in either the user level or kernel level. In other words, it would count nothing.
An event programmed to monitor kernel only cannot be switched to user only without seriously warning the user.
This patch forces an error in this case to make it clear the request cannot really be satisfied.
Behavior with paranoid 1:
$ sudo bash -c "echo 1 > /proc/sys/kernel/perf_event_paranoid" $ perf stat -e cycles:k sleep 1
Performance counter stats for 'sleep 1':
1,520,413 cycles:k
1.002361664 seconds time elapsed
0.002480000 seconds user
0.000000000 seconds sysOld behavior with paranoid 2:
$ sudo bash -c "echo 2 > /proc/sys/kernel/perf_event_paranoid" $ perf stat -e cycles:k sleep 1 Performance counter stats for 'sleep 1':
0 cycles:ku
1.002358127 seconds time elapsed
0.002384000 seconds user
0.000000000 seconds sysNew behavior with paranoid 2:
$ sudo bash -c "echo 2 > /proc/sys/kernel/perf_event_paranoid" $ perf stat -e cycles:k sleep 1 Error: You may not have permission to collect stats.
Consider tweaking /proc/sys/kernel/perf_event_paranoid, which controls use of the performance events system by unprivileged users (without CAP_PERFMON or CAP_SYS_ADMIN).
The current value is 2:
-1: Allow use of (almost) all events by all users
Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK
Quoted 1 line
= 0: Disallow ftrace function tracepoint by users without
CAP_PERFMONorCAP_SYS_ADMIN
Disallow raw tracepoint access by users without CAP_SYS_PERFMON or CAP_SYS_ADMIN
Quoted 2 lines
= 1: Disallow CPU event access by users without
CAP_PERFMONorCAP_SYS_ADMIN= 2: Disallow kernel profiling by users withoutCAP_PERFMONorCAP_SYS_ADMIN
To make this setting permanent, edit /etc/sysctl.conf too, e.g.:
kernel.perf_event_paranoid = -1
v2 of this patch addresses the review feedback from [email protected].
--- tools/perf/util/evsel.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/perf/util/evsel.c +4 -0
@@ -2796,6 +2796,10 @@ bool perf_evsel__fallback(struct perf_evsel *evsel, int err,char *new_name;const char *sep =":" ; +/* If event has exclude user then don't exclude kernel. */ +if (evsel->core.attr.exclude_user) +return false; +/* Is there already the separator in the name. */ if (strchr (name,'/' ) ||strchr (name,':' ))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 146/206 bdev: Reduce time holding bd_mutex in sync in blkdev_close()
In reply to Sasha LevinFrom: Douglas Anderson <[email protected]>
[ Upstream commit b849dd84b6ccfe32622988b79b7b073861fcf9f7 ]
While trying to "dd" to the block device for a USB stick, I encountered a hung task warning (blocked for > 120 seconds). I managed to come up with an easy way to reproduce this on my system (where /dev/sdb is the block device for my USB stick) with:
while true; do dd if=/dev/zero of=/dev/sdb bs=4M; done
With my reproduction here are the relevant bits from the hung task detector:
INFO: task udevd:294 blocked for more than 122 seconds. ... udevd D 0 294 1 0x00400008 Call trace: ... mutex_lock_nested+0x40/0x50 __blkdev_get+0x7c/0x3d4 blkdev_get+0x118/0x138 blkdev_open+0x94/0xa8 do_dentry_open+0x268/0x3a0 vfs_open+0x34/0x40 path_openat+0x39c/0xdf4 do_filp_open+0x90/0x10c do_sys_open+0x150/0x3c8 ...
...
Showing all locks held in the system:
...
1 lock held by dd/2798:
#0: ffffff814ac1a3b8 (&bdev->bd_mutex){+.+.}, at: __blkdev_put+0x50/0x204
...
dd D 0 2798 2764 0x00400208
Call trace:
...
schedule+0x8c/0xbc
io_schedule+0x1c/0x40
wait_on_page_bit_common+0x238/0x338
__lock_page+0x5c/0x68
write_cache_pages+0x194/0x500
generic_writepages+0x64/0xa4
blkdev_writepages+0x24/0x30
do_writepages+0x48/0xa8
__filemap_fdatawrite_range+0xac/0xd8
filemap_write_and_wait+0x30/0x84
__blkdev_put+0x88/0x204
blkdev_put+0xc4/0xe4
blkdev_close+0x28/0x38
__fput+0xe0/0x238
____fput+0x1c/0x28
task_work_run+0xb0/0xe4
do_notify_resume+0xfc0/0x14bc
work_pending+0x8/0x14The problem appears related to the fact that my USB disk is terribly slow and that I have a lot of RAM in my system to cache things. Specifically my writes seem to be happening at ~15 MB/s and I've got ~4 GB of RAM in my system that can be used for buffering. To write 4 GB of buffer to disk thus takes ~4000 MB / ~15 MB/s = ~267 seconds.
The 267 second number is a problem because in __blkdev_put() we call sync_blockdev() while holding the bd_mutex. Any other callers who want the bd_mutex will be blocked for the whole time.
The problem is made worse because I believe blkdev_put() specifically tells other tasks (namely udev) to go try to access the device at right around the same time we're going to hold the mutex for a long time.
Putting some traces around this (after disabling the hung task detector), I could confirm:
dd: 437.608600: __blkdev_put() right before sync_blockdev() for sdb
udevd: 437.623901: blkdev_open() right before blkdev_get() for sdb
dd: 661.468451: __blkdev_put() right after sync_blockdev() for sdb
udevd: 663.820426: blkdev_open() right after blkdev_get() for sdb
A simple fix for this is to realize that sync_blockdev() works fine if you're not holding the mutex. Also, it's not the end of the world if you sync a little early (though it can have performance impacts). Thus we can make a guess that we're going to need to do the sync and then do it without holding the mutex. We still do one last sync with the mutex but it should be much, much faster.
With this, my hung task warnings for my test case are gone.
--- fs/block_dev.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/block_dev.c +10 -0
@@ -1793,6 +1793,16 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)struct gendisk *disk = bdev->bd_disk;struct block_device *victim =NULL ; +/* +* Sync early if it looks like we're the last one. If someone else +* opens the block device between now and the decrement of bd_openers +* then we did a sync that we didn't need to, but that's not the end +* of the world and we want to avoid long (could be several minute) +* syncs while holding the mutex. +*/ +if (bdev->bd_openers ==1 ) +sync_blockdev (bdev); +mutex_lock_nested (&bdev->bd_mutex, for_part);if (for_part) bdev->bd_part_count--;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 147/206 drivers: char: tlclk.c: Avoid data race between init and interrupt handler
In reply to Sasha LevinFrom: Madhuparna Bhowmik <[email protected]>
[ Upstream commit 44b8fb6eaa7c3fb770bf1e37619cdb3902cca1fc ]
After registering character device the file operation callbacks can be called. The open callback registers interrupt handler. Therefore interrupt handler can execute in parallel with rest of the init function. To avoid such data race initialize telclk_interrupt variable and struct alarm_events before registering character device.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/char/tlclk.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/char/tlclk.c +10 -7
@@ -776,17 +776,21 @@ static int __init tlclk_init(void) {int ret; + telclk_interrupt = (inb (TLCLK_REG7 ) &0x0f ); + + alarm_events =kzalloc (sizeof (struct tlclk_alarms ),GFP_KERNEL ); +if (!alarm_events) { + ret = -ENOMEM ; + goto out1; + } + ret =register_chrdev (tlclk_major,"telco_clock" , &tlclk_fops);if (ret <0 ) {printk (KERN_ERR "tlclk: can't get major %d.\n" , tlclk_major); +kfree (alarm_events);return ret; } tlclk_major = ret; - alarm_events =kzalloc (sizeof (struct tlclk_alarms ),GFP_KERNEL ); -if (!alarm_events) { - ret = -ENOMEM ; - goto out1; - }/* Read telecom clock IRQ number (Set by BIOS) */ if (!request_region (TLCLK_BASE ,8 ,"telco_clock" )) {
@@ -795,7 +799,6 @@ static int __init tlclk_init(void) ret = -EBUSY ; goto out2; } - telclk_interrupt = (inb (TLCLK_REG7 ) &0x0f );if (0x0F == telclk_interrupt ) {/* not MCPBL0010 ? */ printk(KERN_ERR "telclk_interrupt = 0x%x non-mcpbl0010 hw.\n",
@@ -836,8 +839,8 @@ out3:release_region (TLCLK_BASE ,8 ); out2:kfree (alarm_events); -out1:unregister_chrdev (tlclk_major,"telco_clock" ); +out1:return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 148/206 KVM: arm64: vgic-its: Fix memory leak on the error path of vgic_add_lpi()
In reply to Sasha LevinFrom: Zenghui Yu <[email protected]>
[ Upstream commit 57bdb436ce869a45881d8aa4bc5dac8e072dd2b6 ]
If we're going to fail out the vgic_add_lpi(), let's make sure the allocated vgic_irq memory is also freed. Though it seems that both cases are unlikely to fail.
--- virt/kvm/arm/vgic/vgic-its.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
virt/kvm/arm/vgic/vgic-its.c +9 -2
@@ -107,14 +107,21 @@ out_unlock:* We "cache" the configuration table entries in our struct vgic_irq's. * However we only have those structs for mapped IRQs, so we read in * the respective config data from memory here upon mapping the LPI. +* +* Should any of these fail, behave as if we couldn't create the LPI +* by dropping the refcount and returning the error. */ ret =update_lpi_config (kvm, irq,NULL , false); -if (ret) +if (ret) { +vgic_put_irq (kvm, irq);return ERR_PTR (ret); + } ret =vgic_v3_lpi_sync_pending_status (kvm, irq); -if (ret) +if (ret) { +vgic_put_irq (kvm, irq);return ERR_PTR (ret); + }return irq; }
Signature · 6 lines
2.25.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Sasha Levin
maintainerPATCH 149/206 net: openvswitch: use u64 for meter bucket
In reply to Sasha LevinFrom: Tonghao Zhang <[email protected]>
[ Upstream commit e57358873bb5d6caa882b9684f59140912b37dde ]
When setting the meter rate to 4+Gbps, there is an overflow, the meters don't work as expected.
--- net/openvswitch/meter.c | 2 +- net/openvswitch/meter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/openvswitch/meter.c +1 -1
@@ -255,7 +255,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)* * Start with a full bucket. */ - band->bucket = (band->burst_size + band->rate) *1000 ; + band->bucket = (band->burst_size + band->rate) *1000ULL ; band_max_delta_t = band->bucket / band->rate;if (band_max_delta_t > meter->max_delta_t) meter->max_delta_t = band_max_delta_t;
net/openvswitch/meter.h +1 -1
@@ -26,7 +26,7 @@ struct dp_meter_band {u32 type;u32 rate;u32 burst_size; -u32 bucket;/* 1/1000 packets, or in bits */ +u64 bucket;/* 1/1000 packets, or in bits */ struct ovs_flow_stats stats; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 150/206 scsi: aacraid: Fix error handling paths in aac_probe_one()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit f7854c382240c1686900b2f098b36430c6f5047e ]
If 'scsi_host_alloc()' or 'kcalloc()' fail, 'error' is known to be 0. Set it explicitly to -ENOMEM before branching to the error handling path.
While at it, remove 2 useless assignments to 'error'. These values are overwridden a few lines later.
--- drivers/scsi/aacraid/linit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/linit.c +8 -4
@@ -1620,7 +1620,7 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)struct Scsi_Host *shost;struct aac_dev *aac;struct list_head *insert = &aac_devices; -int error = -ENODEV ; +int error;int unique_id =0 ;u64 dmamask;int mask_bits =0 ;
@@ -1645,7 +1645,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) error =pci_enable_device (pdev);if (error) goto out; - error = -ENODEV ;if (!(aac_drivers[index].quirks &AAC_QUIRK_SRC )) { error =pci_set_dma_mask (pdev,DMA_BIT_MASK (32 ));
@@ -1677,8 +1676,10 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)pci_set_master (pdev); shost =scsi_host_alloc (&aac_driver_template,sizeof (struct aac_dev )); -if (!shost) +if (!shost) { + error = -ENOMEM ; goto out_disable_pdev; + } shost->irq = pdev->irq; shost->unique_id = unique_id;
@@ -1703,8 +1704,11 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) aac->fibs =kcalloc (shost->can_queue +AAC_NUM_MGT_FIB ,sizeof (struct fib ),GFP_KERNEL ); -if (!aac->fibs) +if (!aac->fibs) { + error = -ENOMEM ; goto out_free_host; + } +spin_lock_init (&aac->fib_lock);mutex_init (&aac->ioctl_mutex);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 151/206 staging:r8188eu: avoid skb_clone for amsdu to msdu conversion
In reply to Sasha LevinFrom: Ivan Safonov <[email protected]>
[ Upstream commit 628cbd971a927abe6388d44320e351c337b331e4 ]
skb clones use same data buffer,
so tail of one skb is corrupted by beginning of next skb.
--- drivers/staging/rtl8188eu/core/rtw_recv.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/staging/rtl8188eu/core/rtw_recv.c +6 -13
@@ -1535,21 +1535,14 @@ static int amsdu_to_msdu(struct adapter *padapter, struct recv_frame *prframe)/* Allocate new skb for releasing to upper layer */ sub_skb =dev_alloc_skb (nSubframe_Length +12 ); -if (sub_skb) { -skb_reserve (sub_skb,12 ); -skb_put_data (sub_skb, pdata, nSubframe_Length); - }else { - sub_skb =skb_clone (prframe->pkt,GFP_ATOMIC ); -if (sub_skb) { - sub_skb->data = pdata; - sub_skb->len = nSubframe_Length; -skb_set_tail_pointer (sub_skb, nSubframe_Length); - }else { -DBG_88E ("skb_clone() Fail!!! , nr_subframes=%d\n" , nr_subframes); -break ; - } +if (!sub_skb) { +DBG_88E ("dev_alloc_skb() Fail!!! , nr_subframes=%d\n" , nr_subframes); +break ; } +skb_reserve (sub_skb,12 ); +skb_put_data (sub_skb, pdata, nSubframe_Length); + subframes[nr_subframes++] = sub_skb;if (nr_subframes >=MAX_SUBFRAME_COUNT ) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 152/206 sparc64: vcc: Fix error return code in vcc_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit ff62255a2a5c1228a28f2bb063646f948115a309 ]
Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/tty/vcc.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/vcc.c +1 -0
@@ -604,6 +604,7 @@ static int vcc_probe(struct vio_dev *vdev, const struct vio_device_id *id) port->index =vcc_table_add (port);if (port->index ==-1 ) {pr_err ("VCC: no more TTY indices left for allocation\n" ); + rv = -ENOMEM ; goto free_ldc; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 153/206 arm64: cpufeature: Relax checks for AArch32 support at EL[0-2]
In reply to Sasha LevinFrom: Will Deacon <[email protected]>
[ Upstream commit 98448cdfe7060dd5491bfbd3f7214ffe1395d58e ]
We don't need to be quite as strict about mismatched AArch32 support, which is good because the friendly hardware folks have been busy mismatching this to their hearts' content.
* We don't care about EL2 or EL3 (there are silly comments concerning the latter, so remove those)
* EL1 support is gated by the ARM64_HAS_32BIT_EL1 capability and handled gracefully when a mismatch occurs
* EL0 support is gated by the ARM64_HAS_32BIT_EL0 capability and handled gracefully when a mismatch occurs
Relax the AArch32 checks to FTR_NONSTRICT.
--- arch/arm64/kernel/cpufeature.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/arm64/kernel/cpufeature.c +3 -7
@@ -155,11 +155,10 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_GIC_SHIFT ,4 ,0 ),S_ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_ASIMD_SHIFT ,4 ,ID_AA64PFR0_ASIMD_NI ),S_ARM64_FTR_BITS (FTR_VISIBLE ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_FP_SHIFT ,4 ,ID_AA64PFR0_FP_NI ), -/* Linux doesn't care about the EL3 */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL3_SHIFT ,4 ,0 ), -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL2_SHIFT ,4 ,0 ), -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL1_SHIFT ,4 ,ID_AA64PFR0_EL1_64BIT_ONLY ), -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL0_SHIFT ,4 ,ID_AA64PFR0_EL0_64BIT_ONLY ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL2_SHIFT ,4 ,0 ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL1_SHIFT ,4 ,ID_AA64PFR0_EL1_64BIT_ONLY ), +ARM64_FTR_BITS (FTR_HIDDEN ,FTR_NONSTRICT ,FTR_LOWER_SAFE ,ID_AA64PFR0_EL0_SHIFT ,4 ,ID_AA64PFR0_EL0_64BIT_ONLY ), ARM64_FTR_END, };
@@ -671,9 +670,6 @@ void update_cpu_features(int cpu, taint |=check_update_ftr_reg (SYS_ID_AA64MMFR2_EL1 , cpu, info->reg_id_aa64mmfr2, boot->reg_id_aa64mmfr2); -/* -* EL3 is not our concern. -*/ taint |=check_update_ftr_reg (SYS_ID_AA64PFR0_EL1 , cpu, info->reg_id_aa64pfr0, boot->reg_id_aa64pfr0); taint |= check_update_ftr_reg(SYS_ID_AA64PFR1_EL1, cpu,
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 154/206 dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 8c149b7d75e53be47648742f40fc90d9fc6fa63a ]
The required supplies in bindings were actually not matching implementation making the bindings incorrect and misleading. The Linux kernel driver requires all supplies to be present. Also for wlf,wm8994 uses just DBVDD-supply instead of DBVDDn-supply (n: <1,3>).
--- .../devicetree/bindings/sound/wm8994.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/sound/wm8994.txt +12 -6
@@ -14,9 +14,15 @@ Required properties: - #gpio-cells : Must be 2. The first cell is the pin number and the second cell is used to specify optional parameters (currently unused). - - AVDD2-supply, DBVDD1-supply, DBVDD2-supply, DBVDD3-supply, CPVDD-supply, - SPKVDD1-supply, SPKVDD2-supply : power supplies for the device, as covered - in Documentation/devicetree/bindings/regulator/regulator.txt + - power supplies for the device, as covered in + Documentation/devicetree/bindings/regulator/regulator.txt, depending + on compatible: + - for wlf,wm1811 and wlf,wm8958: + AVDD1-supply, AVDD2-supply, DBVDD1-supply, DBVDD2-supply, DBVDD3-supply, + DCVDD-supply, CPVDD-supply, SPKVDD1-supply, SPKVDD2-supply + - for wlf,wm8994: + AVDD1-supply, AVDD2-supply, DBVDD-supply, DCVDD-supply, CPVDD-supply, + SPKVDD1-supply, SPKVDD2-supply Optional properties:
@@ -73,11 +79,11 @@ wm8994: codec@1a { lineout1-se; + AVDD1-supply = <®ulator>; AVDD2-supply = <®ulator>; CPVDD-supply = <®ulator>; - DBVDD1-supply = <®ulator>; - DBVDD2-supply = <®ulator>; - DBVDD3-supply = <®ulator>; + DBVDD-supply = <®ulator>; + DCVDD-supply = <®ulator>; SPKVDD1-supply = <®ulator>; SPKVDD2-supply = <®ulator>; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 155/206 atm: fix a memory leak of vcc->user_back
In reply to Sasha LevinFrom: Cong Wang <[email protected]>
[ Upstream commit 8d9f73c0ad2f20e9fed5380de0a3097825859d03 ]
In lec_arp_clear_vccs() only entry->vcc is freed, but vcc could be installed on entry->recv_vcc too in lec_vcc_added().
This fixes the following memory leak:
unreferenced object 0xffff8880d9266b90 (size 16):
comm "atm2", pid 425, jiffies 4294907980 (age 23.488s) hex dump (first 16 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 6b 6b 6b a5 ............kkk.
backtrace:
[<(____ptrval____)>] kmem_cache_alloc_trace+0x10e/0x151
[<(____ptrval____)>] lane_ioctl+0x4b3/0x569
[<(____ptrval____)>] do_vcc_ioctl+0x1ea/0x236
[<(____ptrval____)>] svc_ioctl+0x17d/0x198
[<(____ptrval____)>] sock_do_ioctl+0x47/0x12f
[<(____ptrval____)>] sock_ioctl+0x2f9/0x322
[<(____ptrval____)>] vfs_ioctl+0x1e/0x2b
[<(____ptrval____)>] ksys_ioctl+0x61/0x80
[<(____ptrval____)>] __x64_sys_ioctl+0x16/0x19
[<(____ptrval____)>] do_syscall_64+0x57/0x65
[<(____ptrval____)>] entry_SYSCALL_64_after_hwframe+0x49/0xb3--- net/atm/lec.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/atm/lec.c +6 -0
@@ -1270,6 +1270,12 @@ static void lec_arp_clear_vccs(struct lec_arp_table *entry) entry->vcc =NULL ; }if (entry->recv_vcc) { +struct atm_vcc *vcc = entry->recv_vcc; +struct lec_vcc_priv *vpriv =LEC_VCC_PRIV (vcc); + +kfree (vpriv); + vcc->user_back =NULL ; + entry->recv_vcc->push = entry->old_recv_push;vcc_release_async (entry->recv_vcc, -EPIPE ); entry->recv_vcc =NULL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 156/206 perf parse-events: Fix memory leaks found on parse_events
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit e8dfb81838b14f82521968343884665b996646ef ]
Fix a memory leak found by applying LLVM's libfuzzer on parse_events().
--- tools/perf/util/parse-events.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/parse-events.c +1 -0
@@ -1287,6 +1287,7 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,list_for_each_entry_safe (pos, tmp, &config_terms, list) {list_del_init (&pos->list); +zfree (&pos->val.str);free (pos); }return -EINVAL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 157/206 perf mem2node: Avoid double free related to realloc
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 266150c94c69429cf6d18e130237224a047f5061 ]
Realloc of size zero is a free not an error, avoid this causing a double free. Caught by clang's address sanitizer:
==2634==ERROR: AddressSanitizer: attempting double-free on 0x6020000015f0 in thread T0:
#0 0x5649659297fd in free llvm/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:123:3
#1 0x5649659e9251 in __zfree tools/lib/zalloc.c:13:2
#2 0x564965c0f92c in mem2node__exit tools/perf/util/mem2node.c:114:2
#3 0x564965a08b4c in perf_c2c__report tools/perf/builtin-c2c.c:2867:2
#4 0x564965a0616a in cmd_c2c tools/perf/builtin-c2c.c:2989:10
#5 0x564965944348 in run_builtin tools/perf/perf.c:312:11
#6 0x564965943235 in handle_internal_command tools/perf/perf.c:364:8
#7 0x5649659440c4 in run_argv tools/perf/perf.c:408:2
#8 0x564965942e41 in main tools/perf/perf.c:538:30x6020000015f0 is located 0 bytes inside of 1-byte region [0x6020000015f0,0x6020000015f1) freed by thread T0 here:
#0 0x564965929da3 in realloc third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:164:3
#1 0x564965c0f55e in mem2node__init tools/perf/util/mem2node.c:97:16
#2 0x564965a08956 in perf_c2c__report tools/perf/builtin-c2c.c:2803:8
#3 0x564965a0616a in cmd_c2c tools/perf/builtin-c2c.c:2989:10
#4 0x564965944348 in run_builtin tools/perf/perf.c:312:11
#5 0x564965943235 in handle_internal_command tools/perf/perf.c:364:8
#6 0x5649659440c4 in run_argv tools/perf/perf.c:408:2
#7 0x564965942e41 in main tools/perf/perf.c:538:3previously allocated by thread T0 here:
#0 0x564965929c42 in calloc third_party/llvm/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:154:3
#1 0x5649659e9220 in zalloc tools/lib/zalloc.c:8:9
#2 0x564965c0f32d in mem2node__init tools/perf/util/mem2node.c:61:12
#3 0x564965a08956 in perf_c2c__report tools/perf/builtin-c2c.c:2803:8
#4 0x564965a0616a in cmd_c2c tools/perf/builtin-c2c.c:2989:10
#5 0x564965944348 in run_builtin tools/perf/perf.c:312:11
#6 0x564965943235 in handle_internal_command tools/perf/perf.c:364:8
#7 0x5649659440c4 in run_argv tools/perf/perf.c:408:2
#8 0x564965942e41 in main tools/perf/perf.c:538:3v2: add a WARN_ON_ONCE when the free condition arises.
--- tools/perf/util/mem2node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/mem2node.c +2 -1
@@ -1,5 +1,6 @@#include <errno.h> #include <inttypes.h> +#include <asm/bug.h> #include <linux/bitmap.h> #include "mem2node.h" #include "util.h"
@@ -92,7 +93,7 @@ int mem2node__init(struct mem2node *map, struct perf_env *env)/* Cut unused entries, due to merging. */ tmp_entries =realloc (entries,sizeof (*entries) * j); -if (tmp_entries) +if (tmp_entries ||WARN_ON_ONCE (j ==0 )) entries = tmp_entries;for (i =0 ; i < j; i++) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 158/206 power: supply: max17040: Correct voltage reading
In reply to Sasha LevinFrom: Jonathan Bakker <[email protected]>
[ Upstream commit 0383024f811aa469df258039807810fc3793a105 ]
According to the datasheet available at (1), the bottom four bits are always zero and the actual voltage is 1.25x this value in mV. Since the kernel API specifies that voltages should be in uV, it should report 1250x the shifted value.
1) https://datasheets.maximintegrated.com/en/ds/MAX17040-MAX17041.pdf
--- drivers/power/supply/max17040_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17040_battery.c +1 -1
@@ -109,7 +109,7 @@ static void max17040_get_vcell(struct i2c_client *client) vcell =max17040_read_reg (client,MAX17040_VCELL ); - chip->vcell = vcell; + chip->vcell = (vcell >>4 ) *1250 ; }static void max17040_get_soc (struct i2c_client *client)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 159/206 phy: samsung: s5pv210-usb2: Add delay after reset
In reply to Sasha LevinFrom: Jonathan Bakker <[email protected]>
[ Upstream commit 05942b8c36c7eb5d3fc5e375d4b0d0c49562e85d ]
The USB phy takes some time to reset, so make sure we give it to it. The delay length was taken from the 4x12 phy driver.
This manifested in issues with the DWC2 driver since commit fe369e1826b3 ("usb: dwc2: Make dwc2_readl/writel functions endianness-agnostic.") where the endianness check would read the DWC ID as 0 due to the phy still resetting, resulting in the wrong endian mode being chosen.
--- drivers/phy/samsung/phy-s5pv210-usb2.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/phy/samsung/phy-s5pv210-usb2.c +4 -0
@@ -142,6 +142,10 @@ static void s5pv210_phy_pwr(struct samsung_usb2_phy_instance *inst, bool on)udelay (10 ); rst &= ~rstbits;writel (rst, drv->reg_phy +S5PV210_UPHYRST ); +/* The following delay is necessary for the reset sequence to be +* completed +*/ +udelay (80 ); }else { pwr =readl (drv->reg_phy +S5PV210_UPHYPWR ); pwr |= phypwr;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 160/206 Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
In reply to Sasha LevinFrom: Sonny Sasaka <[email protected]>
[ Upstream commit adf1d6926444029396861413aba8a0f2a805742a ]
After sending Inquiry Cancel command to the controller, it is possible that Inquiry Complete event comes before Inquiry Cancel command complete event. In this case the Inquiry Cancel command will have status of Command Disallowed since there is no Inquiry session to be cancelled. This case should not be treated as error, otherwise we can reach an inconsistent state.
Example of a btmon trace when this happened:
< HCI Command: Inquiry Cancel (0x01|0x0002) plen 0
Quoted 1 line
HCI Event: Inquiry Complete (
0x01) plen 1
Status: Success (0x00)
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
Inquiry Cancel (0x01|0x0002) ncmd 1
Status: Command Disallowed (0x0c)--- net/bluetooth/hci_event.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
net/bluetooth/hci_event.c +17 -2
@@ -41,12 +41,27 @@/* Handle HCI Event packets */ -static void hci_cc_inquiry_cancel (struct hci_dev *hdev,struct sk_buff *skb) +static void hci_cc_inquiry_cancel (struct hci_dev *hdev,struct sk_buff *skb, +u8 *new_status) {__u8 status = *((__u8 *) skb->data);BT_DBG ("%s status 0x%2.2x" , hdev->name, status); +/* It is possible that we receive Inquiry Complete event right +* before we receive Inquiry Cancel Command Complete event, in +* which case the latter event should have status of Command +* Disallowed (0x0c). This should not be treated as error, since +* we actually achieve what Inquiry Cancel wants to achieve, +* which is to end the last Inquiry session. +*/ +if (status ==0x0c && !test_bit (HCI_INQUIRY , &hdev->flags)) { +bt_dev_warn (hdev,"Ignoring error of Inquiry Cancel command" ); + status =0x00 ; + } + + *new_status = status; +if (status)return ;
@@ -3039,7 +3054,7 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb,switch (*opcode) {case HCI_OP_INQUIRY_CANCEL : -hci_cc_inquiry_cancel (hdev, skb); +hci_cc_inquiry_cancel (hdev, skb, status);break ;case HCI_OP_PERIODIC_INQ :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 161/206 USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe()
In reply to Sasha LevinFrom: Tang Bin <[email protected]>
[ Upstream commit c856b4b0fdb5044bca4c0acf9a66f3b5cc01a37a ]
If the function platform_get_irq() failed, the negative value returned will not be detected here. So fix error handling in mv_ehci_probe(). And when get irq failed, the function platform_get_irq() logs an error message, so remove redundant message here.
--- drivers/usb/host/ehci-mv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-mv.c +2 -3
@@ -193,9 +193,8 @@ static int mv_ehci_probe(struct platform_device *pdev) hcd->regs = ehci_mv->op_regs; hcd->irq =platform_get_irq (pdev,0 ); -if (!hcd->irq) { -dev_err (&pdev->dev,"Cannot get irq." ); - retval = -ENODEV ; +if (hcd->irq <0 ) { + retval = hcd->irq; goto err_disable_clk; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 162/206 tipc: fix memory leak in service subscripting
In reply to Sasha LevinFrom: Tuong Lien <[email protected]>
[ Upstream commit 0771d7df819284d46cf5cfb57698621b503ec17f ]
Upon receipt of a service subscription request from user via a topology connection, one 'sub' object will be allocated in kernel, so it will be able to send an event of the service if any to the user correspondingly then. Also, in case of any failure, the connection will be shutdown and all the pertaining 'sub' objects will be freed.
However, there is a race condition as follows resulting in memory leak:
receive-work connection send-work
| | |
sub-1 |<------//-------| |
sub-2 |<------//-------| |
| |<---------------| evt for sub-x
sub-3 |<------//-------| |
: : :
: : :
| /--------| |
| | * peer closed |
| | | |
| | |<-------X-------| evt for sub-y
| | |<===============|
sub-n |<------/ X shutdown |
-> orphan | |That is, the 'receive-work' may get the last subscription request while the 'send-work' is shutting down the connection due to peer close.
We had a 'lock' on the connection, so the two actions cannot be carried out simultaneously. If the last subscription is allocated e.g. 'sub-n', before the 'send-work' closes the connection, there will be no issue at all, the 'sub' objects will be freed. In contrast the last subscription will become orphan since the connection was closed, and we released all references.
This commit fixes the issue by simply adding one test if the connection remains in 'connected' state right after we obtain the connection lock, then a subscription object can be created as usual, otherwise we ignore it.
--- net/tipc/topsrv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/topsrv.c +3 -1
@@ -407,7 +407,9 @@ static int tipc_conn_rcv_from_sock(struct tipc_conn *con)return -EWOULDBLOCK ;if (ret ==sizeof (s)) {read_lock_bh (&sk->sk_callback_lock); - ret =tipc_conn_rcv_sub (srv, con, &s); +/* RACE: the connection can be closed in the meantime */ +if (likely (connected (con))) + ret =tipc_conn_rcv_sub (srv, con, &s);read_unlock_bh (&sk->sk_callback_lock);if (!ret)return 0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 163/206 tty: serial: samsung: Correct clock selection logic
In reply to Sasha LevinFrom: Jonathan Bakker <[email protected]>
[ Upstream commit 7d31676a8d91dd18e08853efd1cb26961a38c6a6 ]
Some variants of the samsung tty driver can pick which clock to use for their baud rate generation. In the DT conversion, a default clock was selected to be used if a specific one wasn't assigned and then a comparison of which clock rate worked better was done. Unfortunately, the comparison was implemented in such a way that only the default clock was ever actually compared. Fix this by iterating through all possible clocks, except when a specific clock has already been picked via clk_sel (which is only possible via board files).
--- drivers/tty/serial/samsung.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/samsung.c +4 -4
@@ -1187,14 +1187,14 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,struct s3c24xx_uart_info *info = ourport->info;struct clk *clk;unsigned long rate; -unsigned int cnt, baud, quot, clk_sel, best_quot =0 ; +unsigned int cnt, baud, quot, best_quot =0 ;char clkname[MAX_CLK_NAME_LENGTH ];int calc_deviation, deviation = (1 <<30 ) -1 ; - clk_sel = (ourport->cfg->clk_sel) ? ourport->cfg->clk_sel : - ourport->info->def_clk_sel;for (cnt =0 ; cnt < info->num_clks; cnt++) { -if (!(clk_sel & (1 << cnt))) +/* Keep selected clock if provided */ +if (ourport->cfg->clk_sel && + !(ourport->cfg->clk_sel & (1 << cnt)))continue ;sprintf (clkname,"clk_uart_baud%d" , cnt);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 164/206 ALSA: hda: Fix potential race in unsol event handler
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit c637fa151259c0f74665fde7cba5b7eac1417ae5 ]
The unsol event handling code has a loop retrieving the read/write indices and the arrays without locking while the append to the array may happen concurrently. This may lead to some inconsistency. Although there hasn't been any proof of this bad results, it's still safer to protect the racy accesses.
This patch adds the spinlock protection around the unsol handling loop for addressing it. Here we take bus->reg_lock as the writer side snd_hdac_bus_queue_event() is also protected by that lock.
--- sound/hda/hdac_bus.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/hda/hdac_bus.c +4 -0
@@ -155,6 +155,7 @@ static void process_unsol_events(struct work_struct *work)struct hdac_driver *drv;unsigned int rp, caddr, res; +spin_lock_irq (&bus->reg_lock);while (bus->unsol_rp != bus->unsol_wp) { rp = (bus->unsol_rp +1 ) %HDA_UNSOL_QUEUE_SIZE ; bus->unsol_rp = rp;
@@ -166,10 +167,13 @@ static void process_unsol_events(struct work_struct *work) codec = bus->caddr_tbl[caddr &0x0f ];if (!codec || !codec->dev.driver)continue ; +spin_unlock_irq (&bus->reg_lock); drv =drv_to_hdac_driver (codec->dev.driver);if (drv->unsol_event) drv->unsol_event (codec, res); +spin_lock_irq (&bus->reg_lock); } +spin_unlock_irq (&bus->reg_lock); }/**
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 165/206 powerpc/traps: Make unrecoverable NMIs die instead of panic
In reply to Sasha LevinFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 265d6e588d87194c2fe2d6c240247f0264e0c19b ]
System Reset and Machine Check interrupts that are not recoverable due to being nested or interrupting when RI=0 currently panic. This is not necessary, and can often just kill the current context and recover.
--- arch/powerpc/kernel/traps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/traps.c +3 -3
@@ -430,11 +430,11 @@ out:#ifdef CONFIG_PPC_BOOK3S_64 BUG_ON (get_paca ()->in_nmi ==0 );if (get_paca ()->in_nmi >1 ) -nmi_panic (regs,"Unrecoverable nested System Reset" ); +die ("Unrecoverable nested System Reset" , regs,SIGABRT );#endif /* Must die if the interrupt is not recoverable */ if (!(regs->msr &MSR_RI )) -nmi_panic (regs,"Unrecoverable System Reset" ); +die ("Unrecoverable System Reset" , regs,SIGABRT );if (!nested)nmi_exit ();
@@ -775,7 +775,7 @@ void machine_check_exception(struct pt_regs *regs)/* Must die if the interrupt is not recoverable */ if (!(regs->msr &MSR_RI )) -nmi_panic (regs,"Unrecoverable Machine check" ); +die ("Unrecoverable Machine check" , regs,SIGBUS );return ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 166/206 fuse: don't check refcount after stealing page
In reply to Sasha LevinFrom: Miklos Szeredi <[email protected]>
[ Upstream commit 32f98877c57bee6bc27f443a96f49678a2cd6a50 ]
page_count() is unstable. Unless there has been an RCU grace period between when the page was removed from the page cache and now, a speculative reference may exist from the page cache.
--- fs/fuse/dev.c | 1 - 1 file changed, 1 deletion(-)
fs/fuse/dev.c +0 -1
@@ -831,7 +831,6 @@ static int fuse_check_page(struct page *page) { if (page_mapcount(page) || page->mapping != NULL || - page_count(page) != 1 || (page->flags & PAGE_FLAGS_CHECK_AT_PREP & ~(1 << PG_locked | 1 << PG_referenced |
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 167/206 USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit a7f40c233a6b0540d28743267560df9cfb571ca9 ]
The comparison of hcd->irq to less than zero for an error check will never be true because hcd->irq is an unsigned int. Fix this by assigning the int retval to the return of platform_get_irq and checking this for the -ve error condition and assigning hcd->irq to retval.
Addresses-Coverity: ("Unsigned compared against 0")
--- drivers/usb/host/ehci-mv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-mv.c +3 -4
@@ -192,11 +192,10 @@ static int mv_ehci_probe(struct platform_device *pdev) hcd->rsrc_len =resource_size (r); hcd->regs = ehci_mv->op_regs; - hcd->irq =platform_get_irq (pdev,0 ); -if (hcd->irq <0 ) { - retval = hcd->irq; + retval =platform_get_irq (pdev,0 ); +if (retval <0 ) goto err_disable_clk; - } + hcd->irq = retval; ehci =hcd_to_ehci (hcd); ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 168/206 scsi: cxlflash: Fix error return code in cxlflash_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit d0b1e4a638d670a09f42017a3e567dc846931ba8 ]
Fix to return negative error code -ENOMEM from create_afu error handling case instead of 0, as done elsewhere in this function.
--- drivers/scsi/cxlflash/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/cxlflash/main.c +1 -0
@@ -3749,6 +3749,7 @@ static int cxlflash_probe(struct pci_dev *pdev, cfg->afu_cookie = cfg->ops->create_afu (pdev);if (unlikely (!cfg->afu_cookie)) {dev_err (dev,"%s: create_afu failed\n" , __func__); + rc = -ENOMEM ; goto out_remove; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 169/206 arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register
In reply to Sasha LevinFrom: Anshuman Khandual <[email protected]>
[ Upstream commit 1ed1b90a0594c8c9d31e8bb8be25a2b37717dc9e ]
ID_DFR0 based TraceFilt feature should not be exposed to guests. Hence lets drop it.
--- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/cpufeature.c +1 -1
@@ -300,7 +300,7 @@ static const struct arm64_ftr_bits ftr_id_pfr0[] = { };static const struct arm64_ftr_bits ftr_id_dfr0[] = { -ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,28 ,4 ,0 ), +/* [31:28] TraceFilt */ S_ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,24 ,4 ,0xf ),/* PerfMon */ ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,20 ,4 ,0 ),ARM64_FTR_BITS (FTR_HIDDEN ,FTR_STRICT ,FTR_LOWER_SAFE ,16 ,4 ,0 ),
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 170/206 e1000: Do not perform reset in reset_task if we are already down
In reply to Sasha LevinFrom: Alexander Duyck <[email protected]>
[ Upstream commit 49ee3c2ab5234757bfb56a0b3a3cb422f427e3a3 ]
We are seeing a deadlock in e1000 down when NAPI is being disabled. Looking over the kernel function trace of the system it appears that the interface is being closed and then a reset is hitting which deadlocks the interface as the NAPI interface is already disabled.
To prevent this from happening I am disabling the reset task when __E1000_DOWN is already set. In addition code has been added so that we set the __E1000_DOWN while holding the __E1000_RESET flag in e1000_close in order to guarantee that the reset task will not run after we have started the close call.
--- drivers/net/ethernet/intel/e1000/e1000_main.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/e1000/e1000_main.c +14 -4
@@ -542,8 +542,13 @@ void e1000_reinit_locked(struct e1000_adapter *adapter)WARN_ON (in_interrupt ());while (test_and_set_bit (__E1000_RESETTING, &adapter->flags))msleep (1 ); -e1000_down (adapter); -e1000_up (adapter); + +/* only run the task if not already down */ +if (!test_bit (__E1000_DOWN, &adapter->flags)) { +e1000_down (adapter); +e1000_up (adapter); + } +clear_bit (__E1000_RESETTING, &adapter->flags); }
@@ -1433,10 +1438,15 @@ int e1000_close(struct net_device *netdev)struct e1000_hw *hw = &adapter->hw;int count =E1000_CHECK_RESET_COUNT ; -while (test_bit (__E1000_RESETTING, &adapter->flags) && count--) +while (test_and_set_bit (__E1000_RESETTING, &adapter->flags) && count--)usleep_range (10000 ,20000 ); -WARN_ON (test_bit (__E1000_RESETTING, &adapter->flags)); +WARN_ON (count <0 ); + +/* signal that we're down so that the reset task will no longer run */ +set_bit (__E1000_DOWN, &adapter->flags); +clear_bit (__E1000_RESETTING, &adapter->flags); +e1000_down (adapter);e1000_power_down_phy (adapter);e1000_free_irq (adapter);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 171/206 drm/nouveau/debugfs: fix runtime pm imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 00583fbe8031f69bba8b0a9a861efb75fb7131af ]
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +4 -1
@@ -161,8 +161,11 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf, } ret =pm_runtime_get_sync (drm->dev); -if (ret <0 && ret != -EACCES ) +if (ret <0 && ret != -EACCES ) { +pm_runtime_put_autosuspend (drm->dev);return ret; + } + ret =nvif_mthd (ctrl,NVIF_CONTROL_PSTATE_USER , &args,sizeof (args));pm_runtime_put_autosuspend (drm->dev);if (ret <0 )
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 172/206 drm/nouveau: fix runtime pm imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit d7372dfb3f7f1602b87e0663e8b8646da23ebca7 ]
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +3 -1
@@ -82,8 +82,10 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv)return ret; ret =pm_runtime_get_sync (dev); -if (ret <0 && ret != -EACCES ) +if (ret <0 && ret != -EACCES ) { +pm_runtime_put_autosuspend (dev); goto out; + } ret =nouveau_vma_new (nvbo, &cli->vmm, &vma);pm_runtime_mark_last_busy (dev);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 173/206 drm/nouveau/dispnv50: fix runtime pm imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit dc455f4c888365595c0a13da445e092422d55b8d ]
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +3 -1
@@ -909,8 +909,10 @@ nv50_mstc_detect(struct drm_connector *connector, bool force)return connector_status_disconnected; ret =pm_runtime_get_sync (connector->dev->dev); -if (ret <0 && ret != -EACCES ) +if (ret <0 && ret != -EACCES ) { +pm_runtime_put_autosuspend (connector->dev->dev);return connector_status_disconnected; + } conn_status =drm_dp_mst_detect_port (connector, mstc->port->mgr, mstc->port);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 174/206 printk: handle blank console arguments passed in.
In reply to Sasha LevinFrom: Shreyas Joshi <[email protected]>
[ Upstream commit 48021f98130880dd74286459a1ef48b5e9bc374f ]
If uboot passes a blank string to console_setup then it results in a trashed memory. Ultimately, the kernel crashes during freeing up the memory.
This fix checks if there is a blank parameter being passed to console_setup from uboot. In case it detects that the console parameter is blank then it doesn't setup the serial device and it gracefully exits.
--- kernel/printk/printk.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/printk/printk.c +3 -0
@@ -2148,6 +2148,9 @@ static int __init console_setup(char *str)char *s, *options, *brl_options =NULL ;int idx; +if (str[0 ] ==0 ) +return 1 ; +if (_braille_console_setup (&str, &brl_options))return 1 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 175/206 usb: dwc3: Increase timeout for CmdAct cleared by device controller
In reply to Sasha LevinFrom: Yu Chen <[email protected]>
[ Upstream commit 1c0e69ae1b9f9004fd72978612ae3463791edc56 ]
If the SS PHY is in P3, there is no pipe_clk, HW may use suspend_clk for function, as suspend_clk is slow so EP command need more time to complete, e.g, imx8M suspend_clk is 32K, set ep configuration will take about 380us per below trace time stamp(44.286278 - 44.285897 = 0.000381):
configfs_acm.sh-822 [000] d..1 44.285896: dwc3_writel: addr000000006d59aae1 value 00000401
configfs_acm.sh-822 [000] d..1 44.285897: dwc3_readl: addr000000006d59aae1 value 00000401
... ...
configfs_acm.sh-822 [000] d..1 44.286278: dwc3_readl: addr000000006d59aae1 value 00000001
configfs_acm.sh-822 [000] d..1 44.286279: dwc3_gadget_ep_cmd:
ep0out: cmd 'Set Endpoint Configuration' [401] params 00001000 00000500 00000000 --> status: Successful
This was originally found on Hisilicon Kirin Soc that need more time for the device controller to clear the CmdAct of DEPCMD.
--- drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +1 -1
@@ -270,7 +270,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd, {const struct usb_endpoint_descriptor *desc = dep->endpoint.desc;struct dwc3 *dwc = dep->dwc; -u32 timeout =1000 ; +u32 timeout =5000 ;u32 saved_config =0 ;u32 reg;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 176/206 btrfs: don't force read-only after error in drop snapshot
In reply to Sasha LevinFrom: David Sterba <[email protected]>
[ Upstream commit 7c09c03091ac562ddca2b393e5d65c1d37da79f1 ]
Deleting a subvolume on a full filesystem leads to ENOSPC followed by a forced read-only. This is not a transaction abort and the filesystem is otherwise ok, so the error should be just propagated to the callers.
This is caused by unnecessary call to btrfs_handle_fs_error for all errors, except EAGAIN. This does not make sense as the standard transaction abort mechanism is in btrfs_drop_snapshot so all relevant failures are handled.
Originally in commit cb1b69f4508a ("Btrfs: forced readonly when btrfs_drop_snapshot() fails") there was no return value at all, so the btrfs_std_error made some sense but once the error handling and propagation has been implemented we don't need it anymore.
--- fs/btrfs/extent-tree.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/extent-tree.c +0 -2
@@ -9099,8 +9099,6 @@ out:*/ if (!for_reloc && !root_dropped)btrfs_add_dead_root (root); -if (err && err != -EAGAIN ) -btrfs_handle_fs_error (fs_info, err,NULL );return err; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 177/206 vfio/pci: fix memory leaks of eventfd ctx
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit 1518ac272e789cae8c555d69951b032a275b7602 ]
Finished a qemu-kvm (-device vfio-pci,host=0001:01:00.0) triggers a few memory leaks after a while because vfio_pci_set_ctx_trigger_single() calls eventfd_ctx_fdget() without the matching eventfd_ctx_put() later. Fix it by calling eventfd_ctx_put() for those memory in vfio_pci_release() before vfio_device_release().
unreferenced object 0xebff008981cc2b00 (size 128):
comm "qemu-kvm", pid 4043, jiffies 4294994816 (age 9796.310s) hex dump (first 32 bytes):
01 00 00 00 6b 6b 6b 6b 00 00 00 00 ad 4e ad de ....kkkk.....N.. ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff ....kkkk........
backtrace:
[<00000000917e8f8d>] slab_post_alloc_hook+0x74/0x9c
[<00000000df0f2aa2>] kmem_cache_alloc_trace+0x2b4/0x3d4
[<000000005fcec025>] do_eventfd+0x54/0x1ac
[<0000000082791a69>] __arm64_sys_eventfd2+0x34/0x44
[<00000000b819758c>] do_el0_svc+0x128/0x1dc
[<00000000b244e810>] el0_sync_handler+0xd0/0x268
[<00000000d495ef94>] el0_sync+0x164/0x180unreferenced object 0x29ff008981cc4180 (size 128):
comm "qemu-kvm", pid 4043, jiffies 4294994818 (age 9796.290s) hex dump (first 32 bytes):
01 00 00 00 6b 6b 6b 6b 00 00 00 00 ad 4e ad de ....kkkk.....N.. ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff ....kkkk........
backtrace:
[<00000000917e8f8d>] slab_post_alloc_hook+0x74/0x9c
[<00000000df0f2aa2>] kmem_cache_alloc_trace+0x2b4/0x3d4
[<000000005fcec025>] do_eventfd+0x54/0x1ac
[<0000000082791a69>] __arm64_sys_eventfd2+0x34/0x44
[<00000000b819758c>] do_el0_svc+0x128/0x1dc
[<00000000b244e810>] el0_sync_handler+0xd0/0x268
[<00000000d495ef94>] el0_sync+0x164/0x180--- drivers/vfio/pci/vfio_pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/vfio/pci/vfio_pci.c +4 -0
@@ -409,6 +409,10 @@ static void vfio_pci_release(void *device_data)if (!(--vdev->refcnt)) {vfio_spapr_pci_eeh_release (vdev->pdev);vfio_pci_disable (vdev); +if (vdev->err_trigger) +eventfd_ctx_put (vdev->err_trigger); +if (vdev->req_trigger) +eventfd_ctx_put (vdev->req_trigger); }mutex_unlock (&driver_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 178/206 perf parse-events: Fix incorrect conversion of 'if () free()' to 'zfree()'
In reply to Sasha LevinFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 7fcdccd4237724931d9773d1e3039bfe053a6f52 ]
When applying a patch by Ian I incorrectly converted to zfree() an expression that involved testing some other struct member, not the one being freed, which lead to bugs reproduceable by:
$ perf stat -e i/bs,tsc,L2/o sleep 1 WARNING: multiple event parsing errors Segmentation fault (core dumped) $
Fix it by restoring the test for pos->free_str before freeing pos->val.str, but continue using zfree(&pos->val.str) to set that member to NULL after freeing it.
--- tools/perf/util/parse-events.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/parse-events.c +2 -1
@@ -1287,7 +1287,8 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,list_for_each_entry_safe (pos, tmp, &config_terms, list) {list_del_init (&pos->list); -zfree (&pos->val.str); +if (pos->free_str) +zfree (&pos->val.str);free (pos); }return -EINVAL ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 179/206 perf evsel: Fix 2 memory leaks
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 3efc899d9afb3d03604f191a0be9669eabbfc4aa ]
If allocated, perf_pkg_mask and metric_events need freeing.
--- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evsel.c +2 -0
@@ -1291,6 +1291,8 @@ void perf_evsel__exit(struct perf_evsel *evsel)zfree (&evsel->group_name);zfree (&evsel->name);zfree (&evsel->pmu_name); +zfree (&evsel->per_pkg_mask); +zfree (&evsel->metric_events); perf_evsel__object.fini (evsel); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 180/206 perf trace: Fix the selection for architectures to generate the errno name tables
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 7597ce89b3ed239f7a3408b930d2a6c7a4c938a1 ]
Make the architecture test directory agree with the code comment.
Committer notes:
This was split from a larger patch.
The code was assuming the developer always worked from tools/perf/, so make sure we do the test -d having $toolsdir/perf/arch/$arch, to match the intent expressed in the comment, just above that loop.
--- tools/perf/trace/beauty/arch_errno_names.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/trace/beauty/arch_errno_names.sh +1 -1
@@ -91,7 +91,7 @@ EoHEADER # in tools/perf/arch archlist="" for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do - test -d arch/$arch && archlist="$archlist $arch" + test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch" done for arch in x86 $archlist generic; do
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 181/206 perf stat: Fix duration_time value for higher intervals
In reply to Sasha LevinFrom: Jiri Olsa <[email protected]>
[ Upstream commit ea9eb1f456a08c18feb485894185f7a4e31cc8a4 ]
Joakim reported wrong duration_time value for interval bigger than 4000 [1].
The problem is in the interval value we pass to update_stats function, which is typed as 'unsigned int' and overflows when we get over 2^32 (happens between intervals 4000 and 5000).
Retyping the passed value to unsigned long long.
[1] https://www.spinics.net/lists/linux-perf-users/msg11777.html
--- tools/perf/builtin-stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-stat.c +1 -1
@@ -422,7 +422,7 @@ static void process_interval(void) }init_stats (&walltime_nsecs_stats); -update_stats (&walltime_nsecs_stats, stat_config.interval *1000000 ); +update_stats (&walltime_nsecs_stats, stat_config.interval *1000000ULL );print_counters (&rs,0 ,NULL ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 182/206 perf util: Fix memory leak of prefix_if_not_in
In reply to Sasha LevinFrom: Xie XiuQi <[email protected]>
[ Upstream commit 07e9a6f538cbeecaf5c55b6f2991416f873cdcbd ]
Need to free "str" before return when asprintf() failed to avoid memory leak.
--- tools/perf/util/sort.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/sort.c +1 -1
@@ -2690,7 +2690,7 @@ static char *prefix_if_not_in(const char *pre, char *str)return str;if (asprintf (&n,"%s,%s" , pre, str) <0 ) -return NULL ; + n =NULL ;free (str);return n;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 183/206 perf metricgroup: Free metric_events on error
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit a159e2fe89b4d1f9fb54b0ae418b961e239bf617 ]
Avoid a simple memory leak.
--- tools/perf/util/metricgroup.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/metricgroup.c +3 -0
@@ -171,6 +171,7 @@ static int metricgroup__setup_events(struct list_head *groups,if (!evsel) {pr_debug ("Cannot resolve %s: %s\n" , eg->metric_name, eg->metric_expr); +free (metric_events);continue ; }for (i =0 ; i < eg->idnum; i++)
@@ -178,11 +179,13 @@ static int metricgroup__setup_events(struct list_head *groups, me =metricgroup__lookup (metric_events_list, evsel, true);if (!me) { ret = -ENOMEM ; +free (metric_events);break ; } expr =malloc (sizeof (struct metric_expr ));if (!expr) { ret = -ENOMEM ; +free (metric_events);break ; } expr->metric_expr = eg->metric_expr;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 184/206 perf kcore_copy: Fix module map when there are no modules loaded
In reply to Sasha LevinFrom: Adrian Hunter <[email protected]>
[ Upstream commit 61f82e3fb697a8e85f22fdec786528af73dc36d1 ]
In the absence of any modules, no "modules" map is created, but there are other executable pages to map, due to eBPF JIT, kprobe or ftrace. Map them by recognizing that the first "module" symbol is not necessarily from a module, and adjust the map accordingly.
--- tools/perf/util/symbol-elf.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/util/symbol-elf.c +7 -0
@@ -1421,6 +1421,7 @@ struct kcore_copy_info {u64 first_symbol;u64 last_symbol;u64 first_module; +u64 first_module_symbol;u64 last_module_symbol;size_t phnum;struct list_head phdrs;
@@ -1497,6 +1498,8 @@ static int kcore_copy__process_kallsyms(void *arg, const char *name, char type,return 0 ;if (strchr (name,'[' )) { +if (!kci->first_module_symbol || start < kci->first_module_symbol) + kci->first_module_symbol = start;if (start > kci->last_module_symbol) kci->last_module_symbol = start;return 0 ;
@@ -1694,6 +1697,10 @@ static int kcore_copy__calc_maps(struct kcore_copy_info *kci, const char *dir, kci->etext += page_size; } +if (kci->first_module_symbol && + (!kci->first_module || kci->first_module_symbol < kci->first_module)) + kci->first_module = kci->first_module_symbol; + kci->first_module =round_down (kci->first_module, page_size);if (kci->last_module_symbol) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 185/206 ASoC: img-i2s-out: Fix runtime PM imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 65bd91dd6957390c42a0491b9622cf31a2cdb140 ]
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- sound/soc/img/img-i2s-out.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/img/img-i2s-out.c +6 -2
@@ -350,8 +350,10 @@ static int img_i2s_out_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) chan_control_mask =IMG_I2S_OUT_CHAN_CTL_CLKT_MASK ; ret =pm_runtime_get_sync (i2s->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (i2s->dev);return ret; + }img_i2s_out_disable (i2s);
@@ -491,8 +493,10 @@ static int img_i2s_out_probe(struct platform_device *pdev) goto err_pm_disable; } ret =pm_runtime_get_sync (&pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_noidle (&pdev->dev); goto err_suspend; + } reg =IMG_I2S_OUT_CTL_FRM_SIZE_MASK ;img_i2s_out_writel (i2s, reg,IMG_I2S_OUT_CTL );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 186/206 wlcore: fix runtime pm imbalance in wl1271_tx_work
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 9604617e998b49f7695fea1479ed82421ef8c9f0 ]
There are two error handling paths in this functon. When wlcore_tx_work_locked() returns an error code, we should decrease the runtime PM usage counter the same way as the error handling path beginning from pm_runtime_get_sync().
--- drivers/net/wireless/ti/wlcore/tx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ti/wlcore/tx.c +1 -0
@@ -877,6 +877,7 @@ void wl1271_tx_work(struct work_struct *work) ret =wlcore_tx_work_locked (wl);if (ret <0 ) { +pm_runtime_put_noidle (wl->dev);wl12xx_queue_recovery_work (wl); goto out; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 187/206 wlcore: fix runtime pm imbalance in wlcore_regdomain_config
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 282a04bf1d8029eb98585cb5db3fd70fe8bc91f7 ]
pm_runtime_get_sync() increments the runtime PM usage counter even the call returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/net/wireless/ti/wlcore/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ti/wlcore/main.c +3 -1
@@ -3671,8 +3671,10 @@ void wlcore_regdomain_config(struct wl1271 *wl) goto out; ret =pm_runtime_get_sync (wl->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (wl->dev); goto out; + } ret =wlcore_cmd_regdomain_config_locked (wl);if (ret <0 ) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 188/206 mtd: rawnand: omap_elm: Fix runtime PM imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 37f7212148cf1d796135cdf8d0c7fee13067674b ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/mtd/nand/raw/omap_elm.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/omap_elm.c +1 -0
@@ -421,6 +421,7 @@ static int elm_probe(struct platform_device *pdev)pm_runtime_enable (&pdev->dev);if (pm_runtime_get_sync (&pdev->dev) <0 ) { ret = -EINVAL ; +pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);dev_err (&pdev->dev,"can't enable clock\n" );return ret;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 189/206 PCI: tegra: Fix runtime PM imbalance on error
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit fcee90cdf6f3a3a371add04d41528d5ba9c3b411 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
Also, call pm_runtime_disable() when pm_runtime_get_sync() returns an error code.
--- drivers/pci/controller/pci-tegra.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pci/controller/pci-tegra.c +1 -2
@@ -2400,7 +2400,7 @@ static int tegra_pcie_probe(struct platform_device *pdev) err =pm_runtime_get_sync (pcie->dev);if (err <0 ) {dev_err (dev,"fail to enable pcie controller: %d\n" , err); - goto teardown_msi; + goto pm_runtime_put; } err =tegra_pcie_request_resources (pcie);
@@ -2440,7 +2440,6 @@ free_resources: pm_runtime_put:pm_runtime_put_sync (pcie->dev);pm_runtime_disable (pcie->dev); -teardown_msi:tegra_pcie_msi_teardown (pcie); put_resources:tegra_pcie_put_resources (pcie);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 190/206 ceph: fix potential race in ceph_check_caps
In reply to Sasha LevinFrom: Jeff Layton <[email protected]>
[ Upstream commit dc3da0461cc4b76f2d0c5b12247fcb3b520edbbf ]
Nothing ensures that session will still be valid by the time we dereference the pointer. Take and put a reference.
In principle, we should always be able to get a reference here, but throw a warning if that's ever not the case.
--- fs/ceph/caps.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/ceph/caps.c +13 -1
@@ -2015,12 +2015,24 @@ ack:if (mutex_trylock (&session->s_mutex) ==0 ) {dout ("inverting session/ino locks on %p\n" , session); + session =ceph_get_mds_session (session);spin_unlock (&ci->i_ceph_lock);if (took_snap_rwsem) {up_read (&mdsc->snap_rwsem); took_snap_rwsem =0 ; } -mutex_lock (&session->s_mutex); +if (session) { +mutex_lock (&session->s_mutex); +ceph_put_mds_session (session); + }else { +/* +* Because we take the reference while +* holding the i_ceph_lock, it should +* never be NULL. Throw a warning if it +* ever is. +*/ +WARN_ON_ONCE (true); + } goto retry; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 191/206 mm/swap_state: fix a data race in swapin_nr_pages
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit d6c1f098f2a7ba62627c9bc17cda28f534ef9e4a ]
"prev_offset" is a static variable in swapin_nr_pages() that can be accessed concurrently with only mmap_sem held in read mode as noticed by KCSAN,
BUG: KCSAN: data-race in swap_cluster_readahead / swap_cluster_readahead
write to 0xffffffff92763830 of 8 bytes by task 14795 on cpu 17:
swap_cluster_readahead+0x2a6/0x5e0 swapin_readahead+0x92/0x8dc do_swap_page+0x49b/0xf20 __handle_mm_fault+0xcfb/0xd70 handle_mm_fault+0xfc/0x2f0 do_page_fault+0x263/0x715 page_fault+0x34/0x40
1 lock held by (dnf)/14795:
#0: ffff897bd2e98858 (&mm->mmap_sem#2){++++}-{3:3}, at: do_page_fault+0x143/0x715 do_user_addr_fault at arch/x86/mm/fault.c:1405
(inlined by) do_page_fault at arch/x86/mm/fault.c:1535
irq event stamp: 83493 count_memcg_event_mm+0x1a6/0x270 count_memcg_event_mm+0x119/0x270 __do_softirq+0x365/0x589 irq_exit+0xa2/0xc0
read to 0xffffffff92763830 of 8 bytes by task 1 on cpu 22:
swap_cluster_readahead+0xfd/0x5e0 swapin_readahead+0x92/0x8dc do_swap_page+0x49b/0xf20 __handle_mm_fault+0xcfb/0xd70 handle_mm_fault+0xfc/0x2f0 do_page_fault+0x263/0x715 page_fault+0x34/0x40
1 lock held by systemd/1:
#0: ffff897c38f14858 (&mm->mmap_sem#2){++++}-{3:3}, at: do_page_fault+0x143/0x715
irq event stamp: 43530289 count_memcg_event_mm+0x1a6/0x270 count_memcg_event_mm+0x119/0x270 __do_softirq+0x365/0x589 irq_exit+0xa2/0xc0
--- mm/swap_state.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/swap_state.c +3 -2
@@ -537,10 +537,11 @@ static unsigned long swapin_nr_pages(unsigned long offset)return 1 ; hits =atomic_xchg (&swapin_readahead_hits,0 ); - pages =__swapin_nr_pages (prev_offset, offset, hits, max_pages, + pages =__swapin_nr_pages (READ_ONCE (prev_offset), offset, hits, + max_pages,atomic_read (&last_readahead_pages));if (!hits) - prev_offset = offset; +WRITE_ONCE (prev_offset, offset);atomic_set (&last_readahead_pages, pages);return pages;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 192/206 rapidio: avoid data race between file operation callbacks and mport_cdev_add().
In reply to Sasha LevinFrom: Madhuparna Bhowmik <[email protected]>
[ Upstream commit e1c3cdb26ab881b77486dc50370356a349077c74 ]
Fields of md(mport_dev) are set after cdev_device_add(). However, the file operation callbacks can be called after cdev_device_add() and therefore accesses to fields of md in the callbacks can race with the rest of the mport_cdev_add() function.
One such example is INIT_LIST_HEAD(&md->portwrites) in mport_cdev_add(), the list is initialised after cdev_device_add(). This can race with list_add_tail(&pw_filter->md_node,&md->portwrites) in rio_mport_add_pw_filter() which is called by unlocked_ioctl.
To avoid such data races use cdev_device_add() after initializing md.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/rapidio/devices/rio_mport_cdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +7 -7
@@ -2385,13 +2385,6 @@ static struct mport_dev *mport_cdev_add(struct rio_mport *mport)cdev_init (&md->cdev, &mport_fops); md->cdev.owner =THIS_MODULE ; - ret =cdev_device_add (&md->cdev, &md->dev); -if (ret) { -rmcd_error ("Failed to register mport %d (err=%d)" , - mport->id, ret); - goto err_cdev; - } -INIT_LIST_HEAD (&md->doorbells);spin_lock_init (&md->db_lock);INIT_LIST_HEAD (&md->portwrites);
@@ -2411,6 +2404,13 @@ static struct mport_dev *mport_cdev_add(struct rio_mport *mport)#else md->properties.transfer_mode |=RIO_TRANSFER_MODE_TRANSFER ;#endif + + ret =cdev_device_add (&md->cdev, &md->dev); +if (ret) { +rmcd_error ("Failed to register mport %d (err=%d)" , + mport->id, ret); + goto err_cdev; + } ret =rio_query_mport (mport, &attr);if (!ret) { md->properties.flags = attr.flags;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 193/206 mtd: parser: cmdline: Support MTD names containing one or more colons
In reply to Sasha LevinFrom: Boris Brezillon <[email protected]>
[ Upstream commit eb13fa0227417e84aecc3bd9c029d376e33474d3 ]
Looks like some drivers define MTD names with a colon in it, thus making mtdpart= parsing impossible. Let's fix the parser to gracefully handle that case: the last ':' in a partition definition sequence is considered instead of the first one.
--- drivers/mtd/cmdlinepart.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/mtd/cmdlinepart.c +20 -3
@@ -231,12 +231,29 @@ static int mtdpart_setup_real(char *s)struct cmdline_mtd_partition *this_mtd;struct mtd_partition *parts;int mtd_id_len, num_parts; -char *p, *mtd_id; +char *p, *mtd_id, *semicol; + +/* +* Replace the first ';' by a NULL char so strrchr can work +* properly. +*/ + semicol =strchr (s,';' ); +if (semicol) + *semicol ='\0' ; mtd_id = s; -/* fetch <mtd-id> */ - p =strchr (s,':' ); +/* +* fetch <mtd-id>. We use strrchr to ignore all ':' that could +* be present in the MTD name, only the last one is interpreted +* as an <mtd-id>/<part-definition> separator. +*/ + p =strrchr (s,':' ); + +/* Restore the ';' now. */ +if (semicol) + *semicol =';' ; +if (!p) {pr_err ("no mtd-id\n" );return -EINVAL ;
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Sasha Levin
maintainerPATCH 194/206 x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit a7ef9ba986b5fae9d80f8a7b31db0423687efe4e ]
Prevent the compiler from uninlining and creating traceable/probable functions as this is invoked _after_ context tracking switched to CONTEXT_USER and rcu idle.
--- arch/x86/include/asm/nospec-branch.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/nospec-branch.h +2 -2
@@ -330,7 +330,7 @@ DECLARE_STATIC_KEY_FALSE(mds_idle_clear);* combination with microcode which triggers a CPU buffer flush when the * instruction is executed. */ -static inline void mds_clear_cpu_buffers (void ) +static __always_inline void mds_clear_cpu_buffers(void) {static const u16 ds = __KERNEL_DS;
@@ -351,7 +351,7 @@ static inline void mds_clear_cpu_buffers(void)* * Clear CPU buffers if the corresponding static key is enabled */ -static inline void mds_user_clear_cpu_buffers (void ) +static __always_inline void mds_user_clear_cpu_buffers(void) {if (static_branch_likely (&mds_user_clear))mds_clear_cpu_buffers ();
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 195/206 vfio/pci: Clear error and request eventfd ctx after releasing
In reply to Sasha LevinFrom: Alex Williamson <[email protected]>
[ Upstream commit 5c5866c593bbd444d0339ede6a8fb5f14ff66d72 ]
The next use of the device will generate an underflow from the stale reference.
--- drivers/vfio/pci/vfio_pci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/vfio/pci/vfio_pci.c +6 -2
@@ -409,10 +409,14 @@ static void vfio_pci_release(void *device_data)if (!(--vdev->refcnt)) {vfio_spapr_pci_eeh_release (vdev->pdev);vfio_pci_disable (vdev); -if (vdev->err_trigger) +if (vdev->err_trigger) {eventfd_ctx_put (vdev->err_trigger); -if (vdev->req_trigger) + vdev->err_trigger =NULL ; + } +if (vdev->req_trigger) {eventfd_ctx_put (vdev->req_trigger); + vdev->req_trigger =NULL ; + } }mutex_unlock (&driver_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 196/206 cifs: Fix double add page to memcg when cifs_readpages
In reply to Sasha LevinFrom: Zhang Xiaoxu <[email protected]>
[ Upstream commit 95a3d8f3af9b0d63b43f221b630beaab9739d13a ]
When xfstests generic/451, there is an BUG at mm/memcontrol.c:
page:ffffea000560f2c0 refcount:2 mapcount:0 mapping:000000008544e0ea
index:0xf
mapping->aops:cifs_addr_ops dentry name:"tst-aio-dio-cycle-write.451"
flags: 0x2fffff80000001(locked)
raw: 002fffff80000001 ffffc90002023c50 ffffea0005280088 ffff88815cda0210
raw: 000000000000000f 0000000000000000 00000002ffffffff ffff88817287d000
page dumped because: VM_BUG_ON_PAGE(page->mem_cgroup)
page->mem_cgroup:ffff88817287d000
------------[ cut here ]------------
kernel BUG at mm/memcontrol.c:2659!
invalid opcode: 0000 [#1] SMP
CPU: 2 PID: 2038 Comm: xfs_io Not tainted 5.8.0-rc1 #44
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190727_
073836-buildvm-ppc64le-16.ppc.4
RIP: 0010:commit_charge+0x35/0x50
Code: 0d 48 83 05 54 b2 02 05 01 48 89 77 38 c3 48 c7
c6 78 4a ea ba 48 83 05 38 b2 02 05 01 e8 63 0d9
RSP: 0018:ffffc90002023a50 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff88817287d000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff88817ac97ea0 RDI: ffff88817ac97ea0
RBP: ffffea000560f2c0 R08: 0000000000000203 R09: 0000000000000005
R10: 0000000000000030 R11: ffffc900020237a8 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000001 R15: ffff88815a1272c0
FS: 00007f5071ab0800(0000) GS:ffff88817ac80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055efcd5ca000 CR3: 000000015d312000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
mem_cgroup_charge+0x166/0x4f0
__add_to_page_cache_locked+0x4a9/0x710
add_to_page_cache_locked+0x15/0x20
cifs_readpages+0x217/0x1270
read_pages+0x29a/0x670
page_cache_readahead_unbounded+0x24f/0x390
__do_page_cache_readahead+0x3f/0x60
ondemand_readahead+0x1f1/0x470
page_cache_async_readahead+0x14c/0x170
generic_file_buffered_read+0x5df/0x1100
generic_file_read_iter+0x10c/0x1d0
cifs_strict_readv+0x139/0x170
new_sync_read+0x164/0x250
__vfs_read+0x39/0x60
vfs_read+0xb5/0x1e0
ksys_pread64+0x85/0xf0
__x64_sys_pread64+0x22/0x30
do_syscall_64+0x69/0x150
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f5071fcb1af
Code: Bad RIP value.
RSP: 002b:00007ffde2cdb8e0 EFLAGS: 00000293 ORIG_RAX: 0000000000000011
RAX: ffffffffffffffda RBX: 00007ffde2cdb990 RCX: 00007f5071fcb1af
RDX: 0000000000001000 RSI: 000055efcd5ca000 RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: 0000000000000001
R13: 000000000009f000 R14: 0000000000000000 R15: 0000000000001000
Modules linked in:
---[ end trace 725fa14a3e1af65c ]---Since commit 3fea5a499d57 ("mm: memcontrol: convert page cache to a new mem_cgroup_charge() API") not cancel the page charge, the pages maybe double add to pagecache:
thread1 | thread2cifs_readpagesreadpages_get_pages
add_to_page_cache_locked(head,index=n)=0
| readpages_get_pages
| add_to_page_cache_locked(head,index=n+1)=0 add_to_page_cache_locked(head, index=n+1)=-EEXIST then, will next loop with list head page's index=n+1 and the page->mapping not NULLreadpages_get_pages add_to_page_cache_locked(head, index=n+1)
commit_charge
VM_BUG_ON_PAGE
So, we should not do the next loop when any page add to page cache failed.
--- fs/cifs/file.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/cifs/file.c +7 -4
@@ -3804,7 +3804,8 @@ readpages_get_pages(struct address_space *mapping, struct list_head *page_list,break ;__SetPageLocked (page); -if (add_to_page_cache_locked (page, mapping, page->index, gfp)) { + rc =add_to_page_cache_locked (page, mapping, page->index, gfp); +if (rc) {__ClearPageLocked (page);break ; }
@@ -3820,6 +3821,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, struct list_head *page_list, unsigned num_pages) { int rc; +int err =0 ;struct list_head tmplist;struct cifsFileInfo *open_file = file->private_data;struct cifs_sb_info *cifs_sb =CIFS_FILE_SB (file);
@@ -3860,7 +3862,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,* the order of declining indexes. When we put the pages in * the rdata->pages, then we want them in increasing order. */ -while (!list_empty (page_list)) { +while (!list_empty (page_list) && !err) {unsigned int i, nr_pages, bytes, rsize;loff_t offset;struct page *page, *tpage;
@@ -3883,9 +3885,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,return 0 ; } - rc =readpages_get_pages (mapping, page_list, rsize, &tmplist, + nr_pages =0 ; + err =readpages_get_pages (mapping, page_list, rsize, &tmplist, &nr_pages, &offset, &bytes); -if (rc) { +if (!nr_pages) {add_credits_and_wake_if (server, credits,0 );break ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 197/206 nvme: fix possible deadlock when I/O is blocked
In reply to Sasha LevinFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 3b4b19721ec652ad2c4fe51dfbe5124212b5f581 ]
Revert fab7772bfbcf ("nvme-multipath: revalidate nvme_ns_head gendisk in nvme_validate_ns")
When adding a new namespace to the head disk (via nvme_mpath_set_live) we will see partition scan which triggers I/O on the mpath device node. This process will usually be triggered from the scan_work which holds the scan_lock. If I/O blocks (if we got ana change currently have only available paths but none are accessible) this can deadlock on the head disk bd_mutex as both partition scan I/O takes it, and head disk revalidation takes it to check for resize (also triggered from scan_work on a different path). See trace [1].
The mpath disk revalidation was originally added to detect online disk size change, but this is no longer needed since commit cb224c3af4df ("nvme: Convert to use set_capacity_revalidate_and_notify") which already updates resize info without unnecessarily revalidating the disk (the mpath disk doesn't even implement .revalidate_disk fop).
[1]:
--
kernel: INFO: task kworker/u65:9:494 blocked for more than 241 seconds. kernel: Tainted: G OE 5.3.5-050305-generic #201910071830 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kernel: kworker/u65:9 D 0 494 2 0x80004000 kernel: Workqueue: nvme-wq nvme_scan_work [nvme_core] kernel: Call Trace: kernel: __schedule+0x2b9/0x6c0 kernel: schedule+0x42/0xb0 kernel: schedule_preempt_disabled+0xe/0x10 kernel: __mutex_lock.isra.0+0x182/0x4f0 kernel: __mutex_lock_slowpath+0x13/0x20 kernel: mutex_lock+0x2e/0x40 kernel: revalidate_disk+0x63/0xa0 kernel: __nvme_revalidate_disk+0xfe/0x110 [nvme_core] kernel: nvme_revalidate_disk+0xa4/0x160 [nvme_core] kernel: ? evict+0x14c/0x1b0 kernel: revalidate_disk+0x2b/0xa0 kernel: nvme_validate_ns+0x49/0x940 [nvme_core] kernel: ? blk_mq_free_request+0xd2/0x100 kernel: ? __nvme_submit_sync_cmd+0xbe/0x1e0 [nvme_core] kernel: nvme_scan_work+0x24f/0x380 [nvme_core] kernel: process_one_work+0x1db/0x380 kernel: worker_thread+0x249/0x400 kernel: kthread+0x104/0x140 kernel: ? process_one_work+0x380/0x380 kernel: ? kthread_park+0x80/0x80 kernel: ret_from_fork+0x1f/0x40 ... kernel: INFO: task kworker/u65:1:2630 blocked for more than 241 seconds. kernel: Tainted: G OE 5.3.5-050305-generic #201910071830 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. kernel: kworker/u65:1 D 0 2630 2 0x80004000 kernel: Workqueue: nvme-wq nvme_scan_work [nvme_core] kernel: Call Trace: kernel: __schedule+0x2b9/0x6c0 kernel: schedule+0x42/0xb0 kernel: io_schedule+0x16/0x40 kernel: do_read_cache_page+0x438/0x830 kernel: ? __switch_to_asm+0x34/0x70 kernel: ? file_fdatawait_range+0x30/0x30 kernel: read_cache_page+0x12/0x20 kernel: read_dev_sector+0x27/0xc0 kernel: read_lba+0xc1/0x220 kernel: ? kmem_cache_alloc_trace+0x19c/0x230 kernel: efi_partition+0x1e6/0x708 kernel: ? vsnprintf+0x39e/0x4e0 kernel: ? snprintf+0x49/0x60 kernel: check_partition+0x154/0x244 kernel: rescan_partitions+0xae/0x280 kernel: __blkdev_get+0x40f/0x560 kernel: blkdev_get+0x3d/0x140 kernel: __device_add_disk+0x388/0x480 kernel: device_add_disk+0x13/0x20 kernel: nvme_mpath_set_live+0x119/0x140 [nvme_core] kernel: nvme_update_ns_ana_state+0x5c/0x60 [nvme_core] kernel: nvme_set_ns_ana_state+0x1e/0x30 [nvme_core] kernel: nvme_parse_ana_log+0xa1/0x180 [nvme_core] kernel: ? nvme_update_ns_ana_state+0x60/0x60 [nvme_core] kernel: nvme_mpath_add_disk+0x47/0x90 [nvme_core] kernel: nvme_validate_ns+0x396/0x940 [nvme_core] kernel: ? blk_mq_free_request+0xd2/0x100 kernel: nvme_scan_work+0x24f/0x380 [nvme_core] kernel: process_one_work+0x1db/0x380 kernel: worker_thread+0x249/0x400 kernel: kthread+0x104/0x140 kernel: ? process_one_work+0x380/0x380 kernel: ? kthread_park+0x80/0x80 kernel: ret_from_fork+0x1f/0x40
--
in nvme_validate_ns")
--- drivers/nvme/host/core.c | 1 - 1 file changed, 1 deletion(-)
drivers/nvme/host/core.c +0 -1
@@ -1599,7 +1599,6 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)if (ns->head->disk) {nvme_update_disk_info (ns->head->disk, ns, id);blk_queue_stack_limits (ns->head->disk->queue, ns->queue); -revalidate_disk (ns->head->disk); }#endif }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 198/206 scsi: libfc: Handling of extra kref
In reply to Sasha LevinFrom: Javed Hasan <[email protected]>
[ Upstream commit 71f2bf85e90d938d4a9ef9dd9bfa8d9b0b6a03f7 ]
Handling of extra kref which is done by lookup table in case rdata is already present in list.
This issue was leading to memory leak. Trace from KMEMLEAK tool:
unreferenced object 0xffff8888259e8780 (size 512):
comm "kworker/2:1", pid 182614, jiffies 4433237386 (age 113021.971s)
hex dump (first 32 bytes):
58 0a ec cf 83 88 ff ff 00 00 00 00 00 00 00 00
01 00 00 00 08 00 00 00 13 7d f0 1e 0e 00 00 10
backtrace:
[<000000006b25760f>] fc_rport_recv_req+0x3c6/0x18f0 [libfc]
[<00000000f208d994>] fc_lport_recv_els_req+0x120/0x8a0 [libfc]
[<00000000a9c437b8>] fc_lport_recv+0xb9/0x130 [libfc]
[<00000000ad5be37b>] qedf_ll2_process_skb+0x73d/0xad0 [qedf]
[<00000000e0eb6893>] process_one_work+0x382/0x6c0
[<000000002dfd9e21>] worker_thread+0x57/0x5c0
[<00000000b648204f>] kthread+0x1a0/0x1c0
[<0000000072f5ab20>] ret_from_fork+0x35/0x40
[<000000001d5c05d8>] 0xffffffffffffffffBelow is the log sequence which leads to memory leak. Here we get the nested "Received PLOGI request" for same port and this request leads to call the fc_rport_create() twice for the same rport.
kernel: host1: rport fffce5: Received PLOGI request
kernel: host1: rport fffce5: Received PLOGI in INIT state
kernel: host1: rport fffce5: Port is Ready
kernel: host1: rport fffce5: Received PRLI request while in state Ready
kernel: host1: rport fffce5: PRLI rspp type 8 active 1 passive 0
kernel: host1: rport fffce5: Received LOGO request while in state Ready
kernel: host1: rport fffce5: Delete port
kernel: host1: rport fffce5: Received PLOGI request
kernel: host1: rport fffce5: Received PLOGI in state Delete - send busy
--- drivers/scsi/libfc/fc_rport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/libfc/fc_rport.c +3 -1
@@ -145,8 +145,10 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)lockdep_assert_held (&lport->disc.disc_mutex); rdata =fc_rport_lookup (lport, port_id); -if (rdata) +if (rdata) { +kref_put (&rdata->kref, fc_rport_destroy);return rdata; + }if (lport->rport_priv_size >0 ) rport_priv_size = lport->rport_priv_size;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 199/206 scsi: libfc: Skip additional kref updating work event
In reply to Sasha LevinFrom: Javed Hasan <[email protected]>
[ Upstream commit 823a65409c8990f64c5693af98ce0e7819975cba ]
When an rport event (RPORT_EV_READY) is updated without work being queued, avoid taking an additional reference.
This issue was leading to memory leak. Trace from KMEMLEAK tool:
unreferenced object 0xffff8888259e8780 (size 512):
comm "kworker/2:1", jiffies 4433237386 (age 113021.971s)
hex dump (first 32 bytes): 58 0a ec cf 83 88 ff ff 00 00 00 00 00 00 00 00 01 00 00 00 08 00 00 00 13 7d f0 1e 0e 00 00 10 backtrace: [<000000006b25760f>] fc_rport_recv_req+0x3c6/0x18f0 [libfc] [<00000000f208d994>] fc_lport_recv_els_req+0x120/0x8a0 [libfc] [<00000000a9c437b8>] fc_lport_recv+0xb9/0x130 [libfc] [<00000000a9c437b8>] fc_lport_recv+0xb9/0x130 [libfc] [<00000000ad5be37b>] qedf_ll2_process_skb+0x73d/0xad0 [qedf] [<00000000e0eb6893>] process_one_work+0x382/0x6c0 [<000000002dfd9e21>] worker_thread+0x57/0x5c0 [<00000000b648204f>] kthread+0x1a0/0x1c0 [<0000000072f5ab20>] ret_from_fork+0x35/0x40 [<000000001d5c05d8>] 0xffffffffffffffff
Below is the log sequence which leads to memory leak. Here we get the RPORT_EV_READY and RPORT_EV_STOP back to back, which lead to overwrite the event RPORT_EV_READY by event RPORT_EV_STOP. Because of this, kref_count gets incremented by 1.
kernel: host0: rport fffce5: Received PLOGI request
kernel: host0: rport fffce5: Received PLOGI in INIT state
kernel: host0: rport fffce5: Port is Ready
kernel: host0: rport fffce5: Received PRLI request while in state Ready
kernel: host0: rport fffce5: PRLI rspp type 8 active 1 passive 0
kernel: host0: rport fffce5: Received LOGO request while in state Ready
kernel: host0: rport fffce5: Delete port
kernel: host0: rport fffce5: Received PLOGI request
kernel: host0: rport fffce5: Received PLOGI in state Delete - send busy
kernel: host0: rport fffce5: work event 3
kernel: host0: rport fffce5: lld callback ev 3
kernel: host0: rport fffce5: work delete
--- drivers/scsi/libfc/fc_rport.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/scsi/libfc/fc_rport.c +5 -4
@@ -495,10 +495,11 @@ static void fc_rport_enter_delete(struct fc_rport_priv *rdata,fc_rport_state_enter (rdata,RPORT_ST_DELETE ); -kref_get (&rdata->kref); -if (rdata->event ==RPORT_EV_NONE && - !queue_work (rport_event_queue, &rdata->event_work)) -kref_put (&rdata->kref, fc_rport_destroy); +if (rdata->event ==RPORT_EV_NONE ) { +kref_get (&rdata->kref); +if (!queue_work (rport_event_queue, &rdata->event_work)) +kref_put (&rdata->kref, fc_rport_destroy); + } rdata->event = event; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 200/206 selftests/x86/syscall_nt: Clear weird flags after each test
In reply to Sasha LevinFrom: Andy Lutomirski <[email protected]>
[ Upstream commit a61fa2799ef9bf6c4f54cf7295036577cececc72 ]
Clear the weird flags before logging to improve strace output -- logging results while, say, TF is set does no one any favors.
--- tools/testing/selftests/x86/syscall_nt.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/x86/syscall_nt.c +1 -0
@@ -67,6 +67,7 @@ static void do_it(unsigned long extraflags)set_eflags (get_eflags () | extraflags);syscall (SYS_getpid); flags =get_eflags (); +set_eflags (X86_EFLAGS_IF |X86_EFLAGS_FIXED );if ((flags & extraflags) == extraflags) {printf ("[OK]\tThe syscall worked and flags are still set\n" ); }else {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 201/206 vfio/pci: fix racy on error and request eventfd ctx
In reply to Sasha LevinFrom: Zeng Tao <[email protected]>
[ Upstream commit b872d0640840018669032b20b6375a478ed1f923 ]
The vfio_pci_release call will free and clear the error and request eventfd ctx while these ctx could be in use at the same time in the function like vfio_pci_request, and it's expected to protect them under the vdev->igate mutex, which is missing in vfio_pci_release.
This issue is introduced since commit 1518ac272e78 ("vfio/pci: fix memory leaks of eventfd ctx"),and since commit 5c5866c593bb ("vfio/pci: Clear error and request eventfd ctx after releasing"), it's very easily to trigger the kernel panic like this:
[ 9513.904346] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 [ 9513.913091] Mem abort info: [ 9513.915871] ESR = 0x96000006 [ 9513.918912] EC = 0x25: DABT (current EL), IL = 32 bits [ 9513.924198] SET = 0, FnV = 0 [ 9513.927238] EA = 0, S1PTW = 0 [ 9513.930364] Data abort info: [ 9513.933231] ISV = 0, ISS = 0x00000006 [ 9513.937048] CM = 0, WnR = 0 [ 9513.940003] user pgtable: 4k pages, 48-bit VAs, pgdp=0000007ec7d12000 [ 9513.946414] [0000000000000008] pgd=0000007ec7d13003, p4d=0000007ec7d13003, pud=0000007ec728c003, pmd=0000000000000000 [ 9513.956975] Internal error: Oops: 96000006 [#1] PREEMPT SMP [ 9513.962521] Modules linked in: vfio_pci vfio_virqfd vfio_iommu_type1 vfio hclge hns3 hnae3 [last unloaded: vfio_pci] [ 9513.972998] CPU: 4 PID: 1327 Comm: bash Tainted: G W 5.8.0-rc4+ #3 [ 9513.980443] Hardware name: Huawei TaiShan 2280 V2/BC82AMDC, BIOS 2280-V2 CS V3.B270.01 05/08/2020 [ 9513.989274] pstate: 80400089 (Nzcv daIf +PAN -UAO BTYPE=--) [ 9513.994827] pc : _raw_spin_lock_irqsave+0x48/0x88 [ 9513.999515] lr : eventfd_signal+0x6c/0x1b0 [ 9514.003591] sp : ffff800038a0b960 [ 9514.006889] x29: ffff800038a0b960 x28: ffff007ef7f4da10 [ 9514.012175] x27: ffff207eefbbfc80 x26: ffffbb7903457000 [ 9514.017462] x25: ffffbb7912191000 x24: ffff007ef7f4d400 [ 9514.022747] x23: ffff20be6e0e4c00 x22: 0000000000000008 [ 9514.028033] x21: 0000000000000000 x20: 0000000000000000 [ 9514.033321] x19: 0000000000000008 x18: 0000000000000000 [ 9514.038606] x17: 0000000000000000 x16: ffffbb7910029328 [ 9514.043893] x15: 0000000000000000 x14: 0000000000000001 [ 9514.049179] x13: 0000000000000000 x12: 0000000000000002 [ 9514.054466] x11: 0000000000000000 x10: 0000000000000a00 [ 9514.059752] x9 : ffff800038a0b840 x8 : ffff007ef7f4de60 [ 9514.065038] x7 : ffff007fffc96690 x6 : fffffe01faffb748 [ 9514.070324] x5 : 0000000000000000 x4 : 0000000000000000 [ 9514.075609] x3 : 0000000000000000 x2 : 0000000000000001 [ 9514.080895] x1 : ffff007ef7f4d400 x0 : 0000000000000000 [ 9514.086181] Call trace: [ 9514.088618] _raw_spin_lock_irqsave+0x48/0x88 [ 9514.092954] eventfd_signal+0x6c/0x1b0 [ 9514.096691] vfio_pci_request+0x84/0xd0 [vfio_pci] [ 9514.101464] vfio_del_group_dev+0x150/0x290 [vfio] [ 9514.106234] vfio_pci_remove+0x30/0x128 [vfio_pci] [ 9514.111007] pci_device_remove+0x48/0x108 [ 9514.115001] device_release_driver_internal+0x100/0x1b8 [ 9514.120200] device_release_driver+0x28/0x38 [ 9514.124452] pci_stop_bus_device+0x68/0xa8 [ 9514.128528] pci_stop_and_remove_bus_device+0x20/0x38 [ 9514.133557] pci_iov_remove_virtfn+0xb4/0x128 [ 9514.137893] sriov_disable+0x3c/0x108 [ 9514.141538] pci_disable_sriov+0x28/0x38 [ 9514.145445] hns3_pci_sriov_configure+0x48/0xb8 [hns3] [ 9514.150558] sriov_numvfs_store+0x110/0x198 [ 9514.154724] dev_attr_store+0x44/0x60 [ 9514.158373] sysfs_kf_write+0x5c/0x78 [ 9514.162018] kernfs_fop_write+0x104/0x210 [ 9514.166010] __vfs_write+0x48/0x90 [ 9514.169395] vfs_write+0xbc/0x1c0 [ 9514.172694] ksys_write+0x74/0x100 [ 9514.176079] __arm64_sys_write+0x24/0x30 [ 9514.179987] el0_svc_common.constprop.4+0x110/0x200 [ 9514.184842] do_el0_svc+0x34/0x98 [ 9514.188144] el0_svc+0x14/0x40 [ 9514.191185] el0_sync_handler+0xb0/0x2d0 [ 9514.195088] el0_sync+0x140/0x180 [ 9514.198389] Code: b9001020 d2800000 52800022 f9800271 (885ffe61) [ 9514.204455] ---[ end trace 648de00c8406465f ]--- [ 9514.212308] note: bash[1327] exited with preempt_count 1
--- drivers/vfio/pci/vfio_pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/vfio/pci/vfio_pci.c +5 -0
@@ -409,14 +409,19 @@ static void vfio_pci_release(void *device_data)if (!(--vdev->refcnt)) {vfio_spapr_pci_eeh_release (vdev->pdev);vfio_pci_disable (vdev); +mutex_lock (&vdev->igate);if (vdev->err_trigger) {eventfd_ctx_put (vdev->err_trigger); vdev->err_trigger =NULL ; } +mutex_unlock (&vdev->igate); + +mutex_lock (&vdev->igate);if (vdev->req_trigger) {eventfd_ctx_put (vdev->req_trigger); vdev->req_trigger =NULL ; } +mutex_unlock (&vdev->igate); }mutex_unlock (&driver_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 202/206 btrfs: qgroup: fix data leak caused by race between writeback and truncate
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit fa91e4aa1716004ea8096d5185ec0451e206aea0 ]
[BUG]
When running tests like generic/013 on test device with btrfs quota enabled, it can normally lead to data leak, detected at unmount time:
BTRFS warning (device dm-3): qgroup 0/5 has unreleased space, type 0 rsv 4096
------------[ cut here ]------------ WARNING: CPU: 11 PID: 16386 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs] RIP: 0010:close_ctree+0x1dc/0x323 [btrfs] Call Trace: btrfs_put_super+0x15/0x17 [btrfs] generic_shutdown_super+0x72/0x110 kill_anon_super+0x18/0x30 btrfs_kill_super+0x17/0x30 [btrfs] deactivate_locked_super+0x3b/0xa0 deactivate_super+0x40/0x50 cleanup_mnt+0x135/0x190 __cleanup_mnt+0x12/0x20 task_work_run+0x64/0xb0 __prepare_exit_to_usermode+0x1bc/0x1c0 __syscall_return_slowpath+0x47/0x230 do_syscall_64+0x64/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ---[ end trace caf08beafeca2392 ]--- BTRFS error (device dm-3): qgroup reserved space leaked
[CAUSE]
In the offending case, the offending operations are:
2/6: writev f2X[269 1 0 0 0 0] [1006997,67,288] 0 2/7: truncate f2X[269 1 0 0 48 1026293] 18388 0
The following sequence of events could happen after the writev():
CPU1 (writeback) | CPU2 (truncate)
-----------------------------------------------------------------
btrfs_writepages() |
|- extent_write_cache_pages() |
|- Got page for 1003520 |
| 1003520 is Dirty, no writeback |
| So (!clear_page_dirty_for_io()) |
| gets called for it |
|- Now page 1003520 is Clean. |
| | btrfs_setattr()
| | |- btrfs_setsize()
| | |- truncate_setsize()
| | New i_size is 18388
|- __extent_writepage() |
| |- page_offset() > i_size |
|- btrfs_invalidatepage() |
|- Page is clean, so no qgroup |callback executed
This means, the qgroup reserved data space is not properly released in btrfs_invalidatepage() as the page is Clean.
[FIX]
Instead of checking the dirty bit of a page, call btrfs_qgroup_free_data() unconditionally in btrfs_invalidatepage().
As qgroup rsv are completely bound to the QGROUP_RESERVED bit of io_tree, not bound to page status, thus we won't cause double freeing anyway.
--- fs/btrfs/inode.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
fs/btrfs/inode.c +10 -13
@@ -8913,20 +8913,17 @@ again:/* * Qgroup reserved space handler * Page here will be either -* 1) Already written to disk -* In this case, its reserved space is released from data rsv map -* and will be freed by delayed_ref handler finally. -* So even we call qgroup_free_data(), it won't decrease reserved -* space. -* 2) Not written to disk -* This means the reserved space should be freed here. However, -* if a truncate invalidates the page (by clearing PageDirty) -* and the page is accounted for while allocating extent -* in btrfs_check_data_free_space() we let delayed_ref to -* free the entire extent. +* 1) Already written to disk or ordered extent already submitted +* Then its QGROUP_RESERVED bit in io_tree is already cleaned. +* Qgroup will be handled by its qgroup_record then. +* btrfs_qgroup_free_data() call will do nothing here. +* +* 2) Not written to disk yet +* Then btrfs_qgroup_free_data() call will clear the QGROUP_RESERVED +* bit of its io_tree, and free the qgroup reserved data space. +* Since the IO will never happen for this page. */ -if (PageDirty (page)) -btrfs_qgroup_free_data (inode,NULL , page_start,PAGE_SIZE ); +btrfs_qgroup_free_data (inode,NULL , page_start,PAGE_SIZE );if (!inode_evicting) { clear_extent_bit(tree, page_start, page_end, EXTENT_LOCKED | EXTENT_DIRTY |
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 203/206 ubi: fastmap: Free unused fastmap anchor peb during detach
In reply to Sasha LevinFrom: Hou Tao <[email protected]>
[ Upstream commit c16f39d14a7e0ec59881fbdb22ae494907534384 ]
When CONFIG_MTD_UBI_FASTMAP is enabled, fm_anchor will be assigned a free PEB during ubi_wl_init() or ubi_update_fastmap(). However if fastmap is not used or disabled on the MTD device, ubi_wl_entry related with the PEB will not be freed during detach.
So Fix it by freeing the unused fastmap anchor during detach.
--- drivers/mtd/ubi/fastmap-wl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/mtd/ubi/fastmap-wl.c +13 -2
@@ -48,6 +48,13 @@ static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root)return victim; } +static inline void return_unused_peb (struct ubi_device *ubi, +struct ubi_wl_entry *e) +{ +wl_tree_add (e, &ubi->free); + ubi->free_count++; +} +/** * return_unused_pool_pebs - returns unused PEB to the free tree. * @ubi: UBI device description object
@@ -61,8 +68,7 @@ static void return_unused_pool_pebs(struct ubi_device *ubi,for (i = pool->used; i < pool->size; i++) { e = ubi->lookuptbl[pool->pebs[i]]; -wl_tree_add (e, &ubi->free); - ubi->free_count++; +return_unused_peb (ubi, e); } }
@@ -370,6 +376,11 @@ static void ubi_fastmap_close(struct ubi_device *ubi)return_unused_pool_pebs (ubi, &ubi->fm_pool);return_unused_pool_pebs (ubi, &ubi->fm_wl_pool); +if (ubi->fm_anchor) { +return_unused_peb (ubi, ubi->fm_anchor); + ubi->fm_anchor =NULL ; + } +if (ubi->fm) {for (i =0 ; i < ubi->fm->used_blocks; i++)kfree (ubi->fm->e[i]);
Signature · 6 lines
2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Sasha Levin
maintainerPATCH 204/206 perf parse-events: Use strcmp() to compare the PMU name
In reply to Sasha LevinFrom: Jin Yao <[email protected]>
[ Upstream commit 8510895bafdbf7c4dd24c22946d925691135c2b2 ]
A big uncore event group is split into multiple small groups which only include the uncore events from the same PMU. This has been supported in the commit 3cdc5c2cb924a ("perf parse-events: Handle uncore event aliases in small groups properly").
If the event's PMU name starts to repeat, it must be a new event. That can be used to distinguish the leader from other members. But now it only compares the pointer of pmu_name (leader->pmu_name == evsel->pmu_name).
If we use "perf stat -M LLC_MISSES.PCIE_WRITE -a" on cascadelakex, the event list is:
evsel->name evsel->pmu_name
---------------------------------------------------------------
unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_4 (as leader)
unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_2
unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_0
unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_5
unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_3
unc_iio_data_req_of_cpu.mem_write.part0 uncore_iio_1
unc_iio_data_req_of_cpu.mem_write.part1 uncore_iio_4
......
For the event "unc_iio_data_req_of_cpu.mem_write.part1" with "uncore_iio_4", it should be the event from PMU "uncore_iio_4". It's not a new leader for this PMU.
But if we use "(leader->pmu_name == evsel->pmu_name)", the check would be failed and the event is stored to leaders[] as a new PMU leader.
So this patch uses strcmp to compare the PMU name between events.
--- tools/perf/util/parse-events.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tools/perf/util/parse-events.c +2 -3
@@ -1423,12 +1423,11 @@ parse_events__set_leader_for_uncore_aliase(char *name, struct list_head *list,* event. That can be used to distinguish the leader from * other members, even they have the same event name. */ -if ((leader != evsel) && (leader->pmu_name == evsel->pmu_name)) { +if ((leader != evsel) && + !strcmp (leader->pmu_name, evsel->pmu_name)) { is_leader = false;continue ; } -/* The name is always alias name */ -WARN_ON (strcmp (leader->name, evsel->name));/* Store the leader event for each PMU */ leaders[nr_pmu++] = (uintptr_t ) evsel;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 205/206 net: openvswitch: use div_u64() for 64-by-32 divisions
In reply to Sasha LevinFrom: Tonghao Zhang <[email protected]>
[ Upstream commit 659d4587fe7233bfdff303744b20d6f41ad04362 ]
Compile the kernel for arm 32 platform, the build warning found. To fix that, should use div_u64() for divisions.
| net/openvswitch/meter.c:396: undefined reference to `__udivdi3'
[add more commit msg, change reported tag, and use div_u64 instead of do_div by Tonghao]
--- net/openvswitch/meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/meter.c +1 -1
@@ -256,7 +256,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)* Start with a full bucket. */ band->bucket = (band->burst_size + band->rate) *1000ULL ; - band_max_delta_t = band->bucket / band->rate; + band_max_delta_t =div_u64 (band->bucket, band->rate);if (band_max_delta_t > meter->max_delta_t) meter->max_delta_t = band_max_delta_t; band++;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 206/206 nvme: explicitly update mpath disk capacity on revalidation
In reply to Sasha LevinFrom: Anthony Iliopoulos <[email protected]>
[ Upstream commit 05b29021fba5e725dd385151ef00b6340229b500 ]
Commit 3b4b19721ec652 ("nvme: fix possible deadlock when I/O is blocked") reverted multipath head disk revalidation due to deadlocks caused by holding the bd_mutex during revalidate.
Updating the multipath disk blockdev size is still required though for userspace to be able to observe any resizing while the device is mounted. Directly update the bdev inode size to avoid unnecessarily holding the bdev->bd_mutex.
blocked")
--- drivers/nvme/host/core.c | 1 + drivers/nvme/host/nvme.h | 13 +++++++++++++ 2 files changed, 14 insertions(+)
drivers/nvme/host/core.c +1 -0
@@ -1599,6 +1599,7 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)if (ns->head->disk) {nvme_update_disk_info (ns->head->disk, ns, id);blk_queue_stack_limits (ns->head->disk->queue, ns->queue); +nvme_mpath_update_disk_size (ns->head->disk); }#endif }
drivers/nvme/host/nvme.h +13 -0
@@ -504,6 +504,16 @@ static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)kblockd_schedule_work (&head->requeue_work); } +static inline void nvme_mpath_update_disk_size (struct gendisk *disk) +{ +struct block_device *bdev =bdget_disk (disk,0 ); + +if (bdev) { +bd_set_size (bdev,get_capacity (disk) <<SECTOR_SHIFT ); +bdput (bdev); + } +} +extern struct device_attribute dev_attr_ana_grpid;extern struct device_attribute dev_attr_ana_state;
@@ -570,6 +580,9 @@ static inline void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys)static inline void nvme_mpath_start_freeze (struct nvme_subsystem *subsys) { } +static inline void nvme_mpath_update_disk_size (struct gendisk *disk) +{ +}#endif /* CONFIG_NVME_MULTIPATH */ #ifdef CONFIG_NVM
Signature · 1 line
2.25.1